diff --git a/.coveragerc b/.coveragerc index 9e66f2146..d505ff27e 100644 --- a/.coveragerc +++ b/.coveragerc @@ -11,7 +11,7 @@ omit = [report] show_missing = true # TODO bump back to 79 -fail_under = 60 +fail_under = 70 precision = 2 # Regexes for lines to exclude from consideration diff --git a/.github/actions/setup_build_env/action.yml b/.github/actions/setup_build_env/action.yml index 560b53749..a25f0ae44 100644 --- a/.github/actions/setup_build_env/action.yml +++ b/.github/actions/setup_build_env/action.yml @@ -18,7 +18,7 @@ inputs: poetry-version: description: 'Poetry version to install' required: false - default: '1.3.1' + default: '1.8.3' run-poetry-install: description: 'Whether to run poetry install on current dir' required: false diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index b849dd328..aac67f7a6 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -81,17 +81,13 @@ jobs: matrix: # Show OS combos first in GUI os: [ubuntu-latest, windows-latest, macos-12] - python-version: ['3.8.18', '3.9.18', '3.10.13', '3.11.5', '3.12.0'] + python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0'] exclude: - os: windows-latest python-version: '3.10.13' - os: windows-latest python-version: '3.9.18' - - os: windows-latest - python-version: '3.8.18' # keep only one python version for MacOS - - os: macos-latest - python-version: '3.8.18' - os: macos-latest python-version: '3.9.18' - os: macos-latest @@ -103,8 +99,6 @@ jobs: python-version: '3.10.11' - os: windows-latest python-version: '3.9.13' - - os: windows-latest - python-version: '3.8.10' runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/check_node_latest.yml b/.github/workflows/check_node_latest.yml new file mode 100644 index 000000000..5910fa9ed --- /dev/null +++ b/.github/workflows/check_node_latest.yml @@ -0,0 +1,40 @@ +name: integration-node-latest + +on: + push: + branches: + - main + pull_request: + branches: + - main + +env: + TELEMETRY_ENABLED: false + REFLEX_USE_SYSTEM_NODE: true + +jobs: + check_latest_node: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: ['3.12'] + node-version: ['node'] + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup_build_env + with: + python-version: ${{ matrix.python-version }} + run-poetry-install: true + create-venv-at-path: .venv + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: | + poetry run uv pip install pyvirtualdisplay pillow + poetry run playwright install --with-deps + - run: | + poetry run pytest tests/test_node_version.py + poetry run pytest tests/integration + + + diff --git a/.github/workflows/check_outdated_dependencies.yml b/.github/workflows/check_outdated_dependencies.yml new file mode 100644 index 000000000..fe8c42608 --- /dev/null +++ b/.github/workflows/check_outdated_dependencies.yml @@ -0,0 +1,88 @@ +name: check-outdated-dependencies + +on: + push: # This will trigger the action when a pull request is opened or updated. + branches: + - 'release/**' # This will trigger the action when any branch starting with "release/" is created. + workflow_dispatch: # Allow manual triggering if needed. + +jobs: + backend: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - uses: ./.github/actions/setup_build_env + with: + python-version: '3.9' + run-poetry-install: true + create-venv-at-path: .venv + + - name: Check outdated backend dependencies + run: | + outdated=$(poetry show -oT) + echo "Outdated:" + echo "$outdated" + + filtered_outdated=$(echo "$outdated" | grep -vE 'pyright|ruff' || true) + + if [ ! -z "$filtered_outdated" ]; then + echo "Outdated dependencies found:" + echo "$filtered_outdated" + exit 1 + else + echo "All dependencies are up to date. (pyright and ruff are ignored)" + fi + + + frontend: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - uses: ./.github/actions/setup_build_env + with: + python-version: '3.10.11' + run-poetry-install: true + create-venv-at-path: .venv + - name: Clone Reflex Website Repo + uses: actions/checkout@v4 + with: + repository: reflex-dev/reflex-web + ref: main + path: reflex-web + - name: Install Requirements for reflex-web + working-directory: ./reflex-web + run: poetry run uv pip install -r requirements.txt + - name: Install additional dependencies for DB access + run: poetry run uv pip install psycopg2-binary + - name: Init Website for reflex-web + working-directory: ./reflex-web + run: poetry run reflex init + - name: Run Website and Check for errors + run: | + poetry run bash scripts/integration.sh ./reflex-web dev + - name: Check outdated frontend dependencies + working-directory: ./reflex-web/.web + run: | + raw_outdated=$(/home/runner/.local/share/reflex/bun/bin/bun outdated) + outdated=$(echo "$raw_outdated" | grep -vE '\|\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\|' || true) + echo "Outdated:" + echo "$outdated" + + # Ignore 3rd party dependencies that are not updated. + filtered_outdated=$(echo "$outdated" | grep -vE 'Package|@chakra-ui|lucide-react|@splinetool/runtime|ag-grid-react|framer-motion|react-markdown|remark-math|remark-gfm|rehype-katex|rehype-raw|remark-unwrap-images' || true) + no_extra=$(echo "$filtered_outdated" | grep -vE '\|\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-' || true) + + + if [ ! -z "$no_extra" ]; then + echo "Outdated dependencies found:" + echo "$filtered_outdated" + exit 1 + else + echo "All dependencies are up to date. (3rd party packages are ignored)" + fi + diff --git a/.github/workflows/integration_app_harness.yml b/.github/workflows/integration_app_harness.yml index 9f90bc079..65eccf146 100644 --- a/.github/workflows/integration_app_harness.yml +++ b/.github/workflows/integration_app_harness.yml @@ -23,8 +23,8 @@ jobs: strategy: matrix: state_manager: ['redis', 'memory'] - python-version: ['3.8.18', '3.11.5', '3.12.0'] - runs-on: ubuntu-latest + python-version: ['3.11.5', '3.12.0'] + runs-on: ubuntu-22.04 services: # Label used to access the service container redis: @@ -47,16 +47,11 @@ jobs: create-venv-at-path: .venv - run: poetry run uv pip install pyvirtualdisplay pillow playwright pytest-playwright - name: Run app harness tests - uses: nick-fields/retry@v3 env: SCREENSHOT_DIR: /tmp/screenshots REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }} - with: - timeout_minutes: 30 - max_attempts: 2 - command: | - poetry run playwright install --with-deps - poetry run pytest integration + run: | + poetry run pytest tests/integration - uses: actions/upload-artifact@v4 name: Upload failed test screenshots if: always() diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index d5e22a23b..38d50055b 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -42,22 +42,18 @@ jobs: fail-fast: false matrix: # Show OS combos first in GUI - os: [ubuntu-latest, windows-latest, macos-12] - python-version: ['3.8.18', '3.9.18', '3.10.13', '3.11.5', '3.12.0'] + os: [ubuntu-latest, windows-latest] + python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0'] exclude: - os: windows-latest python-version: '3.10.13' - os: windows-latest python-version: '3.9.18' - - os: windows-latest - python-version: '3.8.18' include: - os: windows-latest python-version: '3.10.11' - os: windows-latest python-version: '3.9.13' - - os: windows-latest - python-version: '3.8.10' runs-on: ${{ matrix.os }} steps: @@ -126,7 +122,7 @@ jobs: fail-fast: false matrix: # Show OS combos first in GUI - os: [ubuntu-latest, windows-latest, macos-12] + os: [ubuntu-latest, windows-latest] python-version: ['3.10.11', '3.11.4'] env: @@ -156,11 +152,7 @@ jobs: working-directory: ./reflex-web run: poetry run reflex init - name: Run Website and Check for errors - uses: nick-fields/retry@v3 - with: - timeout_minutes: 30 - max_attempts: 2 - command: | + run: | # Check that npm is home npm -v poetry run bash scripts/integration.sh ./reflex-web prod @@ -169,4 +161,45 @@ jobs: poetry run python benchmarks/benchmark_web_size.py --os "${{ matrix.os }}" --python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}" --pr-id "${{ github.event.pull_request.id }}" --branch-name "${{ github.head_ref || github.ref_name }}" - --app-name "reflex-web" --path ./reflex-web/.web \ No newline at end of file + --app-name "reflex-web" --path ./reflex-web/.web + + reflex-web-macos: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + strategy: + fail-fast: false + matrix: + python-version: ['3.11.5', '3.12.0'] + runs-on: macos-12 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup_build_env + with: + python-version: ${{ matrix.python-version }} + run-poetry-install: true + create-venv-at-path: .venv + - name: Clone Reflex Website Repo + uses: actions/checkout@v4 + with: + repository: reflex-dev/reflex-web + ref: main + path: reflex-web + - name: Install Requirements for reflex-web + working-directory: ./reflex-web + run: poetry run uv pip install -r requirements.txt + - name: Install additional dependencies for DB access + run: poetry run uv pip install psycopg2-binary + - name: Init Website for reflex-web + working-directory: ./reflex-web + run: poetry run reflex init + - name: Run Website and Check for errors + run: | + # Check that npm is home + npm -v + poetry run bash scripts/integration.sh ./reflex-web prod + - name: Measure and upload .web size + run: + poetry run python benchmarks/benchmark_web_size.py --os "${{ matrix.os }}" + --python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}" + --pr-id "${{ github.event.pull_request.id }}" --branch-name "${{ github.head_ref || github.ref_name }}" + --app-name "reflex-web" --path ./reflex-web/.web + \ No newline at end of file diff --git a/.github/workflows/integration_tests_wsl.yml b/.github/workflows/integration_tests_wsl.yml index 6750fcd46..7a743252b 100644 --- a/.github/workflows/integration_tests_wsl.yml +++ b/.github/workflows/integration_tests_wsl.yml @@ -37,6 +37,8 @@ jobs: path: reflex-examples - uses: Vampire/setup-wsl@v3 + with: + distribution: Ubuntu-24.04 - name: Install Python shell: wsl-bash {0} diff --git a/.github/workflows/reflex_init_in_docker_test.yml b/.github/workflows/reflex_init_in_docker_test.yml index b34efd2f6..ce56a1310 100644 --- a/.github/workflows/reflex_init_in_docker_test.yml +++ b/.github/workflows/reflex_init_in_docker_test.yml @@ -28,5 +28,5 @@ jobs: # Run reflex init in a docker container # cwd is repo root - docker build -f integration/init-test/Dockerfile -t reflex-init-test integration/init-test - docker run --rm -v $(pwd):/reflex-repo/ reflex-init-test /reflex-repo/integration/init-test/in_docker_test_script.sh + docker build -f tests/integration/init-test/Dockerfile -t reflex-init-test tests/integration/init-test + docker run --rm -v $(pwd):/reflex-repo/ reflex-init-test /reflex-repo/tests/integration/init-test/in_docker_test_script.sh diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index f49a9b279..c76918583 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -27,24 +27,21 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-12] - python-version: ['3.8.18', '3.9.18', '3.10.13', '3.11.5', '3.12.0'] + os: [ubuntu-latest, windows-latest] + python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0'] # Windows is a bit behind on Python version availability in Github exclude: - os: windows-latest python-version: '3.10.13' - os: windows-latest python-version: '3.9.18' - - os: windows-latest - python-version: '3.8.18' include: - os: windows-latest python-version: '3.10.11' - os: windows-latest python-version: '3.9.13' - - os: windows-latest - python-version: '3.8.10' runs-on: ${{ matrix.os }} + # Service containers to run with `runner-job` services: # Label used to access the service container @@ -69,17 +66,43 @@ jobs: - name: Run unit tests run: | export PYTHONUNBUFFERED=1 - poetry run pytest tests --cov --no-cov-on-fail --cov-report= + poetry run pytest tests/units --cov --no-cov-on-fail --cov-report= - name: Run unit tests w/ redis if: ${{ matrix.os == 'ubuntu-latest' }} run: | export PYTHONUNBUFFERED=1 export REDIS_URL=redis://localhost:6379 - poetry run pytest tests --cov --no-cov-on-fail --cov-report= + poetry run pytest tests/units --cov --no-cov-on-fail --cov-report= # Change to explicitly install v1 when reflex-hosting-cli is compatible with v2 - name: Run unit tests w/ pydantic v1 run: | export PYTHONUNBUFFERED=1 poetry run uv pip install "pydantic~=1.10" - poetry run pytest tests --cov --no-cov-on-fail --cov-report= - - run: poetry run coverage html + poetry run pytest tests/units --cov --no-cov-on-fail --cov-report= + - name: Generate coverage report + run: poetry run coverage html + + unit-tests-macos: + timeout-minutes: 30 + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + strategy: + fail-fast: false + matrix: + python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0'] + runs-on: macos-12 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup_build_env + with: + python-version: ${{ matrix.python-version }} + run-poetry-install: true + create-venv-at-path: .venv + - name: Run unit tests + run: | + export PYTHONUNBUFFERED=1 + poetry run pytest tests/units --cov --no-cov-on-fail --cov-report= + - name: Run unit tests w/ pydantic v1 + run: | + export PYTHONUNBUFFERED=1 + poetry run uv pip install "pydantic~=1.10" + poetry run pytest tests/units --cov --no-cov-on-fail --cov-report= \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fbd88c485..e2983d1d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,10 +3,10 @@ fail_fast: true repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.4.10 + rev: v0.7.0 hooks: - id: ruff-format - args: [integration, reflex, tests] + args: [reflex, tests] - id: ruff args: ["--fix", "--exit-non-zero-on-fix"] exclude: '^integration/benchmarks/' @@ -25,7 +25,7 @@ repos: rev: v1.1.313 hooks: - id: pyright - args: [integration, reflex, tests] + args: [reflex, tests] language: system - repo: https://github.com/terrencepreilly/darglint diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e57c0a249..fc8398013 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ Here is a quick guide on how to run Reflex repo locally so you can start contrib **Prerequisites:** -- Python >= 3.8 +- Python >= 3.9 - Poetry version >= 1.4.0 and add it to your path (see [Poetry Docs](https://python-poetry.org/docs/#installation) for more info). **1. Fork this repository:** @@ -69,7 +69,7 @@ In your `reflex` directory run make sure all the unit tests are still passing us This will fail if code coverage is below 70%. ``` bash -poetry run pytest tests --cov --no-cov-on-fail --cov-report= +poetry run pytest tests/units --cov --no-cov-on-fail --cov-report= ``` Next make sure all the following tests pass. This ensures that every new change has proper documentation and type checking. @@ -87,7 +87,7 @@ poetry run ruff format . ``` Consider installing git pre-commit hooks so Ruff, Pyright, Darglint and `make_pyi` will run automatically before each commit. -Note that pre-commit will only be installed when you use a Python version >= 3.8. +Note that pre-commit will only be installed when you use a Python version >= 3.9. ``` bash pre-commit install diff --git a/README.md b/README.md index 2c5b14087..9c965b00f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ ### **✨ Performant, customizable web apps in pure Python. Deploy in seconds. ✨** [![PyPI version](https://badge.fury.io/py/reflex.svg)](https://badge.fury.io/py/reflex) -![tests](https://github.com/pynecone-io/pynecone/actions/workflows/integration.yml/badge.svg) ![versions](https://img.shields.io/pypi/pyversions/reflex.svg) [![Documentation](https://img.shields.io/badge/Documentation%20-Introduction%20-%20%23007ec6)](https://reflex.dev/docs/getting-started/introduction) [![Discord](https://img.shields.io/discord/1029853095527727165?color=%237289da&label=Discord)](https://discord.gg/T5WSbC2YtQ) @@ -18,7 +17,7 @@ --- -[English](https://github.com/reflex-dev/reflex/blob/main/README.md) | [简体中文](https://github.com/reflex-dev/reflex/blob/main/docs/zh/zh_cn/README.md) | [繁體中文](https://github.com/reflex-dev/reflex/blob/main/docs/zh/zh_tw/README.md) | [Türkçe](https://github.com/reflex-dev/reflex/blob/main/docs/tr/README.md) | [हिंदी](https://github.com/reflex-dev/reflex/blob/main/docs/in/README.md) | [Português (Brasil)](https://github.com/reflex-dev/reflex/blob/main/docs/pt/pt_br/README.md) | [Italiano](https://github.com/reflex-dev/reflex/blob/main/docs/it/README.md) | [Español](https://github.com/reflex-dev/reflex/blob/main/docs/es/README.md) | [한국어](https://github.com/reflex-dev/reflex/blob/main/docs/kr/README.md) | [日本語](https://github.com/reflex-dev/reflex/blob/main/docs/ja/README.md) | [Deutsch](https://github.com/reflex-dev/reflex/blob/main/docs/de/README.md) | [Persian (پارسی)](https://github.com/reflex-dev/reflex/blob/main/docs/pe/README.md) +[English](https://github.com/reflex-dev/reflex/blob/main/README.md) | [简体中文](https://github.com/reflex-dev/reflex/blob/main/docs/zh/zh_cn/README.md) | [繁體中文](https://github.com/reflex-dev/reflex/blob/main/docs/zh/zh_tw/README.md) | [Türkçe](https://github.com/reflex-dev/reflex/blob/main/docs/tr/README.md) | [हिंदी](https://github.com/reflex-dev/reflex/blob/main/docs/in/README.md) | [Português (Brasil)](https://github.com/reflex-dev/reflex/blob/main/docs/pt/pt_br/README.md) | [Italiano](https://github.com/reflex-dev/reflex/blob/main/docs/it/README.md) | [Español](https://github.com/reflex-dev/reflex/blob/main/docs/es/README.md) | [한국어](https://github.com/reflex-dev/reflex/blob/main/docs/kr/README.md) | [日本語](https://github.com/reflex-dev/reflex/blob/main/docs/ja/README.md) | [Deutsch](https://github.com/reflex-dev/reflex/blob/main/docs/de/README.md) | [Persian (پارسی)](https://github.com/reflex-dev/reflex/blob/main/docs/pe/README.md) | [Tiếng Việt](https://github.com/reflex-dev/reflex/blob/main/docs/vi/README.md) --- @@ -35,7 +34,7 @@ See our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architectu ## ⚙️ Installation -Open a terminal and run (Requires Python 3.8+): +Open a terminal and run (Requires Python 3.9+): ```bash pip install reflex diff --git a/benchmarks/benchmark_lighthouse.py b/benchmarks/benchmark_lighthouse.py index 72f486b6f..25d5eaac4 100644 --- a/benchmarks/benchmark_lighthouse.py +++ b/benchmarks/benchmark_lighthouse.py @@ -3,8 +3,8 @@ from __future__ import annotations import json -import os import sys +from pathlib import Path from utils import send_data_to_posthog @@ -28,7 +28,7 @@ def insert_benchmarking_data( send_data_to_posthog("lighthouse_benchmark", properties) -def get_lighthouse_scores(directory_path: str) -> dict: +def get_lighthouse_scores(directory_path: str | Path) -> dict: """Extracts the Lighthouse scores from the JSON files in the specified directory. Args: @@ -38,24 +38,21 @@ def get_lighthouse_scores(directory_path: str) -> dict: dict: The Lighthouse scores. """ scores = {} - + directory_path = Path(directory_path) try: - for filename in os.listdir(directory_path): - if filename.endswith(".json") and filename != "manifest.json": - file_path = os.path.join(directory_path, filename) - with open(file_path, "r") as file: - data = json.load(file) - # Extract scores and add them to the dictionary with the filename as key - scores[data["finalUrl"].replace("http://localhost:3000/", "/")] = { - "performance_score": data["categories"]["performance"]["score"], - "accessibility_score": data["categories"]["accessibility"][ - "score" - ], - "best_practices_score": data["categories"]["best-practices"][ - "score" - ], - "seo_score": data["categories"]["seo"]["score"], - } + for filename in directory_path.iterdir(): + if filename.suffix == ".json" and filename.stem != "manifest": + file_path = directory_path / filename + data = json.loads(file_path.read_text()) + # Extract scores and add them to the dictionary with the filename as key + scores[data["finalUrl"].replace("http://localhost:3000/", "/")] = { + "performance_score": data["categories"]["performance"]["score"], + "accessibility_score": data["categories"]["accessibility"]["score"], + "best_practices_score": data["categories"]["best-practices"][ + "score" + ], + "seo_score": data["categories"]["seo"]["score"], + } except Exception as e: return {"error": e} diff --git a/benchmarks/benchmark_package_size.py b/benchmarks/benchmark_package_size.py index 8e2704355..778b52769 100644 --- a/benchmarks/benchmark_package_size.py +++ b/benchmarks/benchmark_package_size.py @@ -2,11 +2,12 @@ import argparse import os +from pathlib import Path from utils import get_directory_size, get_python_version, send_data_to_posthog -def get_package_size(venv_path, os_name): +def get_package_size(venv_path: Path, os_name): """Get the size of a specified package. Args: @@ -26,14 +27,12 @@ def get_package_size(venv_path, os_name): is_windows = "windows" in os_name - full_path = ( - ["lib", f"python{python_version}", "site-packages"] + package_dir: Path = ( + venv_path / "lib" / f"python{python_version}" / "site-packages" if not is_windows - else ["Lib", "site-packages"] + else venv_path / "Lib" / "site-packages" ) - - package_dir = os.path.join(venv_path, *full_path) - if not os.path.exists(package_dir): + if not package_dir.exists(): raise ValueError( "Error: Virtual environment does not exist or is not activated." ) @@ -63,9 +62,9 @@ def insert_benchmarking_data( path: The path to the dir or file to check size. """ if "./dist" in path: - size = get_directory_size(path) + size = get_directory_size(Path(path)) else: - size = get_package_size(path, os_type_version) + size = get_package_size(Path(path), os_type_version) # Prepare the event data properties = { diff --git a/benchmarks/benchmark_web_size.py b/benchmarks/benchmark_web_size.py index 6c2f40bbc..3ceccecf8 100644 --- a/benchmarks/benchmark_web_size.py +++ b/benchmarks/benchmark_web_size.py @@ -2,6 +2,7 @@ import argparse import os +from pathlib import Path from utils import get_directory_size, send_data_to_posthog @@ -28,7 +29,7 @@ def insert_benchmarking_data( pr_id: The id of the PR. path: The path to the dir or file to check size. """ - size = get_directory_size(path) + size = get_directory_size(Path(path)) # Prepare the event data properties = { diff --git a/benchmarks/test_benchmark_compile_pages.py b/benchmarks/test_benchmark_compile_pages.py index 33404bca7..4448bca45 100644 --- a/benchmarks/test_benchmark_compile_pages.py +++ b/benchmarks/test_benchmark_compile_pages.py @@ -130,7 +130,6 @@ def render_multiple_pages(app, num: int): def AppWithOnePage(): """A reflex app with one page.""" - import reflex_chakra as rc from rxconfig import config # type: ignore import reflex as rx @@ -145,7 +144,7 @@ def AppWithOnePage(): def index() -> rx.Component: return rx.center( - rc.input( + rx.input( id="token", value=State.router.session.client_token, is_read_only=True ), rx.vstack( diff --git a/benchmarks/utils.py b/benchmarks/utils.py index 7b02c8cc8..bfadf5b4e 100644 --- a/benchmarks/utils.py +++ b/benchmarks/utils.py @@ -2,12 +2,13 @@ import os import subprocess +from pathlib import Path import httpx from httpx import HTTPError -def get_python_version(venv_path, os_name): +def get_python_version(venv_path: Path, os_name): """Get the python version of python in a virtual env. Args: @@ -18,13 +19,13 @@ def get_python_version(venv_path, os_name): The python version. """ python_executable = ( - os.path.join(venv_path, "bin", "python") + venv_path / "bin" / "python" if "windows" not in os_name - else os.path.join(venv_path, "Scripts", "python.exe") + else venv_path / "Scripts" / "python.exe" ) try: output = subprocess.check_output( - [python_executable, "--version"], stderr=subprocess.STDOUT + [str(python_executable), "--version"], stderr=subprocess.STDOUT ) python_version = output.decode("utf-8").strip().split()[1] return ".".join(python_version.split(".")[:-1]) @@ -32,7 +33,7 @@ def get_python_version(venv_path, os_name): return None -def get_directory_size(directory): +def get_directory_size(directory: Path): """Get the size of a directory in bytes. Args: @@ -44,8 +45,8 @@ def get_directory_size(directory): total_size = 0 for dirpath, _, filenames in os.walk(directory): for f in filenames: - fp = os.path.join(dirpath, f) - total_size += os.path.getsize(fp) + fp = Path(dirpath) / f + total_size += fp.stat().st_size return total_size diff --git a/docker-example/README.md b/docker-example/README.md index 8ac32421d..552dba950 100644 --- a/docker-example/README.md +++ b/docker-example/README.md @@ -1,133 +1,30 @@ -# Reflex Docker Container +# Reflex Docker Examples -This example describes how to create and use a container image for Reflex with your own code. +This directory contains several examples of how to deploy Reflex apps using docker. -## Update Requirements +In all cases, ensure that your `requirements.txt` file is up to date and +includes the `reflex` package. -The `requirements.txt` includes the reflex package which is needed to install -Reflex framework. If you use additional packages in your project you have to add -this in the `requirements.txt` first. Copy the `Dockerfile`, `.dockerignore` and -the `requirements.txt` file in your project folder. +## `simple-two-port` -## Build Simple Reflex Container Image +The most basic production deployment exposes two HTTP ports and relies on an +existing load balancer to forward the traffic appropriately. -The main `Dockerfile` is intended to build a very simple, single container deployment that runs -the Reflex frontend and backend together, exposing ports 3000 and 8000. +## `simple-one-port` -To build your container image run the following command: +This deployment exports the frontend statically and serves it via a single HTTP +port using Caddy. This is useful for platforms that only support a single port +or where running a node server in the container is undesirable. -```bash -docker build -t reflex-app:latest . -``` +## `production-compose` -## Start Container Service +This deployment is intended for use with a standalone VPS that is only hosting a +single Reflex app. It provides the entire stack in a single `compose.yaml` +including a webserver, one or more backend instances, redis, and a postgres +database. -Finally, you can start your Reflex container service as follows: +## `production-app-platform` -```bash -docker run -it --rm -p 3000:3000 -p 8000:8000 --name app reflex-app:latest -``` - -It may take a few seconds for the service to become available. - -Access your app at http://localhost:3000. - -Note that this container has _no persistence_ and will lose all data when -stopped. You can use bind mounts or named volumes to persist the database and -uploaded_files directories as needed. - -# Production Service with Docker Compose and Caddy - -An example production deployment uses automatic TLS with Caddy serving static files -for the frontend and proxying requests to both the frontend and backend. - -Copy the following files to your project directory: - * `compose.yaml` - * `compose.prod.yaml` - * `compose.tools.yaml` - * `prod.Dockerfile` - * `Caddy.Dockerfile` - * `Caddyfile` - -The production app container, based on `prod.Dockerfile`, builds and exports the -frontend statically (to be served by Caddy). The resulting image only runs the -backend service. - -The `webserver` service, based on `Caddy.Dockerfile`, copies the static frontend -and `Caddyfile` into the container to configure the reverse proxy routes that will -forward requests to the backend service. Caddy will automatically provision TLS -for localhost or the domain specified in the environment variable `DOMAIN`. - -This type of deployment should use less memory and be more performant since -nodejs is not required at runtime. - -## Customize `Caddyfile` (optional) - -If the app uses additional backend API routes, those should be added to the -`@backend_routes` path matcher to ensure they are forwarded to the backend. - -## Build Reflex Production Service - -During build, set `DOMAIN` environment variable to the domain where the app will -be hosted! (Do not include http or https, it will always use https). - -**If `DOMAIN` is not provided, the service will default to `localhost`.** - -```bash -DOMAIN=example.com docker compose build -``` - -This will build both the `app` service from the `prod.Dockerfile` and the `webserver` -service via `Caddy.Dockerfile`. - -## Run Reflex Production Service - -```bash -DOMAIN=example.com docker compose up -``` - -The app should be available at the specified domain via HTTPS. Certificate -provisioning will occur automatically and may take a few minutes. - -### Data Persistence - -Named docker volumes are used to persist the app database (`db-data`), -uploaded_files (`upload-data`), and caddy TLS keys and certificates -(`caddy-data`). - -## More Robust Deployment - -For a more robust deployment, consider bringing the service up with -`compose.prod.yaml` which includes postgres database and redis cache, allowing -the backend to run with multiple workers and service more requests. - -```bash -DOMAIN=example.com docker compose -f compose.yaml -f compose.prod.yaml up -d -``` - -Postgres uses its own named docker volume for data persistence. - -## Admin Tools - -When needed, the services in `compose.tools.yaml` can be brought up, providing -graphical database administration (Adminer on http://localhost:8080) and a -redis cache browser (redis-commander on http://localhost:8081). It is not recommended -to deploy these services if they are not in active use. - -```bash -DOMAIN=example.com docker compose -f compose.yaml -f compose.prod.yaml -f compose.tools.yaml up -d -``` - -# Container Hosting - -Most container hosting services automatically terminate TLS and expect the app -to be listening on a single port (typically `$PORT`). - -To host a Reflex app on one of these platforms, like Google Cloud Run, Render, -Railway, etc, use `app.Dockerfile` to build a single image containing a reverse -proxy that will serve that frontend as static files and proxy requests to the -backend for specific endpoints. - -If the chosen platform does not support buildx and thus heredoc, you can copy -the Caddyfile configuration into a separate Caddyfile in the root of the -project. +This example deployment is intended for use with App hosting platforms, like +Azure, AWS, or Google Cloud Run. It is the backend of the deployment, which +depends on a separately hosted redis instance and static frontend deployment. \ No newline at end of file diff --git a/docker-example/production-app-platform/.dockerignore b/docker-example/production-app-platform/.dockerignore new file mode 100644 index 000000000..ea66a51f5 --- /dev/null +++ b/docker-example/production-app-platform/.dockerignore @@ -0,0 +1,5 @@ +.web +.git +__pycache__/* +Dockerfile +uploaded_files diff --git a/docker-example/production-app-platform/Dockerfile b/docker-example/production-app-platform/Dockerfile new file mode 100644 index 000000000..b0f6c69fc --- /dev/null +++ b/docker-example/production-app-platform/Dockerfile @@ -0,0 +1,65 @@ +# This docker file is intended to be used with container hosting services +# +# After deploying this image, get the URL pointing to the backend service +# and run API_URL=https://path-to-my-container.example.com reflex export frontend +# then copy the contents of `frontend.zip` to your static file server (github pages, s3, etc). +# +# Azure Static Web App example: +# npx @azure/static-web-apps-cli deploy --env production --app-location .web/_static +# +# For dynamic routes to function properly, ensure that 404s are redirected to /404 on the +# static file host (for github pages, this works out of the box; remember to create .nojekyll). +# +# For azure static web apps, add `staticwebapp.config.json` to to `.web/_static` with the following: +# { +# "responseOverrides": { +# "404": { +# "rewrite": "/404.html" +# } +# } +# } +# +# Note: many container hosting platforms require amd64 images, so when building on an M1 Mac +# for example, pass `docker build --platform=linux/amd64 ...` + +# Stage 1: init +FROM python:3.11 as init + +ARG uv=/root/.cargo/bin/uv + +# Install `uv` for faster package boostrapping +ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh +RUN /install.sh && rm /install.sh + +# Copy local context to `/app` inside container (see .dockerignore) +WORKDIR /app +COPY . . +RUN mkdir -p /app/data /app/uploaded_files + +# Create virtualenv which will be copied into final container +ENV VIRTUAL_ENV=/app/.venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN $uv venv + +# Install app requirements and reflex inside virtualenv +RUN $uv pip install -r requirements.txt + +# Deploy templates and prepare app +RUN reflex init + +# Stage 2: copy artifacts into slim image +FROM python:3.11-slim +WORKDIR /app +RUN adduser --disabled-password --home /app reflex +COPY --chown=reflex --from=init /app /app +# Install libpq-dev for psycopg2 (skip if not using postgres). +RUN apt-get update -y && apt-get install -y libpq-dev && rm -rf /var/lib/apt/lists/* +USER reflex +ENV PATH="/app/.venv/bin:$PATH" PYTHONUNBUFFERED=1 + +# Needed until Reflex properly passes SIGTERM on backend. +STOPSIGNAL SIGKILL + +# Always apply migrations before starting the backend. +CMD [ -d alembic ] && reflex db migrate; \ + exec reflex run --env prod --backend-only --backend-port ${PORT:-8000} diff --git a/docker-example/production-app-platform/README.md b/docker-example/production-app-platform/README.md new file mode 100644 index 000000000..ad54f814f --- /dev/null +++ b/docker-example/production-app-platform/README.md @@ -0,0 +1,113 @@ +# production-app-platform + +This example deployment is intended for use with App hosting platforms, like +Azure, AWS, or Google Cloud Run. + +## Architecture + +The production deployment consists of a few pieces: + * Backend container - built by `Dockerfile` Runs the Reflex backend + service on port 8000 and is scalable to multiple instances. + * Redis container - A single instance the standard `redis` docker image should + share private networking with the backend + * Static frontend - HTML/CSS/JS files that are hosted via a CDN or static file + server. This is not included in the docker image. + +## Deployment + +These general steps do not cover the specifics of each platform, but all platforms should +support the concepts described here. + +### Vnet + +All containers in the deployment should be hooked up to the same virtual private +network so they can access the redis service and optionally the database server. +The vnet should not be exposed to the internet, use an ingress rule to terminate +TLS at the load balancer and forward the traffic to a backend service replica. + +### Redis + +Deploy a `redis` instance on the vnet. + +### Backend + +The backend is built by the `Dockerfile` in this directory. When deploying the +backend, be sure to set REDIS_URL=redis://internal-redis-hostname to connect to +the redis service. + +### Ingress + +Configure the load balancer for the app to forward traffic to port 8000 on the +backend service replicas. Most platforms will generate an ingress hostname +automatically. Make sure when you access the ingress endpoint on `/ping` that it +returns "pong", indicating that the backend is up an available. + +### Frontend + +The frontend should be hosted on a static file server or CDN. + +**Important**: when exporting the frontend, set the API_URL environment variable +to the ingress hostname of the backend service. + +If you will host the frontend from a path other than the root, set the +`FRONTEND_PATH` environment variable appropriately when exporting the frontend. + +Most static hosts will automatically use the `/404.html` file to handle 404 +errors. _This is essential for dynamic routes to work correctly._ Ensure that +missing routes return the `/404.html` content to the user if this is not the +default behavior. + +_For Github Pages_: ensure the file `.nojekyll` is present in the root of the repo +to avoid special processing of underscore-prefix directories, like `_next`. + +## Platform Notes + +The following sections are currently a work in progress and may be incomplete. + +### Azure + +In the Azure load balancer, per-message deflate is not supported. Add the following +to your `rxconfig.py` to workaround this issue. + +```python +import uvicorn.workers + +import reflex as rx + + +class NoWSPerMessageDeflate(uvicorn.workers.UvicornH11Worker): + CONFIG_KWARGS = { + **uvicorn.workers.UvicornH11Worker.CONFIG_KWARGS, + "ws_per_message_deflate": False, + } + + +config = rx.Config( + app_name="my_app", + gunicorn_worker_class="rxconfig.NoWSPerMessageDeflate", +) +``` + +#### Persistent Storage + +If you need to use a database or upload files, you cannot save them to the +container volume. Use Azure Files and mount it into the container at /app/uploaded_files. + +#### Resource Types + +* Create a new vnet with 10.0.0.0/16 + * Create a new subnet for redis, database, and containers +* Deploy redis as a Container Instances +* Deploy database server as "Azure Database for PostgreSQL" + * Create a new database for the app + * Set db-url as a secret containing the db user/password connection string +* Deploy Storage account for uploaded files + * Enable access from the vnet and container subnet + * Create a new file share + * In the environment, create a new files share (get the storage key) +* Deploy the backend as a Container App + * Create a custom Container App Environment linked up to the same vnet as the redis container. + * Set REDIS_URL and DB_URL environment variables + * Add the volume from the environment + * Add the volume mount to the container +* Deploy the frontend as a Static Web App \ No newline at end of file diff --git a/docker-example/.dockerignore b/docker-example/production-compose/.dockerignore similarity index 100% rename from docker-example/.dockerignore rename to docker-example/production-compose/.dockerignore diff --git a/docker-example/Caddy.Dockerfile b/docker-example/production-compose/Caddy.Dockerfile similarity index 100% rename from docker-example/Caddy.Dockerfile rename to docker-example/production-compose/Caddy.Dockerfile diff --git a/docker-example/Caddyfile b/docker-example/production-compose/Caddyfile similarity index 100% rename from docker-example/Caddyfile rename to docker-example/production-compose/Caddyfile diff --git a/docker-example/prod.Dockerfile b/docker-example/production-compose/Dockerfile similarity index 91% rename from docker-example/prod.Dockerfile rename to docker-example/production-compose/Dockerfile index 2cde12ca0..f73473df7 100644 --- a/docker-example/prod.Dockerfile +++ b/docker-example/production-compose/Dockerfile @@ -42,10 +42,11 @@ COPY --chown=reflex --from=init /app /app # Install libpq-dev for psycopg2 (skip if not using postgres). RUN apt-get update -y && apt-get install -y libpq-dev && rm -rf /var/lib/apt/lists/* USER reflex -ENV PATH="/app/.venv/bin:$PATH" +ENV PATH="/app/.venv/bin:$PATH" PYTHONUNBUFFERED=1 # Needed until Reflex properly passes SIGTERM on backend. STOPSIGNAL SIGKILL # Always apply migrations before starting the backend. -CMD reflex db migrate && reflex run --env prod --backend-only +CMD [ -d alembic ] && reflex db migrate; \ + exec reflex run --env prod --backend-only diff --git a/docker-example/production-compose/README.md b/docker-example/production-compose/README.md new file mode 100644 index 000000000..87222327e --- /dev/null +++ b/docker-example/production-compose/README.md @@ -0,0 +1,75 @@ +# production-compose + +This example production deployment uses automatic TLS with Caddy serving static +files for the frontend and proxying requests to both the frontend and backend. +It is intended for use with a standalone VPS that is only hosting a single +Reflex app. + +The production app container (`Dockerfile`), builds and exports the frontend +statically (to be served by Caddy). The resulting image only runs the backend +service. + +The `webserver` service, based on `Caddy.Dockerfile`, copies the static frontend +and `Caddyfile` into the container to configure the reverse proxy routes that will +forward requests to the backend service. Caddy will automatically provision TLS +for localhost or the domain specified in the environment variable `DOMAIN`. + +This type of deployment should use less memory and be more performant since +nodejs is not required at runtime. + +## Customize `Caddyfile` (optional) + +If the app uses additional backend API routes, those should be added to the +`@backend_routes` path matcher to ensure they are forwarded to the backend. + +## Build Reflex Production Service + +During build, set `DOMAIN` environment variable to the domain where the app will +be hosted! (Do not include http or https, it will always use https). + +**If `DOMAIN` is not provided, the service will default to `localhost`.** + +```bash +DOMAIN=example.com docker compose build +``` + +This will build both the `app` service from the `prod.Dockerfile` and the `webserver` +service via `Caddy.Dockerfile`. + +## Run Reflex Production Service + +```bash +DOMAIN=example.com docker compose up +``` + +The app should be available at the specified domain via HTTPS. Certificate +provisioning will occur automatically and may take a few minutes. + +### Data Persistence + +Named docker volumes are used to persist the app database (`db-data`), +uploaded_files (`upload-data`), and caddy TLS keys and certificates +(`caddy-data`). + +## More Robust Deployment + +For a more robust deployment, consider bringing the service up with +`compose.prod.yaml` which includes postgres database and redis cache, allowing +the backend to run with multiple workers and service more requests. + +```bash +DOMAIN=example.com docker compose -f compose.yaml -f compose.prod.yaml up -d +``` + +Postgres uses its own named docker volume for data persistence. + +## Admin Tools + +When needed, the services in `compose.tools.yaml` can be brought up, providing +graphical database administration (Adminer on http://localhost:8080) and a +redis cache browser (redis-commander on http://localhost:8081). It is not recommended +to deploy these services if they are not in active use. + +```bash +DOMAIN=example.com docker compose -f compose.yaml -f compose.prod.yaml -f compose.tools.yaml up -d +``` \ No newline at end of file diff --git a/docker-example/compose.prod.yaml b/docker-example/production-compose/compose.prod.yaml similarity index 100% rename from docker-example/compose.prod.yaml rename to docker-example/production-compose/compose.prod.yaml diff --git a/docker-example/compose.tools.yaml b/docker-example/production-compose/compose.tools.yaml similarity index 100% rename from docker-example/compose.tools.yaml rename to docker-example/production-compose/compose.tools.yaml diff --git a/docker-example/compose.yaml b/docker-example/production-compose/compose.yaml similarity index 96% rename from docker-example/compose.yaml rename to docker-example/production-compose/compose.yaml index 8c2f97ba6..de79c0778 100644 --- a/docker-example/compose.yaml +++ b/docker-example/production-compose/compose.yaml @@ -12,7 +12,6 @@ services: DB_URL: sqlite:///data/reflex.db build: context: . - dockerfile: prod.Dockerfile volumes: - db-data:/app/data - upload-data:/app/uploaded_files diff --git a/docker-example/requirements.txt b/docker-example/requirements.txt deleted file mode 100644 index fc29504eb..000000000 --- a/docker-example/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -reflex diff --git a/docker-example/simple-one-port/.dockerignore b/docker-example/simple-one-port/.dockerignore new file mode 100644 index 000000000..ea66a51f5 --- /dev/null +++ b/docker-example/simple-one-port/.dockerignore @@ -0,0 +1,5 @@ +.web +.git +__pycache__/* +Dockerfile +uploaded_files diff --git a/docker-example/simple-one-port/Caddyfile b/docker-example/simple-one-port/Caddyfile new file mode 100644 index 000000000..13d94ce8e --- /dev/null +++ b/docker-example/simple-one-port/Caddyfile @@ -0,0 +1,14 @@ +:{$PORT} + +encode gzip + +@backend_routes path /_event/* /ping /_upload /_upload/* +handle @backend_routes { + reverse_proxy localhost:8000 +} + +root * /srv +route { + try_files {path} {path}/ /404.html + file_server +} \ No newline at end of file diff --git a/docker-example/app.Dockerfile b/docker-example/simple-one-port/Dockerfile similarity index 67% rename from docker-example/app.Dockerfile rename to docker-example/simple-one-port/Dockerfile index 4aae2f31d..4cd7e9a18 100644 --- a/docker-example/app.Dockerfile +++ b/docker-example/simple-one-port/Dockerfile @@ -10,31 +10,13 @@ FROM python:3.11 ARG PORT=8080 # Only set for local/direct access. When TLS is used, the API_URL is assumed to be the same as the frontend. ARG API_URL -ENV PORT=$PORT API_URL=${API_URL:-http://localhost:$PORT} +ENV PORT=$PORT API_URL=${API_URL:-http://localhost:$PORT} REDIS_URL=redis://localhost PYTHONUNBUFFERED=1 -# Install Caddy server inside image -RUN apt-get update -y && apt-get install -y caddy && rm -rf /var/lib/apt/lists/* +# Install Caddy and redis server inside image +RUN apt-get update -y && apt-get install -y caddy redis-server && rm -rf /var/lib/apt/lists/* WORKDIR /app -# Create a simple Caddyfile to serve as reverse proxy -RUN cat > Caddyfile < +Reflex Logo +Reflex Logo + +
+ +### **✨ Ứng dụng web hiệu suất cao, tùy chỉnh bằng Python thuần. Deploy trong vài giây. ✨** +[![PyPI version](https://badge.fury.io/py/reflex.svg)](https://badge.fury.io/py/reflex) +![versions](https://img.shields.io/pypi/pyversions/reflex.svg) +[![Documentation](https://img.shields.io/badge/Documentation%20-Introduction%20-%20%23007ec6)](https://reflex.dev/docs/getting-started/introduction) +[![Discord](https://img.shields.io/discord/1029853095527727165?color=%237289da&label=Discord)](https://discord.gg/T5WSbC2YtQ) + + +--- + +[English](https://github.com/reflex-dev/reflex/blob/main/README.md) | [简体中文](https://github.com/reflex-dev/reflex/blob/main/docs/zh/zh_cn/README.md) | [繁體中文](https://github.com/reflex-dev/reflex/blob/main/docs/zh/zh_tw/README.md) | [Türkçe](https://github.com/reflex-dev/reflex/blob/main/docs/tr/README.md) | [हिंदी](https://github.com/reflex-dev/reflex/blob/main/docs/in/README.md) | [Português (Brasil)](https://github.com/reflex-dev/reflex/blob/main/docs/pt/pt_br/README.md) | [Italiano](https://github.com/reflex-dev/reflex/blob/main/docs/it/README.md) | [Español](https://github.com/reflex-dev/reflex/blob/main/docs/es/README.md) | [한국어](https://github.com/reflex-dev/reflex/blob/main/docs/kr/README.md) | [日本語](https://github.com/reflex-dev/reflex/blob/main/docs/ja/README.md) | [Deutsch](https://github.com/reflex-dev/reflex/blob/main/docs/de/README.md) | [Persian (پارسی)](https://github.com/reflex-dev/reflex/blob/main/docs/pe/README.md) | [Tiếng Việt](https://github.com/reflex-dev/reflex/blob/main/docs/vi/README.md) + +--- + +# Reflex + +Reflex là một thư viện để xây dựng ứng dụng web toàn bộ bằng Python thuần. + +Các tính năng chính: +* **Python thuần tuý** - Viết toàn bộ ứng dụng cả backend và frontend hoàn toàn bằng Python, không cần học JavaScript. +* **Full Flexibility** - Reflex dễ dàng để bắt đầu, nhưng cũng có thể mở rộng lên các ứng dụng phức tạp. +* **Deploy Instantly** - Sau khi xây dựng ứng dụng, bạn có thể triển khai bằng [một dòng lệnh](https://reflex.dev/docs/hosting/deploy-quick-start/) hoặc triển khai trên server của riêng bạn. + +Đọc [bài viết về kiến trúc hệ thống](https://reflex.dev/blog/2024-03-21-reflex-architecture/#the-reflex-architecture) để hiểu rõ các hoạt động của Reflex. + +## ⚙️ Cài đặt + +Mở cửa sổ lệnh và chạy (Yêu cầu Python phiên bản 3.9+): + +```bash +pip install reflex +``` + +## 🥳 Tạo ứng dụng đầu tiên + +Cài đặt `reflex` cũng như cài đặt công cụ dòng lệnh `reflex`. + +Kiểm tra việc cài đặt đã thành công hay chưa bằng cách tạo mới một ứng dụng. (Thay `my_app_name` bằng tên ứng dụng của bạn): + +```bash +mkdir my_app_name +cd my_app_name +reflex init +``` + +Lệnh này tạo ra một ứng dụng mẫu trong một thư mục mới. + +Bạn có thể chạy ứng dụng ở chế độ phát triển. + +```bash +reflex run +``` + +Bạn có thể xem ứng dụng của bạn ở địa chỉ http://localhost:3000. + +Bạn có thể thay đổi mã nguồn ở `my_app_name/my_app_name.py`. Reflex nhanh chóng làm mới và bạn có thể thấy thay đổi trên ứng dụng của bạn ngay lập tức khi bạn lưu file. + + +## 🫧 Ứng dụng ví dụ + +Bắt đầu với ví dụ: tạo một ứng dụng tạo ảnh bằng [DALL·E](https://platform.openai.com/docs/guides/images/image-generation?context=node). Để cho đơn giản, chúng ta sẽ sử dụng [OpenAI API](https://platform.openai.com/docs/api-reference/authentication), nhưng bạn có thể sử dụng model của chính bạn được triển khai trên local. + +  + +
+A frontend wrapper for DALL·E, shown in the process of generating an image. +
+ +  + +Đây là toàn bộ đoạn mã để xây dựng ứng dụng trên. Nó được viết hoàn toàn trong một file Python! + + + +```python +import reflex as rx +import openai + +openai_client = openai.OpenAI() + + +class State(rx.State): + """The app state.""" + + prompt = "" + image_url = "" + processing = False + complete = False + + def get_image(self): + """Get the image from the prompt.""" + if self.prompt == "": + return rx.window_alert("Prompt Empty") + + self.processing, self.complete = True, False + yield + response = openai_client.images.generate( + prompt=self.prompt, n=1, size="1024x1024" + ) + self.image_url = response.data[0].url + self.processing, self.complete = False, True + + +def index(): + return rx.center( + rx.vstack( + rx.heading("DALL-E", font_size="1.5em"), + rx.input( + placeholder="Enter a prompt..", + on_blur=State.set_prompt, + width="25em", + ), + rx.button( + "Generate Image", + on_click=State.get_image, + width="25em", + loading=State.processing + ), + rx.cond( + State.complete, + rx.image(src=State.image_url, width="20em"), + ), + align="center", + ), + width="100%", + height="100vh", + ) + +# Add state and page to the app. +app = rx.App() +app.add_page(index, title="Reflex:DALL-E") +``` + + + + + +## Hãy phân tích chi tiết. + +
+Explaining the differences between backend and frontend parts of the DALL-E app. +
+ + +### **Reflex UI** + +Bắt đầu với giao diện chính. + +```python +def index(): + return rx.center( + ... + ) +``` + +Hàm `index` định nghĩa phần giao diện chính của ứng dụng. + +Chúng tôi sử dụng các component (thành phần) khác nhau như `center`, `vstack`, `input` và `button` để xây dựng giao diện phía trước. +Các component có thể được lồng vào nhau để tạo ra các bố cục phức tạp. Và bạn cũng có thể sử dụng từ khoá `args` để tận dụng đầy đủ sức mạnh của CSS. + +Reflex có đến hơn [60 component được xây dựng sẵn](https://reflex.dev/docs/library) để giúp bạn bắt đầu. Chúng ta có thể tạo ra một component mới khá dễ dàng, thao khảo: [xây dựng component của riêng bạn](https://reflex.dev/docs/wrapping-react/overview/). + +### **State** + +Reflex biểu diễn giao diện bằng các hàm của state (trạng thái). + +```python +class State(rx.State): + """The app state.""" + prompt = "" + image_url = "" + processing = False + complete = False + +``` + +Một state định nghĩa các biến (được gọi là vars) có thể thay đổi trong một ứng dụng và cho phép các hàm có thể thay đổi chúng. + +Tại đây state được cấu thành từ một `prompt` và `image_url`. +Có cũng những biến boolean `processing` và `complete` +để chỉ ra khi nào tắt nút (trong quá trình tạo hình ảnh) +và khi nào hiển thị hình ảnh kết quả. + +### **Event Handlers** + +```python +def get_image(self): + """Get the image from the prompt.""" + if self.prompt == "": + return rx.window_alert("Prompt Empty") + + self.processing, self.complete = True, False + yield + response = openai_client.images.generate( + prompt=self.prompt, n=1, size="1024x1024" + ) + self.image_url = response.data[0].url + self.processing, self.complete = False, True +``` + +Với các state, chúng ta định nghĩa các hàm có thể thay đổi state vars được gọi là event handlers. Event handler là cách chúng ta có thể thay đổi state trong Reflex. Chúng có thể là phản hồi khi người dùng thao tác, chằng hạn khi nhấn vào nút hoặc khi đang nhập trong text box. Các hành động này được gọi là event. + +Ứng dụng DALL·E. của chúng ta có một event handler, `get_image` để lấy hình ảnh từ OpenAI API. Sử dụng từ khoá `yield` in ở giữa event handler để cập nhật giao diện. Hoặc giao diện có thể cập nhật ở cuối event handler. + +### **Routing** + +Cuối cùng, chúng ta định nghĩa một ứng dụng. + +```python +app = rx.App() +``` + +Chúng ta thêm một trang ở đầu ứng dụng bằng index component. Chúng ta cũng thêm tiêu đề của ứng dụng để hiển thị lên trình duyệt. + + +```python +app.add_page(index, title="DALL-E") +``` + +Bạn có thể tạo một ứng dụng nhiều trang bằng cách thêm trang. + +## 📑 Tài liệu + +
+ +📑 [Docs](https://reflex.dev/docs/getting-started/introduction)   |   🗞️ [Blog](https://reflex.dev/blog)   |   📱 [Component Library](https://reflex.dev/docs/library)   |   🖼️ [Gallery](https://reflex.dev/docs/gallery)   |   🛸 [Deployment](https://reflex.dev/docs/hosting/deploy-quick-start)   + +
+ + +## ✅ Status + +Reflex phát hành vào tháng 12/2022 với tên là Pynecone. + +Đến tháng 02/2024, chúng tôi tạo ra dịch vụ dưới phiên bản alpha! Trong thời gian này mọi người có thể triển khai ứng dụng hoàn toàn miễn phí. Xem [roadmap](https://github.com/reflex-dev/reflex/issues/2727) để biết thêm chi tiết. + +Reflex ra phiên bản mới với các tính năng mới hàng tuần! Hãy :star: star và :eyes: watch repo này để thấy các cập nhật mới nhất. + +## Contributing + +Chúng tôi chào đón mọi đóng góp dù lớn hay nhỏ. Dưới đây là các cách để bắt đầu với cộng đồng Reflex. + +- **Discord**: [Discord](https://discord.gg/T5WSbC2YtQ) của chúng tôi là nơi tốt nhất để nhờ sự giúp đỡ và thảo luận các bạn có thể đóng góp. +- **GitHub Discussions**: Là cách tốt nhất để thảo luận về các tính năng mà bạn có thể đóng góp hoặc những điều bạn chưa rõ. +- **GitHub Issues**: [Issues](https://github.com/reflex-dev/reflex/issues) là nơi tốt nhất để thông báo. Ngoài ra bạn có thể sửa chữa các vấn đề bằng cách tạo PR. + +Chúng tôi luôn sẵn sàng tìm kiếm các contributor, bất kể kinh nghiệm. Để tham gia đóng góp, xin mời xem +[CONTIBUTING.md](https://github.com/reflex-dev/reflex/blob/main/CONTRIBUTING.md) + + +## Xin cảm ơn các Contributors: + + + + +## License + +Reflex là mã nguồn mở và sử dụng giấy phép [Apache License 2.0](LICENSE). diff --git a/docs/zh/zh_cn/README.md b/docs/zh/zh_cn/README.md index 3edb81976..e114bc1e2 100644 --- a/docs/zh/zh_cn/README.md +++ b/docs/zh/zh_cn/README.md @@ -10,7 +10,6 @@ ### **✨ 使用 Python 创建高效且可自定义的网页应用程序,几秒钟内即可部署.✨** [![PyPI version](https://badge.fury.io/py/reflex.svg)](https://badge.fury.io/py/reflex) -![tests](https://github.com/pynecone-io/pynecone/actions/workflows/integration.yml/badge.svg) ![versions](https://img.shields.io/pypi/pyversions/reflex.svg) [![Documentaiton](https://img.shields.io/badge/Documentation%20-Introduction%20-%20%23007ec6)](https://reflex.dev/docs/getting-started/introduction) [![Discord](https://img.shields.io/discord/1029853095527727165?color=%237289da&label=Discord)](https://discord.gg/T5WSbC2YtQ) @@ -35,7 +34,7 @@ Reflex 是一个使用纯Python构建全栈web应用的库。 ## ⚙️ 安装 -打开一个终端并且运行(要求Python3.8+): +打开一个终端并且运行(要求Python3.9+): ```bash pip install reflex diff --git a/docs/zh/zh_tw/README.md b/docs/zh/zh_tw/README.md index 388631dd2..83f6b2ae2 100644 --- a/docs/zh/zh_tw/README.md +++ b/docs/zh/zh_tw/README.md @@ -11,7 +11,6 @@ **✨ 使用 Python 建立高效且可自訂的網頁應用程式,幾秒鐘內即可部署。✨** [![PyPI version](https://badge.fury.io/py/reflex.svg)](https://badge.fury.io/py/reflex) -![tests](https://github.com/pynecone-io/pynecone/actions/workflows/integration.yml/badge.svg) ![versions](https://img.shields.io/pypi/pyversions/reflex.svg) [![Documentaiton](https://img.shields.io/badge/Documentation%20-Introduction%20-%20%23007ec6)](https://reflex.dev/docs/getting-started/introduction) [![Discord](https://img.shields.io/discord/1029853095527727165?color=%237289da&label=Discord)](https://discord.gg/T5WSbC2YtQ) @@ -37,7 +36,7 @@ Reflex 是一個可以用純 Python 構建全端網頁應用程式的函式庫 ## ⚙️ 安裝 -開啟一個終端機並且執行 (需要 Python 3.8+): +開啟一個終端機並且執行 (需要 Python 3.9+): ```bash pip install reflex diff --git a/integration/test_component_state.py b/integration/test_component_state.py deleted file mode 100644 index 77b8b3fa1..000000000 --- a/integration/test_component_state.py +++ /dev/null @@ -1,107 +0,0 @@ -"""Test that per-component state scaffold works and operates independently.""" - -from typing import Generator - -import pytest -from selenium.webdriver.common.by import By - -from reflex.testing import AppHarness - -from . import utils - - -def ComponentStateApp(): - """App using per component state.""" - import reflex as rx - - class MultiCounter(rx.ComponentState): - count: int = 0 - - def increment(self): - self.count += 1 - - @classmethod - def get_component(cls, *children, **props): - return rx.vstack( - *children, - rx.heading(cls.count, id=f"count-{props.get('id', 'default')}"), - rx.button( - "Increment", - on_click=cls.increment, - id=f"button-{props.get('id', 'default')}", - ), - **props, - ) - - app = rx.App(state=rx.State) # noqa - - @rx.page() - def index(): - mc_a = MultiCounter.create(id="a") - mc_b = MultiCounter.create(id="b") - assert mc_a.State != mc_b.State - return rx.vstack( - mc_a, - mc_b, - rx.button( - "Inc A", - on_click=mc_a.State.increment, # type: ignore - id="inc-a", - ), - ) - - -@pytest.fixture() -def component_state_app(tmp_path) -> Generator[AppHarness, None, None]: - """Start ComponentStateApp app at tmp_path via AppHarness. - - Args: - tmp_path: pytest tmp_path fixture - - Yields: - running AppHarness instance - """ - with AppHarness.create( - root=tmp_path, - app_source=ComponentStateApp, # type: ignore - ) as harness: - yield harness - - -@pytest.mark.asyncio -async def test_component_state_app(component_state_app: AppHarness): - """Increment counters independently. - - Args: - component_state_app: harness for ComponentStateApp app - """ - assert component_state_app.app_instance is not None, "app is not running" - driver = component_state_app.frontend() - - ss = utils.SessionStorage(driver) - assert AppHarness._poll_for(lambda: ss.get("token") is not None), "token not found" - - count_a = driver.find_element(By.ID, "count-a") - count_b = driver.find_element(By.ID, "count-b") - button_a = driver.find_element(By.ID, "button-a") - button_b = driver.find_element(By.ID, "button-b") - button_inc_a = driver.find_element(By.ID, "inc-a") - - assert count_a.text == "0" - - button_a.click() - assert component_state_app.poll_for_content(count_a, exp_not_equal="0") == "1" - - button_a.click() - assert component_state_app.poll_for_content(count_a, exp_not_equal="1") == "2" - - button_inc_a.click() - assert component_state_app.poll_for_content(count_a, exp_not_equal="2") == "3" - - assert count_b.text == "0" - - button_b.click() - assert component_state_app.poll_for_content(count_b, exp_not_equal="0") == "1" - - button_b.click() - assert component_state_app.poll_for_content(count_b, exp_not_equal="1") == "2" diff --git a/integration/test_table.py b/integration/test_table.py deleted file mode 100644 index d28798a98..000000000 --- a/integration/test_table.py +++ /dev/null @@ -1,173 +0,0 @@ -"""Integration tests for table and related components.""" - -from typing import Generator - -import pytest -from selenium.webdriver.common.by import By - -from reflex.testing import AppHarness - - -def Table(): - """App using table component.""" - from typing import List - - import reflex_chakra as rc - - import reflex as rx - - class TableState(rx.State): - rows: List[List[str]] = [ - ["John", "30", "New York"], - ["Jane", "31", "San Fransisco"], - ["Joe", "32", "Los Angeles"], - ] - - headers: List[str] = ["Name", "Age", "Location"] - - footers: List[str] = ["footer1", "footer2", "footer3"] - - caption: str = "random caption" - - app = rx.App(state=rx.State) - - @app.add_page - def index(): - return rx.center( - rc.input( - id="token", - value=TableState.router.session.client_token, - is_read_only=True, - ), - rc.table_container( - rc.table( - headers=TableState.headers, - rows=TableState.rows, - footers=TableState.footers, - caption=TableState.caption, - variant="striped", - color_scheme="blue", - width="100%", - ), - ), - ) - - @app.add_page - def another(): - return rx.center( - rc.table_container( - rc.table( # type: ignore - rc.thead( # type: ignore - rc.tr( # type: ignore - rc.th("Name"), - rc.th("Age"), - rc.th("Location"), - ) - ), - rc.tbody( # type: ignore - rc.tr( # type: ignore - rc.td("John"), - rc.td(30), - rc.td("New York"), - ), - rc.tr( # type: ignore - rc.td("Jane"), - rc.td(31), - rc.td("San Francisco"), - ), - rc.tr( # type: ignore - rc.td("Joe"), - rc.td(32), - rc.td("Los Angeles"), - ), - ), - rc.tfoot( # type: ignore - rc.tr( - rc.td("footer1"), - rc.td("footer2"), - rc.td("footer3"), - ) # type: ignore - ), - rc.table_caption("random caption"), - variant="striped", - color_scheme="teal", - ) - ) - ) - - -@pytest.fixture() -def table(tmp_path_factory) -> Generator[AppHarness, None, None]: - """Start Table app at tmp_path via AppHarness. - - Args: - tmp_path_factory: pytest tmp_path_factory fixture - - Yields: - running AppHarness instance - - """ - with AppHarness.create( - root=tmp_path_factory.mktemp("table"), - app_source=Table, # type: ignore - ) as harness: - assert harness.app_instance is not None, "app is not running" - yield harness - - -@pytest.fixture -def driver(table: AppHarness): - """GEt an instance of the browser open to the table app. - - Args: - table: harness for Table app - - Yields: - WebDriver instance. - """ - driver = table.frontend() - try: - token_input = driver.find_element(By.ID, "token") - assert token_input - # wait for the backend connection to send the token - token = table.poll_for_value(token_input) - assert token is not None - - yield driver - finally: - driver.quit() - - -@pytest.mark.parametrize("route", ["", "/another"]) -def test_table(driver, table: AppHarness, route): - """Test that a table component is rendered properly. - - Args: - driver: Selenium WebDriver open to the app - table: Harness for Table app - route: Page route or path. - """ - driver.get(f"{table.frontend_url}/{route}") - assert table.app_instance is not None, "app is not running" - - thead = driver.find_element(By.TAG_NAME, "thead") - # poll till page is fully loaded. - table.poll_for_content(element=thead) - # check headers - assert thead.find_element(By.TAG_NAME, "tr").text == "NAME AGE LOCATION" - # check first row value - assert ( - driver.find_element(By.TAG_NAME, "tbody") - .find_elements(By.TAG_NAME, "tr")[0] - .text - == "John 30 New York" - ) - # check footer - assert ( - driver.find_element(By.TAG_NAME, "tfoot") - .find_element(By.TAG_NAME, "tr") - .text.lower() - == "footer1 footer2 footer3" - ) - # check caption - assert driver.find_element(By.TAG_NAME, "caption").text == "random caption" diff --git a/integration/test_urls.py b/integration/test_urls.py deleted file mode 100755 index bcf17fe41..000000000 --- a/integration/test_urls.py +++ /dev/null @@ -1,68 +0,0 @@ -"""Integration tests for all urls in Reflex.""" - -import os -import re -from pathlib import Path - -import pytest -import requests - - -def check_urls(repo_dir): - """Check that all URLs in the repo are valid and secure. - - Args: - repo_dir: The directory of the repo. - - Returns: - A list of errors. - """ - url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') - errors = [] - - for root, _dirs, files in os.walk(repo_dir): - if "__pycache__" in root: - continue - - for file_name in files: - if not file_name.endswith(".py") and not file_name.endswith(".md"): - continue - - file_path = os.path.join(root, file_name) - try: - with open(file_path, "r", encoding="utf-8", errors="ignore") as file: - for line in file: - urls = url_pattern.findall(line) - for url in set(urls): - if url.startswith("http://"): - errors.append( - f"Found insecure HTTP URL: {url} in {file_path}" - ) - url = url.strip('"\n') - try: - response = requests.head( - url, allow_redirects=True, timeout=5 - ) - response.raise_for_status() - except requests.RequestException as e: - errors.append( - f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check your path ends with a /" - ) - except Exception as e: - errors.append(f"Error reading file: {file_path} | Error: {e}") - - return errors - - -@pytest.mark.parametrize( - "repo_dir", - [Path(__file__).resolve().parent.parent / "reflex"], -) -def test_find_and_check_urls(repo_dir): - """Test that all URLs in the repo are valid and secure. - - Args: - repo_dir: The directory of the repo. - """ - errors = check_urls(repo_dir) - assert not errors, "\n".join(errors) diff --git a/poetry.lock b/poetry.lock index b8e88b5ed..7161e6af7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2,18 +2,16 @@ [[package]] name = "alembic" -version = "1.13.2" +version = "1.13.3" description = "A database migration tool for SQLAlchemy." optional = false python-versions = ">=3.8" files = [ - {file = "alembic-1.13.2-py3-none-any.whl", hash = "sha256:6b8733129a6224a9a711e17c99b08462dbf7cc9670ba8f2e2ae9af860ceb1953"}, - {file = "alembic-1.13.2.tar.gz", hash = "sha256:1ff0ae32975f4fd96028c39ed9bb3c867fe3af956bd7bb37343b54c9fe7445ef"}, + {file = "alembic-1.13.3-py3-none-any.whl", hash = "sha256:908e905976d15235fae59c9ac42c4c5b75cfcefe3d27c0fbf7ae15a37715d80e"}, + {file = "alembic-1.13.3.tar.gz", hash = "sha256:203503117415561e203aa14541740643a611f641517f0209fcae63e9fa09f1a2"}, ] [package.dependencies] -importlib-metadata = {version = "*", markers = "python_version < \"3.9\""} -importlib-resources = {version = "*", markers = "python_version < \"3.9\""} Mako = "*" SQLAlchemy = ">=1.3.0" typing-extensions = ">=4" @@ -32,18 +30,15 @@ files = [ {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, ] -[package.dependencies] -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} - [[package]] name = "anyio" -version = "4.4.0" +version = "4.6.2.post1" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "anyio-4.4.0-py3-none-any.whl", hash = "sha256:c1b2d8f46a8a812513012e1107cb0e68c17159a7a594208005a57dc776e1bdc7"}, - {file = "anyio-4.4.0.tar.gz", hash = "sha256:5aadc6a1bbb7cdb0bede386cac5e2940f5e2ff3aa20277e991cf028e0585ce94"}, + {file = "anyio-4.6.2.post1-py3-none-any.whl", hash = "sha256:6d170c36fba3bdd840c73d3868c1e777e33676a69c3a72cf0a0d5d6d8009b61d"}, + {file = "anyio-4.6.2.post1.tar.gz", hash = "sha256:4c8bc31ccdb51c7f7bd251f51c609e038d63e34219b44aa86e47576389880b4c"}, ] [package.dependencies] @@ -53,9 +48,9 @@ sniffio = ">=1.1" typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] -doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (>=0.23)"] +doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21.0b1)"] +trio = ["trio (>=0.26.1)"] [[package]] name = "async-timeout" @@ -126,13 +121,13 @@ files = [ [[package]] name = "build" -version = "1.2.1" +version = "1.2.2.post1" description = "A simple, correct Python build frontend" optional = false python-versions = ">=3.8" files = [ - {file = "build-1.2.1-py3-none-any.whl", hash = "sha256:75e10f767a433d9a86e50d83f418e83efc18ede923ee5ff7df93b6cb0306c5d4"}, - {file = "build-1.2.1.tar.gz", hash = "sha256:526263f4870c26f26c433545579475377b2b7588b6f1eac76a001e873ae3e19d"}, + {file = "build-1.2.2.post1-py3-none-any.whl", hash = "sha256:1d61c0887fa860c01971625baae8bdd338e517b836a2f70dd1f7aa3a6b2fc5b5"}, + {file = "build-1.2.2.post1.tar.gz", hash = "sha256:b36993e92ca9375a219c99e606a122ff365a760a2d4bba0caa09bd5278b608b7"}, ] [package.dependencies] @@ -252,101 +247,116 @@ files = [ [[package]] name = "charset-normalizer" -version = "3.3.2" +version = "3.4.0" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." optional = false python-versions = ">=3.7.0" files = [ - {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-win32.whl", hash = "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-win32.whl", hash = "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-win_amd64.whl", hash = "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-win32.whl", hash = "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-win32.whl", hash = "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d"}, - {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:4f9fc98dad6c2eaa32fc3af1417d95b5e3d08aff968df0cd320066def971f9a6"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0de7b687289d3c1b3e8660d0741874abe7888100efe14bd0f9fd7141bcbda92b"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5ed2e36c3e9b4f21dd9422f6893dec0abf2cca553af509b10cd630f878d3eb99"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40d3ff7fc90b98c637bda91c89d51264a3dcf210cade3a2c6f838c7268d7a4ca"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1110e22af8ca26b90bd6364fe4c763329b0ebf1ee213ba32b68c73de5752323d"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:86f4e8cca779080f66ff4f191a685ced73d2f72d50216f7112185dc02b90b9b7"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f683ddc7eedd742e2889d2bfb96d69573fde1d92fcb811979cdb7165bb9c7d3"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:27623ba66c183eca01bf9ff833875b459cad267aeeb044477fedac35e19ba907"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:f606a1881d2663630ea5b8ce2efe2111740df4b687bd78b34a8131baa007f79b"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0b309d1747110feb25d7ed6b01afdec269c647d382c857ef4663bbe6ad95a912"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:136815f06a3ae311fae551c3df1f998a1ebd01ddd424aa5603a4336997629e95"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:14215b71a762336254351b00ec720a8e85cada43b987da5a042e4ce3e82bd68e"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:79983512b108e4a164b9c8d34de3992f76d48cadc9554c9e60b43f308988aabe"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-win32.whl", hash = "sha256:c94057af19bc953643a33581844649a7fdab902624d2eb739738a30e2b3e60fc"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:55f56e2ebd4e3bc50442fbc0888c9d8c94e4e06a933804e2af3e89e2f9c1c749"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0d99dd8ff461990f12d6e42c7347fd9ab2532fb70e9621ba520f9e8637161d7c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c57516e58fd17d03ebe67e181a4e4e2ccab1168f8c2976c6a334d4f819fe5944"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6dba5d19c4dfab08e58d5b36304b3f92f3bd5d42c1a3fa37b5ba5cdf6dfcbcee"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf4475b82be41b07cc5e5ff94810e6a01f276e37c2d55571e3fe175e467a1a1c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce031db0408e487fd2775d745ce30a7cd2923667cf3b69d48d219f1d8f5ddeb6"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ff4e7cdfdb1ab5698e675ca622e72d58a6fa2a8aa58195de0c0061288e6e3ea"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3710a9751938947e6327ea9f3ea6332a09bf0ba0c09cae9cb1f250bd1f1549bc"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:82357d85de703176b5587dbe6ade8ff67f9f69a41c0733cf2425378b49954de5"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:47334db71978b23ebcf3c0f9f5ee98b8d65992b65c9c4f2d34c2eaf5bcaf0594"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8ce7fd6767a1cc5a92a639b391891bf1c268b03ec7e021c7d6d902285259685c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f1a2f519ae173b5b6a2c9d5fa3116ce16e48b3462c8b96dfdded11055e3d6365"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:63bc5c4ae26e4bc6be6469943b8253c0fd4e4186c43ad46e713ea61a0ba49129"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bcb4f8ea87d03bc51ad04add8ceaf9b0f085ac045ab4d74e73bbc2dc033f0236"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-win32.whl", hash = "sha256:9ae4ef0b3f6b41bad6366fb0ea4fc1d7ed051528e113a60fa2a65a9abb5b1d99"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cee4373f4d3ad28f1ab6290684d8e2ebdb9e7a1b74fdc39e4c211995f77bec27"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0713f3adb9d03d49d365b70b84775d0a0d18e4ab08d12bc46baa6132ba78aaf6"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:de7376c29d95d6719048c194a9cf1a1b0393fbe8488a22008610b0361d834ecf"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4a51b48f42d9358460b78725283f04bddaf44a9358197b889657deba38f329db"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b295729485b06c1a0683af02a9e42d2caa9db04a373dc38a6a58cdd1e8abddf1"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ee803480535c44e7f5ad00788526da7d85525cfefaf8acf8ab9a310000be4b03"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3d59d125ffbd6d552765510e3f31ed75ebac2c7470c7274195b9161a32350284"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8cda06946eac330cbe6598f77bb54e690b4ca93f593dee1568ad22b04f347c15"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07afec21bbbbf8a5cc3651aa96b980afe2526e7f048fdfb7f1014d84acc8b6d8"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6b40e8d38afe634559e398cc32b1472f376a4099c75fe6299ae607e404c033b2"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b8dcd239c743aa2f9c22ce674a145e0a25cb1566c495928440a181ca1ccf6719"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:84450ba661fb96e9fd67629b93d2941c871ca86fc38d835d19d4225ff946a631"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:44aeb140295a2f0659e113b31cfe92c9061622cadbc9e2a2f7b8ef6b1e29ef4b"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1db4e7fefefd0f548d73e2e2e041f9df5c59e178b4c72fbac4cc6f535cfb1565"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-win32.whl", hash = "sha256:5726cf76c982532c1863fb64d8c6dd0e4c90b6ece9feb06c9f202417a31f7dd7"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:b197e7094f232959f8f20541ead1d9862ac5ebea1d58e9849c1bf979255dfac9"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:dd4eda173a9fcccb5f2e2bd2a9f423d180194b1bf17cf59e3269899235b2a114"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9e3c4c9e1ed40ea53acf11e2a386383c3304212c965773704e4603d589343ed"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:92a7e36b000bf022ef3dbb9c46bfe2d52c047d5e3f3343f43204263c5addc250"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54b6a92d009cbe2fb11054ba694bc9e284dad30a26757b1e372a1fdddaf21920"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ffd9493de4c922f2a38c2bf62b831dcec90ac673ed1ca182fe11b4d8e9f2a64"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:35c404d74c2926d0287fbd63ed5d27eb911eb9e4a3bb2c6d294f3cfd4a9e0c23"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4796efc4faf6b53a18e3d46343535caed491776a22af773f366534056c4e1fbc"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7fdd52961feb4c96507aa649550ec2a0d527c086d284749b2f582f2d40a2e0d"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:92db3c28b5b2a273346bebb24857fda45601aef6ae1c011c0a997106581e8a88"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ab973df98fc99ab39080bfb0eb3a925181454d7c3ac8a1e695fddfae696d9e90"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:4b67fdab07fdd3c10bb21edab3cbfe8cf5696f453afce75d815d9d7223fbe88b"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:aa41e526a5d4a9dfcfbab0716c7e8a1b215abd3f3df5a45cf18a12721d31cb5d"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ffc519621dce0c767e96b9c53f09c5d215578e10b02c285809f76509a3931482"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-win32.whl", hash = "sha256:f19c1585933c82098c2a520f8ec1227f20e339e33aca8fa6f956f6691b784e67"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:707b82d19e65c9bd28b81dde95249b07bf9f5b90ebe1ef17d9b57473f8a64b7b"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dbe03226baf438ac4fda9e2d0715022fd579cb641c4cf639fa40d53b2fe6f3e2"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd9a8bd8900e65504a305bf8ae6fa9fbc66de94178c420791d0293702fce2df7"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8831399554b92b72af5932cdbbd4ddc55c55f631bb13ff8fe4e6536a06c5c51"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a14969b8691f7998e74663b77b4c36c0337cb1df552da83d5c9004a93afdb574"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcaf7c1524c0542ee2fc82cc8ec337f7a9f7edee2532421ab200d2b920fc97cf"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:425c5f215d0eecee9a56cdb703203dda90423247421bf0d67125add85d0c4455"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:d5b054862739d276e09928de37c79ddeec42a6e1bfc55863be96a36ba22926f6"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:f3e73a4255342d4eb26ef6df01e3962e73aa29baa3124a8e824c5d3364a65748"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:2f6c34da58ea9c1a9515621f4d9ac379871a8f21168ba1b5e09d74250de5ad62"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:f09cb5a7bbe1ecae6e87901a2eb23e0256bb524a79ccc53eb0b7629fbe7677c4"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:0099d79bdfcf5c1f0c2c72f91516702ebf8b0b8ddd8905f97a8aecf49712c621"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-win32.whl", hash = "sha256:9c98230f5042f4945f957d006edccc2af1e03ed5e37ce7c373f00a5a4daa6149"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:62f60aebecfc7f4b82e3f639a7d1433a20ec32824db2199a11ad4f5e146ef5ee"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:af73657b7a68211996527dbfeffbb0864e043d270580c5aef06dc4b659a4b578"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cab5d0b79d987c67f3b9e9c53f54a61360422a5a0bc075f43cab5621d530c3b6"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9289fd5dddcf57bab41d044f1756550f9e7cf0c8e373b8cdf0ce8773dc4bd417"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b493a043635eb376e50eedf7818f2f322eabbaa974e948bd8bdd29eb7ef2a51"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9fa2566ca27d67c86569e8c85297aaf413ffab85a8960500f12ea34ff98e4c41"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a8e538f46104c815be19c975572d74afb53f29650ea2025bbfaef359d2de2f7f"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fd30dc99682dc2c603c2b315bded2799019cea829f8bf57dc6b61efde6611c8"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2006769bd1640bdf4d5641c69a3d63b71b81445473cac5ded39740a226fa88ab"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:dc15e99b2d8a656f8e666854404f1ba54765871104e50c8e9813af8a7db07f12"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:ab2e5bef076f5a235c3774b4f4028a680432cded7cad37bba0fd90d64b187d19"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:4ec9dd88a5b71abfc74e9df5ebe7921c35cbb3b641181a531ca65cdb5e8e4dea"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:43193c5cda5d612f247172016c4bb71251c784d7a4d9314677186a838ad34858"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:aa693779a8b50cd97570e5a0f343538a8dbd3e496fa5dcb87e29406ad0299654"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-win32.whl", hash = "sha256:7706f5850360ac01d80c89bcef1640683cc12ed87f42579dab6c5d3ed6888613"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:c3e446d253bd88f6377260d07c895816ebf33ffffd56c1c792b13bff9c3e1ade"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:980b4f289d1d90ca5efcf07958d3eb38ed9c0b7676bf2831a54d4f66f9c27dfa"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f28f891ccd15c514a0981f3b9db9aa23d62fe1a99997512b0491d2ed323d229a"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8aacce6e2e1edcb6ac625fb0f8c3a9570ccc7bfba1f63419b3769ccf6a00ed0"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd7af3717683bea4c87acd8c0d3d5b44d56120b26fd3f8a692bdd2d5260c620a"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5ff2ed8194587faf56555927b3aa10e6fb69d931e33953943bc4f837dfee2242"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e91f541a85298cf35433bf66f3fab2a4a2cff05c127eeca4af174f6d497f0d4b"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:309a7de0a0ff3040acaebb35ec45d18db4b28232f21998851cfa709eeff49d62"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:285e96d9d53422efc0d7a17c60e59f37fbf3dfa942073f666db4ac71e8d726d0"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:5d447056e2ca60382d460a604b6302d8db69476fd2015c81e7c35417cfabe4cd"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:20587d20f557fe189b7947d8e7ec5afa110ccf72a3128d61a2a387c3313f46be"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:130272c698667a982a5d0e626851ceff662565379baf0ff2cc58067b81d4f11d"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:ab22fbd9765e6954bc0bcff24c25ff71dcbfdb185fcdaca49e81bac68fe724d3"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7782afc9b6b42200f7362858f9e73b1f8316afb276d316336c0ec3bd73312742"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-win32.whl", hash = "sha256:2de62e8801ddfff069cd5c504ce3bc9672b23266597d4e4f50eda28846c322f2"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:95c3c157765b031331dd4db3c775e58deaee050a3042fcad72cbc4189d7c8dca"}, + {file = "charset_normalizer-3.4.0-py3-none-any.whl", hash = "sha256:fe9f97feb71aa9896b81973a7bbada8c49501dc73e58a10fcef6663af95e5079"}, + {file = "charset_normalizer-3.4.0.tar.gz", hash = "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e"}, ] [[package]] @@ -376,83 +386,73 @@ files = [ [[package]] name = "coverage" -version = "7.6.1" +version = "7.6.4" description = "Code coverage measurement for Python" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "coverage-7.6.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b06079abebbc0e89e6163b8e8f0e16270124c154dc6e4a47b413dd538859af16"}, - {file = "coverage-7.6.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cf4b19715bccd7ee27b6b120e7e9dd56037b9c0681dcc1adc9ba9db3d417fa36"}, - {file = "coverage-7.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61c0abb4c85b095a784ef23fdd4aede7a2628478e7baba7c5e3deba61070a02"}, - {file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd21f6ae3f08b41004dfb433fa895d858f3f5979e7762d052b12aef444e29afc"}, - {file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f59d57baca39b32db42b83b2a7ba6f47ad9c394ec2076b084c3f029b7afca23"}, - {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a1ac0ae2b8bd743b88ed0502544847c3053d7171a3cff9228af618a068ed9c34"}, - {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e6a08c0be454c3b3beb105c0596ebdc2371fab6bb90c0c0297f4e58fd7e1012c"}, - {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f5796e664fe802da4f57a168c85359a8fbf3eab5e55cd4e4569fbacecc903959"}, - {file = "coverage-7.6.1-cp310-cp310-win32.whl", hash = "sha256:7bb65125fcbef8d989fa1dd0e8a060999497629ca5b0efbca209588a73356232"}, - {file = "coverage-7.6.1-cp310-cp310-win_amd64.whl", hash = "sha256:3115a95daa9bdba70aea750db7b96b37259a81a709223c8448fa97727d546fe0"}, - {file = "coverage-7.6.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7dea0889685db8550f839fa202744652e87c60015029ce3f60e006f8c4462c93"}, - {file = "coverage-7.6.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ed37bd3c3b063412f7620464a9ac1314d33100329f39799255fb8d3027da50d3"}, - {file = "coverage-7.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d85f5e9a5f8b73e2350097c3756ef7e785f55bd71205defa0bfdaf96c31616ff"}, - {file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bc572be474cafb617672c43fe989d6e48d3c83af02ce8de73fff1c6bb3c198d"}, - {file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c0420b573964c760df9e9e86d1a9a622d0d27f417e1a949a8a66dd7bcee7bc6"}, - {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1f4aa8219db826ce6be7099d559f8ec311549bfc4046f7f9fe9b5cea5c581c56"}, - {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:fc5a77d0c516700ebad189b587de289a20a78324bc54baee03dd486f0855d234"}, - {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b48f312cca9621272ae49008c7f613337c53fadca647d6384cc129d2996d1133"}, - {file = "coverage-7.6.1-cp311-cp311-win32.whl", hash = "sha256:1125ca0e5fd475cbbba3bb67ae20bd2c23a98fac4e32412883f9bcbaa81c314c"}, - {file = "coverage-7.6.1-cp311-cp311-win_amd64.whl", hash = "sha256:8ae539519c4c040c5ffd0632784e21b2f03fc1340752af711f33e5be83a9d6c6"}, - {file = "coverage-7.6.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:95cae0efeb032af8458fc27d191f85d1717b1d4e49f7cb226cf526ff28179778"}, - {file = "coverage-7.6.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5621a9175cf9d0b0c84c2ef2b12e9f5f5071357c4d2ea6ca1cf01814f45d2391"}, - {file = "coverage-7.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:260933720fdcd75340e7dbe9060655aff3af1f0c5d20f46b57f262ab6c86a5e8"}, - {file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07e2ca0ad381b91350c0ed49d52699b625aab2b44b65e1b4e02fa9df0e92ad2d"}, - {file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c44fee9975f04b33331cb8eb272827111efc8930cfd582e0320613263ca849ca"}, - {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:877abb17e6339d96bf08e7a622d05095e72b71f8afd8a9fefc82cf30ed944163"}, - {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3e0cadcf6733c09154b461f1ca72d5416635e5e4ec4e536192180d34ec160f8a"}, - {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c3c02d12f837d9683e5ab2f3d9844dc57655b92c74e286c262e0fc54213c216d"}, - {file = "coverage-7.6.1-cp312-cp312-win32.whl", hash = "sha256:e05882b70b87a18d937ca6768ff33cc3f72847cbc4de4491c8e73880766718e5"}, - {file = "coverage-7.6.1-cp312-cp312-win_amd64.whl", hash = "sha256:b5d7b556859dd85f3a541db6a4e0167b86e7273e1cdc973e5b175166bb634fdb"}, - {file = "coverage-7.6.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a4acd025ecc06185ba2b801f2de85546e0b8ac787cf9d3b06e7e2a69f925b106"}, - {file = "coverage-7.6.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a6d3adcf24b624a7b778533480e32434a39ad8fa30c315208f6d3e5542aeb6e9"}, - {file = "coverage-7.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0c212c49b6c10e6951362f7c6df3329f04c2b1c28499563d4035d964ab8e08c"}, - {file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e81d7a3e58882450ec4186ca59a3f20a5d4440f25b1cff6f0902ad890e6748a"}, - {file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78b260de9790fd81e69401c2dc8b17da47c8038176a79092a89cb2b7d945d060"}, - {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a78d169acd38300060b28d600344a803628c3fd585c912cacc9ea8790fe96862"}, - {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2c09f4ce52cb99dd7505cd0fc8e0e37c77b87f46bc9c1eb03fe3bc9991085388"}, - {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6878ef48d4227aace338d88c48738a4258213cd7b74fd9a3d4d7582bb1d8a155"}, - {file = "coverage-7.6.1-cp313-cp313-win32.whl", hash = "sha256:44df346d5215a8c0e360307d46ffaabe0f5d3502c8a1cefd700b34baf31d411a"}, - {file = "coverage-7.6.1-cp313-cp313-win_amd64.whl", hash = "sha256:8284cf8c0dd272a247bc154eb6c95548722dce90d098c17a883ed36e67cdb129"}, - {file = "coverage-7.6.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:d3296782ca4eab572a1a4eca686d8bfb00226300dcefdf43faa25b5242ab8a3e"}, - {file = "coverage-7.6.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:502753043567491d3ff6d08629270127e0c31d4184c4c8d98f92c26f65019962"}, - {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a89ecca80709d4076b95f89f308544ec8f7b4727e8a547913a35f16717856cb"}, - {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a318d68e92e80af8b00fa99609796fdbcdfef3629c77c6283566c6f02c6d6704"}, - {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13b0a73a0896988f053e4fbb7de6d93388e6dd292b0d87ee51d106f2c11b465b"}, - {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4421712dbfc5562150f7554f13dde997a2e932a6b5f352edcce948a815efee6f"}, - {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:166811d20dfea725e2e4baa71fffd6c968a958577848d2131f39b60043400223"}, - {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:225667980479a17db1048cb2bf8bfb39b8e5be8f164b8f6628b64f78a72cf9d3"}, - {file = "coverage-7.6.1-cp313-cp313t-win32.whl", hash = "sha256:170d444ab405852903b7d04ea9ae9b98f98ab6d7e63e1115e82620807519797f"}, - {file = "coverage-7.6.1-cp313-cp313t-win_amd64.whl", hash = "sha256:b9f222de8cded79c49bf184bdbc06630d4c58eec9459b939b4a690c82ed05657"}, - {file = "coverage-7.6.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6db04803b6c7291985a761004e9060b2bca08da6d04f26a7f2294b8623a0c1a0"}, - {file = "coverage-7.6.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f1adfc8ac319e1a348af294106bc6a8458a0f1633cc62a1446aebc30c5fa186a"}, - {file = "coverage-7.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a95324a9de9650a729239daea117df21f4b9868ce32e63f8b650ebe6cef5595b"}, - {file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b43c03669dc4618ec25270b06ecd3ee4fa94c7f9b3c14bae6571ca00ef98b0d3"}, - {file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8929543a7192c13d177b770008bc4e8119f2e1f881d563fc6b6305d2d0ebe9de"}, - {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:a09ece4a69cf399510c8ab25e0950d9cf2b42f7b3cb0374f95d2e2ff594478a6"}, - {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:9054a0754de38d9dbd01a46621636689124d666bad1936d76c0341f7d71bf569"}, - {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:0dbde0f4aa9a16fa4d754356a8f2e36296ff4d83994b2c9d8398aa32f222f989"}, - {file = "coverage-7.6.1-cp38-cp38-win32.whl", hash = "sha256:da511e6ad4f7323ee5702e6633085fb76c2f893aaf8ce4c51a0ba4fc07580ea7"}, - {file = "coverage-7.6.1-cp38-cp38-win_amd64.whl", hash = "sha256:3f1156e3e8f2872197af3840d8ad307a9dd18e615dc64d9ee41696f287c57ad8"}, - {file = "coverage-7.6.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:abd5fd0db5f4dc9289408aaf34908072f805ff7792632250dcb36dc591d24255"}, - {file = "coverage-7.6.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:547f45fa1a93154bd82050a7f3cddbc1a7a4dd2a9bf5cb7d06f4ae29fe94eaf8"}, - {file = "coverage-7.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645786266c8f18a931b65bfcefdbf6952dd0dea98feee39bd188607a9d307ed2"}, - {file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9e0b2df163b8ed01d515807af24f63de04bebcecbd6c3bfeff88385789fdf75a"}, - {file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:609b06f178fe8e9f89ef676532760ec0b4deea15e9969bf754b37f7c40326dbc"}, - {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:702855feff378050ae4f741045e19a32d57d19f3e0676d589df0575008ea5004"}, - {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:2bdb062ea438f22d99cba0d7829c2ef0af1d768d1e4a4f528087224c90b132cb"}, - {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9c56863d44bd1c4fe2abb8a4d6f5371d197f1ac0ebdee542f07f35895fc07f36"}, - {file = "coverage-7.6.1-cp39-cp39-win32.whl", hash = "sha256:6e2cd258d7d927d09493c8df1ce9174ad01b381d4729a9d8d4e38670ca24774c"}, - {file = "coverage-7.6.1-cp39-cp39-win_amd64.whl", hash = "sha256:06a737c882bd26d0d6ee7269b20b12f14a8704807a01056c80bb881a4b2ce6ca"}, - {file = "coverage-7.6.1-pp38.pp39.pp310-none-any.whl", hash = "sha256:e9a6e0eb86070e8ccaedfbd9d38fec54864f3125ab95419970575b42af7541df"}, - {file = "coverage-7.6.1.tar.gz", hash = "sha256:953510dfb7b12ab69d20135a0662397f077c59b1e6379a768e97c59d852ee51d"}, + {file = "coverage-7.6.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5f8ae553cba74085db385d489c7a792ad66f7f9ba2ee85bfa508aeb84cf0ba07"}, + {file = "coverage-7.6.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8165b796df0bd42e10527a3f493c592ba494f16ef3c8b531288e3d0d72c1f6f0"}, + {file = "coverage-7.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c7c8b95bf47db6d19096a5e052ffca0a05f335bc63cef281a6e8fe864d450a72"}, + {file = "coverage-7.6.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8ed9281d1b52628e81393f5eaee24a45cbd64965f41857559c2b7ff19385df51"}, + {file = "coverage-7.6.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0809082ee480bb8f7416507538243c8863ac74fd8a5d2485c46f0f7499f2b491"}, + {file = "coverage-7.6.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d541423cdd416b78626b55f123412fcf979d22a2c39fce251b350de38c15c15b"}, + {file = "coverage-7.6.4-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:58809e238a8a12a625c70450b48e8767cff9eb67c62e6154a642b21ddf79baea"}, + {file = "coverage-7.6.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c9b8e184898ed014884ca84c70562b4a82cbc63b044d366fedc68bc2b2f3394a"}, + {file = "coverage-7.6.4-cp310-cp310-win32.whl", hash = "sha256:6bd818b7ea14bc6e1f06e241e8234508b21edf1b242d49831831a9450e2f35fa"}, + {file = "coverage-7.6.4-cp310-cp310-win_amd64.whl", hash = "sha256:06babbb8f4e74b063dbaeb74ad68dfce9186c595a15f11f5d5683f748fa1d172"}, + {file = "coverage-7.6.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:73d2b73584446e66ee633eaad1a56aad577c077f46c35ca3283cd687b7715b0b"}, + {file = "coverage-7.6.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:51b44306032045b383a7a8a2c13878de375117946d68dcb54308111f39775a25"}, + {file = "coverage-7.6.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0b3fb02fe73bed561fa12d279a417b432e5b50fe03e8d663d61b3d5990f29546"}, + {file = "coverage-7.6.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ed8fe9189d2beb6edc14d3ad19800626e1d9f2d975e436f84e19efb7fa19469b"}, + {file = "coverage-7.6.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b369ead6527d025a0fe7bd3864e46dbee3aa8f652d48df6174f8d0bac9e26e0e"}, + {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:ade3ca1e5f0ff46b678b66201f7ff477e8fa11fb537f3b55c3f0568fbfe6e718"}, + {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:27fb4a050aaf18772db513091c9c13f6cb94ed40eacdef8dad8411d92d9992db"}, + {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4f704f0998911abf728a7783799444fcbbe8261c4a6c166f667937ae6a8aa522"}, + {file = "coverage-7.6.4-cp311-cp311-win32.whl", hash = "sha256:29155cd511ee058e260db648b6182c419422a0d2e9a4fa44501898cf918866cf"}, + {file = "coverage-7.6.4-cp311-cp311-win_amd64.whl", hash = "sha256:8902dd6a30173d4ef09954bfcb24b5d7b5190cf14a43170e386979651e09ba19"}, + {file = "coverage-7.6.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:12394842a3a8affa3ba62b0d4ab7e9e210c5e366fbac3e8b2a68636fb19892c2"}, + {file = "coverage-7.6.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2b6b4c83d8e8ea79f27ab80778c19bc037759aea298da4b56621f4474ffeb117"}, + {file = "coverage-7.6.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d5b8007f81b88696d06f7df0cb9af0d3b835fe0c8dbf489bad70b45f0e45613"}, + {file = "coverage-7.6.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b57b768feb866f44eeed9f46975f3d6406380275c5ddfe22f531a2bf187eda27"}, + {file = "coverage-7.6.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5915fcdec0e54ee229926868e9b08586376cae1f5faa9bbaf8faf3561b393d52"}, + {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0b58c672d14f16ed92a48db984612f5ce3836ae7d72cdd161001cc54512571f2"}, + {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:2fdef0d83a2d08d69b1f2210a93c416d54e14d9eb398f6ab2f0a209433db19e1"}, + {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8cf717ee42012be8c0cb205dbbf18ffa9003c4cbf4ad078db47b95e10748eec5"}, + {file = "coverage-7.6.4-cp312-cp312-win32.whl", hash = "sha256:7bb92c539a624cf86296dd0c68cd5cc286c9eef2d0c3b8b192b604ce9de20a17"}, + {file = "coverage-7.6.4-cp312-cp312-win_amd64.whl", hash = "sha256:1032e178b76a4e2b5b32e19d0fd0abbce4b58e77a1ca695820d10e491fa32b08"}, + {file = "coverage-7.6.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:023bf8ee3ec6d35af9c1c6ccc1d18fa69afa1cb29eaac57cb064dbb262a517f9"}, + {file = "coverage-7.6.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:b0ac3d42cb51c4b12df9c5f0dd2f13a4f24f01943627120ec4d293c9181219ba"}, + {file = "coverage-7.6.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f8fe4984b431f8621ca53d9380901f62bfb54ff759a1348cd140490ada7b693c"}, + {file = "coverage-7.6.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5fbd612f8a091954a0c8dd4c0b571b973487277d26476f8480bfa4b2a65b5d06"}, + {file = "coverage-7.6.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dacbc52de979f2823a819571f2e3a350a7e36b8cb7484cdb1e289bceaf35305f"}, + {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:dab4d16dfef34b185032580e2f2f89253d302facba093d5fa9dbe04f569c4f4b"}, + {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:862264b12ebb65ad8d863d51f17758b1684560b66ab02770d4f0baf2ff75da21"}, + {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5beb1ee382ad32afe424097de57134175fea3faf847b9af002cc7895be4e2a5a"}, + {file = "coverage-7.6.4-cp313-cp313-win32.whl", hash = "sha256:bf20494da9653f6410213424f5f8ad0ed885e01f7e8e59811f572bdb20b8972e"}, + {file = "coverage-7.6.4-cp313-cp313-win_amd64.whl", hash = "sha256:182e6cd5c040cec0a1c8d415a87b67ed01193ed9ad458ee427741c7d8513d963"}, + {file = "coverage-7.6.4-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:a181e99301a0ae128493a24cfe5cfb5b488c4e0bf2f8702091473d033494d04f"}, + {file = "coverage-7.6.4-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:df57bdbeffe694e7842092c5e2e0bc80fff7f43379d465f932ef36f027179806"}, + {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0bcd1069e710600e8e4cf27f65c90c7843fa8edfb4520fb0ccb88894cad08b11"}, + {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:99b41d18e6b2a48ba949418db48159d7a2e81c5cc290fc934b7d2380515bd0e3"}, + {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6b1e54712ba3474f34b7ef7a41e65bd9037ad47916ccb1cc78769bae324c01a"}, + {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:53d202fd109416ce011578f321460795abfe10bb901b883cafd9b3ef851bacfc"}, + {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:c48167910a8f644671de9f2083a23630fbf7a1cb70ce939440cd3328e0919f70"}, + {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:cc8ff50b50ce532de2fa7a7daae9dd12f0a699bfcd47f20945364e5c31799fef"}, + {file = "coverage-7.6.4-cp313-cp313t-win32.whl", hash = "sha256:b8d3a03d9bfcaf5b0141d07a88456bb6a4c3ce55c080712fec8418ef3610230e"}, + {file = "coverage-7.6.4-cp313-cp313t-win_amd64.whl", hash = "sha256:f3ddf056d3ebcf6ce47bdaf56142af51bb7fad09e4af310241e9db7a3a8022e1"}, + {file = "coverage-7.6.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9cb7fa111d21a6b55cbf633039f7bc2749e74932e3aa7cb7333f675a58a58bf3"}, + {file = "coverage-7.6.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:11a223a14e91a4693d2d0755c7a043db43d96a7450b4f356d506c2562c48642c"}, + {file = "coverage-7.6.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a413a096c4cbac202433c850ee43fa326d2e871b24554da8327b01632673a076"}, + {file = "coverage-7.6.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:00a1d69c112ff5149cabe60d2e2ee948752c975d95f1e1096742e6077affd376"}, + {file = "coverage-7.6.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f76846299ba5c54d12c91d776d9605ae33f8ae2b9d1d3c3703cf2db1a67f2c0"}, + {file = "coverage-7.6.4-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:fe439416eb6380de434886b00c859304338f8b19f6f54811984f3420a2e03858"}, + {file = "coverage-7.6.4-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:0294ca37f1ba500667b1aef631e48d875ced93ad5e06fa665a3295bdd1d95111"}, + {file = "coverage-7.6.4-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:6f01ba56b1c0e9d149f9ac85a2f999724895229eb36bd997b61e62999e9b0901"}, + {file = "coverage-7.6.4-cp39-cp39-win32.whl", hash = "sha256:bc66f0bf1d7730a17430a50163bb264ba9ded56739112368ba985ddaa9c3bd09"}, + {file = "coverage-7.6.4-cp39-cp39-win_amd64.whl", hash = "sha256:c481b47f6b5845064c65a7bc78bc0860e635a9b055af0df46fdf1c58cebf8e8f"}, + {file = "coverage-7.6.4-pp39.pp310-none-any.whl", hash = "sha256:3c65d37f3a9ebb703e710befdc489a38683a5b152242664b973a7b7b22348a4e"}, + {file = "coverage-7.6.4.tar.gz", hash = "sha256:29fc0f17b1d3fea332f8001d4558f8214af7f1d87a345f3a133c901d60347c73"}, ] [package.dependencies] @@ -463,38 +463,38 @@ toml = ["tomli"] [[package]] name = "cryptography" -version = "43.0.1" +version = "43.0.3" description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." optional = false python-versions = ">=3.7" files = [ - {file = "cryptography-43.0.1-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:8385d98f6a3bf8bb2d65a73e17ed87a3ba84f6991c155691c51112075f9ffc5d"}, - {file = "cryptography-43.0.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:27e613d7077ac613e399270253259d9d53872aaf657471473ebfc9a52935c062"}, - {file = "cryptography-43.0.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:68aaecc4178e90719e95298515979814bda0cbada1256a4485414860bd7ab962"}, - {file = "cryptography-43.0.1-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:de41fd81a41e53267cb020bb3a7212861da53a7d39f863585d13ea11049cf277"}, - {file = "cryptography-43.0.1-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f98bf604c82c416bc829e490c700ca1553eafdf2912a91e23a79d97d9801372a"}, - {file = "cryptography-43.0.1-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:61ec41068b7b74268fa86e3e9e12b9f0c21fcf65434571dbb13d954bceb08042"}, - {file = "cryptography-43.0.1-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:014f58110f53237ace6a408b5beb6c427b64e084eb451ef25a28308270086494"}, - {file = "cryptography-43.0.1-cp37-abi3-win32.whl", hash = "sha256:2bd51274dcd59f09dd952afb696bf9c61a7a49dfc764c04dd33ef7a6b502a1e2"}, - {file = "cryptography-43.0.1-cp37-abi3-win_amd64.whl", hash = "sha256:666ae11966643886c2987b3b721899d250855718d6d9ce41b521252a17985f4d"}, - {file = "cryptography-43.0.1-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:ac119bb76b9faa00f48128b7f5679e1d8d437365c5d26f1c2c3f0da4ce1b553d"}, - {file = "cryptography-43.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1bbcce1a551e262dfbafb6e6252f1ae36a248e615ca44ba302df077a846a8806"}, - {file = "cryptography-43.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58d4e9129985185a06d849aa6df265bdd5a74ca6e1b736a77959b498e0505b85"}, - {file = "cryptography-43.0.1-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:d03a475165f3134f773d1388aeb19c2d25ba88b6a9733c5c590b9ff7bbfa2e0c"}, - {file = "cryptography-43.0.1-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:511f4273808ab590912a93ddb4e3914dfd8a388fed883361b02dea3791f292e1"}, - {file = "cryptography-43.0.1-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:80eda8b3e173f0f247f711eef62be51b599b5d425c429b5d4ca6a05e9e856baa"}, - {file = "cryptography-43.0.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:38926c50cff6f533f8a2dae3d7f19541432610d114a70808f0926d5aaa7121e4"}, - {file = "cryptography-43.0.1-cp39-abi3-win32.whl", hash = "sha256:a575913fb06e05e6b4b814d7f7468c2c660e8bb16d8d5a1faf9b33ccc569dd47"}, - {file = "cryptography-43.0.1-cp39-abi3-win_amd64.whl", hash = "sha256:d75601ad10b059ec832e78823b348bfa1a59f6b8d545db3a24fd44362a1564cb"}, - {file = "cryptography-43.0.1-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:ea25acb556320250756e53f9e20a4177515f012c9eaea17eb7587a8c4d8ae034"}, - {file = "cryptography-43.0.1-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:c1332724be35d23a854994ff0b66530119500b6053d0bd3363265f7e5e77288d"}, - {file = "cryptography-43.0.1-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:fba1007b3ef89946dbbb515aeeb41e30203b004f0b4b00e5e16078b518563289"}, - {file = "cryptography-43.0.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:5b43d1ea6b378b54a1dc99dd8a2b5be47658fe9a7ce0a58ff0b55f4b43ef2b84"}, - {file = "cryptography-43.0.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:88cce104c36870d70c49c7c8fd22885875d950d9ee6ab54df2745f83ba0dc365"}, - {file = "cryptography-43.0.1-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:9d3cdb25fa98afdd3d0892d132b8d7139e2c087da1712041f6b762e4f807cc96"}, - {file = "cryptography-43.0.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e710bf40870f4db63c3d7d929aa9e09e4e7ee219e703f949ec4073b4294f6172"}, - {file = "cryptography-43.0.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7c05650fe8023c5ed0d46793d4b7d7e6cd9c04e68eabe5b0aeea836e37bdcec2"}, - {file = "cryptography-43.0.1.tar.gz", hash = "sha256:203e92a75716d8cfb491dc47c79e17d0d9207ccffcbcb35f598fbe463ae3444d"}, + {file = "cryptography-43.0.3-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:bf7a1932ac4176486eab36a19ed4c0492da5d97123f1406cf15e41b05e787d2e"}, + {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63efa177ff54aec6e1c0aefaa1a241232dcd37413835a9b674b6e3f0ae2bfd3e"}, + {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e1ce50266f4f70bf41a2c6dc4358afadae90e2a1e5342d3c08883df1675374f"}, + {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:443c4a81bb10daed9a8f334365fe52542771f25aedaf889fd323a853ce7377d6"}, + {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:74f57f24754fe349223792466a709f8e0c093205ff0dca557af51072ff47ab18"}, + {file = "cryptography-43.0.3-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:9762ea51a8fc2a88b70cf2995e5675b38d93bf36bd67d91721c309df184f49bd"}, + {file = "cryptography-43.0.3-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:81ef806b1fef6b06dcebad789f988d3b37ccaee225695cf3e07648eee0fc6b73"}, + {file = "cryptography-43.0.3-cp37-abi3-win32.whl", hash = "sha256:cbeb489927bd7af4aa98d4b261af9a5bc025bd87f0e3547e11584be9e9427be2"}, + {file = "cryptography-43.0.3-cp37-abi3-win_amd64.whl", hash = "sha256:f46304d6f0c6ab8e52770addfa2fc41e6629495548862279641972b6215451cd"}, + {file = "cryptography-43.0.3-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:8ac43ae87929a5982f5948ceda07001ee5e83227fd69cf55b109144938d96984"}, + {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:846da004a5804145a5f441b8530b4bf35afbf7da70f82409f151695b127213d5"}, + {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f996e7268af62598f2fc1204afa98a3b5712313a55c4c9d434aef49cadc91d4"}, + {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f7b178f11ed3664fd0e995a47ed2b5ff0a12d893e41dd0494f406d1cf555cab7"}, + {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:c2e6fc39c4ab499049df3bdf567f768a723a5e8464816e8f009f121a5a9f4405"}, + {file = "cryptography-43.0.3-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:e1be4655c7ef6e1bbe6b5d0403526601323420bcf414598955968c9ef3eb7d16"}, + {file = "cryptography-43.0.3-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:df6b6c6d742395dd77a23ea3728ab62f98379eff8fb61be2744d4679ab678f73"}, + {file = "cryptography-43.0.3-cp39-abi3-win32.whl", hash = "sha256:d56e96520b1020449bbace2b78b603442e7e378a9b3bd68de65c782db1507995"}, + {file = "cryptography-43.0.3-cp39-abi3-win_amd64.whl", hash = "sha256:0c580952eef9bf68c4747774cde7ec1d85a6e61de97281f2dba83c7d2c806362"}, + {file = "cryptography-43.0.3-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:d03b5621a135bffecad2c73e9f4deb1a0f977b9a8ffe6f8e002bf6c9d07b918c"}, + {file = "cryptography-43.0.3-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:a2a431ee15799d6db9fe80c82b055bae5a752bef645bba795e8e52687c69efe3"}, + {file = "cryptography-43.0.3-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:281c945d0e28c92ca5e5930664c1cefd85efe80e5c0d2bc58dd63383fda29f83"}, + {file = "cryptography-43.0.3-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:f18c716be16bc1fea8e95def49edf46b82fccaa88587a45f8dc0ff6ab5d8e0a7"}, + {file = "cryptography-43.0.3-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:4a02ded6cd4f0a5562a8887df8b3bd14e822a90f97ac5e544c162899bc467664"}, + {file = "cryptography-43.0.3-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:53a583b6637ab4c4e3591a15bc9db855b8d9dee9a669b550f311480acab6eb08"}, + {file = "cryptography-43.0.3-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:1ec0bcf7e17c0c5669d881b1cd38c4972fade441b27bda1051665faaa89bdcaa"}, + {file = "cryptography-43.0.3-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2ce6fae5bdad59577b44e4dfed356944fbf1d925269114c28be377692643b4ff"}, + {file = "cryptography-43.0.3.tar.gz", hash = "sha256:315b9001266a492a6ff443b61238f956b214dbec9910a081ba5b6646a055a805"}, ] [package.dependencies] @@ -507,7 +507,7 @@ nox = ["nox"] pep8test = ["check-sdist", "click", "mypy", "ruff"] sdist = ["build"] ssh = ["bcrypt (>=3.1.5)"] -test = ["certifi", "cryptography-vectors (==43.0.1)", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"] +test = ["certifi", "cryptography-vectors (==43.0.3)", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"] test-randomorder = ["pytest-randomly"] [[package]] @@ -521,30 +521,15 @@ files = [ {file = "darglint-1.8.1.tar.gz", hash = "sha256:080d5106df149b199822e7ee7deb9c012b49891538f14a11be681044f0bb20da"}, ] -[[package]] -name = "dill" -version = "0.3.8" -description = "serialize all of Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "dill-0.3.8-py3-none-any.whl", hash = "sha256:c36ca9ffb54365bdd2f8eb3eff7d2a21237f8452b57ace88b1ac615b7e815bd7"}, - {file = "dill-0.3.8.tar.gz", hash = "sha256:3ebe3c479ad625c4553aca177444d89b486b1d84982eeacded644afc0cf797ca"}, -] - -[package.extras] -graph = ["objgraph (>=1.7.2)"] -profile = ["gprof2dot (>=2022.7.29)"] - [[package]] name = "distlib" -version = "0.3.8" +version = "0.3.9" description = "Distribution utilities" optional = false python-versions = "*" files = [ - {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"}, - {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, + {file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"}, + {file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"}, ] [[package]] @@ -560,11 +545,14 @@ files = [ [[package]] name = "docutils" -version = "0.20.1" +version = "0.21.2" description = "Docutils -- Python Documentation Utilities" optional = false -python-versions = "*" -files = [] +python-versions = ">=3.9" +files = [ + {file = "docutils-0.21.2-py3-none-any.whl", hash = "sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2"}, + {file = "docutils-0.21.2.tar.gz", hash = "sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f"}, +] [[package]] name = "exceptiongroup" @@ -582,18 +570,18 @@ test = ["pytest (>=6)"] [[package]] name = "fastapi" -version = "0.113.0" +version = "0.115.3" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" optional = false python-versions = ">=3.8" files = [ - {file = "fastapi-0.113.0-py3-none-any.whl", hash = "sha256:c8d364485b6361fb643d53920a18d58a696e189abcb901ec03b487e35774c476"}, - {file = "fastapi-0.113.0.tar.gz", hash = "sha256:b7cf9684dc154dfc93f8b718e5850577b529889096518df44defa41e73caf50f"}, + {file = "fastapi-0.115.3-py3-none-any.whl", hash = "sha256:8035e8f9a2b0aa89cea03b6c77721178ed5358e1aea4cd8570d9466895c0638c"}, + {file = "fastapi-0.115.3.tar.gz", hash = "sha256:c091c6a35599c036d676fa24bd4a6e19fa30058d93d950216cdc672881f6f7db"}, ] [package.dependencies] pydantic = ">=1.7.4,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0 || >2.0.0,<2.0.1 || >2.0.1,<2.1.0 || >2.1.0,<3.0.0" -starlette = ">=0.37.2,<0.39.0" +starlette = ">=0.40.0,<0.42.0" typing-extensions = ">=4.8.0" [package.extras] @@ -602,85 +590,100 @@ standard = ["email-validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.5)", "htt [[package]] name = "filelock" -version = "3.15.4" +version = "3.16.1" description = "A platform independent file lock." optional = false python-versions = ">=3.8" files = [ - {file = "filelock-3.15.4-py3-none-any.whl", hash = "sha256:6ca1fffae96225dab4c6eaf1c4f4f28cd2568d3ec2a44e15a08520504de468e7"}, - {file = "filelock-3.15.4.tar.gz", hash = "sha256:2207938cbc1844345cb01a5a95524dae30f0ce089eba5b00378295a17e3e90cb"}, + {file = "filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0"}, + {file = "filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"}, ] [package.extras] -docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8.0.1)", "pytest (>=7.4.3)", "pytest-asyncio (>=0.21)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)", "virtualenv (>=20.26.2)"] -typing = ["typing-extensions (>=4.8)"] +docs = ["furo (>=2024.8.6)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4.1)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.6.1)", "diff-cover (>=9.2)", "pytest (>=8.3.3)", "pytest-asyncio (>=0.24)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.26.4)"] +typing = ["typing-extensions (>=4.12.2)"] [[package]] name = "greenlet" -version = "3.0.3" +version = "3.1.1" description = "Lightweight in-process concurrent programming" optional = false python-versions = ">=3.7" files = [ - {file = "greenlet-3.0.3-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:9da2bd29ed9e4f15955dd1595ad7bc9320308a3b766ef7f837e23ad4b4aac31a"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d353cadd6083fdb056bb46ed07e4340b0869c305c8ca54ef9da3421acbdf6881"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dca1e2f3ca00b84a396bc1bce13dd21f680f035314d2379c4160c98153b2059b"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ed7fb269f15dc662787f4119ec300ad0702fa1b19d2135a37c2c4de6fadfd4a"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd4f49ae60e10adbc94b45c0b5e6a179acc1736cf7a90160b404076ee283cf83"}, - {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:73a411ef564e0e097dbe7e866bb2dda0f027e072b04da387282b02c308807405"}, - {file = "greenlet-3.0.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:7f362975f2d179f9e26928c5b517524e89dd48530a0202570d55ad6ca5d8a56f"}, - {file = "greenlet-3.0.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:649dde7de1a5eceb258f9cb00bdf50e978c9db1b996964cd80703614c86495eb"}, - {file = "greenlet-3.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:68834da854554926fbedd38c76e60c4a2e3198c6fbed520b106a8986445caaf9"}, - {file = "greenlet-3.0.3-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:b1b5667cced97081bf57b8fa1d6bfca67814b0afd38208d52538316e9422fc61"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:52f59dd9c96ad2fc0d5724107444f76eb20aaccb675bf825df6435acb7703559"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:afaff6cf5200befd5cec055b07d1c0a5a06c040fe5ad148abcd11ba6ab9b114e"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fe754d231288e1e64323cfad462fcee8f0288654c10bdf4f603a39ed923bef33"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2797aa5aedac23af156bbb5a6aa2cd3427ada2972c828244eb7d1b9255846379"}, - {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b7f009caad047246ed379e1c4dbcb8b020f0a390667ea74d2387be2998f58a22"}, - {file = "greenlet-3.0.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:c5e1536de2aad7bf62e27baf79225d0d64360d4168cf2e6becb91baf1ed074f3"}, - {file = "greenlet-3.0.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:894393ce10ceac937e56ec00bb71c4c2f8209ad516e96033e4b3b1de270e200d"}, - {file = "greenlet-3.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:1ea188d4f49089fc6fb283845ab18a2518d279c7cd9da1065d7a84e991748728"}, - {file = "greenlet-3.0.3-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:70fb482fdf2c707765ab5f0b6655e9cfcf3780d8d87355a063547b41177599be"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d4d1ac74f5c0c0524e4a24335350edad7e5f03b9532da7ea4d3c54d527784f2e"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:149e94a2dd82d19838fe4b2259f1b6b9957d5ba1b25640d2380bea9c5df37676"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:15d79dd26056573940fcb8c7413d84118086f2ec1a8acdfa854631084393efcc"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:881b7db1ebff4ba09aaaeae6aa491daeb226c8150fc20e836ad00041bcb11230"}, - {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fcd2469d6a2cf298f198f0487e0a5b1a47a42ca0fa4dfd1b6862c999f018ebbf"}, - {file = "greenlet-3.0.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:1f672519db1796ca0d8753f9e78ec02355e862d0998193038c7073045899f305"}, - {file = "greenlet-3.0.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:2516a9957eed41dd8f1ec0c604f1cdc86758b587d964668b5b196a9db5bfcde6"}, - {file = "greenlet-3.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:bba5387a6975598857d86de9eac14210a49d554a77eb8261cc68b7d082f78ce2"}, - {file = "greenlet-3.0.3-cp37-cp37m-macosx_11_0_universal2.whl", hash = "sha256:5b51e85cb5ceda94e79d019ed36b35386e8c37d22f07d6a751cb659b180d5274"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:daf3cb43b7cf2ba96d614252ce1684c1bccee6b2183a01328c98d36fcd7d5cb0"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99bf650dc5d69546e076f413a87481ee1d2d09aaaaaca058c9251b6d8c14783f"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2dd6e660effd852586b6a8478a1d244b8dc90ab5b1321751d2ea15deb49ed414"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e3391d1e16e2a5a1507d83e4a8b100f4ee626e8eca43cf2cadb543de69827c4c"}, - {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e1f145462f1fa6e4a4ae3c0f782e580ce44d57c8f2c7aae1b6fa88c0b2efdb41"}, - {file = "greenlet-3.0.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1a7191e42732df52cb5f39d3527217e7ab73cae2cb3694d241e18f53d84ea9a7"}, - {file = "greenlet-3.0.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:0448abc479fab28b00cb472d278828b3ccca164531daab4e970a0458786055d6"}, - {file = "greenlet-3.0.3-cp37-cp37m-win32.whl", hash = "sha256:b542be2440edc2d48547b5923c408cbe0fc94afb9f18741faa6ae970dbcb9b6d"}, - {file = "greenlet-3.0.3-cp37-cp37m-win_amd64.whl", hash = "sha256:01bc7ea167cf943b4c802068e178bbf70ae2e8c080467070d01bfa02f337ee67"}, - {file = "greenlet-3.0.3-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:1996cb9306c8595335bb157d133daf5cf9f693ef413e7673cb07e3e5871379ca"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3ddc0f794e6ad661e321caa8d2f0a55ce01213c74722587256fb6566049a8b04"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c9db1c18f0eaad2f804728c67d6c610778456e3e1cc4ab4bbd5eeb8e6053c6fc"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7170375bcc99f1a2fbd9c306f5be8764eaf3ac6b5cb968862cad4c7057756506"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b66c9c1e7ccabad3a7d037b2bcb740122a7b17a53734b7d72a344ce39882a1b"}, - {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:098d86f528c855ead3479afe84b49242e174ed262456c342d70fc7f972bc13c4"}, - {file = "greenlet-3.0.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:81bb9c6d52e8321f09c3d165b2a78c680506d9af285bfccbad9fb7ad5a5da3e5"}, - {file = "greenlet-3.0.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fd096eb7ffef17c456cfa587523c5f92321ae02427ff955bebe9e3c63bc9f0da"}, - {file = "greenlet-3.0.3-cp38-cp38-win32.whl", hash = "sha256:d46677c85c5ba00a9cb6f7a00b2bfa6f812192d2c9f7d9c4f6a55b60216712f3"}, - {file = "greenlet-3.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:419b386f84949bf0e7c73e6032e3457b82a787c1ab4a0e43732898a761cc9dbf"}, - {file = "greenlet-3.0.3-cp39-cp39-macosx_11_0_universal2.whl", hash = "sha256:da70d4d51c8b306bb7a031d5cff6cc25ad253affe89b70352af5f1cb68e74b53"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:086152f8fbc5955df88382e8a75984e2bb1c892ad2e3c80a2508954e52295257"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d73a9fe764d77f87f8ec26a0c85144d6a951a6c438dfe50487df5595c6373eac"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b7dcbe92cc99f08c8dd11f930de4d99ef756c3591a5377d1d9cd7dd5e896da71"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1551a8195c0d4a68fac7a4325efac0d541b48def35feb49d803674ac32582f61"}, - {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:64d7675ad83578e3fc149b617a444fab8efdafc9385471f868eb5ff83e446b8b"}, - {file = "greenlet-3.0.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b37eef18ea55f2ffd8f00ff8fe7c8d3818abd3e25fb73fae2ca3b672e333a7a6"}, - {file = "greenlet-3.0.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:77457465d89b8263bca14759d7c1684df840b6811b2499838cc5b040a8b5b113"}, - {file = "greenlet-3.0.3-cp39-cp39-win32.whl", hash = "sha256:57e8974f23e47dac22b83436bdcf23080ade568ce77df33159e019d161ce1d1e"}, - {file = "greenlet-3.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:c5ee858cfe08f34712f548c3c363e807e7186f03ad7a5039ebadb29e8c6be067"}, - {file = "greenlet-3.0.3.tar.gz", hash = "sha256:43374442353259554ce33599da8b692d5aa96f8976d567d4badf263371fbe491"}, + {file = "greenlet-3.1.1-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:0bbae94a29c9e5c7e4a2b7f0aae5c17e8e90acbfd3bf6270eeba60c39fce3563"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fde093fb93f35ca72a556cf72c92ea3ebfda3d79fc35bb19fbe685853869a83"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:36b89d13c49216cadb828db8dfa6ce86bbbc476a82d3a6c397f0efae0525bdd0"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94b6150a85e1b33b40b1464a3f9988dcc5251d6ed06842abff82e42632fac120"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93147c513fac16385d1036b7e5b102c7fbbdb163d556b791f0f11eada7ba65dc"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:da7a9bff22ce038e19bf62c4dd1ec8391062878710ded0a845bcf47cc0200617"}, + {file = "greenlet-3.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b2795058c23988728eec1f36a4e5e4ebad22f8320c85f3587b539b9ac84128d7"}, + {file = "greenlet-3.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ed10eac5830befbdd0c32f83e8aa6288361597550ba669b04c48f0f9a2c843c6"}, + {file = "greenlet-3.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:77c386de38a60d1dfb8e55b8c1101d68c79dfdd25c7095d51fec2dd800892b80"}, + {file = "greenlet-3.1.1-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:e4d333e558953648ca09d64f13e6d8f0523fa705f51cae3f03b5983489958c70"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:09fc016b73c94e98e29af67ab7b9a879c307c6731a2c9da0db5a7d9b7edd1159"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d5e975ca70269d66d17dd995dafc06f1b06e8cb1ec1e9ed54c1d1e4a7c4cf26e"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3b2813dc3de8c1ee3f924e4d4227999285fd335d1bcc0d2be6dc3f1f6a318ec1"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e347b3bfcf985a05e8c0b7d462ba6f15b1ee1c909e2dcad795e49e91b152c383"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9e8f8c9cb53cdac7ba9793c276acd90168f416b9ce36799b9b885790f8ad6c0a"}, + {file = "greenlet-3.1.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:62ee94988d6b4722ce0028644418d93a52429e977d742ca2ccbe1c4f4a792511"}, + {file = "greenlet-3.1.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1776fd7f989fc6b8d8c8cb8da1f6b82c5814957264d1f6cf818d475ec2bf6395"}, + {file = "greenlet-3.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:48ca08c771c268a768087b408658e216133aecd835c0ded47ce955381105ba39"}, + {file = "greenlet-3.1.1-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:4afe7ea89de619adc868e087b4d2359282058479d7cfb94970adf4b55284574d"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f406b22b7c9a9b4f8aa9d2ab13d6ae0ac3e85c9a809bd590ad53fed2bf70dc79"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c3a701fe5a9695b238503ce5bbe8218e03c3bcccf7e204e455e7462d770268aa"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2846930c65b47d70b9d178e89c7e1a69c95c1f68ea5aa0a58646b7a96df12441"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:99cfaa2110534e2cf3ba31a7abcac9d328d1d9f1b95beede58294a60348fba36"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1443279c19fca463fc33e65ef2a935a5b09bb90f978beab37729e1c3c6c25fe9"}, + {file = "greenlet-3.1.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b7cede291382a78f7bb5f04a529cb18e068dd29e0fb27376074b6d0317bf4dd0"}, + {file = "greenlet-3.1.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:23f20bb60ae298d7d8656c6ec6db134bca379ecefadb0b19ce6f19d1f232a942"}, + {file = "greenlet-3.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:7124e16b4c55d417577c2077be379514321916d5790fa287c9ed6f23bd2ffd01"}, + {file = "greenlet-3.1.1-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:05175c27cb459dcfc05d026c4232f9de8913ed006d42713cb8a5137bd49375f1"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:935e943ec47c4afab8965954bf49bfa639c05d4ccf9ef6e924188f762145c0ff"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:667a9706c970cb552ede35aee17339a18e8f2a87a51fba2ed39ceeeb1004798a"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b8a678974d1f3aa55f6cc34dc480169d58f2e6d8958895d68845fa4ab566509e"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:efc0f674aa41b92da8c49e0346318c6075d734994c3c4e4430b1c3f853e498e4"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0153404a4bb921f0ff1abeb5ce8a5131da56b953eda6e14b88dc6bbc04d2049e"}, + {file = "greenlet-3.1.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:275f72decf9932639c1c6dd1013a1bc266438eb32710016a1c742df5da6e60a1"}, + {file = "greenlet-3.1.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:c4aab7f6381f38a4b42f269057aee279ab0fc7bf2e929e3d4abfae97b682a12c"}, + {file = "greenlet-3.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:b42703b1cf69f2aa1df7d1030b9d77d3e584a70755674d60e710f0af570f3761"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1695e76146579f8c06c1509c7ce4dfe0706f49c6831a817ac04eebb2fd02011"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7876452af029456b3f3549b696bb36a06db7c90747740c5302f74a9e9fa14b13"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4ead44c85f8ab905852d3de8d86f6f8baf77109f9da589cb4fa142bd3b57b475"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8320f64b777d00dd7ccdade271eaf0cad6636343293a25074cc5566160e4de7b"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6510bf84a6b643dabba74d3049ead221257603a253d0a9873f55f6a59a65f822"}, + {file = "greenlet-3.1.1-cp313-cp313t-musllinux_1_1_aarch64.whl", hash = "sha256:04b013dc07c96f83134b1e99888e7a79979f1a247e2a9f59697fa14b5862ed01"}, + {file = "greenlet-3.1.1-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:411f015496fec93c1c8cd4e5238da364e1da7a124bcb293f085bf2860c32c6f6"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:47da355d8687fd65240c364c90a31569a133b7b60de111c255ef5b606f2ae291"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:98884ecf2ffb7d7fe6bd517e8eb99d31ff7855a840fa6d0d63cd07c037f6a981"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f1d4aeb8891338e60d1ab6127af1fe45def5259def8094b9c7e34690c8858803"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db32b5348615a04b82240cc67983cb315309e88d444a288934ee6ceaebcad6cc"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dcc62f31eae24de7f8dce72134c8651c58000d3b1868e01392baea7c32c247de"}, + {file = "greenlet-3.1.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1d3755bcb2e02de341c55b4fca7a745a24a9e7212ac953f6b3a48d117d7257aa"}, + {file = "greenlet-3.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:b8da394b34370874b4572676f36acabac172602abf054cbc4ac910219f3340af"}, + {file = "greenlet-3.1.1-cp37-cp37m-win32.whl", hash = "sha256:a0dfc6c143b519113354e780a50381508139b07d2177cb6ad6a08278ec655798"}, + {file = "greenlet-3.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:54558ea205654b50c438029505def3834e80f0869a70fb15b871c29b4575ddef"}, + {file = "greenlet-3.1.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:346bed03fe47414091be4ad44786d1bd8bef0c3fcad6ed3dee074a032ab408a9"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfc59d69fc48664bc693842bd57acfdd490acafda1ab52c7836e3fc75c90a111"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d21e10da6ec19b457b82636209cbe2331ff4306b54d06fa04b7c138ba18c8a81"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:37b9de5a96111fc15418819ab4c4432e4f3c2ede61e660b1e33971eba26ef9ba"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ef9ea3f137e5711f0dbe5f9263e8c009b7069d8a1acea822bd5e9dae0ae49c8"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:85f3ff71e2e60bd4b4932a043fbbe0f499e263c628390b285cb599154a3b03b1"}, + {file = "greenlet-3.1.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:95ffcf719966dd7c453f908e208e14cde192e09fde6c7186c8f1896ef778d8cd"}, + {file = "greenlet-3.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:03a088b9de532cbfe2ba2034b2b85e82df37874681e8c470d6fb2f8c04d7e4b7"}, + {file = "greenlet-3.1.1-cp38-cp38-win32.whl", hash = "sha256:8b8b36671f10ba80e159378df9c4f15c14098c4fd73a36b9ad715f057272fbef"}, + {file = "greenlet-3.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:7017b2be767b9d43cc31416aba48aab0d2309ee31b4dbf10a1d38fb7972bdf9d"}, + {file = "greenlet-3.1.1-cp39-cp39-macosx_11_0_universal2.whl", hash = "sha256:396979749bd95f018296af156201d6211240e7a23090f50a8d5d18c370084dc3"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca9d0ff5ad43e785350894d97e13633a66e2b50000e8a183a50a88d834752d42"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f6ff3b14f2df4c41660a7dec01045a045653998784bf8cfcb5a525bdffffbc8f"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94ebba31df2aa506d7b14866fed00ac141a867e63143fe5bca82a8e503b36437"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:73aaad12ac0ff500f62cebed98d8789198ea0e6f233421059fa68a5aa7220145"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:63e4844797b975b9af3a3fb8f7866ff08775f5426925e1e0bbcfe7932059a12c"}, + {file = "greenlet-3.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:7939aa3ca7d2a1593596e7ac6d59391ff30281ef280d8632fa03d81f7c5f955e"}, + {file = "greenlet-3.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:d0028e725ee18175c6e422797c407874da24381ce0690d6b9396c204c7f7276e"}, + {file = "greenlet-3.1.1-cp39-cp39-win32.whl", hash = "sha256:5e06afd14cbaf9e00899fae69b24a32f2196c19de08fcb9f4779dd4f004e5e7c"}, + {file = "greenlet-3.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:3319aa75e0e0639bc15ff54ca327e8dc7a6fe404003496e3c6925cd3142e0e22"}, + {file = "greenlet-3.1.1.tar.gz", hash = "sha256:4ce3ac6cdb6adf7946475d7ef31777c26d94bccc377e070a7986bd2d5c515467"}, ] [package.extras] @@ -721,13 +724,13 @@ files = [ [[package]] name = "httpcore" -version = "1.0.5" +version = "1.0.6" description = "A minimal low-level HTTP client." optional = false python-versions = ">=3.8" files = [ - {file = "httpcore-1.0.5-py3-none-any.whl", hash = "sha256:421f18bac248b25d310f3cacd198d55b8e6125c107797b609ff9b7a6ba7991b5"}, - {file = "httpcore-1.0.5.tar.gz", hash = "sha256:34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61"}, + {file = "httpcore-1.0.6-py3-none-any.whl", hash = "sha256:27b59625743b85577a8c0e10e55b50b5368a4f2cfe8cc7bcfa9cf00829c2682f"}, + {file = "httpcore-1.0.6.tar.gz", hash = "sha256:73f6dbd6eb8c21bbf7ef8efad555481853f5f6acdeaff1edb0694289269ee17f"}, ] [package.dependencies] @@ -738,7 +741,7 @@ h11 = ">=0.13,<0.15" asyncio = ["anyio (>=4.0,<5.0)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] -trio = ["trio (>=0.22.0,<0.26.0)"] +trio = ["trio (>=0.22.0,<1.0)"] [[package]] name = "httpx" @@ -767,13 +770,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "identify" -version = "2.6.0" +version = "2.6.1" description = "File identification library for Python" optional = false python-versions = ">=3.8" files = [ - {file = "identify-2.6.0-py2.py3-none-any.whl", hash = "sha256:e79ae4406387a9d300332b5fd366d8994f1525e8414984e1a59e058b2eda2dd0"}, - {file = "identify-2.6.0.tar.gz", hash = "sha256:cb171c685bdc31bcc4c1734698736a7d5b6c8bf2e0c15117f4d469c8640ae5cf"}, + {file = "identify-2.6.1-py2.py3-none-any.whl", hash = "sha256:53863bcac7caf8d2ed85bd20312ea5dcfc22226800f6d6881f232d861db5a8f0"}, + {file = "identify-2.6.1.tar.gz", hash = "sha256:91478c5fb7c3aac5ff7bf9b4344f803843dc586832d5f110d672b19aa1984c98"}, ] [package.extras] @@ -781,54 +784,39 @@ license = ["ukkonen"] [[package]] name = "idna" -version = "3.8" +version = "3.10" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.6" files = [ - {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, - {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, + {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, + {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, ] +[package.extras] +all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] + [[package]] name = "importlib-metadata" -version = "8.4.0" +version = "8.5.0" description = "Read metadata from Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "importlib_metadata-8.4.0-py3-none-any.whl", hash = "sha256:66f342cc6ac9818fc6ff340576acd24d65ba0b3efabb2b4ac08b598965a4a2f1"}, - {file = "importlib_metadata-8.4.0.tar.gz", hash = "sha256:9a547d3bc3608b025f93d403fdd1aae741c24fbb8314df4b155675742ce303c5"}, + {file = "importlib_metadata-8.5.0-py3-none-any.whl", hash = "sha256:45e54197d28b7a7f1559e60b95e7c567032b602131fbd588f1497f47880aa68b"}, + {file = "importlib_metadata-8.5.0.tar.gz", hash = "sha256:71522656f0abace1d072b9e5481a48f07c138e00f079c38c8f883823f9c26bd7"}, ] [package.dependencies] -zipp = ">=0.5" - -[package.extras] -doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -perf = ["ipython"] -test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-perf (>=0.9.2)", "pytest-ruff (>=0.2.1)"] - -[[package]] -name = "importlib-resources" -version = "6.4.4" -description = "Read resources from Python packages" -optional = false -python-versions = ">=3.8" -files = [ - {file = "importlib_resources-6.4.4-py3-none-any.whl", hash = "sha256:dda242603d1c9cd836c3368b1174ed74cb4049ecd209e7a1a0104620c18c5c11"}, - {file = "importlib_resources-6.4.4.tar.gz", hash = "sha256:20600c8b7361938dc0bb2d5ec0297802e575df486f5a544fa414da65e13721f7"}, -] - -[package.dependencies] -zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} +zipp = ">=3.20" [package.extras] check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] enabler = ["pytest-enabler (>=2.2)"] -test = ["jaraco.test (>=5.4)", "pytest (>=6,!=8.1.*)", "zipp (>=3.17)"] +perf = ["ipython"] +test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-perf (>=0.9.2)"] type = ["pytest-mypy"] [[package]] @@ -880,21 +868,25 @@ test = ["portend", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-c [[package]] name = "jaraco-functools" -version = "4.0.2" +version = "4.1.0" description = "Functools like those found in stdlib" optional = false python-versions = ">=3.8" files = [ - {file = "jaraco.functools-4.0.2-py3-none-any.whl", hash = "sha256:c9d16a3ed4ccb5a889ad8e0b7a343401ee5b2a71cee6ed192d3f68bc351e94e3"}, - {file = "jaraco_functools-4.0.2.tar.gz", hash = "sha256:3460c74cd0d32bf82b9576bbb3527c4364d5b27a21f5158a62aed6c4b42e23f5"}, + {file = "jaraco.functools-4.1.0-py3-none-any.whl", hash = "sha256:ad159f13428bc4acbf5541ad6dec511f91573b90fba04df61dafa2a1231cf649"}, + {file = "jaraco_functools-4.1.0.tar.gz", hash = "sha256:70f7e0e2ae076498e212562325e805204fc092d7b4c17e0e86c959e249701a9d"}, ] [package.dependencies] more-itertools = "*" [package.extras] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] +cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -test = ["jaraco.classes", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)"] +enabler = ["pytest-enabler (>=2.2)"] +test = ["jaraco.classes", "pytest (>=6,!=8.1.*)"] +type = ["pytest-mypy"] [[package]] name = "jeepney" @@ -930,18 +922,17 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "keyring" -version = "25.3.0" +version = "25.4.1" description = "Store and access your passwords safely." optional = false python-versions = ">=3.8" files = [ - {file = "keyring-25.3.0-py3-none-any.whl", hash = "sha256:8d963da00ccdf06e356acd9bf3b743208878751032d8599c6cc89eb51310ffae"}, - {file = "keyring-25.3.0.tar.gz", hash = "sha256:8d85a1ea5d6db8515b59e1c5d1d1678b03cf7fc8b8dcfb1651e8c4a524eb42ef"}, + {file = "keyring-25.4.1-py3-none-any.whl", hash = "sha256:5426f817cf7f6f007ba5ec722b1bcad95a75b27d780343772ad76b17cb47b0bf"}, + {file = "keyring-25.4.1.tar.gz", hash = "sha256:b07ebc55f3e8ed86ac81dd31ef14e81ace9dd9c3d4b5d77a6e9a2016d0d71a1b"}, ] [package.dependencies] importlib-metadata = {version = ">=4.11.4", markers = "python_version < \"3.12\""} -importlib-resources = {version = "*", markers = "python_version < \"3.9\""} "jaraco.classes" = "*" "jaraco.context" = "*" "jaraco.functools" = "*" @@ -950,9 +941,13 @@ pywin32-ctypes = {version = ">=0.2.0", markers = "sys_platform == \"win32\""} SecretStorage = {version = ">=3.2", markers = "sys_platform == \"linux\""} [package.extras] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] completion = ["shtab (>=1.1.0)"] +cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -test = ["pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)"] +enabler = ["pytest-enabler (>=2.2)"] +test = ["pyfakefs", "pytest (>=6,!=8.1.*)"] +type = ["pygobject-stubs", "pytest-mypy", "shtab", "types-pywin32"] [[package]] name = "lazy-loader" @@ -975,13 +970,13 @@ test = ["pytest (>=7.4)", "pytest-cov (>=4.1)"] [[package]] name = "mako" -version = "1.3.5" +version = "1.3.6" description = "A super-fast templating language that borrows the best ideas from the existing templating languages." optional = false python-versions = ">=3.8" files = [ - {file = "Mako-1.3.5-py3-none-any.whl", hash = "sha256:260f1dbc3a519453a9c856dedfe4beb4e50bd5a26d96386cb6c80856556bb91a"}, - {file = "Mako-1.3.5.tar.gz", hash = "sha256:48dbc20568c1d276a2698b36d968fa76161bf127194907ea6fc594fa81f943bc"}, + {file = "Mako-1.3.6-py3-none-any.whl", hash = "sha256:a91198468092a2f1a0de86ca92690fb0cfc43ca90ee17e15d93662b4c04b241a"}, + {file = "mako-1.3.6.tar.gz", hash = "sha256:9ec3a1583713479fae654f83ed9fa8c9a4c16b7bb0daba0e6bbebff50c0d983d"}, ] [package.dependencies] @@ -1018,71 +1013,72 @@ testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] [[package]] name = "markupsafe" -version = "2.1.5" +version = "3.0.2" description = "Safely add untrusted strings to HTML/XML markup." optional = false -python-versions = ">=3.7" +python-versions = ">=3.9" files = [ - {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-win32.whl", hash = "sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4"}, - {file = "MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl", hash = "sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-win32.whl", hash = "sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906"}, - {file = "MarkupSafe-2.1.5-cp311-cp311-win_amd64.whl", hash = "sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-win32.whl", hash = "sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad"}, - {file = "MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", hash = "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c8b29db45f8fe46ad280a7294f5c3ec36dbac9491f2d1c17345be8e69cc5928f"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec6a563cff360b50eed26f13adc43e61bc0c04d94b8be985e6fb24b81f6dcfdf"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a549b9c31bec33820e885335b451286e2969a2d9e24879f83fe904a5ce59d70a"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4f11aa001c540f62c6166c7726f71f7573b52c68c31f014c25cc7901deea0b52"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7b2e5a267c855eea6b4283940daa6e88a285f5f2a67f2220203786dfa59b37e9"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:2d2d793e36e230fd32babe143b04cec8a8b3eb8a3122d2aceb4a371e6b09b8df"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ce409136744f6521e39fd8e2a24c53fa18ad67aa5bc7c2cf83645cce5b5c4e50"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-win32.whl", hash = "sha256:4096e9de5c6fdf43fb4f04c26fb114f61ef0bf2e5604b6ee3019d51b69e8c371"}, - {file = "MarkupSafe-2.1.5-cp37-cp37m-win_amd64.whl", hash = "sha256:4275d846e41ecefa46e2015117a9f491e57a71ddd59bbead77e904dc02b1bed2"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-win32.whl", hash = "sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff"}, - {file = "MarkupSafe-2.1.5-cp38-cp38-win_amd64.whl", hash = "sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-win32.whl", hash = "sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf"}, - {file = "MarkupSafe-2.1.5-cp39-cp39-win_amd64.whl", hash = "sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5"}, - {file = "MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-win32.whl", hash = "sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-win32.whl", hash = "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-win32.whl", hash = "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-win32.whl", hash = "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-win32.whl", hash = "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-win_amd64.whl", hash = "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-win32.whl", hash = "sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a"}, + {file = "markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"}, ] [[package]] @@ -1143,43 +1139,6 @@ files = [ {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, ] -[[package]] -name = "numpy" -version = "1.24.4" -description = "Fundamental package for array computing in Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "numpy-1.24.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c0bfb52d2169d58c1cdb8cc1f16989101639b34c7d3ce60ed70b19c63eba0b64"}, - {file = "numpy-1.24.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ed094d4f0c177b1b8e7aa9cba7d6ceed51c0e569a5318ac0ca9a090680a6a1b1"}, - {file = "numpy-1.24.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79fc682a374c4a8ed08b331bef9c5f582585d1048fa6d80bc6c35bc384eee9b4"}, - {file = "numpy-1.24.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ffe43c74893dbf38c2b0a1f5428760a1a9c98285553c89e12d70a96a7f3a4d6"}, - {file = "numpy-1.24.4-cp310-cp310-win32.whl", hash = "sha256:4c21decb6ea94057331e111a5bed9a79d335658c27ce2adb580fb4d54f2ad9bc"}, - {file = "numpy-1.24.4-cp310-cp310-win_amd64.whl", hash = "sha256:b4bea75e47d9586d31e892a7401f76e909712a0fd510f58f5337bea9572c571e"}, - {file = "numpy-1.24.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f136bab9c2cfd8da131132c2cf6cc27331dd6fae65f95f69dcd4ae3c3639c810"}, - {file = "numpy-1.24.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e2926dac25b313635e4d6cf4dc4e51c8c0ebfed60b801c799ffc4c32bf3d1254"}, - {file = "numpy-1.24.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:222e40d0e2548690405b0b3c7b21d1169117391c2e82c378467ef9ab4c8f0da7"}, - {file = "numpy-1.24.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7215847ce88a85ce39baf9e89070cb860c98fdddacbaa6c0da3ffb31b3350bd5"}, - {file = "numpy-1.24.4-cp311-cp311-win32.whl", hash = "sha256:4979217d7de511a8d57f4b4b5b2b965f707768440c17cb70fbf254c4b225238d"}, - {file = "numpy-1.24.4-cp311-cp311-win_amd64.whl", hash = "sha256:b7b1fc9864d7d39e28f41d089bfd6353cb5f27ecd9905348c24187a768c79694"}, - {file = "numpy-1.24.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1452241c290f3e2a312c137a9999cdbf63f78864d63c79039bda65ee86943f61"}, - {file = "numpy-1.24.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:04640dab83f7c6c85abf9cd729c5b65f1ebd0ccf9de90b270cd61935eef0197f"}, - {file = "numpy-1.24.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5425b114831d1e77e4b5d812b69d11d962e104095a5b9c3b641a218abcc050e"}, - {file = "numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd80e219fd4c71fc3699fc1dadac5dcf4fd882bfc6f7ec53d30fa197b8ee22dc"}, - {file = "numpy-1.24.4-cp38-cp38-win32.whl", hash = "sha256:4602244f345453db537be5314d3983dbf5834a9701b7723ec28923e2889e0bb2"}, - {file = "numpy-1.24.4-cp38-cp38-win_amd64.whl", hash = "sha256:692f2e0f55794943c5bfff12b3f56f99af76f902fc47487bdfe97856de51a706"}, - {file = "numpy-1.24.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2541312fbf09977f3b3ad449c4e5f4bb55d0dbf79226d7724211acc905049400"}, - {file = "numpy-1.24.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9667575fb6d13c95f1b36aca12c5ee3356bf001b714fc354eb5465ce1609e62f"}, - {file = "numpy-1.24.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f3a86ed21e4f87050382c7bc96571755193c4c1392490744ac73d660e8f564a9"}, - {file = "numpy-1.24.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d11efb4dbecbdf22508d55e48d9c8384db795e1b7b51ea735289ff96613ff74d"}, - {file = "numpy-1.24.4-cp39-cp39-win32.whl", hash = "sha256:6620c0acd41dbcb368610bb2f4d83145674040025e5536954782467100aa8835"}, - {file = "numpy-1.24.4-cp39-cp39-win_amd64.whl", hash = "sha256:befe2bf740fd8373cf56149a5c23a0f601e82869598d41f8e188a0e9869926f8"}, - {file = "numpy-1.24.4-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:31f13e25b4e304632a4619d0e0777662c2ffea99fcae2029556b17d8ff958aef"}, - {file = "numpy-1.24.4-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95f7ac6540e95bc440ad77f56e520da5bf877f87dca58bd095288dce8940532a"}, - {file = "numpy-1.24.4-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:e98f220aa76ca2a977fe435f5b04d7b3470c0a2e6312907b37ba6068f26787f2"}, - {file = "numpy-1.24.4.tar.gz", hash = "sha256:80f5e3a4e498641401868df4208b74581206afbee7cf7b8329daae82676d9463"}, -] - [[package]] name = "numpy" version = "2.0.2" @@ -1236,64 +1195,64 @@ files = [ [[package]] name = "numpy" -version = "2.1.1" +version = "2.1.2" description = "Fundamental package for array computing in Python" optional = false python-versions = ">=3.10" files = [ - {file = "numpy-2.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c8a0e34993b510fc19b9a2ce7f31cb8e94ecf6e924a40c0c9dd4f62d0aac47d9"}, - {file = "numpy-2.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:7dd86dfaf7c900c0bbdcb8b16e2f6ddf1eb1fe39c6c8cca6e94844ed3152a8fd"}, - {file = "numpy-2.1.1-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:5889dd24f03ca5a5b1e8a90a33b5a0846d8977565e4ae003a63d22ecddf6782f"}, - {file = "numpy-2.1.1-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:59ca673ad11d4b84ceb385290ed0ebe60266e356641428c845b39cd9df6713ab"}, - {file = "numpy-2.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:13ce49a34c44b6de5241f0b38b07e44c1b2dcacd9e36c30f9c2fcb1bb5135db7"}, - {file = "numpy-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:913cc1d311060b1d409e609947fa1b9753701dac96e6581b58afc36b7ee35af6"}, - {file = "numpy-2.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:caf5d284ddea7462c32b8d4a6b8af030b6c9fd5332afb70e7414d7fdded4bfd0"}, - {file = "numpy-2.1.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:57eb525e7c2a8fdee02d731f647146ff54ea8c973364f3b850069ffb42799647"}, - {file = "numpy-2.1.1-cp310-cp310-win32.whl", hash = "sha256:9a8e06c7a980869ea67bbf551283bbed2856915f0a792dc32dd0f9dd2fb56728"}, - {file = "numpy-2.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:d10c39947a2d351d6d466b4ae83dad4c37cd6c3cdd6d5d0fa797da56f710a6ae"}, - {file = "numpy-2.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0d07841fd284718feffe7dd17a63a2e6c78679b2d386d3e82f44f0108c905550"}, - {file = "numpy-2.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b5613cfeb1adfe791e8e681128f5f49f22f3fcaa942255a6124d58ca59d9528f"}, - {file = "numpy-2.1.1-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:0b8cc2715a84b7c3b161f9ebbd942740aaed913584cae9cdc7f8ad5ad41943d0"}, - {file = "numpy-2.1.1-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:b49742cdb85f1f81e4dc1b39dcf328244f4d8d1ded95dea725b316bd2cf18c95"}, - {file = "numpy-2.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8d5f8a8e3bc87334f025194c6193e408903d21ebaeb10952264943a985066ca"}, - {file = "numpy-2.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d51fc141ddbe3f919e91a096ec739f49d686df8af254b2053ba21a910ae518bf"}, - {file = "numpy-2.1.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:98ce7fb5b8063cfdd86596b9c762bf2b5e35a2cdd7e967494ab78a1fa7f8b86e"}, - {file = "numpy-2.1.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:24c2ad697bd8593887b019817ddd9974a7f429c14a5469d7fad413f28340a6d2"}, - {file = "numpy-2.1.1-cp311-cp311-win32.whl", hash = "sha256:397bc5ce62d3fb73f304bec332171535c187e0643e176a6e9421a6e3eacef06d"}, - {file = "numpy-2.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:ae8ce252404cdd4de56dcfce8b11eac3c594a9c16c231d081fb705cf23bd4d9e"}, - {file = "numpy-2.1.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:7c803b7934a7f59563db459292e6aa078bb38b7ab1446ca38dd138646a38203e"}, - {file = "numpy-2.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6435c48250c12f001920f0751fe50c0348f5f240852cfddc5e2f97e007544cbe"}, - {file = "numpy-2.1.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:3269c9eb8745e8d975980b3a7411a98976824e1fdef11f0aacf76147f662b15f"}, - {file = "numpy-2.1.1-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:fac6e277a41163d27dfab5f4ec1f7a83fac94e170665a4a50191b545721c6521"}, - {file = "numpy-2.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fcd8f556cdc8cfe35e70efb92463082b7f43dd7e547eb071ffc36abc0ca4699b"}, - {file = "numpy-2.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b9cd92c8f8e7b313b80e93cedc12c0112088541dcedd9197b5dee3738c1201"}, - {file = "numpy-2.1.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:afd9c680df4de71cd58582b51e88a61feed4abcc7530bcd3d48483f20fc76f2a"}, - {file = "numpy-2.1.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8661c94e3aad18e1ea17a11f60f843a4933ccaf1a25a7c6a9182af70610b2313"}, - {file = "numpy-2.1.1-cp312-cp312-win32.whl", hash = "sha256:950802d17a33c07cba7fd7c3dcfa7d64705509206be1606f196d179e539111ed"}, - {file = "numpy-2.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:3fc5eabfc720db95d68e6646e88f8b399bfedd235994016351b1d9e062c4b270"}, - {file = "numpy-2.1.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:046356b19d7ad1890c751b99acad5e82dc4a02232013bd9a9a712fddf8eb60f5"}, - {file = "numpy-2.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:6e5a9cb2be39350ae6c8f79410744e80154df658d5bea06e06e0ac5bb75480d5"}, - {file = "numpy-2.1.1-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:d4c57b68c8ef5e1ebf47238e99bf27657511ec3f071c465f6b1bccbef12d4136"}, - {file = "numpy-2.1.1-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:8ae0fd135e0b157365ac7cc31fff27f07a5572bdfc38f9c2d43b2aff416cc8b0"}, - {file = "numpy-2.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:981707f6b31b59c0c24bcda52e5605f9701cb46da4b86c2e8023656ad3e833cb"}, - {file = "numpy-2.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ca4b53e1e0b279142113b8c5eb7d7a877e967c306edc34f3b58e9be12fda8df"}, - {file = "numpy-2.1.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:e097507396c0be4e547ff15b13dc3866f45f3680f789c1a1301b07dadd3fbc78"}, - {file = "numpy-2.1.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f7506387e191fe8cdb267f912469a3cccc538ab108471291636a96a54e599556"}, - {file = "numpy-2.1.1-cp313-cp313-win32.whl", hash = "sha256:251105b7c42abe40e3a689881e1793370cc9724ad50d64b30b358bbb3a97553b"}, - {file = "numpy-2.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:f212d4f46b67ff604d11fff7cc62d36b3e8714edf68e44e9760e19be38c03eb0"}, - {file = "numpy-2.1.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:920b0911bb2e4414c50e55bd658baeb78281a47feeb064ab40c2b66ecba85553"}, - {file = "numpy-2.1.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:bab7c09454460a487e631ffc0c42057e3d8f2a9ddccd1e60c7bb8ed774992480"}, - {file = "numpy-2.1.1-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:cea427d1350f3fd0d2818ce7350095c1a2ee33e30961d2f0fef48576ddbbe90f"}, - {file = "numpy-2.1.1-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:e30356d530528a42eeba51420ae8bf6c6c09559051887196599d96ee5f536468"}, - {file = "numpy-2.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8dfa9e94fc127c40979c3eacbae1e61fda4fe71d84869cc129e2721973231ef"}, - {file = "numpy-2.1.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:910b47a6d0635ec1bd53b88f86120a52bf56dcc27b51f18c7b4a2e2224c29f0f"}, - {file = "numpy-2.1.1-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:13cc11c00000848702322af4de0147ced365c81d66053a67c2e962a485b3717c"}, - {file = "numpy-2.1.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:53e27293b3a2b661c03f79aa51c3987492bd4641ef933e366e0f9f6c9bf257ec"}, - {file = "numpy-2.1.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:7be6a07520b88214ea85d8ac8b7d6d8a1839b0b5cb87412ac9f49fa934eb15d5"}, - {file = "numpy-2.1.1-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:52ac2e48f5ad847cd43c4755520a2317f3380213493b9d8a4c5e37f3b87df504"}, - {file = "numpy-2.1.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:50a95ca3560a6058d6ea91d4629a83a897ee27c00630aed9d933dff191f170cd"}, - {file = "numpy-2.1.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:99f4a9ee60eed1385a86e82288971a51e71df052ed0b2900ed30bc840c0f2e39"}, - {file = "numpy-2.1.1.tar.gz", hash = "sha256:d0cf7d55b1051387807405b3898efafa862997b4cba8aa5dbe657be794afeafd"}, + {file = "numpy-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:30d53720b726ec36a7f88dc873f0eec8447fbc93d93a8f079dfac2629598d6ee"}, + {file = "numpy-2.1.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e8d3ca0a72dd8846eb6f7dfe8f19088060fcb76931ed592d29128e0219652884"}, + {file = "numpy-2.1.2-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:fc44e3c68ff00fd991b59092a54350e6e4911152682b4782f68070985aa9e648"}, + {file = "numpy-2.1.2-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:7c1c60328bd964b53f8b835df69ae8198659e2b9302ff9ebb7de4e5a5994db3d"}, + {file = "numpy-2.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6cdb606a7478f9ad91c6283e238544451e3a95f30fb5467fbf715964341a8a86"}, + {file = "numpy-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d666cb72687559689e9906197e3bec7b736764df6a2e58ee265e360663e9baf7"}, + {file = "numpy-2.1.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c6eef7a2dbd0abfb0d9eaf78b73017dbfd0b54051102ff4e6a7b2980d5ac1a03"}, + {file = "numpy-2.1.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:12edb90831ff481f7ef5f6bc6431a9d74dc0e5ff401559a71e5e4611d4f2d466"}, + {file = "numpy-2.1.2-cp310-cp310-win32.whl", hash = "sha256:a65acfdb9c6ebb8368490dbafe83c03c7e277b37e6857f0caeadbbc56e12f4fb"}, + {file = "numpy-2.1.2-cp310-cp310-win_amd64.whl", hash = "sha256:860ec6e63e2c5c2ee5e9121808145c7bf86c96cca9ad396c0bd3e0f2798ccbe2"}, + {file = "numpy-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b42a1a511c81cc78cbc4539675713bbcf9d9c3913386243ceff0e9429ca892fe"}, + {file = "numpy-2.1.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:faa88bc527d0f097abdc2c663cddf37c05a1c2f113716601555249805cf573f1"}, + {file = "numpy-2.1.2-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:c82af4b2ddd2ee72d1fc0c6695048d457e00b3582ccde72d8a1c991b808bb20f"}, + {file = "numpy-2.1.2-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:13602b3174432a35b16c4cfb5de9a12d229727c3dd47a6ce35111f2ebdf66ff4"}, + {file = "numpy-2.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ebec5fd716c5a5b3d8dfcc439be82a8407b7b24b230d0ad28a81b61c2f4659a"}, + {file = "numpy-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2b49c3c0804e8ecb05d59af8386ec2f74877f7ca8fd9c1e00be2672e4d399b1"}, + {file = "numpy-2.1.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2cbba4b30bf31ddbe97f1c7205ef976909a93a66bb1583e983adbd155ba72ac2"}, + {file = "numpy-2.1.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8e00ea6fc82e8a804433d3e9cedaa1051a1422cb6e443011590c14d2dea59146"}, + {file = "numpy-2.1.2-cp311-cp311-win32.whl", hash = "sha256:5006b13a06e0b38d561fab5ccc37581f23c9511879be7693bd33c7cd15ca227c"}, + {file = "numpy-2.1.2-cp311-cp311-win_amd64.whl", hash = "sha256:f1eb068ead09f4994dec71c24b2844f1e4e4e013b9629f812f292f04bd1510d9"}, + {file = "numpy-2.1.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7bf0a4f9f15b32b5ba53147369e94296f5fffb783db5aacc1be15b4bf72f43b"}, + {file = "numpy-2.1.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b1d0fcae4f0949f215d4632be684a539859b295e2d0cb14f78ec231915d644db"}, + {file = "numpy-2.1.2-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:f751ed0a2f250541e19dfca9f1eafa31a392c71c832b6bb9e113b10d050cb0f1"}, + {file = "numpy-2.1.2-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:bd33f82e95ba7ad632bc57837ee99dba3d7e006536200c4e9124089e1bf42426"}, + {file = "numpy-2.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b8cde4f11f0a975d1fd59373b32e2f5a562ade7cde4f85b7137f3de8fbb29a0"}, + {file = "numpy-2.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d95f286b8244b3649b477ac066c6906fbb2905f8ac19b170e2175d3d799f4df"}, + {file = "numpy-2.1.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:ab4754d432e3ac42d33a269c8567413bdb541689b02d93788af4131018cbf366"}, + {file = "numpy-2.1.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e585c8ae871fd38ac50598f4763d73ec5497b0de9a0ab4ef5b69f01c6a046142"}, + {file = "numpy-2.1.2-cp312-cp312-win32.whl", hash = "sha256:9c6c754df29ce6a89ed23afb25550d1c2d5fdb9901d9c67a16e0b16eaf7e2550"}, + {file = "numpy-2.1.2-cp312-cp312-win_amd64.whl", hash = "sha256:456e3b11cb79ac9946c822a56346ec80275eaf2950314b249b512896c0d2505e"}, + {file = "numpy-2.1.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a84498e0d0a1174f2b3ed769b67b656aa5460c92c9554039e11f20a05650f00d"}, + {file = "numpy-2.1.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4d6ec0d4222e8ffdab1744da2560f07856421b367928026fb540e1945f2eeeaf"}, + {file = "numpy-2.1.2-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:259ec80d54999cc34cd1eb8ded513cb053c3bf4829152a2e00de2371bd406f5e"}, + {file = "numpy-2.1.2-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:675c741d4739af2dc20cd6c6a5c4b7355c728167845e3c6b0e824e4e5d36a6c3"}, + {file = "numpy-2.1.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:05b2d4e667895cc55e3ff2b56077e4c8a5604361fc21a042845ea3ad67465aa8"}, + {file = "numpy-2.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:43cca367bf94a14aca50b89e9bc2061683116cfe864e56740e083392f533ce7a"}, + {file = "numpy-2.1.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:76322dcdb16fccf2ac56f99048af32259dcc488d9b7e25b51e5eca5147a3fb98"}, + {file = "numpy-2.1.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:32e16a03138cabe0cb28e1007ee82264296ac0983714094380b408097a418cfe"}, + {file = "numpy-2.1.2-cp313-cp313-win32.whl", hash = "sha256:242b39d00e4944431a3cd2db2f5377e15b5785920421993770cddb89992c3f3a"}, + {file = "numpy-2.1.2-cp313-cp313-win_amd64.whl", hash = "sha256:f2ded8d9b6f68cc26f8425eda5d3877b47343e68ca23d0d0846f4d312ecaa445"}, + {file = "numpy-2.1.2-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:2ffef621c14ebb0188a8633348504a35c13680d6da93ab5cb86f4e54b7e922b5"}, + {file = "numpy-2.1.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:ad369ed238b1959dfbade9018a740fb9392c5ac4f9b5173f420bd4f37ba1f7a0"}, + {file = "numpy-2.1.2-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:d82075752f40c0ddf57e6e02673a17f6cb0f8eb3f587f63ca1eaab5594da5b17"}, + {file = "numpy-2.1.2-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:1600068c262af1ca9580a527d43dc9d959b0b1d8e56f8a05d830eea39b7c8af6"}, + {file = "numpy-2.1.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a26ae94658d3ba3781d5e103ac07a876b3e9b29db53f68ed7df432fd033358a8"}, + {file = "numpy-2.1.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13311c2db4c5f7609b462bc0f43d3c465424d25c626d95040f073e30f7570e35"}, + {file = "numpy-2.1.2-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:2abbf905a0b568706391ec6fa15161fad0fb5d8b68d73c461b3c1bab6064dd62"}, + {file = "numpy-2.1.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:ef444c57d664d35cac4e18c298c47d7b504c66b17c2ea91312e979fcfbdfb08a"}, + {file = "numpy-2.1.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:bdd407c40483463898b84490770199d5714dcc9dd9b792f6c6caccc523c00952"}, + {file = "numpy-2.1.2-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:da65fb46d4cbb75cb417cddf6ba5e7582eb7bb0b47db4b99c9fe5787ce5d91f5"}, + {file = "numpy-2.1.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1c193d0b0238638e6fc5f10f1b074a6993cb13b0b431f64079a509d63d3aa8b7"}, + {file = "numpy-2.1.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:a7d80b2e904faa63068ead63107189164ca443b42dd1930299e0d1cb041cec2e"}, + {file = "numpy-2.1.2.tar.gz", hash = "sha256:13532a088217fa624c99b843eeb54640de23b3414b14aa66d023805eb731066c"}, ] [[package]] @@ -1323,90 +1282,59 @@ files = [ [[package]] name = "pandas" -version = "1.5.3" -description = "Powerful data structures for data analysis, time series, and statistics" -optional = false -python-versions = ">=3.8" -files = [ - {file = "pandas-1.5.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3749077d86e3a2f0ed51367f30bf5b82e131cc0f14260c4d3e499186fccc4406"}, - {file = "pandas-1.5.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:972d8a45395f2a2d26733eb8d0f629b2f90bebe8e8eddbb8829b180c09639572"}, - {file = "pandas-1.5.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:50869a35cbb0f2e0cd5ec04b191e7b12ed688874bd05dd777c19b28cbea90996"}, - {file = "pandas-1.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c3ac844a0fe00bfaeb2c9b51ab1424e5c8744f89860b138434a363b1f620f354"}, - {file = "pandas-1.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a0a56cef15fd1586726dace5616db75ebcfec9179a3a55e78f72c5639fa2a23"}, - {file = "pandas-1.5.3-cp310-cp310-win_amd64.whl", hash = "sha256:478ff646ca42b20376e4ed3fa2e8d7341e8a63105586efe54fa2508ee087f328"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6973549c01ca91ec96199e940495219c887ea815b2083722821f1d7abfa2b4dc"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c39a8da13cede5adcd3be1182883aea1c925476f4e84b2807a46e2775306305d"}, - {file = "pandas-1.5.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f76d097d12c82a535fda9dfe5e8dd4127952b45fea9b0276cb30cca5ea313fbc"}, - {file = "pandas-1.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e474390e60ed609cec869b0da796ad94f420bb057d86784191eefc62b65819ae"}, - {file = "pandas-1.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f2b952406a1588ad4cad5b3f55f520e82e902388a6d5a4a91baa8d38d23c7f6"}, - {file = "pandas-1.5.3-cp311-cp311-win_amd64.whl", hash = "sha256:bc4c368f42b551bf72fac35c5128963a171b40dce866fb066540eeaf46faa003"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:14e45300521902689a81f3f41386dc86f19b8ba8dd5ac5a3c7010ef8d2932813"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9842b6f4b8479e41968eced654487258ed81df7d1c9b7b870ceea24ed9459b31"}, - {file = "pandas-1.5.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:26d9c71772c7afb9d5046e6e9cf42d83dd147b5cf5bcb9d97252077118543792"}, - {file = "pandas-1.5.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5fbcb19d6fceb9e946b3e23258757c7b225ba450990d9ed63ccceeb8cae609f7"}, - {file = "pandas-1.5.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:565fa34a5434d38e9d250af3c12ff931abaf88050551d9fbcdfafca50d62babf"}, - {file = "pandas-1.5.3-cp38-cp38-win32.whl", hash = "sha256:87bd9c03da1ac870a6d2c8902a0e1fd4267ca00f13bc494c9e5a9020920e1d51"}, - {file = "pandas-1.5.3-cp38-cp38-win_amd64.whl", hash = "sha256:41179ce559943d83a9b4bbacb736b04c928b095b5f25dd2b7389eda08f46f373"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c74a62747864ed568f5a82a49a23a8d7fe171d0c69038b38cedf0976831296fa"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c4c00e0b0597c8e4f59e8d461f797e5d70b4d025880516a8261b2817c47759ee"}, - {file = "pandas-1.5.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a50d9a4336a9621cab7b8eb3fb11adb82de58f9b91d84c2cd526576b881a0c5a"}, - {file = "pandas-1.5.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd05f7783b3274aa206a1af06f0ceed3f9b412cf665b7247eacd83be41cf7bf0"}, - {file = "pandas-1.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f69c4029613de47816b1bb30ff5ac778686688751a5e9c99ad8c7031f6508e5"}, - {file = "pandas-1.5.3-cp39-cp39-win32.whl", hash = "sha256:7cec0bee9f294e5de5bbfc14d0573f65526071029d036b753ee6507d2a21480a"}, - {file = "pandas-1.5.3-cp39-cp39-win_amd64.whl", hash = "sha256:dfd681c5dc216037e0b0a2c821f5ed99ba9f03ebcf119c7dac0e9a7b960b9ec9"}, - {file = "pandas-1.5.3.tar.gz", hash = "sha256:74a3fd7e5a7ec052f183273dc7b0acd3a863edf7520f5d3a1765c04ffdb3b0b1"}, -] - -[package.dependencies] -numpy = {version = ">=1.20.3", markers = "python_version < \"3.10\""} -python-dateutil = ">=2.8.1" -pytz = ">=2020.1" - -[package.extras] -test = ["hypothesis (>=5.5.3)", "pytest (>=6.0)", "pytest-xdist (>=1.31)"] - -[[package]] -name = "pandas" -version = "2.2.2" +version = "2.2.3" description = "Powerful data structures for data analysis, time series, and statistics" optional = false python-versions = ">=3.9" files = [ - {file = "pandas-2.2.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:90c6fca2acf139569e74e8781709dccb6fe25940488755716d1d354d6bc58bce"}, - {file = "pandas-2.2.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c7adfc142dac335d8c1e0dcbd37eb8617eac386596eb9e1a1b77791cf2498238"}, - {file = "pandas-2.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4abfe0be0d7221be4f12552995e58723c7422c80a659da13ca382697de830c08"}, - {file = "pandas-2.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8635c16bf3d99040fdf3ca3db669a7250ddf49c55dc4aa8fe0ae0fa8d6dcc1f0"}, - {file = "pandas-2.2.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:40ae1dffb3967a52203105a077415a86044a2bea011b5f321c6aa64b379a3f51"}, - {file = "pandas-2.2.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8e5a0b00e1e56a842f922e7fae8ae4077aee4af0acb5ae3622bd4b4c30aedf99"}, - {file = "pandas-2.2.2-cp310-cp310-win_amd64.whl", hash = "sha256:ddf818e4e6c7c6f4f7c8a12709696d193976b591cc7dc50588d3d1a6b5dc8772"}, - {file = "pandas-2.2.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:696039430f7a562b74fa45f540aca068ea85fa34c244d0deee539cb6d70aa288"}, - {file = "pandas-2.2.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8e90497254aacacbc4ea6ae5e7a8cd75629d6ad2b30025a4a8b09aa4faf55151"}, - {file = "pandas-2.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:58b84b91b0b9f4bafac2a0ac55002280c094dfc6402402332c0913a59654ab2b"}, - {file = "pandas-2.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2123dc9ad6a814bcdea0f099885276b31b24f7edf40f6cdbc0912672e22eee"}, - {file = "pandas-2.2.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:2925720037f06e89af896c70bca73459d7e6a4be96f9de79e2d440bd499fe0db"}, - {file = "pandas-2.2.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0cace394b6ea70c01ca1595f839cf193df35d1575986e484ad35c4aeae7266c1"}, - {file = "pandas-2.2.2-cp311-cp311-win_amd64.whl", hash = "sha256:873d13d177501a28b2756375d59816c365e42ed8417b41665f346289adc68d24"}, - {file = "pandas-2.2.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9dfde2a0ddef507a631dc9dc4af6a9489d5e2e740e226ad426a05cabfbd7c8ef"}, - {file = "pandas-2.2.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e9b79011ff7a0f4b1d6da6a61aa1aa604fb312d6647de5bad20013682d1429ce"}, - {file = "pandas-2.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1cb51fe389360f3b5a4d57dbd2848a5f033350336ca3b340d1c53a1fad33bcad"}, - {file = "pandas-2.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eee3a87076c0756de40b05c5e9a6069c035ba43e8dd71c379e68cab2c20f16ad"}, - {file = "pandas-2.2.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:3e374f59e440d4ab45ca2fffde54b81ac3834cf5ae2cdfa69c90bc03bde04d76"}, - {file = "pandas-2.2.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:43498c0bdb43d55cb162cdc8c06fac328ccb5d2eabe3cadeb3529ae6f0517c32"}, - {file = "pandas-2.2.2-cp312-cp312-win_amd64.whl", hash = "sha256:d187d355ecec3629624fccb01d104da7d7f391db0311145817525281e2804d23"}, - {file = "pandas-2.2.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:0ca6377b8fca51815f382bd0b697a0814c8bda55115678cbc94c30aacbb6eff2"}, - {file = "pandas-2.2.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9057e6aa78a584bc93a13f0a9bf7e753a5e9770a30b4d758b8d5f2a62a9433cd"}, - {file = "pandas-2.2.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:001910ad31abc7bf06f49dcc903755d2f7f3a9186c0c040b827e522e9cef0863"}, - {file = "pandas-2.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:66b479b0bd07204e37583c191535505410daa8df638fd8e75ae1b383851fe921"}, - {file = "pandas-2.2.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:a77e9d1c386196879aa5eb712e77461aaee433e54c68cf253053a73b7e49c33a"}, - {file = "pandas-2.2.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:92fd6b027924a7e178ac202cfbe25e53368db90d56872d20ffae94b96c7acc57"}, - {file = "pandas-2.2.2-cp39-cp39-win_amd64.whl", hash = "sha256:640cef9aa381b60e296db324337a554aeeb883ead99dc8f6c18e81a93942f5f4"}, - {file = "pandas-2.2.2.tar.gz", hash = "sha256:9e79019aba43cb4fda9e4d983f8e88ca0373adbb697ae9c6c43093218de28b54"}, + {file = "pandas-2.2.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1948ddde24197a0f7add2bdc4ca83bf2b1ef84a1bc8ccffd95eda17fd836ecb5"}, + {file = "pandas-2.2.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:381175499d3802cde0eabbaf6324cce0c4f5d52ca6f8c377c29ad442f50f6348"}, + {file = "pandas-2.2.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d9c45366def9a3dd85a6454c0e7908f2b3b8e9c138f5dc38fed7ce720d8453ed"}, + {file = "pandas-2.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:86976a1c5b25ae3f8ccae3a5306e443569ee3c3faf444dfd0f41cda24667ad57"}, + {file = "pandas-2.2.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:b8661b0238a69d7aafe156b7fa86c44b881387509653fdf857bebc5e4008ad42"}, + {file = "pandas-2.2.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:37e0aced3e8f539eccf2e099f65cdb9c8aa85109b0be6e93e2baff94264bdc6f"}, + {file = "pandas-2.2.3-cp310-cp310-win_amd64.whl", hash = "sha256:56534ce0746a58afaf7942ba4863e0ef81c9c50d3f0ae93e9497d6a41a057645"}, + {file = "pandas-2.2.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:66108071e1b935240e74525006034333f98bcdb87ea116de573a6a0dccb6c039"}, + {file = "pandas-2.2.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7c2875855b0ff77b2a64a0365e24455d9990730d6431b9e0ee18ad8acee13dbd"}, + {file = "pandas-2.2.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cd8d0c3be0515c12fed0bdbae072551c8b54b7192c7b1fda0ba56059a0179698"}, + {file = "pandas-2.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c124333816c3a9b03fbeef3a9f230ba9a737e9e5bb4060aa2107a86cc0a497fc"}, + {file = "pandas-2.2.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:63cc132e40a2e084cf01adf0775b15ac515ba905d7dcca47e9a251819c575ef3"}, + {file = "pandas-2.2.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:29401dbfa9ad77319367d36940cd8a0b3a11aba16063e39632d98b0e931ddf32"}, + {file = "pandas-2.2.3-cp311-cp311-win_amd64.whl", hash = "sha256:3fc6873a41186404dad67245896a6e440baacc92f5b716ccd1bc9ed2995ab2c5"}, + {file = "pandas-2.2.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:b1d432e8d08679a40e2a6d8b2f9770a5c21793a6f9f47fdd52c5ce1948a5a8a9"}, + {file = "pandas-2.2.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a5a1595fe639f5988ba6a8e5bc9649af3baf26df3998a0abe56c02609392e0a4"}, + {file = "pandas-2.2.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:5de54125a92bb4d1c051c0659e6fcb75256bf799a732a87184e5ea503965bce3"}, + {file = "pandas-2.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fffb8ae78d8af97f849404f21411c95062db1496aeb3e56f146f0355c9989319"}, + {file = "pandas-2.2.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6dfcb5ee8d4d50c06a51c2fffa6cff6272098ad6540aed1a76d15fb9318194d8"}, + {file = "pandas-2.2.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:062309c1b9ea12a50e8ce661145c6aab431b1e99530d3cd60640e255778bd43a"}, + {file = "pandas-2.2.3-cp312-cp312-win_amd64.whl", hash = "sha256:59ef3764d0fe818125a5097d2ae867ca3fa64df032331b7e0917cf5d7bf66b13"}, + {file = "pandas-2.2.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f00d1345d84d8c86a63e476bb4955e46458b304b9575dcf71102b5c705320015"}, + {file = "pandas-2.2.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3508d914817e153ad359d7e069d752cdd736a247c322d932eb89e6bc84217f28"}, + {file = "pandas-2.2.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:22a9d949bfc9a502d320aa04e5d02feab689d61da4e7764b62c30b991c42c5f0"}, + {file = "pandas-2.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3a255b2c19987fbbe62a9dfd6cff7ff2aa9ccab3fc75218fd4b7530f01efa24"}, + {file = "pandas-2.2.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:800250ecdadb6d9c78eae4990da62743b857b470883fa27f652db8bdde7f6659"}, + {file = "pandas-2.2.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6374c452ff3ec675a8f46fd9ab25c4ad0ba590b71cf0656f8b6daa5202bca3fb"}, + {file = "pandas-2.2.3-cp313-cp313-win_amd64.whl", hash = "sha256:61c5ad4043f791b61dd4752191d9f07f0ae412515d59ba8f005832a532f8736d"}, + {file = "pandas-2.2.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:3b71f27954685ee685317063bf13c7709a7ba74fc996b84fc6821c59b0f06468"}, + {file = "pandas-2.2.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:38cf8125c40dae9d5acc10fa66af8ea6fdf760b2714ee482ca691fc66e6fcb18"}, + {file = "pandas-2.2.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:ba96630bc17c875161df3818780af30e43be9b166ce51c9a18c1feae342906c2"}, + {file = "pandas-2.2.3-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1db71525a1538b30142094edb9adc10be3f3e176748cd7acc2240c2f2e5aa3a4"}, + {file = "pandas-2.2.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:15c0e1e02e93116177d29ff83e8b1619c93ddc9c49083f237d4312337a61165d"}, + {file = "pandas-2.2.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:ad5b65698ab28ed8d7f18790a0dc58005c7629f227be9ecc1072aa74c0c1d43a"}, + {file = "pandas-2.2.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bc6b93f9b966093cb0fd62ff1a7e4c09e6d546ad7c1de191767baffc57628f39"}, + {file = "pandas-2.2.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5dbca4c1acd72e8eeef4753eeca07de9b1db4f398669d5994086f788a5d7cc30"}, + {file = "pandas-2.2.3-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8cd6d7cc958a3910f934ea8dbdf17b2364827bb4dafc38ce6eef6bb3d65ff09c"}, + {file = "pandas-2.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:99df71520d25fade9db7c1076ac94eb994f4d2673ef2aa2e86ee039b6746d20c"}, + {file = "pandas-2.2.3-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:31d0ced62d4ea3e231a9f228366919a5ea0b07440d9d4dac345376fd8e1477ea"}, + {file = "pandas-2.2.3-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7eee9e7cea6adf3e3d24e304ac6b8300646e2a5d1cd3a3c2abed9101b0846761"}, + {file = "pandas-2.2.3-cp39-cp39-win_amd64.whl", hash = "sha256:4850ba03528b6dd51d6c5d273c46f183f39a9baf3f0143e566b89450965b105e"}, + {file = "pandas-2.2.3.tar.gz", hash = "sha256:4f18ba62b61d7e192368b84517265a99b4d7ee8912f8708660fb4a366cc82667"}, ] [package.dependencies] numpy = [ - {version = ">=1.23.2", markers = "python_version == \"3.11\""}, {version = ">=1.26.0", markers = "python_version >= \"3.12\""}, + {version = ">=1.23.2", markers = "python_version == \"3.11\""}, {version = ">=1.22.4", markers = "python_version < \"3.11\""}, ] python-dateutil = ">=2.8.2" @@ -1440,95 +1368,90 @@ xml = ["lxml (>=4.9.2)"] [[package]] name = "pillow" -version = "10.4.0" +version = "11.0.0" description = "Python Imaging Library (Fork)" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "pillow-10.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:4d9667937cfa347525b319ae34375c37b9ee6b525440f3ef48542fcf66f2731e"}, - {file = "pillow-10.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:543f3dc61c18dafb755773efc89aae60d06b6596a63914107f75459cf984164d"}, - {file = "pillow-10.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7928ecbf1ece13956b95d9cbcfc77137652b02763ba384d9ab508099a2eca856"}, - {file = "pillow-10.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4d49b85c4348ea0b31ea63bc75a9f3857869174e2bf17e7aba02945cd218e6f"}, - {file = "pillow-10.4.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:6c762a5b0997f5659a5ef2266abc1d8851ad7749ad9a6a5506eb23d314e4f46b"}, - {file = "pillow-10.4.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:a985e028fc183bf12a77a8bbf36318db4238a3ded7fa9df1b9a133f1cb79f8fc"}, - {file = "pillow-10.4.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:812f7342b0eee081eaec84d91423d1b4650bb9828eb53d8511bcef8ce5aecf1e"}, - {file = "pillow-10.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:ac1452d2fbe4978c2eec89fb5a23b8387aba707ac72810d9490118817d9c0b46"}, - {file = "pillow-10.4.0-cp310-cp310-win32.whl", hash = "sha256:bcd5e41a859bf2e84fdc42f4edb7d9aba0a13d29a2abadccafad99de3feff984"}, - {file = "pillow-10.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:ecd85a8d3e79cd7158dec1c9e5808e821feea088e2f69a974db5edf84dc53141"}, - {file = "pillow-10.4.0-cp310-cp310-win_arm64.whl", hash = "sha256:ff337c552345e95702c5fde3158acb0625111017d0e5f24bf3acdb9cc16b90d1"}, - {file = "pillow-10.4.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:0a9ec697746f268507404647e531e92889890a087e03681a3606d9b920fbee3c"}, - {file = "pillow-10.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dfe91cb65544a1321e631e696759491ae04a2ea11d36715eca01ce07284738be"}, - {file = "pillow-10.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5dc6761a6efc781e6a1544206f22c80c3af4c8cf461206d46a1e6006e4429ff3"}, - {file = "pillow-10.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e84b6cc6a4a3d76c153a6b19270b3526a5a8ed6b09501d3af891daa2a9de7d6"}, - {file = "pillow-10.4.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:bbc527b519bd3aa9d7f429d152fea69f9ad37c95f0b02aebddff592688998abe"}, - {file = "pillow-10.4.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:76a911dfe51a36041f2e756b00f96ed84677cdeb75d25c767f296c1c1eda1319"}, - {file = "pillow-10.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:59291fb29317122398786c2d44427bbd1a6d7ff54017075b22be9d21aa59bd8d"}, - {file = "pillow-10.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:416d3a5d0e8cfe4f27f574362435bc9bae57f679a7158e0096ad2beb427b8696"}, - {file = "pillow-10.4.0-cp311-cp311-win32.whl", hash = "sha256:7086cc1d5eebb91ad24ded9f58bec6c688e9f0ed7eb3dbbf1e4800280a896496"}, - {file = "pillow-10.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cbed61494057c0f83b83eb3a310f0bf774b09513307c434d4366ed64f4128a91"}, - {file = "pillow-10.4.0-cp311-cp311-win_arm64.whl", hash = "sha256:f5f0c3e969c8f12dd2bb7e0b15d5c468b51e5017e01e2e867335c81903046a22"}, - {file = "pillow-10.4.0-cp312-cp312-macosx_10_10_x86_64.whl", hash = "sha256:673655af3eadf4df6b5457033f086e90299fdd7a47983a13827acf7459c15d94"}, - {file = "pillow-10.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:866b6942a92f56300012f5fbac71f2d610312ee65e22f1aa2609e491284e5597"}, - {file = "pillow-10.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29dbdc4207642ea6aad70fbde1a9338753d33fb23ed6956e706936706f52dd80"}, - {file = "pillow-10.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf2342ac639c4cf38799a44950bbc2dfcb685f052b9e262f446482afaf4bffca"}, - {file = "pillow-10.4.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:f5b92f4d70791b4a67157321c4e8225d60b119c5cc9aee8ecf153aace4aad4ef"}, - {file = "pillow-10.4.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a"}, - {file = "pillow-10.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:780c072c2e11c9b2c7ca37f9a2ee8ba66f44367ac3e5c7832afcfe5104fd6d1b"}, - {file = "pillow-10.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:37fb69d905be665f68f28a8bba3c6d3223c8efe1edf14cc4cfa06c241f8c81d9"}, - {file = "pillow-10.4.0-cp312-cp312-win32.whl", hash = "sha256:7dfecdbad5c301d7b5bde160150b4db4c659cee2b69589705b6f8a0c509d9f42"}, - {file = "pillow-10.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:1d846aea995ad352d4bdcc847535bd56e0fd88d36829d2c90be880ef1ee4668a"}, - {file = "pillow-10.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:e553cad5179a66ba15bb18b353a19020e73a7921296a7979c4a2b7f6a5cd57f9"}, - {file = "pillow-10.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8bc1a764ed8c957a2e9cacf97c8b2b053b70307cf2996aafd70e91a082e70df3"}, - {file = "pillow-10.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:6209bb41dc692ddfee4942517c19ee81b86c864b626dbfca272ec0f7cff5d9fb"}, - {file = "pillow-10.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bee197b30783295d2eb680b311af15a20a8b24024a19c3a26431ff83eb8d1f70"}, - {file = "pillow-10.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ef61f5dd14c300786318482456481463b9d6b91ebe5ef12f405afbba77ed0be"}, - {file = "pillow-10.4.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:297e388da6e248c98bc4a02e018966af0c5f92dfacf5a5ca22fa01cb3179bca0"}, - {file = "pillow-10.4.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:e4db64794ccdf6cb83a59d73405f63adbe2a1887012e308828596100a0b2f6cc"}, - {file = "pillow-10.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:bd2880a07482090a3bcb01f4265f1936a903d70bc740bfcb1fd4e8a2ffe5cf5a"}, - {file = "pillow-10.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4b35b21b819ac1dbd1233317adeecd63495f6babf21b7b2512d244ff6c6ce309"}, - {file = "pillow-10.4.0-cp313-cp313-win32.whl", hash = "sha256:551d3fd6e9dc15e4c1eb6fc4ba2b39c0c7933fa113b220057a34f4bb3268a060"}, - {file = "pillow-10.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:030abdbe43ee02e0de642aee345efa443740aa4d828bfe8e2eb11922ea6a21ea"}, - {file = "pillow-10.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:5b001114dd152cfd6b23befeb28d7aee43553e2402c9f159807bf55f33af8a8d"}, - {file = "pillow-10.4.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:8d4d5063501b6dd4024b8ac2f04962d661222d120381272deea52e3fc52d3736"}, - {file = "pillow-10.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7c1ee6f42250df403c5f103cbd2768a28fe1a0ea1f0f03fe151c8741e1469c8b"}, - {file = "pillow-10.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b15e02e9bb4c21e39876698abf233c8c579127986f8207200bc8a8f6bb27acf2"}, - {file = "pillow-10.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a8d4bade9952ea9a77d0c3e49cbd8b2890a399422258a77f357b9cc9be8d680"}, - {file = "pillow-10.4.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:43efea75eb06b95d1631cb784aa40156177bf9dd5b4b03ff38979e048258bc6b"}, - {file = "pillow-10.4.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:950be4d8ba92aca4b2bb0741285a46bfae3ca699ef913ec8416c1b78eadd64cd"}, - {file = "pillow-10.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d7480af14364494365e89d6fddc510a13e5a2c3584cb19ef65415ca57252fb84"}, - {file = "pillow-10.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:73664fe514b34c8f02452ffb73b7a92c6774e39a647087f83d67f010eb9a0cf0"}, - {file = "pillow-10.4.0-cp38-cp38-win32.whl", hash = "sha256:e88d5e6ad0d026fba7bdab8c3f225a69f063f116462c49892b0149e21b6c0a0e"}, - {file = "pillow-10.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:5161eef006d335e46895297f642341111945e2c1c899eb406882a6c61a4357ab"}, - {file = "pillow-10.4.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:0ae24a547e8b711ccaaf99c9ae3cd975470e1a30caa80a6aaee9a2f19c05701d"}, - {file = "pillow-10.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:298478fe4f77a4408895605f3482b6cc6222c018b2ce565c2b6b9c354ac3229b"}, - {file = "pillow-10.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:134ace6dc392116566980ee7436477d844520a26a4b1bd4053f6f47d096997fd"}, - {file = "pillow-10.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:930044bb7679ab003b14023138b50181899da3f25de50e9dbee23b61b4de2126"}, - {file = "pillow-10.4.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:c76e5786951e72ed3686e122d14c5d7012f16c8303a674d18cdcd6d89557fc5b"}, - {file = "pillow-10.4.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:b2724fdb354a868ddf9a880cb84d102da914e99119211ef7ecbdc613b8c96b3c"}, - {file = "pillow-10.4.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:dbc6ae66518ab3c5847659e9988c3b60dc94ffb48ef9168656e0019a93dbf8a1"}, - {file = "pillow-10.4.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:06b2f7898047ae93fad74467ec3d28fe84f7831370e3c258afa533f81ef7f3df"}, - {file = "pillow-10.4.0-cp39-cp39-win32.whl", hash = "sha256:7970285ab628a3779aecc35823296a7869f889b8329c16ad5a71e4901a3dc4ef"}, - {file = "pillow-10.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:961a7293b2457b405967af9c77dcaa43cc1a8cd50d23c532e62d48ab6cdd56f5"}, - {file = "pillow-10.4.0-cp39-cp39-win_arm64.whl", hash = "sha256:32cda9e3d601a52baccb2856b8ea1fc213c90b340c542dcef77140dfa3278a9e"}, - {file = "pillow-10.4.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:5b4815f2e65b30f5fbae9dfffa8636d992d49705723fe86a3661806e069352d4"}, - {file = "pillow-10.4.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:8f0aef4ef59694b12cadee839e2ba6afeab89c0f39a3adc02ed51d109117b8da"}, - {file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9f4727572e2918acaa9077c919cbbeb73bd2b3ebcfe033b72f858fc9fbef0026"}, - {file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff25afb18123cea58a591ea0244b92eb1e61a1fd497bf6d6384f09bc3262ec3e"}, - {file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:dc3e2db6ba09ffd7d02ae9141cfa0ae23393ee7687248d46a7507b75d610f4f5"}, - {file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:02a2be69f9c9b8c1e97cf2713e789d4e398c751ecfd9967c18d0ce304efbf885"}, - {file = "pillow-10.4.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:0755ffd4a0c6f267cccbae2e9903d95477ca2f77c4fcf3a3a09570001856c8a5"}, - {file = "pillow-10.4.0-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:a02364621fe369e06200d4a16558e056fe2805d3468350df3aef21e00d26214b"}, - {file = "pillow-10.4.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:1b5dea9831a90e9d0721ec417a80d4cbd7022093ac38a568db2dd78363b00908"}, - {file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9b885f89040bb8c4a1573566bbb2f44f5c505ef6e74cec7ab9068c900047f04b"}, - {file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87dd88ded2e6d74d31e1e0a99a726a6765cda32d00ba72dc37f0651f306daaa8"}, - {file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:2db98790afc70118bd0255c2eeb465e9767ecf1f3c25f9a1abb8ffc8cfd1fe0a"}, - {file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:f7baece4ce06bade126fb84b8af1c33439a76d8a6fd818970215e0560ca28c27"}, - {file = "pillow-10.4.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:cfdd747216947628af7b259d274771d84db2268ca062dd5faf373639d00113a3"}, - {file = "pillow-10.4.0.tar.gz", hash = "sha256:166c1cd4d24309b30d61f79f4a9114b7b2313d7450912277855ff5dfd7cd4a06"}, + {file = "pillow-11.0.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:6619654954dc4936fcff82db8eb6401d3159ec6be81e33c6000dfd76ae189947"}, + {file = "pillow-11.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b3c5ac4bed7519088103d9450a1107f76308ecf91d6dabc8a33a2fcfb18d0fba"}, + {file = "pillow-11.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a65149d8ada1055029fcb665452b2814fe7d7082fcb0c5bed6db851cb69b2086"}, + {file = "pillow-11.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88a58d8ac0cc0e7f3a014509f0455248a76629ca9b604eca7dc5927cc593c5e9"}, + {file = "pillow-11.0.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:c26845094b1af3c91852745ae78e3ea47abf3dbcd1cf962f16b9a5fbe3ee8488"}, + {file = "pillow-11.0.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:1a61b54f87ab5786b8479f81c4b11f4d61702830354520837f8cc791ebba0f5f"}, + {file = "pillow-11.0.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:674629ff60030d144b7bca2b8330225a9b11c482ed408813924619c6f302fdbb"}, + {file = "pillow-11.0.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:598b4e238f13276e0008299bd2482003f48158e2b11826862b1eb2ad7c768b97"}, + {file = "pillow-11.0.0-cp310-cp310-win32.whl", hash = "sha256:9a0f748eaa434a41fccf8e1ee7a3eed68af1b690e75328fd7a60af123c193b50"}, + {file = "pillow-11.0.0-cp310-cp310-win_amd64.whl", hash = "sha256:a5629742881bcbc1f42e840af185fd4d83a5edeb96475a575f4da50d6ede337c"}, + {file = "pillow-11.0.0-cp310-cp310-win_arm64.whl", hash = "sha256:ee217c198f2e41f184f3869f3e485557296d505b5195c513b2bfe0062dc537f1"}, + {file = "pillow-11.0.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:1c1d72714f429a521d8d2d018badc42414c3077eb187a59579f28e4270b4b0fc"}, + {file = "pillow-11.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:499c3a1b0d6fc8213519e193796eb1a86a1be4b1877d678b30f83fd979811d1a"}, + {file = "pillow-11.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c8b2351c85d855293a299038e1f89db92a2f35e8d2f783489c6f0b2b5f3fe8a3"}, + {file = "pillow-11.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f4dba50cfa56f910241eb7f883c20f1e7b1d8f7d91c750cd0b318bad443f4d5"}, + {file = "pillow-11.0.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:5ddbfd761ee00c12ee1be86c9c0683ecf5bb14c9772ddbd782085779a63dd55b"}, + {file = "pillow-11.0.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:45c566eb10b8967d71bf1ab8e4a525e5a93519e29ea071459ce517f6b903d7fa"}, + {file = "pillow-11.0.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:b4fd7bd29610a83a8c9b564d457cf5bd92b4e11e79a4ee4716a63c959699b306"}, + {file = "pillow-11.0.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:cb929ca942d0ec4fac404cbf520ee6cac37bf35be479b970c4ffadf2b6a1cad9"}, + {file = "pillow-11.0.0-cp311-cp311-win32.whl", hash = "sha256:006bcdd307cc47ba43e924099a038cbf9591062e6c50e570819743f5607404f5"}, + {file = "pillow-11.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:52a2d8323a465f84faaba5236567d212c3668f2ab53e1c74c15583cf507a0291"}, + {file = "pillow-11.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:16095692a253047fe3ec028e951fa4221a1f3ed3d80c397e83541a3037ff67c9"}, + {file = "pillow-11.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d2c0a187a92a1cb5ef2c8ed5412dd8d4334272617f532d4ad4de31e0495bd923"}, + {file = "pillow-11.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:084a07ef0821cfe4858fe86652fffac8e187b6ae677e9906e192aafcc1b69903"}, + {file = "pillow-11.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8069c5179902dcdce0be9bfc8235347fdbac249d23bd90514b7a47a72d9fecf4"}, + {file = "pillow-11.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f02541ef64077f22bf4924f225c0fd1248c168f86e4b7abdedd87d6ebaceab0f"}, + {file = "pillow-11.0.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:fcb4621042ac4b7865c179bb972ed0da0218a076dc1820ffc48b1d74c1e37fe9"}, + {file = "pillow-11.0.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:00177a63030d612148e659b55ba99527803288cea7c75fb05766ab7981a8c1b7"}, + {file = "pillow-11.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8853a3bf12afddfdf15f57c4b02d7ded92c7a75a5d7331d19f4f9572a89c17e6"}, + {file = "pillow-11.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3107c66e43bda25359d5ef446f59c497de2b5ed4c7fdba0894f8d6cf3822dafc"}, + {file = "pillow-11.0.0-cp312-cp312-win32.whl", hash = "sha256:86510e3f5eca0ab87429dd77fafc04693195eec7fd6a137c389c3eeb4cfb77c6"}, + {file = "pillow-11.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:8ec4a89295cd6cd4d1058a5e6aec6bf51e0eaaf9714774e1bfac7cfc9051db47"}, + {file = "pillow-11.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:27a7860107500d813fcd203b4ea19b04babe79448268403172782754870dac25"}, + {file = "pillow-11.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bcd1fb5bb7b07f64c15618c89efcc2cfa3e95f0e3bcdbaf4642509de1942a699"}, + {file = "pillow-11.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0e038b0745997c7dcaae350d35859c9715c71e92ffb7e0f4a8e8a16732150f38"}, + {file = "pillow-11.0.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ae08bd8ffc41aebf578c2af2f9d8749d91f448b3bfd41d7d9ff573d74f2a6b2"}, + {file = "pillow-11.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d69bfd8ec3219ae71bcde1f942b728903cad25fafe3100ba2258b973bd2bc1b2"}, + {file = "pillow-11.0.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:61b887f9ddba63ddf62fd02a3ba7add935d053b6dd7d58998c630e6dbade8527"}, + {file = "pillow-11.0.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:c6a660307ca9d4867caa8d9ca2c2658ab685de83792d1876274991adec7b93fa"}, + {file = "pillow-11.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:73e3a0200cdda995c7e43dd47436c1548f87a30bb27fb871f352a22ab8dcf45f"}, + {file = "pillow-11.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fba162b8872d30fea8c52b258a542c5dfd7b235fb5cb352240c8d63b414013eb"}, + {file = "pillow-11.0.0-cp313-cp313-win32.whl", hash = "sha256:f1b82c27e89fffc6da125d5eb0ca6e68017faf5efc078128cfaa42cf5cb38798"}, + {file = "pillow-11.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:8ba470552b48e5835f1d23ecb936bb7f71d206f9dfeee64245f30c3270b994de"}, + {file = "pillow-11.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:846e193e103b41e984ac921b335df59195356ce3f71dcfd155aa79c603873b84"}, + {file = "pillow-11.0.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:4ad70c4214f67d7466bea6a08061eba35c01b1b89eaa098040a35272a8efb22b"}, + {file = "pillow-11.0.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:6ec0d5af64f2e3d64a165f490d96368bb5dea8b8f9ad04487f9ab60dc4bb6003"}, + {file = "pillow-11.0.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c809a70e43c7977c4a42aefd62f0131823ebf7dd73556fa5d5950f5b354087e2"}, + {file = "pillow-11.0.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:4b60c9520f7207aaf2e1d94de026682fc227806c6e1f55bba7606d1c94dd623a"}, + {file = "pillow-11.0.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:1e2688958a840c822279fda0086fec1fdab2f95bf2b717b66871c4ad9859d7e8"}, + {file = "pillow-11.0.0-cp313-cp313t-win32.whl", hash = "sha256:607bbe123c74e272e381a8d1957083a9463401f7bd01287f50521ecb05a313f8"}, + {file = "pillow-11.0.0-cp313-cp313t-win_amd64.whl", hash = "sha256:5c39ed17edea3bc69c743a8dd3e9853b7509625c2462532e62baa0732163a904"}, + {file = "pillow-11.0.0-cp313-cp313t-win_arm64.whl", hash = "sha256:75acbbeb05b86bc53cbe7b7e6fe00fbcf82ad7c684b3ad82e3d711da9ba287d3"}, + {file = "pillow-11.0.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:2e46773dc9f35a1dd28bd6981332fd7f27bec001a918a72a79b4133cf5291dba"}, + {file = "pillow-11.0.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2679d2258b7f1192b378e2893a8a0a0ca472234d4c2c0e6bdd3380e8dfa21b6a"}, + {file = "pillow-11.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eda2616eb2313cbb3eebbe51f19362eb434b18e3bb599466a1ffa76a033fb916"}, + {file = "pillow-11.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:20ec184af98a121fb2da42642dea8a29ec80fc3efbaefb86d8fdd2606619045d"}, + {file = "pillow-11.0.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:8594f42df584e5b4bb9281799698403f7af489fba84c34d53d1c4bfb71b7c4e7"}, + {file = "pillow-11.0.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:c12b5ae868897c7338519c03049a806af85b9b8c237b7d675b8c5e089e4a618e"}, + {file = "pillow-11.0.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:70fbbdacd1d271b77b7721fe3cdd2d537bbbd75d29e6300c672ec6bb38d9672f"}, + {file = "pillow-11.0.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:5178952973e588b3f1360868847334e9e3bf49d19e169bbbdfaf8398002419ae"}, + {file = "pillow-11.0.0-cp39-cp39-win32.whl", hash = "sha256:8c676b587da5673d3c75bd67dd2a8cdfeb282ca38a30f37950511766b26858c4"}, + {file = "pillow-11.0.0-cp39-cp39-win_amd64.whl", hash = "sha256:94f3e1780abb45062287b4614a5bc0874519c86a777d4a7ad34978e86428b8dd"}, + {file = "pillow-11.0.0-cp39-cp39-win_arm64.whl", hash = "sha256:290f2cc809f9da7d6d622550bbf4c1e57518212da51b6a30fe8e0a270a5b78bd"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:1187739620f2b365de756ce086fdb3604573337cc28a0d3ac4a01ab6b2d2a6d2"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:fbbcb7b57dc9c794843e3d1258c0fbf0f48656d46ffe9e09b63bbd6e8cd5d0a2"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d203af30149ae339ad1b4f710d9844ed8796e97fda23ffbc4cc472968a47d0b"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21a0d3b115009ebb8ac3d2ebec5c2982cc693da935f4ab7bb5c8ebe2f47d36f2"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:73853108f56df97baf2bb8b522f3578221e56f646ba345a372c78326710d3830"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e58876c91f97b0952eb766123bfef372792ab3f4e3e1f1a2267834c2ab131734"}, + {file = "pillow-11.0.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:224aaa38177597bb179f3ec87eeefcce8e4f85e608025e9cfac60de237ba6316"}, + {file = "pillow-11.0.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:5bd2d3bdb846d757055910f0a59792d33b555800813c3b39ada1829c372ccb06"}, + {file = "pillow-11.0.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:375b8dd15a1f5d2feafff536d47e22f69625c1aa92f12b339ec0b2ca40263273"}, + {file = "pillow-11.0.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:daffdf51ee5db69a82dd127eabecce20729e21f7a3680cf7cbb23f0829189790"}, + {file = "pillow-11.0.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7326a1787e3c7b0429659e0a944725e1b03eeaa10edd945a86dead1913383944"}, + {file = "pillow-11.0.0.tar.gz", hash = "sha256:72bacbaf24ac003fea9bff9837d1eedb6088758d41e100c1552930151f677739"}, ] [package.extras] -docs = ["furo", "olefile", "sphinx (>=7.3)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph"] +docs = ["furo", "olefile", "sphinx (>=8.1)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph"] fpx = ["olefile"] mic = ["olefile"] tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"] @@ -1580,49 +1503,49 @@ testing = ["pytest", "pytest-cov", "wheel"] [[package]] name = "platformdirs" -version = "4.2.2" +version = "4.3.6" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.8" files = [ - {file = "platformdirs-4.2.2-py3-none-any.whl", hash = "sha256:2d7a1657e36a80ea911db832a8a6ece5ee53d8de21edd5cc5879af6530b1bfee"}, - {file = "platformdirs-4.2.2.tar.gz", hash = "sha256:38b7b51f512eed9e84a22788b4bce1de17c0adb134d6becb09836e37d8654cd3"}, + {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, + {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, ] [package.extras] -docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] -type = ["mypy (>=1.8)"] +docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"] +type = ["mypy (>=1.11.2)"] [[package]] name = "playwright" -version = "1.46.0" +version = "1.48.0" description = "A high-level API to automate web browsers" optional = false python-versions = ">=3.8" files = [ - {file = "playwright-1.46.0-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:fa60b95c16f6ce954636229a6c9dd885485326bca52d5ba20d02c0bc731a2bbb"}, - {file = "playwright-1.46.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:73dcfc24834f4d004bc862ed0d74b4c1406793a8164734238ad035356fddc8ac"}, - {file = "playwright-1.46.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:f5acfec1dbdc84d02dc696a17a344227e66c91413eab2036428dab405f195b82"}, - {file = "playwright-1.46.0-py3-none-manylinux1_x86_64.whl", hash = "sha256:3b418509f45879f1403d070858657a39bd0b333b23d92c37355682b671726df9"}, - {file = "playwright-1.46.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:23580f6a3f99757bb9779d29be37144cb9328cd9bafa178e6db5b3ab4b7faf4c"}, - {file = "playwright-1.46.0-py3-none-win32.whl", hash = "sha256:85f44dd32a23d02850f0ff4dafe51580e5199531fff5121a62489d9838707782"}, - {file = "playwright-1.46.0-py3-none-win_amd64.whl", hash = "sha256:f14a7fd7e24e954eec6ce61d787d499e41937ade811a0818e9a088aabe28ebb6"}, + {file = "playwright-1.48.0-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:082bce2739f1078acc7d0734da8cc0e23eb91b7fae553f3316d733276f09a6b1"}, + {file = "playwright-1.48.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7da2eb51a19c7f3b523e9faa9d98e7af92e52eb983a099979ea79c9668e3cbf7"}, + {file = "playwright-1.48.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:115b988d1da322358b77bc3bf2d3cc90f8c881e691461538e7df91614c4833c9"}, + {file = "playwright-1.48.0-py3-none-manylinux1_x86_64.whl", hash = "sha256:8dabb80e62f667fe2640a8b694e26a7b884c0b4803f7514a3954fc849126227b"}, + {file = "playwright-1.48.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8ff8303409ebed76bed4c3d655340320b768817d900ba208b394fdd7d7939a5c"}, + {file = "playwright-1.48.0-py3-none-win32.whl", hash = "sha256:85598c360c590076d4f435525be991246d74a905b654ac19d26eab7ed9b98b2d"}, + {file = "playwright-1.48.0-py3-none-win_amd64.whl", hash = "sha256:e0e87b0c4dc8fce83c725dd851aec37bc4e882bb225ec8a96bd83cf32d4f1623"}, ] [package.dependencies] -greenlet = "3.0.3" -pyee = "11.1.0" +greenlet = "3.1.1" +pyee = "12.0.0" [[package]] name = "plotly" -version = "5.24.0" +version = "5.24.1" description = "An open-source, interactive data visualization library for Python" optional = false python-versions = ">=3.8" files = [ - {file = "plotly-5.24.0-py3-none-any.whl", hash = "sha256:0e54efe52c8cef899f7daa41be9ed97dfb6be622613a2a8f56a86a0634b2b67e"}, - {file = "plotly-5.24.0.tar.gz", hash = "sha256:eae9f4f54448682442c92c1e97148e3ad0c52f0cf86306e1b76daba24add554a"}, + {file = "plotly-5.24.1-py3-none-any.whl", hash = "sha256:f67073a1e637eb0dc3e46324d9d51e2fe76e9727c892dde64ddf1e1b51f29089"}, + {file = "plotly-5.24.1.tar.gz", hash = "sha256:dbc8ac8339d248a4bcc36e08a5659bacfe1b079390b8953533f4eb22169b4bae"}, ] [package.dependencies] @@ -1646,13 +1569,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pre-commit" -version = "3.5.0" +version = "4.0.1" description = "A framework for managing and maintaining multi-language pre-commit hooks." optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "pre_commit-3.5.0-py2.py3-none-any.whl", hash = "sha256:841dc9aef25daba9a0238cd27984041fa0467b4199fc4852e27950664919f660"}, - {file = "pre_commit-3.5.0.tar.gz", hash = "sha256:5804465c675b659b0862f07907f96295d490822a450c4c40e747d0b1c6ebcb32"}, + {file = "pre_commit-4.0.1-py2.py3-none-any.whl", hash = "sha256:efde913840816312445dc98787724647c65473daefe420785f885e8ed9a06878"}, + {file = "pre_commit-4.0.1.tar.gz", hash = "sha256:80905ac375958c0444c65e9cebebd948b3cdb518f335a091a670a89d652139d2"}, ] [package.dependencies] @@ -1664,32 +1587,33 @@ virtualenv = ">=20.10.0" [[package]] name = "psutil" -version = "6.0.0" +version = "6.1.0" description = "Cross-platform lib for process and system monitoring in Python." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ - {file = "psutil-6.0.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:a021da3e881cd935e64a3d0a20983bda0bb4cf80e4f74fa9bfcb1bc5785360c6"}, - {file = "psutil-6.0.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:1287c2b95f1c0a364d23bc6f2ea2365a8d4d9b726a3be7294296ff7ba97c17f0"}, - {file = "psutil-6.0.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:a9a3dbfb4de4f18174528d87cc352d1f788b7496991cca33c6996f40c9e3c92c"}, - {file = "psutil-6.0.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:6ec7588fb3ddaec7344a825afe298db83fe01bfaaab39155fa84cf1c0d6b13c3"}, - {file = "psutil-6.0.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:1e7c870afcb7d91fdea2b37c24aeb08f98b6d67257a5cb0a8bc3ac68d0f1a68c"}, - {file = "psutil-6.0.0-cp27-none-win32.whl", hash = "sha256:02b69001f44cc73c1c5279d02b30a817e339ceb258ad75997325e0e6169d8b35"}, - {file = "psutil-6.0.0-cp27-none-win_amd64.whl", hash = "sha256:21f1fb635deccd510f69f485b87433460a603919b45e2a324ad65b0cc74f8fb1"}, - {file = "psutil-6.0.0-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:c588a7e9b1173b6e866756dde596fd4cad94f9399daf99ad8c3258b3cb2b47a0"}, - {file = "psutil-6.0.0-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ed2440ada7ef7d0d608f20ad89a04ec47d2d3ab7190896cd62ca5fc4fe08bf0"}, - {file = "psutil-6.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fd9a97c8e94059b0ef54a7d4baf13b405011176c3b6ff257c247cae0d560ecd"}, - {file = "psutil-6.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e2e8d0054fc88153ca0544f5c4d554d42e33df2e009c4ff42284ac9ebdef4132"}, - {file = "psutil-6.0.0-cp36-cp36m-win32.whl", hash = "sha256:fc8c9510cde0146432bbdb433322861ee8c3efbf8589865c8bf8d21cb30c4d14"}, - {file = "psutil-6.0.0-cp36-cp36m-win_amd64.whl", hash = "sha256:34859b8d8f423b86e4385ff3665d3f4d94be3cdf48221fbe476e883514fdb71c"}, - {file = "psutil-6.0.0-cp37-abi3-win32.whl", hash = "sha256:a495580d6bae27291324fe60cea0b5a7c23fa36a7cd35035a16d93bdcf076b9d"}, - {file = "psutil-6.0.0-cp37-abi3-win_amd64.whl", hash = "sha256:33ea5e1c975250a720b3a6609c490db40dae5d83a4eb315170c4fe0d8b1f34b3"}, - {file = "psutil-6.0.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:ffe7fc9b6b36beadc8c322f84e1caff51e8703b88eee1da46d1e3a6ae11b4fd0"}, - {file = "psutil-6.0.0.tar.gz", hash = "sha256:8faae4f310b6d969fa26ca0545338b21f73c6b15db7c4a8d934a5482faa818f2"}, + {file = "psutil-6.1.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:ff34df86226c0227c52f38b919213157588a678d049688eded74c76c8ba4a5d0"}, + {file = "psutil-6.1.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:c0e0c00aa18ca2d3b2b991643b799a15fc8f0563d2ebb6040f64ce8dc027b942"}, + {file = "psutil-6.1.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:000d1d1ebd634b4efb383f4034437384e44a6d455260aaee2eca1e9c1b55f047"}, + {file = "psutil-6.1.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:5cd2bcdc75b452ba2e10f0e8ecc0b57b827dd5d7aaffbc6821b2a9a242823a76"}, + {file = "psutil-6.1.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:045f00a43c737f960d273a83973b2511430d61f283a44c96bf13a6e829ba8fdc"}, + {file = "psutil-6.1.0-cp27-none-win32.whl", hash = "sha256:9118f27452b70bb1d9ab3198c1f626c2499384935aaf55388211ad982611407e"}, + {file = "psutil-6.1.0-cp27-none-win_amd64.whl", hash = "sha256:a8506f6119cff7015678e2bce904a4da21025cc70ad283a53b099e7620061d85"}, + {file = "psutil-6.1.0-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:6e2dcd475ce8b80522e51d923d10c7871e45f20918e027ab682f94f1c6351688"}, + {file = "psutil-6.1.0-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:0895b8414afafc526712c498bd9de2b063deaac4021a3b3c34566283464aff8e"}, + {file = "psutil-6.1.0-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9dcbfce5d89f1d1f2546a2090f4fcf87c7f669d1d90aacb7d7582addece9fb38"}, + {file = "psutil-6.1.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:498c6979f9c6637ebc3a73b3f87f9eb1ec24e1ce53a7c5173b8508981614a90b"}, + {file = "psutil-6.1.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d905186d647b16755a800e7263d43df08b790d709d575105d419f8b6ef65423a"}, + {file = "psutil-6.1.0-cp36-cp36m-win32.whl", hash = "sha256:6d3fbbc8d23fcdcb500d2c9f94e07b1342df8ed71b948a2649b5cb060a7c94ca"}, + {file = "psutil-6.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:1209036fbd0421afde505a4879dee3b2fd7b1e14fee81c0069807adcbbcca747"}, + {file = "psutil-6.1.0-cp37-abi3-win32.whl", hash = "sha256:1ad45a1f5d0b608253b11508f80940985d1d0c8f6111b5cb637533a0e6ddc13e"}, + {file = "psutil-6.1.0-cp37-abi3-win_amd64.whl", hash = "sha256:a8fb3752b491d246034fa4d279ff076501588ce8cbcdbb62c32fd7a377d996be"}, + {file = "psutil-6.1.0.tar.gz", hash = "sha256:353815f59a7f64cdaca1c0307ee13558a0512f6db064e92fe833784f08539c7a"}, ] [package.extras] -test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"] +dev = ["black", "check-manifest", "coverage", "packaging", "pylint", "pyperf", "pypinfo", "pytest-cov", "requests", "rstcheck", "ruff", "sphinx", "sphinx_rtd_theme", "toml-sort", "twine", "virtualenv", "wheel"] +test = ["pytest", "pytest-xdist", "setuptools"] [[package]] name = "py-cpuinfo" @@ -1715,123 +1639,123 @@ files = [ [[package]] name = "pydantic" -version = "2.9.0" +version = "2.9.2" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic-2.9.0-py3-none-any.whl", hash = "sha256:f66a7073abd93214a20c5f7b32d56843137a7a2e70d02111f3be287035c45370"}, - {file = "pydantic-2.9.0.tar.gz", hash = "sha256:c7a8a9fdf7d100afa49647eae340e2d23efa382466a8d177efcd1381e9be5598"}, + {file = "pydantic-2.9.2-py3-none-any.whl", hash = "sha256:f048cec7b26778210e28a0459867920654d48e5e62db0958433636cde4254f12"}, + {file = "pydantic-2.9.2.tar.gz", hash = "sha256:d155cef71265d1e9807ed1c32b4c8deec042a44a50a4188b25ac67ecd81a9c0f"}, ] [package.dependencies] -annotated-types = ">=0.4.0" -pydantic-core = "2.23.2" +annotated-types = ">=0.6.0" +pydantic-core = "2.23.4" typing-extensions = [ - {version = ">=4.6.1", markers = "python_version < \"3.13\""}, {version = ">=4.12.2", markers = "python_version >= \"3.13\""}, + {version = ">=4.6.1", markers = "python_version < \"3.13\""}, ] -tzdata = {version = "*", markers = "python_version >= \"3.9\""} [package.extras] email = ["email-validator (>=2.0.0)"] +timezone = ["tzdata"] [[package]] name = "pydantic-core" -version = "2.23.2" +version = "2.23.4" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic_core-2.23.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:7d0324a35ab436c9d768753cbc3c47a865a2cbc0757066cb864747baa61f6ece"}, - {file = "pydantic_core-2.23.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:276ae78153a94b664e700ac362587c73b84399bd1145e135287513442e7dfbc7"}, - {file = "pydantic_core-2.23.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:964c7aa318da542cdcc60d4a648377ffe1a2ef0eb1e996026c7f74507b720a78"}, - {file = "pydantic_core-2.23.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1cf842265a3a820ebc6388b963ead065f5ce8f2068ac4e1c713ef77a67b71f7c"}, - {file = "pydantic_core-2.23.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ae90b9e50fe1bd115b24785e962b51130340408156d34d67b5f8f3fa6540938e"}, - {file = "pydantic_core-2.23.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ae65fdfb8a841556b52935dfd4c3f79132dc5253b12c0061b96415208f4d622"}, - {file = "pydantic_core-2.23.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5c8aa40f6ca803f95b1c1c5aeaee6237b9e879e4dfb46ad713229a63651a95fb"}, - {file = "pydantic_core-2.23.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c53100c8ee5a1e102766abde2158077d8c374bee0639201f11d3032e3555dfbc"}, - {file = "pydantic_core-2.23.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d6b9dd6aa03c812017411734e496c44fef29b43dba1e3dd1fa7361bbacfc1354"}, - {file = "pydantic_core-2.23.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b18cf68255a476b927910c6873d9ed00da692bb293c5b10b282bd48a0afe3ae2"}, - {file = "pydantic_core-2.23.2-cp310-none-win32.whl", hash = "sha256:e460475719721d59cd54a350c1f71c797c763212c836bf48585478c5514d2854"}, - {file = "pydantic_core-2.23.2-cp310-none-win_amd64.whl", hash = "sha256:5f3cf3721eaf8741cffaf092487f1ca80831202ce91672776b02b875580e174a"}, - {file = "pydantic_core-2.23.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:7ce8e26b86a91e305858e018afc7a6e932f17428b1eaa60154bd1f7ee888b5f8"}, - {file = "pydantic_core-2.23.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7e9b24cca4037a561422bf5dc52b38d390fb61f7bfff64053ce1b72f6938e6b2"}, - {file = "pydantic_core-2.23.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:753294d42fb072aa1775bfe1a2ba1012427376718fa4c72de52005a3d2a22178"}, - {file = "pydantic_core-2.23.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:257d6a410a0d8aeb50b4283dea39bb79b14303e0fab0f2b9d617701331ed1515"}, - {file = "pydantic_core-2.23.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c8319e0bd6a7b45ad76166cc3d5d6a36c97d0c82a196f478c3ee5346566eebfd"}, - {file = "pydantic_core-2.23.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7a05c0240f6c711eb381ac392de987ee974fa9336071fb697768dfdb151345ce"}, - {file = "pydantic_core-2.23.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d5b0ff3218858859910295df6953d7bafac3a48d5cd18f4e3ed9999efd2245f"}, - {file = "pydantic_core-2.23.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:96ef39add33ff58cd4c112cbac076726b96b98bb8f1e7f7595288dcfb2f10b57"}, - {file = "pydantic_core-2.23.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0102e49ac7d2df3379ef8d658d3bc59d3d769b0bdb17da189b75efa861fc07b4"}, - {file = "pydantic_core-2.23.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a6612c2a844043e4d10a8324c54cdff0042c558eef30bd705770793d70b224aa"}, - {file = "pydantic_core-2.23.2-cp311-none-win32.whl", hash = "sha256:caffda619099cfd4f63d48462f6aadbecee3ad9603b4b88b60cb821c1b258576"}, - {file = "pydantic_core-2.23.2-cp311-none-win_amd64.whl", hash = "sha256:6f80fba4af0cb1d2344869d56430e304a51396b70d46b91a55ed4959993c0589"}, - {file = "pydantic_core-2.23.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:4c83c64d05ffbbe12d4e8498ab72bdb05bcc1026340a4a597dc647a13c1605ec"}, - {file = "pydantic_core-2.23.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6294907eaaccf71c076abdd1c7954e272efa39bb043161b4b8aa1cd76a16ce43"}, - {file = "pydantic_core-2.23.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4a801c5e1e13272e0909c520708122496647d1279d252c9e6e07dac216accc41"}, - {file = "pydantic_core-2.23.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cc0c316fba3ce72ac3ab7902a888b9dc4979162d320823679da270c2d9ad0cad"}, - {file = "pydantic_core-2.23.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6b06c5d4e8701ac2ba99a2ef835e4e1b187d41095a9c619c5b185c9068ed2a49"}, - {file = "pydantic_core-2.23.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:82764c0bd697159fe9947ad59b6db6d7329e88505c8f98990eb07e84cc0a5d81"}, - {file = "pydantic_core-2.23.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2b1a195efd347ede8bcf723e932300292eb13a9d2a3c1f84eb8f37cbbc905b7f"}, - {file = "pydantic_core-2.23.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b7efb12e5071ad8d5b547487bdad489fbd4a5a35a0fc36a1941517a6ad7f23e0"}, - {file = "pydantic_core-2.23.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:5dd0ec5f514ed40e49bf961d49cf1bc2c72e9b50f29a163b2cc9030c6742aa73"}, - {file = "pydantic_core-2.23.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:820f6ee5c06bc868335e3b6e42d7ef41f50dfb3ea32fbd523ab679d10d8741c0"}, - {file = "pydantic_core-2.23.2-cp312-none-win32.whl", hash = "sha256:3713dc093d5048bfaedbba7a8dbc53e74c44a140d45ede020dc347dda18daf3f"}, - {file = "pydantic_core-2.23.2-cp312-none-win_amd64.whl", hash = "sha256:e1895e949f8849bc2757c0dbac28422a04be031204df46a56ab34bcf98507342"}, - {file = "pydantic_core-2.23.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:da43cbe593e3c87d07108d0ebd73771dc414488f1f91ed2e204b0370b94b37ac"}, - {file = "pydantic_core-2.23.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:64d094ea1aa97c6ded4748d40886076a931a8bf6f61b6e43e4a1041769c39dd2"}, - {file = "pydantic_core-2.23.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:084414ffe9a85a52940b49631321d636dadf3576c30259607b75516d131fecd0"}, - {file = "pydantic_core-2.23.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:043ef8469f72609c4c3a5e06a07a1f713d53df4d53112c6d49207c0bd3c3bd9b"}, - {file = "pydantic_core-2.23.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3649bd3ae6a8ebea7dc381afb7f3c6db237fc7cebd05c8ac36ca8a4187b03b30"}, - {file = "pydantic_core-2.23.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6db09153d8438425e98cdc9a289c5fade04a5d2128faff8f227c459da21b9703"}, - {file = "pydantic_core-2.23.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5668b3173bb0b2e65020b60d83f5910a7224027232c9f5dc05a71a1deac9f960"}, - {file = "pydantic_core-2.23.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1c7b81beaf7c7ebde978377dc53679c6cba0e946426fc7ade54251dfe24a7604"}, - {file = "pydantic_core-2.23.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:ae579143826c6f05a361d9546446c432a165ecf1c0b720bbfd81152645cb897d"}, - {file = "pydantic_core-2.23.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:19f1352fe4b248cae22a89268720fc74e83f008057a652894f08fa931e77dced"}, - {file = "pydantic_core-2.23.2-cp313-none-win32.whl", hash = "sha256:e1a79ad49f346aa1a2921f31e8dbbab4d64484823e813a002679eaa46cba39e1"}, - {file = "pydantic_core-2.23.2-cp313-none-win_amd64.whl", hash = "sha256:582871902e1902b3c8e9b2c347f32a792a07094110c1bca6c2ea89b90150caac"}, - {file = "pydantic_core-2.23.2-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:743e5811b0c377eb830150d675b0847a74a44d4ad5ab8845923d5b3a756d8100"}, - {file = "pydantic_core-2.23.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:6650a7bbe17a2717167e3e23c186849bae5cef35d38949549f1c116031b2b3aa"}, - {file = "pydantic_core-2.23.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:56e6a12ec8d7679f41b3750ffa426d22b44ef97be226a9bab00a03365f217b2b"}, - {file = "pydantic_core-2.23.2-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:810ca06cca91de9107718dc83d9ac4d2e86efd6c02cba49a190abcaf33fb0472"}, - {file = "pydantic_core-2.23.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:785e7f517ebb9890813d31cb5d328fa5eda825bb205065cde760b3150e4de1f7"}, - {file = "pydantic_core-2.23.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ef71ec876fcc4d3bbf2ae81961959e8d62f8d74a83d116668409c224012e3af"}, - {file = "pydantic_core-2.23.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d50ac34835c6a4a0d456b5db559b82047403c4317b3bc73b3455fefdbdc54b0a"}, - {file = "pydantic_core-2.23.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:16b25a4a120a2bb7dab51b81e3d9f3cde4f9a4456566c403ed29ac81bf49744f"}, - {file = "pydantic_core-2.23.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:41ae8537ad371ec018e3c5da0eb3f3e40ee1011eb9be1da7f965357c4623c501"}, - {file = "pydantic_core-2.23.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:07049ec9306ec64e955b2e7c40c8d77dd78ea89adb97a2013d0b6e055c5ee4c5"}, - {file = "pydantic_core-2.23.2-cp38-none-win32.whl", hash = "sha256:086c5db95157dc84c63ff9d96ebb8856f47ce113c86b61065a066f8efbe80acf"}, - {file = "pydantic_core-2.23.2-cp38-none-win_amd64.whl", hash = "sha256:67b6655311b00581914aba481729971b88bb8bc7996206590700a3ac85e457b8"}, - {file = "pydantic_core-2.23.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:358331e21a897151e54d58e08d0219acf98ebb14c567267a87e971f3d2a3be59"}, - {file = "pydantic_core-2.23.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c4d9f15ffe68bcd3898b0ad7233af01b15c57d91cd1667f8d868e0eacbfe3f87"}, - {file = "pydantic_core-2.23.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0123655fedacf035ab10c23450163c2f65a4174f2bb034b188240a6cf06bb123"}, - {file = "pydantic_core-2.23.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e6e3ccebdbd6e53474b0bb7ab8b88e83c0cfe91484b25e058e581348ee5a01a5"}, - {file = "pydantic_core-2.23.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fc535cb898ef88333cf317777ecdfe0faac1c2a3187ef7eb061b6f7ecf7e6bae"}, - {file = "pydantic_core-2.23.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aab9e522efff3993a9e98ab14263d4e20211e62da088298089a03056980a3e69"}, - {file = "pydantic_core-2.23.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05b366fb8fe3d8683b11ac35fa08947d7b92be78ec64e3277d03bd7f9b7cda79"}, - {file = "pydantic_core-2.23.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7568f682c06f10f30ef643a1e8eec4afeecdafde5c4af1b574c6df079e96f96c"}, - {file = "pydantic_core-2.23.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:cdd02a08205dc90238669f082747612cb3c82bd2c717adc60f9b9ecadb540f80"}, - {file = "pydantic_core-2.23.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:1a2ab4f410f4b886de53b6bddf5dd6f337915a29dd9f22f20f3099659536b2f6"}, - {file = "pydantic_core-2.23.2-cp39-none-win32.whl", hash = "sha256:0448b81c3dfcde439551bb04a9f41d7627f676b12701865c8a2574bcea034437"}, - {file = "pydantic_core-2.23.2-cp39-none-win_amd64.whl", hash = "sha256:4cebb9794f67266d65e7e4cbe5dcf063e29fc7b81c79dc9475bd476d9534150e"}, - {file = "pydantic_core-2.23.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:e758d271ed0286d146cf7c04c539a5169a888dd0b57026be621547e756af55bc"}, - {file = "pydantic_core-2.23.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:f477d26183e94eaafc60b983ab25af2a809a1b48ce4debb57b343f671b7a90b6"}, - {file = "pydantic_core-2.23.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da3131ef2b940b99106f29dfbc30d9505643f766704e14c5d5e504e6a480c35e"}, - {file = "pydantic_core-2.23.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:329a721253c7e4cbd7aad4a377745fbcc0607f9d72a3cc2102dd40519be75ed2"}, - {file = "pydantic_core-2.23.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7706e15cdbf42f8fab1e6425247dfa98f4a6f8c63746c995d6a2017f78e619ae"}, - {file = "pydantic_core-2.23.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:e64ffaf8f6e17ca15eb48344d86a7a741454526f3a3fa56bc493ad9d7ec63936"}, - {file = "pydantic_core-2.23.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:dd59638025160056687d598b054b64a79183f8065eae0d3f5ca523cde9943940"}, - {file = "pydantic_core-2.23.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:12625e69b1199e94b0ae1c9a95d000484ce9f0182f9965a26572f054b1537e44"}, - {file = "pydantic_core-2.23.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5d813fd871b3d5c3005157622ee102e8908ad6011ec915a18bd8fde673c4360e"}, - {file = "pydantic_core-2.23.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:1eb37f7d6a8001c0f86dc8ff2ee8d08291a536d76e49e78cda8587bb54d8b329"}, - {file = "pydantic_core-2.23.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ce7eaf9a98680b4312b7cebcdd9352531c43db00fca586115845df388f3c465"}, - {file = "pydantic_core-2.23.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f087879f1ffde024dd2788a30d55acd67959dcf6c431e9d3682d1c491a0eb474"}, - {file = "pydantic_core-2.23.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6ce883906810b4c3bd90e0ada1f9e808d9ecf1c5f0b60c6b8831d6100bcc7dd6"}, - {file = "pydantic_core-2.23.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:a8031074a397a5925d06b590121f8339d34a5a74cfe6970f8a1124eb8b83f4ac"}, - {file = "pydantic_core-2.23.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:23af245b8f2f4ee9e2c99cb3f93d0e22fb5c16df3f2f643f5a8da5caff12a653"}, - {file = "pydantic_core-2.23.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:c57e493a0faea1e4c38f860d6862ba6832723396c884fbf938ff5e9b224200e2"}, - {file = "pydantic_core-2.23.2.tar.gz", hash = "sha256:95d6bf449a1ac81de562d65d180af5d8c19672793c81877a2eda8fde5d08f2fd"}, + {file = "pydantic_core-2.23.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:b10bd51f823d891193d4717448fab065733958bdb6a6b351967bd349d48d5c9b"}, + {file = "pydantic_core-2.23.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4fc714bdbfb534f94034efaa6eadd74e5b93c8fa6315565a222f7b6f42ca1166"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63e46b3169866bd62849936de036f901a9356e36376079b05efa83caeaa02ceb"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed1a53de42fbe34853ba90513cea21673481cd81ed1be739f7f2efb931b24916"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cfdd16ab5e59fc31b5e906d1a3f666571abc367598e3e02c83403acabc092e07"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:255a8ef062cbf6674450e668482456abac99a5583bbafb73f9ad469540a3a232"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a7cd62e831afe623fbb7aabbb4fe583212115b3ef38a9f6b71869ba644624a2"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f09e2ff1f17c2b51f2bc76d1cc33da96298f0a036a137f5440ab3ec5360b624f"}, + {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e38e63e6f3d1cec5a27e0afe90a085af8b6806ee208b33030e65b6516353f1a3"}, + {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0dbd8dbed2085ed23b5c04afa29d8fd2771674223135dc9bc937f3c09284d071"}, + {file = "pydantic_core-2.23.4-cp310-none-win32.whl", hash = "sha256:6531b7ca5f951d663c339002e91aaebda765ec7d61b7d1e3991051906ddde119"}, + {file = "pydantic_core-2.23.4-cp310-none-win_amd64.whl", hash = "sha256:7c9129eb40958b3d4500fa2467e6a83356b3b61bfff1b414c7361d9220f9ae8f"}, + {file = "pydantic_core-2.23.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:77733e3892bb0a7fa797826361ce8a9184d25c8dffaec60b7ffe928153680ba8"}, + {file = "pydantic_core-2.23.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1b84d168f6c48fabd1f2027a3d1bdfe62f92cade1fb273a5d68e621da0e44e6d"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df49e7a0861a8c36d089c1ed57d308623d60416dab2647a4a17fe050ba85de0e"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ff02b6d461a6de369f07ec15e465a88895f3223eb75073ffea56b84d9331f607"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:996a38a83508c54c78a5f41456b0103c30508fed9abcad0a59b876d7398f25fd"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d97683ddee4723ae8c95d1eddac7c192e8c552da0c73a925a89fa8649bf13eea"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:216f9b2d7713eb98cb83c80b9c794de1f6b7e3145eef40400c62e86cee5f4e1e"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6f783e0ec4803c787bcea93e13e9932edab72068f68ecffdf86a99fd5918878b"}, + {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d0776dea117cf5272382634bd2a5c1b6eb16767c223c6a5317cd3e2a757c61a0"}, + {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d5f7a395a8cf1621939692dba2a6b6a830efa6b3cee787d82c7de1ad2930de64"}, + {file = "pydantic_core-2.23.4-cp311-none-win32.whl", hash = "sha256:74b9127ffea03643e998e0c5ad9bd3811d3dac8c676e47db17b0ee7c3c3bf35f"}, + {file = "pydantic_core-2.23.4-cp311-none-win_amd64.whl", hash = "sha256:98d134c954828488b153d88ba1f34e14259284f256180ce659e8d83e9c05eaa3"}, + {file = "pydantic_core-2.23.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f3e0da4ebaef65158d4dfd7d3678aad692f7666877df0002b8a522cdf088f231"}, + {file = "pydantic_core-2.23.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f69a8e0b033b747bb3e36a44e7732f0c99f7edd5cea723d45bc0d6e95377ffee"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:723314c1d51722ab28bfcd5240d858512ffd3116449c557a1336cbe3919beb87"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bb2802e667b7051a1bebbfe93684841cc9351004e2badbd6411bf357ab8d5ac8"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d18ca8148bebe1b0a382a27a8ee60350091a6ddaf475fa05ef50dc35b5df6327"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:33e3d65a85a2a4a0dc3b092b938a4062b1a05f3a9abde65ea93b233bca0e03f2"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:128585782e5bfa515c590ccee4b727fb76925dd04a98864182b22e89a4e6ed36"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:68665f4c17edcceecc112dfed5dbe6f92261fb9d6054b47d01bf6371a6196126"}, + {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:20152074317d9bed6b7a95ade3b7d6054845d70584216160860425f4fbd5ee9e"}, + {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:9261d3ce84fa1d38ed649c3638feefeae23d32ba9182963e465d58d62203bd24"}, + {file = "pydantic_core-2.23.4-cp312-none-win32.whl", hash = "sha256:4ba762ed58e8d68657fc1281e9bb72e1c3e79cc5d464be146e260c541ec12d84"}, + {file = "pydantic_core-2.23.4-cp312-none-win_amd64.whl", hash = "sha256:97df63000f4fea395b2824da80e169731088656d1818a11b95f3b173747b6cd9"}, + {file = "pydantic_core-2.23.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7530e201d10d7d14abce4fb54cfe5b94a0aefc87da539d0346a484ead376c3cc"}, + {file = "pydantic_core-2.23.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:df933278128ea1cd77772673c73954e53a1c95a4fdf41eef97c2b779271bd0bd"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cb3da3fd1b6a5d0279a01877713dbda118a2a4fc6f0d821a57da2e464793f05"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42c6dcb030aefb668a2b7009c85b27f90e51e6a3b4d5c9bc4c57631292015b0d"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:696dd8d674d6ce621ab9d45b205df149399e4bb9aa34102c970b721554828510"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2971bb5ffe72cc0f555c13e19b23c85b654dd2a8f7ab493c262071377bfce9f6"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8394d940e5d400d04cad4f75c0598665cbb81aecefaca82ca85bd28264af7f9b"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0dff76e0602ca7d4cdaacc1ac4c005e0ce0dcfe095d5b5259163a80d3a10d327"}, + {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7d32706badfe136888bdea71c0def994644e09fff0bfe47441deaed8e96fdbc6"}, + {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ed541d70698978a20eb63d8c5d72f2cc6d7079d9d90f6b50bad07826f1320f5f"}, + {file = "pydantic_core-2.23.4-cp313-none-win32.whl", hash = "sha256:3d5639516376dce1940ea36edf408c554475369f5da2abd45d44621cb616f769"}, + {file = "pydantic_core-2.23.4-cp313-none-win_amd64.whl", hash = "sha256:5a1504ad17ba4210df3a045132a7baeeba5a200e930f57512ee02909fc5c4cb5"}, + {file = "pydantic_core-2.23.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:d4488a93b071c04dc20f5cecc3631fc78b9789dd72483ba15d423b5b3689b555"}, + {file = "pydantic_core-2.23.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:81965a16b675b35e1d09dd14df53f190f9129c0202356ed44ab2728b1c905658"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ffa2ebd4c8530079140dd2d7f794a9d9a73cbb8e9d59ffe24c63436efa8f271"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:61817945f2fe7d166e75fbfb28004034b48e44878177fc54d81688e7b85a3665"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:29d2c342c4bc01b88402d60189f3df065fb0dda3654744d5a165a5288a657368"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5e11661ce0fd30a6790e8bcdf263b9ec5988e95e63cf901972107efc49218b13"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d18368b137c6295db49ce7218b1a9ba15c5bc254c96d7c9f9e924a9bc7825ad"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ec4e55f79b1c4ffb2eecd8a0cfba9955a2588497d96851f4c8f99aa4a1d39b12"}, + {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:374a5e5049eda9e0a44c696c7ade3ff355f06b1fe0bb945ea3cac2bc336478a2"}, + {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5c364564d17da23db1106787675fc7af45f2f7b58b4173bfdd105564e132e6fb"}, + {file = "pydantic_core-2.23.4-cp38-none-win32.whl", hash = "sha256:d7a80d21d613eec45e3d41eb22f8f94ddc758a6c4720842dc74c0581f54993d6"}, + {file = "pydantic_core-2.23.4-cp38-none-win_amd64.whl", hash = "sha256:5f5ff8d839f4566a474a969508fe1c5e59c31c80d9e140566f9a37bba7b8d556"}, + {file = "pydantic_core-2.23.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:a4fa4fc04dff799089689f4fd502ce7d59de529fc2f40a2c8836886c03e0175a"}, + {file = "pydantic_core-2.23.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0a7df63886be5e270da67e0966cf4afbae86069501d35c8c1b3b6c168f42cb36"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dcedcd19a557e182628afa1d553c3895a9f825b936415d0dbd3cd0bbcfd29b4b"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f54b118ce5de9ac21c363d9b3caa6c800341e8c47a508787e5868c6b79c9323"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86d2f57d3e1379a9525c5ab067b27dbb8a0642fb5d454e17a9ac434f9ce523e3"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:de6d1d1b9e5101508cb37ab0d972357cac5235f5c6533d1071964c47139257df"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1278e0d324f6908e872730c9102b0112477a7f7cf88b308e4fc36ce1bdb6d58c"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9a6b5099eeec78827553827f4c6b8615978bb4b6a88e5d9b93eddf8bb6790f55"}, + {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e55541f756f9b3ee346b840103f32779c695a19826a4c442b7954550a0972040"}, + {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a5c7ba8ffb6d6f8f2ab08743be203654bb1aaa8c9dcb09f82ddd34eadb695605"}, + {file = "pydantic_core-2.23.4-cp39-none-win32.whl", hash = "sha256:37b0fe330e4a58d3c58b24d91d1eb102aeec675a3db4c292ec3928ecd892a9a6"}, + {file = "pydantic_core-2.23.4-cp39-none-win_amd64.whl", hash = "sha256:1498bec4c05c9c787bde9125cfdcc63a41004ff167f495063191b863399b1a29"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f455ee30a9d61d3e1a15abd5068827773d6e4dc513e795f380cdd59932c782d5"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1e90d2e3bd2c3863d48525d297cd143fe541be8bbf6f579504b9712cb6b643ec"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e203fdf807ac7e12ab59ca2bfcabb38c7cf0b33c41efeb00f8e5da1d86af480"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e08277a400de01bc72436a0ccd02bdf596631411f592ad985dcee21445bd0068"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f220b0eea5965dec25480b6333c788fb72ce5f9129e8759ef876a1d805d00801"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:d06b0c8da4f16d1d1e352134427cb194a0a6e19ad5db9161bf32b2113409e728"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ba1a0996f6c2773bd83e63f18914c1de3c9dd26d55f4ac302a7efe93fb8e7433"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:9a5bce9d23aac8f0cf0836ecfc033896aa8443b501c58d0602dbfd5bd5b37753"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:78ddaaa81421a29574a682b3179d4cf9e6d405a09b99d93ddcf7e5239c742e21"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:883a91b5dd7d26492ff2f04f40fbb652de40fcc0afe07e8129e8ae779c2110eb"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:88ad334a15b32a791ea935af224b9de1bf99bcd62fabf745d5f3442199d86d59"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:233710f069d251feb12a56da21e14cca67994eab08362207785cf8c598e74577"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:19442362866a753485ba5e4be408964644dd6a09123d9416c54cd49171f50744"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:624e278a7d29b6445e4e813af92af37820fafb6dcc55c012c834f9e26f9aaaef"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f5ef8f42bec47f21d07668a043f077d507e5bf4e668d5c6dfe6aaba89de1a5b8"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:aea443fffa9fbe3af1a9ba721a87f926fe548d32cab71d188a6ede77d0ff244e"}, + {file = "pydantic_core-2.23.4.tar.gz", hash = "sha256:2584f7cf844ac4d970fba483a717dbe10c1c1c96a969bf65d61ffe94df1b2863"}, ] [package.dependencies] @@ -1839,13 +1763,13 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] name = "pyee" -version = "11.1.0" +version = "12.0.0" description = "A rough port of Node.js's EventEmitter to Python with a few tricks of its own" optional = false python-versions = ">=3.8" files = [ - {file = "pyee-11.1.0-py3-none-any.whl", hash = "sha256:5d346a7d0f861a4b2e6c47960295bd895f816725b27d656181947346be98d7c1"}, - {file = "pyee-11.1.0.tar.gz", hash = "sha256:b53af98f6990c810edd9b56b87791021a8f54fd13db4edd1142438d44ba2263f"}, + {file = "pyee-12.0.0-py3-none-any.whl", hash = "sha256:7b14b74320600049ccc7d0e0b1becd3b4bd0a03c745758225e31a59f4095c990"}, + {file = "pyee-12.0.0.tar.gz", hash = "sha256:c480603f4aa2927d4766eb41fa82793fe60a82cbfdb8d688e0d08c55a534e145"}, ] [package.dependencies] @@ -1870,13 +1794,13 @@ windows-terminal = ["colorama (>=0.4.6)"] [[package]] name = "pyproject-hooks" -version = "1.1.0" +version = "1.2.0" description = "Wrappers to call pyproject.toml-based build backend hooks." optional = false python-versions = ">=3.7" files = [ - {file = "pyproject_hooks-1.1.0-py3-none-any.whl", hash = "sha256:7ceeefe9aec63a1064c18d939bdc3adf2d8aa1988a510afec15151578b232aa2"}, - {file = "pyproject_hooks-1.1.0.tar.gz", hash = "sha256:4b37730834edbd6bd37f26ece6b44802fb1c1ee2ece0e54ddff8bfc06db86965"}, + {file = "pyproject_hooks-1.2.0-py3-none-any.whl", hash = "sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913"}, + {file = "pyproject_hooks-1.2.0.tar.gz", hash = "sha256:1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8"}, ] [[package]] @@ -1911,13 +1835,13 @@ files = [ [[package]] name = "pytest" -version = "7.4.4" +version = "8.3.3" description = "pytest: simple powerful testing with Python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, - {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, + {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"}, + {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"}, ] [package.dependencies] @@ -1925,29 +1849,29 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} +pluggy = ">=1.5,<2" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pytest-asyncio" -version = "0.21.2" +version = "0.24.0" description = "Pytest support for asyncio" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pytest_asyncio-0.21.2-py3-none-any.whl", hash = "sha256:ab664c88bb7998f711d8039cacd4884da6430886ae8bbd4eded552ed2004f16b"}, - {file = "pytest_asyncio-0.21.2.tar.gz", hash = "sha256:d67738fc232b94b326b9d060750beb16e0074210b98dd8b58a5239fa2a154f45"}, + {file = "pytest_asyncio-0.24.0-py3-none-any.whl", hash = "sha256:a811296ed596b69bf0b6f3dc40f83bcaf341b155a269052d82efa2b25ac7037b"}, + {file = "pytest_asyncio-0.24.0.tar.gz", hash = "sha256:d081d828e576d85f875399194281e92bf8a68d60d72d1a2faf2feddb6c46b276"}, ] [package.dependencies] -pytest = ">=7.0.0" +pytest = ">=8.2,<9" [package.extras] docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] -testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] +testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"] [[package]] name = "pytest-base-url" @@ -1989,13 +1913,13 @@ histogram = ["pygal", "pygaljs"] [[package]] name = "pytest-cov" -version = "4.1.0" +version = "5.0.0" description = "Pytest plugin for measuring coverage." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pytest-cov-4.1.0.tar.gz", hash = "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6"}, - {file = "pytest_cov-4.1.0-py3-none-any.whl", hash = "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a"}, + {file = "pytest-cov-5.0.0.tar.gz", hash = "sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857"}, + {file = "pytest_cov-5.0.0-py3-none-any.whl", hash = "sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652"}, ] [package.dependencies] @@ -2003,7 +1927,7 @@ coverage = {version = ">=5.2.1", extras = ["toml"]} pytest = ">=4.6" [package.extras] -testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "virtualenv"] [[package]] name = "pytest-mock" @@ -2053,15 +1977,29 @@ files = [ [package.dependencies] six = ">=1.5" +[[package]] +name = "python-dotenv" +version = "1.0.1" +description = "Read key-value pairs from a .env file and set them as environment variables" +optional = false +python-versions = ">=3.8" +files = [ + {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"}, + {file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"}, +] + +[package.extras] +cli = ["click (>=5.0)"] + [[package]] name = "python-engineio" -version = "4.9.1" +version = "4.10.1" description = "Engine.IO server and client for Python" optional = false python-versions = ">=3.6" files = [ - {file = "python_engineio-4.9.1-py3-none-any.whl", hash = "sha256:f995e702b21f6b9ebde4e2000cd2ad0112ba0e5116ec8d22fe3515e76ba9dddd"}, - {file = "python_engineio-4.9.1.tar.gz", hash = "sha256:7631cf5563086076611e494c643b3fa93dd3a854634b5488be0bba0ef9b99709"}, + {file = "python_engineio-4.10.1-py3-none-any.whl", hash = "sha256:445a94004ec8034960ab99e7ce4209ec619c6e6b6a12aedcb05abeab924025c0"}, + {file = "python_engineio-4.10.1.tar.gz", hash = "sha256:166cea8dd7429638c5c4e3a4895beae95196e860bc6f29ed0b9fe753d1ef2072"}, ] [package.dependencies] @@ -2074,18 +2012,15 @@ docs = ["sphinx"] [[package]] name = "python-multipart" -version = "0.0.9" +version = "0.0.12" description = "A streaming multipart parser for Python" optional = false python-versions = ">=3.8" files = [ - {file = "python_multipart-0.0.9-py3-none-any.whl", hash = "sha256:97ca7b8ea7b05f977dc3849c3ba99d51689822fab725c3703af7c866a0c2b215"}, - {file = "python_multipart-0.0.9.tar.gz", hash = "sha256:03f54688c663f1b7977105f021043b0793151e4cb1c1a9d4a11fc13d622c4026"}, + {file = "python_multipart-0.0.12-py3-none-any.whl", hash = "sha256:43dcf96cf65888a9cd3423544dd0d75ac10f7aa0c3c28a175bbcd00c9ce1aebf"}, + {file = "python_multipart-0.0.12.tar.gz", hash = "sha256:045e1f98d719c1ce085ed7f7e1ef9d8ccc8c02ba02b5566d5f7521410ced58cb"}, ] -[package.extras] -dev = ["atomicwrites (==1.4.1)", "attrs (==23.2.0)", "coverage (==7.4.1)", "hatch", "invoke (==2.2.0)", "more-itertools (==10.2.0)", "pbr (==6.0.0)", "pluggy (==1.4.0)", "py (==1.11.0)", "pytest (==8.0.0)", "pytest-cov (==4.1.0)", "pytest-timeout (==2.2.0)", "pyyaml (==6.0.1)", "ruff (==0.2.1)"] - [[package]] name = "python-slugify" version = "8.0.4" @@ -2125,13 +2060,13 @@ docs = ["sphinx"] [[package]] name = "pytz" -version = "2024.1" +version = "2024.2" description = "World timezone definitions, modern and historical" optional = false python-versions = "*" files = [ - {file = "pytz-2024.1-py2.py3-none-any.whl", hash = "sha256:328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319"}, - {file = "pytz-2024.1.tar.gz", hash = "sha256:2a29735ea9c18baf14b448846bde5a48030ed267578472d8955cd0e7443a9812"}, + {file = "pytz-2024.2-py2.py3-none-any.whl", hash = "sha256:31c7c1817eb7fae7ca4b8c7ee50c72f93aa2dd863de768e1ef4245d426aa0725"}, + {file = "pytz-2024.2.tar.gz", hash = "sha256:2aa355083c50a0f93fa581709deac0c9ad65cca8a9e9beac660adcbd493c798a"}, ] [[package]] @@ -2209,17 +2144,17 @@ files = [ [[package]] name = "readme-renderer" -version = "43.0" +version = "44.0" description = "readme_renderer is a library for rendering readme descriptions for Warehouse" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "readme_renderer-43.0-py3-none-any.whl", hash = "sha256:19db308d86ecd60e5affa3b2a98f017af384678c63c88e5d4556a380e674f3f9"}, - {file = "readme_renderer-43.0.tar.gz", hash = "sha256:1818dd28140813509eeed8d62687f7cd4f7bad90d4db586001c5dc09d4fde311"}, + {file = "readme_renderer-44.0-py3-none-any.whl", hash = "sha256:2fbca89b81a08526aadf1357a8c2ae889ec05fb03f5da67f9769c9a592166151"}, + {file = "readme_renderer-44.0.tar.gz", hash = "sha256:8712034eabbfa6805cacf1402b4eeb2a73028f72d1166d6f5cb7f9c047c5d1e1"}, ] [package.dependencies] -docutils = ">=0.13.1" +docutils = ">=0.21.2" nh3 = ">=0.2.14" Pygments = ">=2.5.1" @@ -2228,31 +2163,31 @@ md = ["cmarkgfm (>=0.8.0)"] [[package]] name = "redis" -version = "5.0.8" +version = "5.1.1" description = "Python client for Redis database and key-value store" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "redis-5.0.8-py3-none-any.whl", hash = "sha256:56134ee08ea909106090934adc36f65c9bcbbaecea5b21ba704ba6fb561f8eb4"}, - {file = "redis-5.0.8.tar.gz", hash = "sha256:0c5b10d387568dfe0698c6fad6615750c24170e548ca2deac10c649d463e9870"}, + {file = "redis-5.1.1-py3-none-any.whl", hash = "sha256:f8ea06b7482a668c6475ae202ed8d9bcaa409f6e87fb77ed1043d912afd62e24"}, + {file = "redis-5.1.1.tar.gz", hash = "sha256:f6c997521fedbae53387307c5d0bf784d9acc28d9f1d058abeac566ec4dbed72"}, ] [package.dependencies] async-timeout = {version = ">=4.0.3", markers = "python_full_version < \"3.11.3\""} [package.extras] -hiredis = ["hiredis (>1.0.0)"] -ocsp = ["cryptography (>=36.0.1)", "pyopenssl (==20.0.1)", "requests (>=2.26.0)"] +hiredis = ["hiredis (>=3.0.0)"] +ocsp = ["cryptography (>=36.0.1)", "pyopenssl (==23.2.1)", "requests (>=2.31.0)"] [[package]] name = "reflex-chakra" -version = "0.6.0a3" +version = "0.6.2" description = "reflex using chakra components" optional = false -python-versions = "<4.0,>=3.8" +python-versions = "<4.0,>=3.9" files = [ - {file = "reflex_chakra-0.6.0a3-py3-none-any.whl", hash = "sha256:5e7ab4c25b783e6176f123b6fe8993d225ebaed51a790bd3c17617272724884c"}, - {file = "reflex_chakra-0.6.0a3.tar.gz", hash = "sha256:71cde012b7249fda9194a5f652b3b7c1dc2f4d5b39b38f53fe7531f8d9ea5248"}, + {file = "reflex_chakra-0.6.2-py3-none-any.whl", hash = "sha256:b8aa19f39a02601c560b97f4b17f171c0b5980e13a58069e3a5dd0999e362e4f"}, + {file = "reflex_chakra-0.6.2.tar.gz", hash = "sha256:81ddb7f182cc454922cc817312755b799d4e1a49a46ef2e81305052dc76ef86d"}, ] [package.dependencies] @@ -2332,47 +2267,48 @@ idna2008 = ["idna"] [[package]] name = "rich" -version = "13.8.0" +version = "13.9.3" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" optional = false -python-versions = ">=3.7.0" +python-versions = ">=3.8.0" files = [ - {file = "rich-13.8.0-py3-none-any.whl", hash = "sha256:2e85306a063b9492dffc86278197a60cbece75bcb766022f3436f567cae11bdc"}, - {file = "rich-13.8.0.tar.gz", hash = "sha256:a5ac1f1cd448ade0d59cc3356f7db7a7ccda2c8cbae9c7a90c28ff463d3e91f4"}, + {file = "rich-13.9.3-py3-none-any.whl", hash = "sha256:9836f5096eb2172c9e77df411c1b009bace4193d6a481d534fea75ebba758283"}, + {file = "rich-13.9.3.tar.gz", hash = "sha256:bc1e01b899537598cf02579d2b9f4a415104d3fc439313a7a2c165d76557a08e"}, ] [package.dependencies] markdown-it-py = ">=2.2.0" pygments = ">=2.13.0,<3.0.0" -typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9\""} +typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.11\""} [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "ruff" -version = "0.4.10" +version = "0.7.0" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.4.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:5c2c4d0859305ac5a16310eec40e4e9a9dec5dcdfbe92697acd99624e8638dac"}, - {file = "ruff-0.4.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:a79489607d1495685cdd911a323a35871abfb7a95d4f98fc6f85e799227ac46e"}, - {file = "ruff-0.4.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b1dd1681dfa90a41b8376a61af05cc4dc5ff32c8f14f5fe20dba9ff5deb80cd6"}, - {file = "ruff-0.4.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c75c53bb79d71310dc79fb69eb4902fba804a81f374bc86a9b117a8d077a1784"}, - {file = "ruff-0.4.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:18238c80ee3d9100d3535d8eb15a59c4a0753b45cc55f8bf38f38d6a597b9739"}, - {file = "ruff-0.4.10-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:d8f71885bce242da344989cae08e263de29752f094233f932d4f5cfb4ef36a81"}, - {file = "ruff-0.4.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:330421543bd3222cdfec481e8ff3460e8702ed1e58b494cf9d9e4bf90db52b9d"}, - {file = "ruff-0.4.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9e9b6fb3a37b772628415b00c4fc892f97954275394ed611056a4b8a2631365e"}, - {file = "ruff-0.4.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f54c481b39a762d48f64d97351048e842861c6662d63ec599f67d515cb417f6"}, - {file = "ruff-0.4.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:67fe086b433b965c22de0b4259ddfe6fa541c95bf418499bedb9ad5fb8d1c631"}, - {file = "ruff-0.4.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:acfaaab59543382085f9eb51f8e87bac26bf96b164839955f244d07125a982ef"}, - {file = "ruff-0.4.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:3cea07079962b2941244191569cf3a05541477286f5cafea638cd3aa94b56815"}, - {file = "ruff-0.4.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:338a64ef0748f8c3a80d7f05785930f7965d71ca260904a9321d13be24b79695"}, - {file = "ruff-0.4.10-py3-none-win32.whl", hash = "sha256:ffe3cd2f89cb54561c62e5fa20e8f182c0a444934bf430515a4b422f1ab7b7ca"}, - {file = "ruff-0.4.10-py3-none-win_amd64.whl", hash = "sha256:67f67cef43c55ffc8cc59e8e0b97e9e60b4837c8f21e8ab5ffd5d66e196e25f7"}, - {file = "ruff-0.4.10-py3-none-win_arm64.whl", hash = "sha256:dd1fcee327c20addac7916ca4e2653fbbf2e8388d8a6477ce5b4e986b68ae6c0"}, - {file = "ruff-0.4.10.tar.gz", hash = "sha256:3aa4f2bc388a30d346c56524f7cacca85945ba124945fe489952aadb6b5cd804"}, + {file = "ruff-0.7.0-py3-none-linux_armv6l.whl", hash = "sha256:0cdf20c2b6ff98e37df47b2b0bd3a34aaa155f59a11182c1303cce79be715628"}, + {file = "ruff-0.7.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:496494d350c7fdeb36ca4ef1c9f21d80d182423718782222c29b3e72b3512737"}, + {file = "ruff-0.7.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:214b88498684e20b6b2b8852c01d50f0651f3cc6118dfa113b4def9f14faaf06"}, + {file = "ruff-0.7.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:630fce3fefe9844e91ea5bbf7ceadab4f9981f42b704fae011bb8efcaf5d84be"}, + {file = "ruff-0.7.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:211d877674e9373d4bb0f1c80f97a0201c61bcd1e9d045b6e9726adc42c156aa"}, + {file = "ruff-0.7.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:194d6c46c98c73949a106425ed40a576f52291c12bc21399eb8f13a0f7073495"}, + {file = "ruff-0.7.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:82c2579b82b9973a110fab281860403b397c08c403de92de19568f32f7178598"}, + {file = "ruff-0.7.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9af971fe85dcd5eaed8f585ddbc6bdbe8c217fb8fcf510ea6bca5bdfff56040e"}, + {file = "ruff-0.7.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b641c7f16939b7d24b7bfc0be4102c56562a18281f84f635604e8a6989948914"}, + {file = "ruff-0.7.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d71672336e46b34e0c90a790afeac8a31954fd42872c1f6adaea1dff76fd44f9"}, + {file = "ruff-0.7.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ab7d98c7eed355166f367597e513a6c82408df4181a937628dbec79abb2a1fe4"}, + {file = "ruff-0.7.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1eb54986f770f49edb14f71d33312d79e00e629a57387382200b1ef12d6a4ef9"}, + {file = "ruff-0.7.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:dc452ba6f2bb9cf8726a84aa877061a2462afe9ae0ea1d411c53d226661c601d"}, + {file = "ruff-0.7.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:4b406c2dce5be9bad59f2de26139a86017a517e6bcd2688da515481c05a2cb11"}, + {file = "ruff-0.7.0-py3-none-win32.whl", hash = "sha256:f6c968509f767776f524a8430426539587d5ec5c662f6addb6aa25bc2e8195ec"}, + {file = "ruff-0.7.0-py3-none-win_amd64.whl", hash = "sha256:ff4aabfbaaba880e85d394603b9e75d32b0693152e16fa659a3064a85df7fce2"}, + {file = "ruff-0.7.0-py3-none-win_arm64.whl", hash = "sha256:10842f69c245e78d6adec7e1db0a7d9ddc2fff0621d730e61657b64fa36f207e"}, + {file = "ruff-0.7.0.tar.gz", hash = "sha256:47a86360cf62d9cd53ebfb0b5eb0e882193fc191c6d717e8bef4462bc3b9ea2b"}, ] [[package]] @@ -2392,13 +2328,13 @@ jeepney = ">=0.6" [[package]] name = "selenium" -version = "4.24.0" +version = "4.25.0" description = "Official Python bindings for Selenium WebDriver" optional = false python-versions = ">=3.8" files = [ - {file = "selenium-4.24.0-py3-none-any.whl", hash = "sha256:42c23f60753d5415b261b236cecbd69bd4eb5271e1563915f546b443cb6b71c6"}, - {file = "selenium-4.24.0.tar.gz", hash = "sha256:88281e5b5b90fe231868905d5ea745b9ee5e30db280b33498cc73fb0fa06d571"}, + {file = "selenium-4.25.0-py3-none-any.whl", hash = "sha256:3798d2d12b4a570bc5790163ba57fef10b2afee958bf1d80f2a3cf07c4141f33"}, + {file = "selenium-4.25.0.tar.gz", hash = "sha256:95d08d3b82fb353f3c474895154516604c7f0e6a9a565ae6498ef36c9bac6921"}, ] [package.dependencies] @@ -2411,18 +2347,23 @@ websocket-client = ">=1.8,<2.0" [[package]] name = "setuptools" -version = "70.1.1" +version = "75.2.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "setuptools-70.1.1-py3-none-any.whl", hash = "sha256:a58a8fde0541dab0419750bcc521fbdf8585f6e5cb41909df3a472ef7b81ca95"}, - {file = "setuptools-70.1.1.tar.gz", hash = "sha256:937a48c7cdb7a21eb53cd7f9b59e525503aa8abaf3584c730dc5f7a5bec3a650"}, + {file = "setuptools-75.2.0-py3-none-any.whl", hash = "sha256:a7fcb66f68b4d9e8e66b42f9876150a3371558f98fa32222ffaa5bced76406f8"}, + {file = "setuptools-75.2.0.tar.gz", hash = "sha256:753bb6ebf1f465a1912e19ed1d41f403a79173a9acf66a42e7e6aec45c3c16ec"}, ] [package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test", "mypy (==1.10.0)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.3.2)", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.5.2)"] +core = ["importlib-metadata (>=6)", "importlib-resources (>=5.10.2)", "jaraco.collections", "jaraco.functools", "jaraco.text (>=3.7)", "more-itertools", "more-itertools (>=8.8)", "packaging", "packaging (>=24)", "platformdirs (>=2.6.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] +cover = ["pytest-cov"] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"] +enabler = ["pytest-enabler (>=2.2)"] +test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] +type = ["importlib-metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (==1.11.*)", "pytest-mypy"] [[package]] name = "shellingham" @@ -2437,19 +2378,20 @@ files = [ [[package]] name = "simple-websocket" -version = "1.0.0" +version = "1.1.0" description = "Simple WebSocket server and client for Python" optional = false python-versions = ">=3.6" files = [ - {file = "simple-websocket-1.0.0.tar.gz", hash = "sha256:17d2c72f4a2bd85174a97e3e4c88b01c40c3f81b7b648b0cc3ce1305968928c8"}, - {file = "simple_websocket-1.0.0-py3-none-any.whl", hash = "sha256:1d5bf585e415eaa2083e2bcf02a3ecf91f9712e7b3e6b9fa0b461ad04e0837bc"}, + {file = "simple_websocket-1.1.0-py3-none-any.whl", hash = "sha256:4af6069630a38ed6c561010f0e11a5bc0d4ca569b36306eb257cd9a192497c8c"}, + {file = "simple_websocket-1.1.0.tar.gz", hash = "sha256:7939234e7aa067c534abdab3a9ed933ec9ce4691b0713c78acb195560aa52ae4"}, ] [package.dependencies] wsproto = "*" [package.extras] +dev = ["flake8", "pytest", "pytest-cov", "tox"] docs = ["sphinx"] [[package]] @@ -2487,60 +2429,68 @@ files = [ [[package]] name = "sqlalchemy" -version = "2.0.34" +version = "2.0.36" description = "Database Abstraction Library" optional = false python-versions = ">=3.7" files = [ - {file = "SQLAlchemy-2.0.34-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:95d0b2cf8791ab5fb9e3aa3d9a79a0d5d51f55b6357eecf532a120ba3b5524db"}, - {file = "SQLAlchemy-2.0.34-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:243f92596f4fd4c8bd30ab8e8dd5965afe226363d75cab2468f2c707f64cd83b"}, - {file = "SQLAlchemy-2.0.34-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9ea54f7300553af0a2a7235e9b85f4204e1fc21848f917a3213b0e0818de9a24"}, - {file = "SQLAlchemy-2.0.34-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:173f5f122d2e1bff8fbd9f7811b7942bead1f5e9f371cdf9e670b327e6703ebd"}, - {file = "SQLAlchemy-2.0.34-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:196958cde924a00488e3e83ff917be3b73cd4ed8352bbc0f2989333176d1c54d"}, - {file = "SQLAlchemy-2.0.34-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:bd90c221ed4e60ac9d476db967f436cfcecbd4ef744537c0f2d5291439848768"}, - {file = "SQLAlchemy-2.0.34-cp310-cp310-win32.whl", hash = "sha256:3166dfff2d16fe9be3241ee60ece6fcb01cf8e74dd7c5e0b64f8e19fab44911b"}, - {file = "SQLAlchemy-2.0.34-cp310-cp310-win_amd64.whl", hash = "sha256:6831a78bbd3c40f909b3e5233f87341f12d0b34a58f14115c9e94b4cdaf726d3"}, - {file = "SQLAlchemy-2.0.34-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c7db3db284a0edaebe87f8f6642c2b2c27ed85c3e70064b84d1c9e4ec06d5d84"}, - {file = "SQLAlchemy-2.0.34-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:430093fce0efc7941d911d34f75a70084f12f6ca5c15d19595c18753edb7c33b"}, - {file = "SQLAlchemy-2.0.34-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79cb400c360c7c210097b147c16a9e4c14688a6402445ac848f296ade6283bbc"}, - {file = "SQLAlchemy-2.0.34-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fb1b30f31a36c7f3fee848391ff77eebdd3af5750bf95fbf9b8b5323edfdb4ec"}, - {file = "SQLAlchemy-2.0.34-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8fddde2368e777ea2a4891a3fb4341e910a056be0bb15303bf1b92f073b80c02"}, - {file = "SQLAlchemy-2.0.34-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:80bd73ea335203b125cf1d8e50fef06be709619eb6ab9e7b891ea34b5baa2287"}, - {file = "SQLAlchemy-2.0.34-cp311-cp311-win32.whl", hash = "sha256:6daeb8382d0df526372abd9cb795c992e18eed25ef2c43afe518c73f8cccb721"}, - {file = "SQLAlchemy-2.0.34-cp311-cp311-win_amd64.whl", hash = "sha256:5bc08e75ed11693ecb648b7a0a4ed80da6d10845e44be0c98c03f2f880b68ff4"}, - {file = "SQLAlchemy-2.0.34-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:53e68b091492c8ed2bd0141e00ad3089bcc6bf0e6ec4142ad6505b4afe64163e"}, - {file = "SQLAlchemy-2.0.34-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bcd18441a49499bf5528deaa9dee1f5c01ca491fc2791b13604e8f972877f812"}, - {file = "SQLAlchemy-2.0.34-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:165bbe0b376541092bf49542bd9827b048357f4623486096fc9aaa6d4e7c59a2"}, - {file = "SQLAlchemy-2.0.34-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3330415cd387d2b88600e8e26b510d0370db9b7eaf984354a43e19c40df2e2b"}, - {file = "SQLAlchemy-2.0.34-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:97b850f73f8abbffb66ccbab6e55a195a0eb655e5dc74624d15cff4bfb35bd74"}, - {file = "SQLAlchemy-2.0.34-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7cee4c6917857fd6121ed84f56d1dc78eb1d0e87f845ab5a568aba73e78adf83"}, - {file = "SQLAlchemy-2.0.34-cp312-cp312-win32.whl", hash = "sha256:fbb034f565ecbe6c530dff948239377ba859420d146d5f62f0271407ffb8c580"}, - {file = "SQLAlchemy-2.0.34-cp312-cp312-win_amd64.whl", hash = "sha256:707c8f44931a4facd4149b52b75b80544a8d824162602b8cd2fe788207307f9a"}, - {file = "SQLAlchemy-2.0.34-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:24af3dc43568f3780b7e1e57c49b41d98b2d940c1fd2e62d65d3928b6f95f021"}, - {file = "SQLAlchemy-2.0.34-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e60ed6ef0a35c6b76b7640fe452d0e47acc832ccbb8475de549a5cc5f90c2c06"}, - {file = "SQLAlchemy-2.0.34-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:413c85cd0177c23e32dee6898c67a5f49296640041d98fddb2c40888fe4daa2e"}, - {file = "SQLAlchemy-2.0.34-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:25691f4adfb9d5e796fd48bf1432272f95f4bbe5f89c475a788f31232ea6afba"}, - {file = "SQLAlchemy-2.0.34-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:526ce723265643dbc4c7efb54f56648cc30e7abe20f387d763364b3ce7506c82"}, - {file = "SQLAlchemy-2.0.34-cp37-cp37m-win32.whl", hash = "sha256:13be2cc683b76977a700948411a94c67ad8faf542fa7da2a4b167f2244781cf3"}, - {file = "SQLAlchemy-2.0.34-cp37-cp37m-win_amd64.whl", hash = "sha256:e54ef33ea80d464c3dcfe881eb00ad5921b60f8115ea1a30d781653edc2fd6a2"}, - {file = "SQLAlchemy-2.0.34-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:43f28005141165edd11fbbf1541c920bd29e167b8bbc1fb410d4fe2269c1667a"}, - {file = "SQLAlchemy-2.0.34-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b68094b165a9e930aedef90725a8fcfafe9ef95370cbb54abc0464062dbf808f"}, - {file = "SQLAlchemy-2.0.34-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a1e03db964e9d32f112bae36f0cc1dcd1988d096cfd75d6a588a3c3def9ab2b"}, - {file = "SQLAlchemy-2.0.34-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:203d46bddeaa7982f9c3cc693e5bc93db476ab5de9d4b4640d5c99ff219bee8c"}, - {file = "SQLAlchemy-2.0.34-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:ae92bebca3b1e6bd203494e5ef919a60fb6dfe4d9a47ed2453211d3bd451b9f5"}, - {file = "SQLAlchemy-2.0.34-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:9661268415f450c95f72f0ac1217cc6f10256f860eed85c2ae32e75b60278ad8"}, - {file = "SQLAlchemy-2.0.34-cp38-cp38-win32.whl", hash = "sha256:895184dfef8708e15f7516bd930bda7e50ead069280d2ce09ba11781b630a434"}, - {file = "SQLAlchemy-2.0.34-cp38-cp38-win_amd64.whl", hash = "sha256:6e7cde3a2221aa89247944cafb1b26616380e30c63e37ed19ff0bba5e968688d"}, - {file = "SQLAlchemy-2.0.34-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:dbcdf987f3aceef9763b6d7b1fd3e4ee210ddd26cac421d78b3c206d07b2700b"}, - {file = "SQLAlchemy-2.0.34-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ce119fc4ce0d64124d37f66a6f2a584fddc3c5001755f8a49f1ca0a177ef9796"}, - {file = "SQLAlchemy-2.0.34-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a17d8fac6df9835d8e2b4c5523666e7051d0897a93756518a1fe101c7f47f2f0"}, - {file = "SQLAlchemy-2.0.34-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9ebc11c54c6ecdd07bb4efbfa1554538982f5432dfb8456958b6d46b9f834bb7"}, - {file = "SQLAlchemy-2.0.34-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2e6965346fc1491a566e019a4a1d3dfc081ce7ac1a736536367ca305da6472a8"}, - {file = "SQLAlchemy-2.0.34-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:220574e78ad986aea8e81ac68821e47ea9202b7e44f251b7ed8c66d9ae3f4278"}, - {file = "SQLAlchemy-2.0.34-cp39-cp39-win32.whl", hash = "sha256:b75b00083e7fe6621ce13cfce9d4469c4774e55e8e9d38c305b37f13cf1e874c"}, - {file = "SQLAlchemy-2.0.34-cp39-cp39-win_amd64.whl", hash = "sha256:c29d03e0adf3cc1a8c3ec62d176824972ae29b67a66cbb18daff3062acc6faa8"}, - {file = "SQLAlchemy-2.0.34-py3-none-any.whl", hash = "sha256:7286c353ee6475613d8beff83167374006c6b3e3f0e6491bfe8ca610eb1dec0f"}, - {file = "sqlalchemy-2.0.34.tar.gz", hash = "sha256:10d8f36990dd929690666679b0f42235c159a7051534adb135728ee52828dd22"}, + {file = "SQLAlchemy-2.0.36-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:59b8f3adb3971929a3e660337f5dacc5942c2cdb760afcabb2614ffbda9f9f72"}, + {file = "SQLAlchemy-2.0.36-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:37350015056a553e442ff672c2d20e6f4b6d0b2495691fa239d8aa18bb3bc908"}, + {file = "SQLAlchemy-2.0.36-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8318f4776c85abc3f40ab185e388bee7a6ea99e7fa3a30686580b209eaa35c08"}, + {file = "SQLAlchemy-2.0.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c245b1fbade9c35e5bd3b64270ab49ce990369018289ecfde3f9c318411aaa07"}, + {file = "SQLAlchemy-2.0.36-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:69f93723edbca7342624d09f6704e7126b152eaed3cdbb634cb657a54332a3c5"}, + {file = "SQLAlchemy-2.0.36-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f9511d8dd4a6e9271d07d150fb2f81874a3c8c95e11ff9af3a2dfc35fe42ee44"}, + {file = "SQLAlchemy-2.0.36-cp310-cp310-win32.whl", hash = "sha256:c3f3631693003d8e585d4200730616b78fafd5a01ef8b698f6967da5c605b3fa"}, + {file = "SQLAlchemy-2.0.36-cp310-cp310-win_amd64.whl", hash = "sha256:a86bfab2ef46d63300c0f06936bd6e6c0105faa11d509083ba8f2f9d237fb5b5"}, + {file = "SQLAlchemy-2.0.36-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fd3a55deef00f689ce931d4d1b23fa9f04c880a48ee97af488fd215cf24e2a6c"}, + {file = "SQLAlchemy-2.0.36-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4f5e9cd989b45b73bd359f693b935364f7e1f79486e29015813c338450aa5a71"}, + {file = "SQLAlchemy-2.0.36-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0ddd9db6e59c44875211bc4c7953a9f6638b937b0a88ae6d09eb46cced54eff"}, + {file = "SQLAlchemy-2.0.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2519f3a5d0517fc159afab1015e54bb81b4406c278749779be57a569d8d1bb0d"}, + {file = "SQLAlchemy-2.0.36-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:59b1ee96617135f6e1d6f275bbe988f419c5178016f3d41d3c0abb0c819f75bb"}, + {file = "SQLAlchemy-2.0.36-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:39769a115f730d683b0eb7b694db9789267bcd027326cccc3125e862eb03bfd8"}, + {file = "SQLAlchemy-2.0.36-cp311-cp311-win32.whl", hash = "sha256:66bffbad8d6271bb1cc2f9a4ea4f86f80fe5e2e3e501a5ae2a3dc6a76e604e6f"}, + {file = "SQLAlchemy-2.0.36-cp311-cp311-win_amd64.whl", hash = "sha256:23623166bfefe1487d81b698c423f8678e80df8b54614c2bf4b4cfcd7c711959"}, + {file = "SQLAlchemy-2.0.36-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f7b64e6ec3f02c35647be6b4851008b26cff592a95ecb13b6788a54ef80bbdd4"}, + {file = "SQLAlchemy-2.0.36-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:46331b00096a6db1fdc052d55b101dbbfc99155a548e20a0e4a8e5e4d1362855"}, + {file = "SQLAlchemy-2.0.36-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fdf3386a801ea5aba17c6410dd1dc8d39cf454ca2565541b5ac42a84e1e28f53"}, + {file = "SQLAlchemy-2.0.36-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac9dfa18ff2a67b09b372d5db8743c27966abf0e5344c555d86cc7199f7ad83a"}, + {file = "SQLAlchemy-2.0.36-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:90812a8933df713fdf748b355527e3af257a11e415b613dd794512461eb8a686"}, + {file = "SQLAlchemy-2.0.36-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1bc330d9d29c7f06f003ab10e1eaced295e87940405afe1b110f2eb93a233588"}, + {file = "SQLAlchemy-2.0.36-cp312-cp312-win32.whl", hash = "sha256:79d2e78abc26d871875b419e1fd3c0bca31a1cb0043277d0d850014599626c2e"}, + {file = "SQLAlchemy-2.0.36-cp312-cp312-win_amd64.whl", hash = "sha256:b544ad1935a8541d177cb402948b94e871067656b3a0b9e91dbec136b06a2ff5"}, + {file = "SQLAlchemy-2.0.36-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b5cc79df7f4bc3d11e4b542596c03826063092611e481fcf1c9dfee3c94355ef"}, + {file = "SQLAlchemy-2.0.36-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3c01117dd36800f2ecaa238c65365b7b16497adc1522bf84906e5710ee9ba0e8"}, + {file = "SQLAlchemy-2.0.36-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9bc633f4ee4b4c46e7adcb3a9b5ec083bf1d9a97c1d3854b92749d935de40b9b"}, + {file = "SQLAlchemy-2.0.36-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e46ed38affdfc95d2c958de328d037d87801cfcbea6d421000859e9789e61c2"}, + {file = "SQLAlchemy-2.0.36-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b2985c0b06e989c043f1dc09d4fe89e1616aadd35392aea2844f0458a989eacf"}, + {file = "SQLAlchemy-2.0.36-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4a121d62ebe7d26fec9155f83f8be5189ef1405f5973ea4874a26fab9f1e262c"}, + {file = "SQLAlchemy-2.0.36-cp313-cp313-win32.whl", hash = "sha256:0572f4bd6f94752167adfd7c1bed84f4b240ee6203a95e05d1e208d488d0d436"}, + {file = "SQLAlchemy-2.0.36-cp313-cp313-win_amd64.whl", hash = "sha256:8c78ac40bde930c60e0f78b3cd184c580f89456dd87fc08f9e3ee3ce8765ce88"}, + {file = "SQLAlchemy-2.0.36-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:be9812b766cad94a25bc63bec11f88c4ad3629a0cec1cd5d4ba48dc23860486b"}, + {file = "SQLAlchemy-2.0.36-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50aae840ebbd6cdd41af1c14590e5741665e5272d2fee999306673a1bb1fdb4d"}, + {file = "SQLAlchemy-2.0.36-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4557e1f11c5f653ebfdd924f3f9d5ebfc718283b0b9beebaa5dd6b77ec290971"}, + {file = "SQLAlchemy-2.0.36-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:07b441f7d03b9a66299ce7ccf3ef2900abc81c0db434f42a5694a37bd73870f2"}, + {file = "SQLAlchemy-2.0.36-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:28120ef39c92c2dd60f2721af9328479516844c6b550b077ca450c7d7dc68575"}, + {file = "SQLAlchemy-2.0.36-cp37-cp37m-win32.whl", hash = "sha256:b81ee3d84803fd42d0b154cb6892ae57ea6b7c55d8359a02379965706c7efe6c"}, + {file = "SQLAlchemy-2.0.36-cp37-cp37m-win_amd64.whl", hash = "sha256:f942a799516184c855e1a32fbc7b29d7e571b52612647866d4ec1c3242578fcb"}, + {file = "SQLAlchemy-2.0.36-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3d6718667da04294d7df1670d70eeddd414f313738d20a6f1d1f379e3139a545"}, + {file = "SQLAlchemy-2.0.36-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:72c28b84b174ce8af8504ca28ae9347d317f9dba3999e5981a3cd441f3712e24"}, + {file = "SQLAlchemy-2.0.36-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b11d0cfdd2b095e7b0686cf5fabeb9c67fae5b06d265d8180715b8cfa86522e3"}, + {file = "SQLAlchemy-2.0.36-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e32092c47011d113dc01ab3e1d3ce9f006a47223b18422c5c0d150af13a00687"}, + {file = "SQLAlchemy-2.0.36-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:6a440293d802d3011028e14e4226da1434b373cbaf4a4bbb63f845761a708346"}, + {file = "SQLAlchemy-2.0.36-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:c54a1e53a0c308a8e8a7dffb59097bff7facda27c70c286f005327f21b2bd6b1"}, + {file = "SQLAlchemy-2.0.36-cp38-cp38-win32.whl", hash = "sha256:1e0d612a17581b6616ff03c8e3d5eff7452f34655c901f75d62bd86449d9750e"}, + {file = "SQLAlchemy-2.0.36-cp38-cp38-win_amd64.whl", hash = "sha256:8958b10490125124463095bbdadda5aa22ec799f91958e410438ad6c97a7b793"}, + {file = "SQLAlchemy-2.0.36-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:dc022184d3e5cacc9579e41805a681187650e170eb2fd70e28b86192a479dcaa"}, + {file = "SQLAlchemy-2.0.36-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b817d41d692bf286abc181f8af476c4fbef3fd05e798777492618378448ee689"}, + {file = "SQLAlchemy-2.0.36-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a4e46a888b54be23d03a89be510f24a7652fe6ff660787b96cd0e57a4ebcb46d"}, + {file = "SQLAlchemy-2.0.36-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c4ae3005ed83f5967f961fd091f2f8c5329161f69ce8480aa8168b2d7fe37f06"}, + {file = "SQLAlchemy-2.0.36-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:03e08af7a5f9386a43919eda9de33ffda16b44eb11f3b313e6822243770e9763"}, + {file = "SQLAlchemy-2.0.36-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:3dbb986bad3ed5ceaf090200eba750b5245150bd97d3e67343a3cfed06feecf7"}, + {file = "SQLAlchemy-2.0.36-cp39-cp39-win32.whl", hash = "sha256:9fe53b404f24789b5ea9003fc25b9a3988feddebd7e7b369c8fac27ad6f52f28"}, + {file = "SQLAlchemy-2.0.36-cp39-cp39-win_amd64.whl", hash = "sha256:af148a33ff0349f53512a049c6406923e4e02bf2f26c5fb285f143faf4f0e46a"}, + {file = "SQLAlchemy-2.0.36-py3-none-any.whl", hash = "sha256:fddbe92b4760c6f5d48162aef14824add991aeda8ddadb3c31d56eb15ca69f8e"}, + {file = "sqlalchemy-2.0.36.tar.gz", hash = "sha256:7f2767680b6d2398aea7082e45a774b2b0767b5c8d8ffb9c8b683088ea9b29c5"}, ] [package.dependencies] @@ -2553,7 +2503,7 @@ aioodbc = ["aioodbc", "greenlet (!=0.4.17)"] aiosqlite = ["aiosqlite", "greenlet (!=0.4.17)", "typing_extensions (!=3.10.0.1)"] asyncio = ["greenlet (!=0.4.17)"] asyncmy = ["asyncmy (>=0.2.3,!=0.2.4,!=0.2.6)", "greenlet (!=0.4.17)"] -mariadb-connector = ["mariadb (>=1.0.1,!=1.1.2,!=1.1.5)"] +mariadb-connector = ["mariadb (>=1.0.1,!=1.1.2,!=1.1.5,!=1.1.10)"] mssql = ["pyodbc"] mssql-pymssql = ["pymssql"] mssql-pyodbc = ["pyodbc"] @@ -2589,13 +2539,13 @@ SQLAlchemy = ">=2.0.14,<2.1.0" [[package]] name = "starlette" -version = "0.38.4" +version = "0.41.0" description = "The little ASGI library that shines." optional = false python-versions = ">=3.8" files = [ - {file = "starlette-0.38.4-py3-none-any.whl", hash = "sha256:526f53a77f0e43b85f583438aee1a940fd84f8fd610353e8b0c1a77ad8a87e76"}, - {file = "starlette-0.38.4.tar.gz", hash = "sha256:53a7439060304a208fea17ed407e998f46da5e5d9b1addfea3040094512a6379"}, + {file = "starlette-0.41.0-py3-none-any.whl", hash = "sha256:a0193a3c413ebc9c78bff1c3546a45bb8c8bcb4a84cae8747d650a65bd37210a"}, + {file = "starlette-0.41.0.tar.gz", hash = "sha256:39cbd8768b107d68bfe1ff1672b38a2c38b49777de46d2a592841d58e3bf7c2a"}, ] [package.dependencies] @@ -2681,13 +2631,13 @@ files = [ [[package]] name = "tomli" -version = "2.0.1" +version = "2.0.2" description = "A lil' TOML parser" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, + {file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"}, + {file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"}, ] [[package]] @@ -2703,13 +2653,13 @@ files = [ [[package]] name = "trio" -version = "0.26.2" +version = "0.27.0" description = "A friendly Python library for async concurrency and I/O" optional = false python-versions = ">=3.8" files = [ - {file = "trio-0.26.2-py3-none-any.whl", hash = "sha256:c5237e8133eb0a1d72f09a971a55c28ebe69e351c783fc64bc37db8db8bbe1d0"}, - {file = "trio-0.26.2.tar.gz", hash = "sha256:0346c3852c15e5c7d40ea15972c4805689ef2cb8b5206f794c9c19450119f3a4"}, + {file = "trio-0.27.0-py3-none-any.whl", hash = "sha256:68eabbcf8f457d925df62da780eff15ff5dc68fd6b367e2dde59f7aaf2a0b884"}, + {file = "trio-0.27.0.tar.gz", hash = "sha256:1dcc95ab1726b2da054afea8fd761af74bad79bd52381b84eae408e983c76831"}, ] [package.dependencies] @@ -2789,24 +2739,24 @@ files = [ [[package]] name = "tzdata" -version = "2024.1" +version = "2024.2" description = "Provider of IANA time zone data" optional = false python-versions = ">=2" files = [ - {file = "tzdata-2024.1-py2.py3-none-any.whl", hash = "sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252"}, - {file = "tzdata-2024.1.tar.gz", hash = "sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd"}, + {file = "tzdata-2024.2-py2.py3-none-any.whl", hash = "sha256:a48093786cdcde33cad18c2555e8532f34422074448fbc874186f0abd79565cd"}, + {file = "tzdata-2024.2.tar.gz", hash = "sha256:7d85cc416e9382e69095b7bdf4afd9e3880418a2413feec7069d533d6b4e31cc"}, ] [[package]] name = "urllib3" -version = "2.2.2" +version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ - {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, - {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, + {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, + {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, ] [package.dependencies] @@ -2820,13 +2770,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.30.6" +version = "0.32.0" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.30.6-py3-none-any.whl", hash = "sha256:65fd46fe3fda5bdc1b03b94eb634923ff18cd35b2f084813ea79d1f103f711b5"}, - {file = "uvicorn-0.30.6.tar.gz", hash = "sha256:4b15decdda1e72be08209e860a1e10e92439ad5b97cf44cc945fcbee66fc5788"}, + {file = "uvicorn-0.32.0-py3-none-any.whl", hash = "sha256:60b8f3a5ac027dcd31448f411ced12b5ef452c646f76f02f8cc3f25d8d26fd82"}, + {file = "uvicorn-0.32.0.tar.gz", hash = "sha256:f78b36b143c16f54ccdb8190d0a26b5f1901fe5a3c777e1ab29f26391af8551e"}, ] [package.dependencies] @@ -2839,13 +2789,13 @@ standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", [[package]] name = "virtualenv" -version = "20.26.3" +version = "20.27.0" description = "Virtual Python Environment builder" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "virtualenv-20.26.3-py3-none-any.whl", hash = "sha256:8cc4a31139e796e9a7de2cd5cf2489de1217193116a8fd42328f1bd65f434589"}, - {file = "virtualenv-20.26.3.tar.gz", hash = "sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a"}, + {file = "virtualenv-20.27.0-py3-none-any.whl", hash = "sha256:44a72c29cceb0ee08f300b314848c86e57bf8d1f13107a5e671fb9274138d655"}, + {file = "virtualenv-20.27.0.tar.gz", hash = "sha256:2ca56a68ed615b8fe4326d11a0dca5dfbe8fd68510fb6c6349163bed3c15f2b2"}, ] [package.dependencies] @@ -2875,97 +2825,97 @@ test = ["websockets"] [[package]] name = "websockets" -version = "13.0.1" +version = "13.1" description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" optional = false python-versions = ">=3.8" files = [ - {file = "websockets-13.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:1841c9082a3ba4a05ea824cf6d99570a6a2d8849ef0db16e9c826acb28089e8f"}, - {file = "websockets-13.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c5870b4a11b77e4caa3937142b650fbbc0914a3e07a0cf3131f35c0587489c1c"}, - {file = "websockets-13.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f1d3d1f2eb79fe7b0fb02e599b2bf76a7619c79300fc55f0b5e2d382881d4f7f"}, - {file = "websockets-13.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:15c7d62ee071fa94a2fc52c2b472fed4af258d43f9030479d9c4a2de885fd543"}, - {file = "websockets-13.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6724b554b70d6195ba19650fef5759ef11346f946c07dbbe390e039bcaa7cc3d"}, - {file = "websockets-13.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56a952fa2ae57a42ba7951e6b2605e08a24801a4931b5644dfc68939e041bc7f"}, - {file = "websockets-13.0.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:17118647c0ea14796364299e942c330d72acc4b248e07e639d34b75067b3cdd8"}, - {file = "websockets-13.0.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:64a11aae1de4c178fa653b07d90f2fb1a2ed31919a5ea2361a38760192e1858b"}, - {file = "websockets-13.0.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:0617fd0b1d14309c7eab6ba5deae8a7179959861846cbc5cb528a7531c249448"}, - {file = "websockets-13.0.1-cp310-cp310-win32.whl", hash = "sha256:11f9976ecbc530248cf162e359a92f37b7b282de88d1d194f2167b5e7ad80ce3"}, - {file = "websockets-13.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:c3c493d0e5141ec055a7d6809a28ac2b88d5b878bb22df8c621ebe79a61123d0"}, - {file = "websockets-13.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:699ba9dd6a926f82a277063603fc8d586b89f4cb128efc353b749b641fcddda7"}, - {file = "websockets-13.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cf2fae6d85e5dc384bf846f8243ddaa9197f3a1a70044f59399af001fd1f51d4"}, - {file = "websockets-13.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:52aed6ef21a0f1a2a5e310fb5c42d7555e9c5855476bbd7173c3aa3d8a0302f2"}, - {file = "websockets-13.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8eb2b9a318542153674c6e377eb8cb9ca0fc011c04475110d3477862f15d29f0"}, - {file = "websockets-13.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5df891c86fe68b2c38da55b7aea7095beca105933c697d719f3f45f4220a5e0e"}, - {file = "websockets-13.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fac2d146ff30d9dd2fcf917e5d147db037a5c573f0446c564f16f1f94cf87462"}, - {file = "websockets-13.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:b8ac5b46fd798bbbf2ac6620e0437c36a202b08e1f827832c4bf050da081b501"}, - {file = "websockets-13.0.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:46af561eba6f9b0848b2c9d2427086cabadf14e0abdd9fde9d72d447df268418"}, - {file = "websockets-13.0.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b5a06d7f60bc2fc378a333978470dfc4e1415ee52f5f0fce4f7853eb10c1e9df"}, - {file = "websockets-13.0.1-cp311-cp311-win32.whl", hash = "sha256:556e70e4f69be1082e6ef26dcb70efcd08d1850f5d6c5f4f2bcb4e397e68f01f"}, - {file = "websockets-13.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:67494e95d6565bf395476e9d040037ff69c8b3fa356a886b21d8422ad86ae075"}, - {file = "websockets-13.0.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f9c9e258e3d5efe199ec23903f5da0eeaad58cf6fccb3547b74fd4750e5ac47a"}, - {file = "websockets-13.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:6b41a1b3b561f1cba8321fb32987552a024a8f67f0d05f06fcf29f0090a1b956"}, - {file = "websockets-13.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f73e676a46b0fe9426612ce8caeca54c9073191a77c3e9d5c94697aef99296af"}, - {file = "websockets-13.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f613289f4a94142f914aafad6c6c87903de78eae1e140fa769a7385fb232fdf"}, - {file = "websockets-13.0.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0f52504023b1480d458adf496dc1c9e9811df4ba4752f0bc1f89ae92f4f07d0c"}, - {file = "websockets-13.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:139add0f98206cb74109faf3611b7783ceafc928529c62b389917a037d4cfdf4"}, - {file = "websockets-13.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:47236c13be337ef36546004ce8c5580f4b1150d9538b27bf8a5ad8edf23ccfab"}, - {file = "websockets-13.0.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:c44ca9ade59b2e376612df34e837013e2b273e6c92d7ed6636d0556b6f4db93d"}, - {file = "websockets-13.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:9bbc525f4be3e51b89b2a700f5746c2a6907d2e2ef4513a8daafc98198b92237"}, - {file = "websockets-13.0.1-cp312-cp312-win32.whl", hash = "sha256:3624fd8664f2577cf8de996db3250662e259bfbc870dd8ebdcf5d7c6ac0b5185"}, - {file = "websockets-13.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0513c727fb8adffa6d9bf4a4463b2bade0186cbd8c3604ae5540fae18a90cb99"}, - {file = "websockets-13.0.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:1ee4cc030a4bdab482a37462dbf3ffb7e09334d01dd37d1063be1136a0d825fa"}, - {file = "websockets-13.0.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:dbb0b697cc0655719522406c059eae233abaa3243821cfdfab1215d02ac10231"}, - {file = "websockets-13.0.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:acbebec8cb3d4df6e2488fbf34702cbc37fc39ac7abf9449392cefb3305562e9"}, - {file = "websockets-13.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63848cdb6fcc0bf09d4a155464c46c64ffdb5807ede4fb251da2c2692559ce75"}, - {file = "websockets-13.0.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:872afa52a9f4c414d6955c365b6588bc4401272c629ff8321a55f44e3f62b553"}, - {file = "websockets-13.0.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05e70fec7c54aad4d71eae8e8cab50525e899791fc389ec6f77b95312e4e9920"}, - {file = "websockets-13.0.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e82db3756ccb66266504f5a3de05ac6b32f287faacff72462612120074103329"}, - {file = "websockets-13.0.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:4e85f46ce287f5c52438bb3703d86162263afccf034a5ef13dbe4318e98d86e7"}, - {file = "websockets-13.0.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f3fea72e4e6edb983908f0db373ae0732b275628901d909c382aae3b592589f2"}, - {file = "websockets-13.0.1-cp313-cp313-win32.whl", hash = "sha256:254ecf35572fca01a9f789a1d0f543898e222f7b69ecd7d5381d8d8047627bdb"}, - {file = "websockets-13.0.1-cp313-cp313-win_amd64.whl", hash = "sha256:ca48914cdd9f2ccd94deab5bcb5ac98025a5ddce98881e5cce762854a5de330b"}, - {file = "websockets-13.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:b74593e9acf18ea5469c3edaa6b27fa7ecf97b30e9dabd5a94c4c940637ab96e"}, - {file = "websockets-13.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:132511bfd42e77d152c919147078460c88a795af16b50e42a0bd14f0ad71ddd2"}, - {file = "websockets-13.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:165bedf13556f985a2aa064309baa01462aa79bf6112fbd068ae38993a0e1f1b"}, - {file = "websockets-13.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e801ca2f448850685417d723ec70298feff3ce4ff687c6f20922c7474b4746ae"}, - {file = "websockets-13.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:30d3a1f041360f029765d8704eae606781e673e8918e6b2c792e0775de51352f"}, - {file = "websockets-13.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:67648f5e50231b5a7f6d83b32f9c525e319f0ddc841be0de64f24928cd75a603"}, - {file = "websockets-13.0.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:4f0426d51c8f0926a4879390f53c7f5a855e42d68df95fff6032c82c888b5f36"}, - {file = "websockets-13.0.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:ef48e4137e8799998a343706531e656fdec6797b80efd029117edacb74b0a10a"}, - {file = "websockets-13.0.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:249aab278810bee585cd0d4de2f08cfd67eed4fc75bde623be163798ed4db2eb"}, - {file = "websockets-13.0.1-cp38-cp38-win32.whl", hash = "sha256:06c0a667e466fcb56a0886d924b5f29a7f0886199102f0a0e1c60a02a3751cb4"}, - {file = "websockets-13.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1f3cf6d6ec1142412d4535adabc6bd72a63f5f148c43fe559f06298bc21953c9"}, - {file = "websockets-13.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:1fa082ea38d5de51dd409434edc27c0dcbd5fed2b09b9be982deb6f0508d25bc"}, - {file = "websockets-13.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4a365bcb7be554e6e1f9f3ed64016e67e2fa03d7b027a33e436aecf194febb63"}, - {file = "websockets-13.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:10a0dc7242215d794fb1918f69c6bb235f1f627aaf19e77f05336d147fce7c37"}, - {file = "websockets-13.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:59197afd478545b1f73367620407b0083303569c5f2d043afe5363676f2697c9"}, - {file = "websockets-13.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7d20516990d8ad557b5abeb48127b8b779b0b7e6771a265fa3e91767596d7d97"}, - {file = "websockets-13.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a1a2e272d067030048e1fe41aa1ec8cfbbaabce733b3d634304fa2b19e5c897f"}, - {file = "websockets-13.0.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:ad327ac80ba7ee61da85383ca8822ff808ab5ada0e4a030d66703cc025b021c4"}, - {file = "websockets-13.0.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:518f90e6dd089d34eaade01101fd8a990921c3ba18ebbe9b0165b46ebff947f0"}, - {file = "websockets-13.0.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:68264802399aed6fe9652e89761031acc734fc4c653137a5911c2bfa995d6d6d"}, - {file = "websockets-13.0.1-cp39-cp39-win32.whl", hash = "sha256:a5dc0c42ded1557cc7c3f0240b24129aefbad88af4f09346164349391dea8e58"}, - {file = "websockets-13.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:b448a0690ef43db5ef31b3a0d9aea79043882b4632cfc3eaab20105edecf6097"}, - {file = "websockets-13.0.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:faef9ec6354fe4f9a2c0bbb52fb1ff852effc897e2a4501e25eb3a47cb0a4f89"}, - {file = "websockets-13.0.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:03d3f9ba172e0a53e37fa4e636b86cc60c3ab2cfee4935e66ed1d7acaa4625ad"}, - {file = "websockets-13.0.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d450f5a7a35662a9b91a64aefa852f0c0308ee256122f5218a42f1d13577d71e"}, - {file = "websockets-13.0.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f55b36d17ac50aa8a171b771e15fbe1561217510c8768af3d546f56c7576cdc"}, - {file = "websockets-13.0.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14b9c006cac63772b31abbcd3e3abb6228233eec966bf062e89e7fa7ae0b7333"}, - {file = "websockets-13.0.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:b79915a1179a91f6c5f04ece1e592e2e8a6bd245a0e45d12fd56b2b59e559a32"}, - {file = "websockets-13.0.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:f40de079779acbcdbb6ed4c65af9f018f8b77c5ec4e17a4b737c05c2db554491"}, - {file = "websockets-13.0.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:80e4ba642fc87fa532bac07e5ed7e19d56940b6af6a8c61d4429be48718a380f"}, - {file = "websockets-13.0.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2a02b0161c43cc9e0232711eff846569fad6ec836a7acab16b3cf97b2344c060"}, - {file = "websockets-13.0.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6aa74a45d4cdc028561a7d6ab3272c8b3018e23723100b12e58be9dfa5a24491"}, - {file = "websockets-13.0.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00fd961943b6c10ee6f0b1130753e50ac5dcd906130dcd77b0003c3ab797d026"}, - {file = "websockets-13.0.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:d93572720d781331fb10d3da9ca1067817d84ad1e7c31466e9f5e59965618096"}, - {file = "websockets-13.0.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:71e6e5a3a3728886caee9ab8752e8113670936a193284be9d6ad2176a137f376"}, - {file = "websockets-13.0.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:c4a6343e3b0714e80da0b0893543bf9a5b5fa71b846ae640e56e9abc6fbc4c83"}, - {file = "websockets-13.0.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a678532018e435396e37422a95e3ab87f75028ac79570ad11f5bf23cd2a7d8c"}, - {file = "websockets-13.0.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d6716c087e4aa0b9260c4e579bb82e068f84faddb9bfba9906cb87726fa2e870"}, - {file = "websockets-13.0.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e33505534f3f673270dd67f81e73550b11de5b538c56fe04435d63c02c3f26b5"}, - {file = "websockets-13.0.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:acab3539a027a85d568c2573291e864333ec9d912675107d6efceb7e2be5d980"}, - {file = "websockets-13.0.1-py3-none-any.whl", hash = "sha256:b80f0c51681c517604152eb6a572f5a9378f877763231fddb883ba2f968e8817"}, - {file = "websockets-13.0.1.tar.gz", hash = "sha256:4d6ece65099411cfd9a48d13701d7438d9c34f479046b34c50ff60bb8834e43e"}, + {file = "websockets-13.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f48c749857f8fb598fb890a75f540e3221d0976ed0bf879cf3c7eef34151acee"}, + {file = "websockets-13.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c7e72ce6bda6fb9409cc1e8164dd41d7c91466fb599eb047cfda72fe758a34a7"}, + {file = "websockets-13.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f779498eeec470295a2b1a5d97aa1bc9814ecd25e1eb637bd9d1c73a327387f6"}, + {file = "websockets-13.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4676df3fe46956fbb0437d8800cd5f2b6d41143b6e7e842e60554398432cf29b"}, + {file = "websockets-13.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7affedeb43a70351bb811dadf49493c9cfd1ed94c9c70095fd177e9cc1541fa"}, + {file = "websockets-13.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1971e62d2caa443e57588e1d82d15f663b29ff9dfe7446d9964a4b6f12c1e700"}, + {file = "websockets-13.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5f2e75431f8dc4a47f31565a6e1355fb4f2ecaa99d6b89737527ea917066e26c"}, + {file = "websockets-13.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:58cf7e75dbf7e566088b07e36ea2e3e2bd5676e22216e4cad108d4df4a7402a0"}, + {file = "websockets-13.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c90d6dec6be2c7d03378a574de87af9b1efea77d0c52a8301dd831ece938452f"}, + {file = "websockets-13.1-cp310-cp310-win32.whl", hash = "sha256:730f42125ccb14602f455155084f978bd9e8e57e89b569b4d7f0f0c17a448ffe"}, + {file = "websockets-13.1-cp310-cp310-win_amd64.whl", hash = "sha256:5993260f483d05a9737073be197371940c01b257cc45ae3f1d5d7adb371b266a"}, + {file = "websockets-13.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:61fc0dfcda609cda0fc9fe7977694c0c59cf9d749fbb17f4e9483929e3c48a19"}, + {file = "websockets-13.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ceec59f59d092c5007e815def4ebb80c2de330e9588e101cf8bd94c143ec78a5"}, + {file = "websockets-13.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c1dca61c6db1166c48b95198c0b7d9c990b30c756fc2923cc66f68d17dc558fd"}, + {file = "websockets-13.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:308e20f22c2c77f3f39caca508e765f8725020b84aa963474e18c59accbf4c02"}, + {file = "websockets-13.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62d516c325e6540e8a57b94abefc3459d7dab8ce52ac75c96cad5549e187e3a7"}, + {file = "websockets-13.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87c6e35319b46b99e168eb98472d6c7d8634ee37750d7693656dc766395df096"}, + {file = "websockets-13.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5f9fee94ebafbc3117c30be1844ed01a3b177bb6e39088bc6b2fa1dc15572084"}, + {file = "websockets-13.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:7c1e90228c2f5cdde263253fa5db63e6653f1c00e7ec64108065a0b9713fa1b3"}, + {file = "websockets-13.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6548f29b0e401eea2b967b2fdc1c7c7b5ebb3eeb470ed23a54cd45ef078a0db9"}, + {file = "websockets-13.1-cp311-cp311-win32.whl", hash = "sha256:c11d4d16e133f6df8916cc5b7e3e96ee4c44c936717d684a94f48f82edb7c92f"}, + {file = "websockets-13.1-cp311-cp311-win_amd64.whl", hash = "sha256:d04f13a1d75cb2b8382bdc16ae6fa58c97337253826dfe136195b7f89f661557"}, + {file = "websockets-13.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:9d75baf00138f80b48f1eac72ad1535aac0b6461265a0bcad391fc5aba875cfc"}, + {file = "websockets-13.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9b6f347deb3dcfbfde1c20baa21c2ac0751afaa73e64e5b693bb2b848efeaa49"}, + {file = "websockets-13.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:de58647e3f9c42f13f90ac7e5f58900c80a39019848c5547bc691693098ae1bd"}, + {file = "websockets-13.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1b54689e38d1279a51d11e3467dd2f3a50f5f2e879012ce8f2d6943f00e83f0"}, + {file = "websockets-13.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf1781ef73c073e6b0f90af841aaf98501f975d306bbf6221683dd594ccc52b6"}, + {file = "websockets-13.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d23b88b9388ed85c6faf0e74d8dec4f4d3baf3ecf20a65a47b836d56260d4b9"}, + {file = "websockets-13.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3c78383585f47ccb0fcf186dcb8a43f5438bd7d8f47d69e0b56f71bf431a0a68"}, + {file = "websockets-13.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:d6d300f8ec35c24025ceb9b9019ae9040c1ab2f01cddc2bcc0b518af31c75c14"}, + {file = "websockets-13.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a9dcaf8b0cc72a392760bb8755922c03e17a5a54e08cca58e8b74f6902b433cf"}, + {file = "websockets-13.1-cp312-cp312-win32.whl", hash = "sha256:2f85cf4f2a1ba8f602298a853cec8526c2ca42a9a4b947ec236eaedb8f2dc80c"}, + {file = "websockets-13.1-cp312-cp312-win_amd64.whl", hash = "sha256:38377f8b0cdeee97c552d20cf1865695fcd56aba155ad1b4ca8779a5b6ef4ac3"}, + {file = "websockets-13.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:a9ab1e71d3d2e54a0aa646ab6d4eebfaa5f416fe78dfe4da2839525dc5d765c6"}, + {file = "websockets-13.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b9d7439d7fab4dce00570bb906875734df13d9faa4b48e261c440a5fec6d9708"}, + {file = "websockets-13.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:327b74e915cf13c5931334c61e1a41040e365d380f812513a255aa804b183418"}, + {file = "websockets-13.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:325b1ccdbf5e5725fdcb1b0e9ad4d2545056479d0eee392c291c1bf76206435a"}, + {file = "websockets-13.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:346bee67a65f189e0e33f520f253d5147ab76ae42493804319b5716e46dddf0f"}, + {file = "websockets-13.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:91a0fa841646320ec0d3accdff5b757b06e2e5c86ba32af2e0815c96c7a603c5"}, + {file = "websockets-13.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:18503d2c5f3943e93819238bf20df71982d193f73dcecd26c94514f417f6b135"}, + {file = "websockets-13.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:a9cd1af7e18e5221d2878378fbc287a14cd527fdd5939ed56a18df8a31136bb2"}, + {file = "websockets-13.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:70c5be9f416aa72aab7a2a76c90ae0a4fe2755c1816c153c1a2bcc3333ce4ce6"}, + {file = "websockets-13.1-cp313-cp313-win32.whl", hash = "sha256:624459daabeb310d3815b276c1adef475b3e6804abaf2d9d2c061c319f7f187d"}, + {file = "websockets-13.1-cp313-cp313-win_amd64.whl", hash = "sha256:c518e84bb59c2baae725accd355c8dc517b4a3ed8db88b4bc93c78dae2974bf2"}, + {file = "websockets-13.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:c7934fd0e920e70468e676fe7f1b7261c1efa0d6c037c6722278ca0228ad9d0d"}, + {file = "websockets-13.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:149e622dc48c10ccc3d2760e5f36753db9cacf3ad7bc7bbbfd7d9c819e286f23"}, + {file = "websockets-13.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a569eb1b05d72f9bce2ebd28a1ce2054311b66677fcd46cf36204ad23acead8c"}, + {file = "websockets-13.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:95df24ca1e1bd93bbca51d94dd049a984609687cb2fb08a7f2c56ac84e9816ea"}, + {file = "websockets-13.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d8dbb1bf0c0a4ae8b40bdc9be7f644e2f3fb4e8a9aca7145bfa510d4a374eeb7"}, + {file = "websockets-13.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:035233b7531fb92a76beefcbf479504db8c72eb3bff41da55aecce3a0f729e54"}, + {file = "websockets-13.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:e4450fc83a3df53dec45922b576e91e94f5578d06436871dce3a6be38e40f5db"}, + {file = "websockets-13.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:463e1c6ec853202dd3657f156123d6b4dad0c546ea2e2e38be2b3f7c5b8e7295"}, + {file = "websockets-13.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:6d6855bbe70119872c05107e38fbc7f96b1d8cb047d95c2c50869a46c65a8e96"}, + {file = "websockets-13.1-cp38-cp38-win32.whl", hash = "sha256:204e5107f43095012b00f1451374693267adbb832d29966a01ecc4ce1db26faf"}, + {file = "websockets-13.1-cp38-cp38-win_amd64.whl", hash = "sha256:485307243237328c022bc908b90e4457d0daa8b5cf4b3723fd3c4a8012fce4c6"}, + {file = "websockets-13.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:9b37c184f8b976f0c0a231a5f3d6efe10807d41ccbe4488df8c74174805eea7d"}, + {file = "websockets-13.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:163e7277e1a0bd9fb3c8842a71661ad19c6aa7bb3d6678dc7f89b17fbcc4aeb7"}, + {file = "websockets-13.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4b889dbd1342820cc210ba44307cf75ae5f2f96226c0038094455a96e64fb07a"}, + {file = "websockets-13.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:586a356928692c1fed0eca68b4d1c2cbbd1ca2acf2ac7e7ebd3b9052582deefa"}, + {file = "websockets-13.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7bd6abf1e070a6b72bfeb71049d6ad286852e285f146682bf30d0296f5fbadfa"}, + {file = "websockets-13.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2aad13a200e5934f5a6767492fb07151e1de1d6079c003ab31e1823733ae79"}, + {file = "websockets-13.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:df01aea34b6e9e33572c35cd16bae5a47785e7d5c8cb2b54b2acdb9678315a17"}, + {file = "websockets-13.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:e54affdeb21026329fb0744ad187cf812f7d3c2aa702a5edb562b325191fcab6"}, + {file = "websockets-13.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9ef8aa8bdbac47f4968a5d66462a2a0935d044bf35c0e5a8af152d58516dbeb5"}, + {file = "websockets-13.1-cp39-cp39-win32.whl", hash = "sha256:deeb929efe52bed518f6eb2ddc00cc496366a14c726005726ad62c2dd9017a3c"}, + {file = "websockets-13.1-cp39-cp39-win_amd64.whl", hash = "sha256:7c65ffa900e7cc958cd088b9a9157a8141c991f8c53d11087e6fb7277a03f81d"}, + {file = "websockets-13.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:5dd6da9bec02735931fccec99d97c29f47cc61f644264eb995ad6c0c27667238"}, + {file = "websockets-13.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:2510c09d8e8df777177ee3d40cd35450dc169a81e747455cc4197e63f7e7bfe5"}, + {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1c3cf67185543730888b20682fb186fc8d0fa6f07ccc3ef4390831ab4b388d9"}, + {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bcc03c8b72267e97b49149e4863d57c2d77f13fae12066622dc78fe322490fe6"}, + {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:004280a140f220c812e65f36944a9ca92d766b6cc4560be652a0a3883a79ed8a"}, + {file = "websockets-13.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:e2620453c075abeb0daa949a292e19f56de518988e079c36478bacf9546ced23"}, + {file = "websockets-13.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:9156c45750b37337f7b0b00e6248991a047be4aa44554c9886fe6bdd605aab3b"}, + {file = "websockets-13.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:80c421e07973a89fbdd93e6f2003c17d20b69010458d3a8e37fb47874bd67d51"}, + {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82d0ba76371769d6a4e56f7e83bb8e81846d17a6190971e38b5de108bde9b0d7"}, + {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e9875a0143f07d74dc5e1ded1c4581f0d9f7ab86c78994e2ed9e95050073c94d"}, + {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a11e38ad8922c7961447f35c7b17bffa15de4d17c70abd07bfbe12d6faa3e027"}, + {file = "websockets-13.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:4059f790b6ae8768471cddb65d3c4fe4792b0ab48e154c9f0a04cefaabcd5978"}, + {file = "websockets-13.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:25c35bf84bf7c7369d247f0b8cfa157f989862c49104c5cf85cb5436a641d93e"}, + {file = "websockets-13.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:83f91d8a9bb404b8c2c41a707ac7f7f75b9442a0a876df295de27251a856ad09"}, + {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a43cfdcddd07f4ca2b1afb459824dd3c6d53a51410636a2c7fc97b9a8cf4842"}, + {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48a2ef1381632a2f0cb4efeff34efa97901c9fbc118e01951ad7cfc10601a9bb"}, + {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:459bf774c754c35dbb487360b12c5727adab887f1622b8aed5755880a21c4a20"}, + {file = "websockets-13.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:95858ca14a9f6fa8413d29e0a585b31b278388aa775b8a81fa24830123874678"}, + {file = "websockets-13.1-py3-none-any.whl", hash = "sha256:a9a396a6ad26130cdae92ae10c36af09d9bfe6cafe69670fd3b6da9b07b4044f"}, + {file = "websockets-13.1.tar.gz", hash = "sha256:a3b3366087c1bc0a2795111edcadddb8b3b59509d5db5d7ea3fdd69f954a8878"}, ] [[package]] @@ -3077,13 +3027,13 @@ h11 = ">=0.9.0,<1" [[package]] name = "zipp" -version = "3.20.1" +version = "3.20.2" description = "Backport of pathlib-compatible object wrapper for zip files" optional = false python-versions = ">=3.8" files = [ - {file = "zipp-3.20.1-py3-none-any.whl", hash = "sha256:9960cd8967c8f85a56f920d5d507274e74f9ff813a0ab8889a5b5be2daf44064"}, - {file = "zipp-3.20.1.tar.gz", hash = "sha256:c22b14cc4763c5a5b04134207736c107db42e9d3ef2d9779d465f5f1bcba572b"}, + {file = "zipp-3.20.2-py3-none-any.whl", hash = "sha256:a817ac80d6cf4b23bf7f2828b7cabf326f15a001bea8b1f9b49631780ba28350"}, + {file = "zipp-3.20.2.tar.gz", hash = "sha256:bc9eb26f4506fda01b81bcde0ca78103b6e62f991b381fec825435c836edbc29"}, ] [package.extras] @@ -3096,5 +3046,5 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" -python-versions = "^3.8" -content-hash = "645995c4b81159c639acf65e422a969740ef2c77586d9f00efff44c495aaa0a5" +python-versions = "^3.9" +content-hash = "c5da15520cef58124f6699007c81158036840469d4f9972592d72bd456c45e7e" diff --git a/pyproject.toml b/pyproject.toml index dd434c38a..3fe6041f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "reflex" -version = "0.6.0a1" +version = "0.6.4dev1" description = "Web apps in pure Python." license = "Apache-2.0" authors = [ @@ -26,14 +26,14 @@ packages = [ ] [tool.poetry.dependencies] -python = "^3.8" -dill = ">=0.3.8,<0.4" +python = "^3.9" fastapi = ">=0.96.0,!=0.111.0,!=0.111.1" gunicorn = ">=20.1.0,<24.0" jinja2 = ">=3.1.2,<4.0" psutil = ">=5.9.4,<7.0" pydantic = ">=1.10.2,<3.0" python-multipart = ">=0.0.5,<0.1" +python-dotenv = ">=1.0.1" python-socketio = ">=5.7.0,<6.0" redis = ">=4.3.5,<6.0" rich = ">=13.0.0,<14.0" @@ -54,37 +54,31 @@ reflex-hosting-cli = ">=0.1.2,<2.0" charset-normalizer = ">=3.3.2,<4.0" wheel = ">=0.42.0,<1.0" build = ">=1.0.3,<2.0" -setuptools = ">=69.1.1,<70.2" +setuptools = ">=75.0" httpx = ">=0.25.1,<1.0" twine = ">=4.0.0,<6.0" tomlkit = ">=0.12.4,<1.0" lazy_loader = ">=0.4" -reflex-chakra = ">=0.6.0a" +reflex-chakra = ">=0.6.0" [tool.poetry.group.dev.dependencies] -pytest = ">=7.1.2,<8.0" +pytest = ">=7.1.2,<9.0" pytest-mock = ">=3.10.0,<4.0" pyright = ">=1.1.229,<1.1.335" darglint = ">=1.8.1,<2.0" toml = ">=0.10.2,<1.0" -pytest-asyncio = ">=0.20.1,<0.22.0" # https://github.com/pytest-dev/pytest-asyncio/issues/706 -pytest-cov = ">=4.0.0,<5.0" -ruff = "^0.4.9" -pandas = [ - {version = ">=2.1.1,<3.0", python = ">=3.9,<3.13"}, - {version = ">=1.5.3,<2.0", python = ">=3.8,<3.9"}, -] -pillow = [ - {version = ">=10.0.0,<11.0", python = ">=3.8,<4.0"} -] +pytest-asyncio = ">=0.24.0" +pytest-cov = ">=4.0.0,<6.0" +ruff = "^0.7.0" +pandas = ">=2.1.1,<3.0" +pillow = ">=10.0.0,<12.0" plotly = ">=5.13.0,<6.0" asynctest = ">=0.13.0,<1.0" -pre-commit = {version = ">=3.2.1", python = ">=3.8,<4.0"} +pre-commit = ">=3.2.1" selenium = ">=4.11.0,<5.0" pytest-benchmark = ">=4.0.0,<5.0" -playwright = "^1.46.0" -pytest-playwright = "^0.5.1" - +playwright = ">=1.46.0" +pytest-playwright = ">=0.5.1" [tool.poetry.scripts] reflex = "reflex.reflex:cli" @@ -96,9 +90,9 @@ build-backend = "poetry.core.masonry.api" [tool.pyright] [tool.ruff] -target-version = "py38" +target-version = "py39" lint.select = ["B", "D", "E", "F", "I", "SIM", "W"] -lint.ignore = ["B008", "D203", "D205", "D213", "D401", "D406", "D407", "E501", "F403", "F405", "F541"] +lint.ignore = ["B008", "D203", "D205", "D213", "D401", "D406", "D407", "E501", "F403", "F405", "F541", "SIM115"] lint.pydocstyle.convention = "google" [tool.ruff.lint.per-file-ignores] @@ -107,3 +101,7 @@ lint.pydocstyle.convention = "google" "reflex/.templates/*.py" = ["D100", "D103", "D104"] "*.pyi" = ["D301", "D415", "D417", "D418", "E742"] "*/blank.py" = ["I001"] + +[tool.pytest.ini_options] +asyncio_default_fixture_loop_scope = "function" +asyncio_mode = "auto" \ No newline at end of file diff --git a/reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 b/reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 index e70a835a5..a5239f33b 100644 --- a/reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +++ b/reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 @@ -8,11 +8,11 @@ version = "0.0.1" description = "Reflex custom component {{ module_name }}" readme = "README.md" license = { text = "Apache-2.0" } -requires-python = ">=3.8" +requires-python = ">=3.9" authors = [{ name = "", email = "YOUREMAIL@domain.com" }] keywords = ["reflex","reflex-custom-components"] -dependencies = ["reflex>=0.4.2"] +dependencies = ["reflex>={{ reflex_version }}"] classifiers = ["Development Status :: 4 - Beta"] diff --git a/reflex/.templates/jinja/web/pages/_app.js.jinja2 b/reflex/.templates/jinja/web/pages/_app.js.jinja2 index d4322b171..c893e19e2 100644 --- a/reflex/.templates/jinja/web/pages/_app.js.jinja2 +++ b/reflex/.templates/jinja/web/pages/_app.js.jinja2 @@ -7,6 +7,9 @@ import '/styles/styles.css' {% block declaration %} import { EventLoopProvider, StateProvider, defaultColorMode } from "/utils/context.js"; import { ThemeProvider } from 'next-themes' +{% for library_alias, library_path in window_libraries %} +import * as {{library_alias}} from "{{library_path}}"; +{% endfor %} {% for custom_code in custom_codes %} {{custom_code}} @@ -26,8 +29,17 @@ function AppWrap({children}) { } export default function MyApp({ Component, pageProps }) { + React.useEffect(() => { + // Make contexts and state objects available globally for dynamic eval'd components + let windowImports = { +{% for library_alias, library_path in window_libraries %} + "{{library_path}}": {{library_alias}}, +{% endfor %} + }; + window["__reflex"] = windowImports; + }, []); return ( - + diff --git a/reflex/.templates/jinja/web/pages/utils.js.jinja2 b/reflex/.templates/jinja/web/pages/utils.js.jinja2 index 8e9808fbb..908482d24 100644 --- a/reflex/.templates/jinja/web/pages/utils.js.jinja2 +++ b/reflex/.templates/jinja/web/pages/utils.js.jinja2 @@ -64,11 +64,11 @@ {# Args: #} {# component: component dictionary #} {% macro render_iterable_tag(component) %} -{ {%- if component.iterable_type == 'dict' -%}Object.entries({{- component.iterable_state }}){%- else -%}{{- component.iterable_state }}{%- endif -%}.map(({{ component.arg_name }}, {{ component.arg_index }}) => ( +<>{ {%- if component.iterable_type == 'dict' -%}Object.entries({{- component.iterable_state }}){%- else -%}{{- component.iterable_state }}{%- endif -%}.map(({{ component.arg_name }}, {{ component.arg_index }}) => ( {% for child in component.children %} {{ render(child) }} {% endfor %} -))} +))} {%- endmacro %} @@ -85,10 +85,10 @@ {% macro render_match_tag(component) %} { (() => { - switch (JSON.stringify({{ component.cond._var_name_unwrapped }})) { + switch (JSON.stringify({{ component.cond._js_expr }})) { {% for case in component.match_cases %} {% for condition in case[:-1] %} - case JSON.stringify({{ condition._var_name_unwrapped }}): + case JSON.stringify({{ condition._js_expr }}): {% endfor %} return {{ case[-1] }}; break; diff --git a/reflex/.templates/jinja/web/utils/theme.js.jinja2 b/reflex/.templates/jinja/web/utils/theme.js.jinja2 index a647a35b3..819abd232 100644 --- a/reflex/.templates/jinja/web/utils/theme.js.jinja2 +++ b/reflex/.templates/jinja/web/utils/theme.js.jinja2 @@ -1 +1 @@ -export default {{ theme|json_dumps }} \ No newline at end of file +export default {{ theme }} \ No newline at end of file diff --git a/reflex/.templates/web/components/reflex/chakra_color_mode_provider.js b/reflex/.templates/web/components/reflex/chakra_color_mode_provider.js deleted file mode 100644 index ad41d5134..000000000 --- a/reflex/.templates/web/components/reflex/chakra_color_mode_provider.js +++ /dev/null @@ -1,36 +0,0 @@ -import { useColorMode as chakraUseColorMode } from "@chakra-ui/react"; -import { useTheme } from "next-themes"; -import { useEffect, useState } from "react"; -import { ColorModeContext, defaultColorMode } from "/utils/context.js"; - -export default function ChakraColorModeProvider({ children }) { - const { theme, resolvedTheme, setTheme } = useTheme(); - const { colorMode, toggleColorMode } = chakraUseColorMode(); - const [resolvedColorMode, setResolvedColorMode] = useState(colorMode); - - useEffect(() => { - if (colorMode != resolvedTheme) { - toggleColorMode(); - } - setResolvedColorMode(resolvedTheme); - }, [theme, resolvedTheme]); - - const rawColorMode = colorMode; - const setColorMode = (mode) => { - const allowedModes = ["light", "dark", "system"]; - if (!allowedModes.includes(mode)) { - console.error( - `Invalid color mode "${mode}". Defaulting to "${defaultColorMode}".` - ); - mode = defaultColorMode; - } - setTheme(mode); - }; - return ( - - {children} - - ); -} diff --git a/reflex/.templates/web/components/shiki/code.js b/reflex/.templates/web/components/shiki/code.js new file mode 100644 index 000000000..c655c3a60 --- /dev/null +++ b/reflex/.templates/web/components/shiki/code.js @@ -0,0 +1,29 @@ +import { useEffect, useState } from "react" +import { codeToHtml} from "shiki" + +export function Code ({code, theme, language, transformers, ...divProps}) { + const [codeResult, setCodeResult] = useState("") + useEffect(() => { + async function fetchCode() { + let final_code; + + if (Array.isArray(code)) { + final_code = code[0]; + } else { + final_code = code; + } + const result = await codeToHtml(final_code, { + lang: language, + theme, + transformers + }); + setCodeResult(result); + } + fetchCode(); + }, [code, language, theme, transformers] + + ) + return ( +
+ ) +} diff --git a/reflex/.templates/web/utils/state.js b/reflex/.templates/web/utils/state.js index 26b2d0d0c..24092f235 100644 --- a/reflex/.templates/web/utils/state.js +++ b/reflex/.templates/web/utils/state.js @@ -15,6 +15,7 @@ import { } from "utils/context.js"; import debounce from "/utils/helpers/debounce"; import throttle from "/utils/helpers/throttle"; +import * as Babel from "@babel/standalone"; // Endpoint URLs. const EVENTURL = env.EVENT; @@ -117,8 +118,8 @@ export const isStateful = () => { if (event_queue.length === 0) { return false; } - return event_queue.some(event => event.name.startsWith("reflex___state")); -} + return event_queue.some((event) => event.name.startsWith("reflex___state")); +}; /** * Apply a delta to the state. @@ -129,6 +130,22 @@ export const applyDelta = (state, delta) => { return { ...state, ...delta }; }; +/** + * Evaluate a dynamic component. + * @param component The component to evaluate. + * @returns The evaluated component. + */ +export const evalReactComponent = async (component) => { + if (!window.React && window.__reflex) { + window.React = window.__reflex.react; + } + const output = Babel.transform(component, { presets: ["react"] }).code; + const encodedJs = encodeURIComponent(output); + const dataUri = "data:text/javascript;charset=utf-8," + encodedJs; + const module = await eval(`import(dataUri)`); + return module.default; +}; + /** * Only Queue and process events when websocket connection exists. * @param event The event to queue. @@ -141,7 +158,7 @@ export const queueEventIfSocketExists = async (events, socket) => { return; } await queueEvents(events, socket); -} +}; /** * Handle frontend event or send the event to the backend via Websocket. @@ -208,7 +225,10 @@ export const applyEvent = async (event, socket) => { const a = document.createElement("a"); a.hidden = true; // Special case when linking to uploaded files - a.href = event.payload.url.replace("${getBackendURL(env.UPLOAD)}", getBackendURL(env.UPLOAD)) + a.href = event.payload.url.replace( + "${getBackendURL(env.UPLOAD)}", + getBackendURL(env.UPLOAD) + ); a.download = event.payload.filename; a.click(); a.remove(); @@ -249,7 +269,7 @@ export const applyEvent = async (event, socket) => { } catch (e) { console.log("_call_script", e); if (window && window?.onerror) { - window.onerror(e.message, null, null, null, e) + window.onerror(e.message, null, null, null, e); } } return false; @@ -290,10 +310,9 @@ export const applyEvent = async (event, socket) => { export const applyRestEvent = async (event, socket) => { let eventSent = false; if (event.handler === "uploadFiles") { - if (event.payload.files === undefined || event.payload.files.length === 0) { // Submit the event over the websocket to trigger the event handler. - return await applyEvent(Event(event.name), socket) + return await applyEvent(Event(event.name), socket); } // Start upload, but do not wait for it, which would block other events. @@ -397,7 +416,7 @@ export const connect = async ( console.log("Disconnect backend before bfcache on navigation"); socket.current.disconnect(); } - } + }; // Once the socket is open, hydrate the page. socket.current.on("connect", () => { @@ -416,7 +435,7 @@ export const connect = async ( }); // On each received message, queue the updates and events. - socket.current.on("event", (message) => { + socket.current.on("event", async (message) => { const update = JSON5.parse(message); for (const substate in update.delta) { dispatch[substate](update.delta[substate]); @@ -525,13 +544,19 @@ export const uploadFiles = async ( /** * Create an event object. - * @param name The name of the event. - * @param payload The payload of the event. - * @param handler The client handler to process event. + * @param {string} name The name of the event. + * @param {Object.} payload The payload of the event. + * @param {Object.} event_actions The actions to take on the event. + * @param {string} handler The client handler to process event. * @returns The event object. */ -export const Event = (name, payload = {}, handler = null) => { - return { name, payload, handler }; +export const Event = ( + name, + payload = {}, + event_actions = {}, + handler = null +) => { + return { name, payload, handler, event_actions }; }; /** @@ -574,7 +599,11 @@ export const hydrateClientStorage = (client_storage) => { } } } - if (client_storage.cookies || client_storage.local_storage || client_storage.session_storage) { + if ( + client_storage.cookies || + client_storage.local_storage || + client_storage.session_storage + ) { return client_storage_values; } return {}; @@ -614,15 +643,17 @@ const applyClientStorageDelta = (client_storage, delta) => { ) { const options = client_storage.local_storage[state_key]; localStorage.setItem(options.name || state_key, delta[substate][key]); - } else if( + } else if ( client_storage.session_storage && state_key in client_storage.session_storage && typeof window !== "undefined" ) { const session_options = client_storage.session_storage[state_key]; - sessionStorage.setItem(session_options.name || state_key, delta[substate][key]); + sessionStorage.setItem( + session_options.name || state_key, + delta[substate][key] + ); } - } } }; @@ -651,7 +682,13 @@ export const useEventLoop = ( if (!(args instanceof Array)) { args = [args]; } - const _e = args.filter((o) => o?.preventDefault !== undefined)[0] + + event_actions = events.reduce( + (acc, e) => ({ ...acc, ...e.event_actions }), + event_actions ?? {} + ); + + const _e = args.filter((o) => o?.preventDefault !== undefined)[0]; if (event_actions?.preventDefault && _e?.preventDefault) { _e.preventDefault(); @@ -671,7 +708,7 @@ export const useEventLoop = ( debounce( combined_name, () => queueEvents(events, socket), - event_actions.debounce, + event_actions.debounce ); } else { queueEvents(events, socket); @@ -696,30 +733,34 @@ export const useEventLoop = ( } }, [router.isReady]); - // Handle frontend errors and send them to the backend via websocket. - useEffect(() => { - - if (typeof window === 'undefined') { - return; - } - - window.onerror = function (msg, url, lineNo, columnNo, error) { - addEvents([Event(`${exception_state_name}.handle_frontend_exception`, { - stack: error.stack, - })]) - return false; - } + // Handle frontend errors and send them to the backend via websocket. + useEffect(() => { + if (typeof window === "undefined") { + return; + } - //NOTE: Only works in Chrome v49+ - //https://github.com/mknichel/javascript-errors?tab=readme-ov-file#promise-rejection-events - window.onunhandledrejection = function (event) { - addEvents([Event(`${exception_state_name}.handle_frontend_exception`, { - stack: event.reason.stack, - })]) - return false; - } - - },[]) + window.onerror = function (msg, url, lineNo, columnNo, error) { + addEvents([ + Event(`${exception_state_name}.handle_frontend_exception`, { + stack: error.stack, + component_stack: "", + }), + ]); + return false; + }; + + //NOTE: Only works in Chrome v49+ + //https://github.com/mknichel/javascript-errors?tab=readme-ov-file#promise-rejection-events + window.onunhandledrejection = function (event) { + addEvents([ + Event(`${exception_state_name}.handle_frontend_exception`, { + stack: event.reason.stack, + component_stack: "", + }), + ]); + return false; + }; + }, []); // Main event loop. useEffect(() => { @@ -782,11 +823,11 @@ export const useEventLoop = ( // Route after the initial page hydration. useEffect(() => { const change_start = () => { - const main_state_dispatch = dispatch["reflex___state____state"] + const main_state_dispatch = dispatch["reflex___state____state"]; if (main_state_dispatch !== undefined) { - main_state_dispatch({ is_hydrated: false }) + main_state_dispatch({ is_hydrated: false }); } - } + }; const change_complete = () => addEvents(onLoadInternalEvent()); router.events.on("routeChangeStart", change_start); router.events.on("routeChangeComplete", change_complete); @@ -805,7 +846,9 @@ export const useEventLoop = ( * @returns True if the value is truthy, false otherwise. */ export const isTrue = (val) => { - return Array.isArray(val) ? val.length > 0 : !!val; + if (Array.isArray(val)) return val.length > 0; + if (val === Object(val)) return Object.keys(val).length > 0; + return Boolean(val); }; /** diff --git a/reflex/__init__.py b/reflex/__init__.py index d69e33d47..ffc4426f9 100644 --- a/reflex/__init__.py +++ b/reflex/__init__.py @@ -89,6 +89,8 @@ from reflex.utils import ( lazy_loader, ) +from .event import event as event + # import this here explicitly to avoid returning the page module since page attr has the # same name as page module(page.py) from .page import page as page @@ -206,6 +208,13 @@ RADIX_PRIMITIVES_MAPPING: dict = { "components.radix.primitives.form": [ "form", ], + "components.radix.primitives.progress": [ + "progress", + ], +} + +RADIX_PRIMITIVES_SHORTCUT_MAPPING: dict = { + k: v for k, v in RADIX_PRIMITIVES_MAPPING.items() if "progress" not in k } COMPONENTS_CORE_MAPPING: dict = { @@ -248,7 +257,7 @@ RADIX_MAPPING: dict = { **RADIX_THEMES_COMPONENTS_MAPPING, **RADIX_THEMES_TYPOGRAPHY_MAPPING, **RADIX_THEMES_LAYOUT_MAPPING, - **RADIX_PRIMITIVES_MAPPING, + **RADIX_PRIMITIVES_SHORTCUT_MAPPING, } _MAPPING: dict = { @@ -311,25 +320,27 @@ _MAPPING: dict = { "upload_files", "window_alert", ], + "istate.storage": [ + "Cookie", + "LocalStorage", + "SessionStorage", + ], "middleware": ["middleware", "Middleware"], "model": ["session", "Model"], "state": [ "var", - "Cookie", - "LocalStorage", - "SessionStorage", "ComponentState", "State", + "dynamic", ], "style": ["Style", "toggle_color_mode"], "utils.imports": ["ImportVar"], "utils.serializers": ["serializer"], - "vars": ["Var"], + "vars": ["Var", "field", "Field"], } _SUBMODULES: set[str] = { "components", - "event", "app", "style", "admin", @@ -338,7 +349,6 @@ _SUBMODULES: set[str] = { "testing", "utils", "vars", - "ivars", "config", "compiler", } diff --git a/reflex/__init__.pyi b/reflex/__init__.pyi index 22c7298fe..aa1c92b72 100644 --- a/reflex/__init__.pyi +++ b/reflex/__init__.pyi @@ -11,8 +11,6 @@ from . import base as base from . import compiler as compiler from . import components as components from . import config as config -from . import event as event -from . import ivars as ivars from . import model as model from . import style as style from . import testing as testing @@ -132,6 +130,7 @@ from .components.radix.themes.layout.container import container as container from .components.radix.themes.layout.flex import flex as flex from .components.radix.themes.layout.grid import grid as grid from .components.radix.themes.layout.list import list_item as list_item +from .components.radix.themes.layout.list import list_ns as list # noqa from .components.radix.themes.layout.list import ordered_list as ordered_list from .components.radix.themes.layout.list import unordered_list as unordered_list from .components.radix.themes.layout.section import section as section @@ -161,6 +160,7 @@ from .event import clear_local_storage as clear_local_storage from .event import clear_session_storage as clear_session_storage from .event import console_log as console_log from .event import download as download +from .event import event as event from .event import prevent_default as prevent_default from .event import redirect as redirect from .event import remove_cookie as remove_cookie @@ -174,22 +174,25 @@ from .event import stop_propagation as stop_propagation from .event import upload_files as upload_files from .event import window_alert as window_alert from .experimental import _x as _x +from .istate.storage import Cookie as Cookie +from .istate.storage import LocalStorage as LocalStorage +from .istate.storage import SessionStorage as SessionStorage from .middleware import Middleware as Middleware from .middleware import middleware as middleware from .model import Model as Model from .model import session as session from .page import page as page from .state import ComponentState as ComponentState -from .state import Cookie as Cookie -from .state import LocalStorage as LocalStorage -from .state import SessionStorage as SessionStorage from .state import State as State +from .state import dynamic as dynamic from .state import var as var from .style import Style as Style from .style import toggle_color_mode as toggle_color_mode from .utils.imports import ImportVar as ImportVar from .utils.serializers import serializer as serializer +from .vars import Field as Field from .vars import Var as Var +from .vars import field as field del compat RADIX_THEMES_MAPPING: dict @@ -197,6 +200,7 @@ RADIX_THEMES_COMPONENTS_MAPPING: dict RADIX_THEMES_LAYOUT_MAPPING: dict RADIX_THEMES_TYPOGRAPHY_MAPPING: dict RADIX_PRIMITIVES_MAPPING: dict +RADIX_PRIMITIVES_SHORTCUT_MAPPING: dict COMPONENTS_CORE_MAPPING: dict COMPONENTS_BASE_MAPPING: dict RADIX_MAPPING: dict diff --git a/reflex/app.py b/reflex/app.py index a3094885d..abf0b5d41 100644 --- a/reflex/app.py +++ b/reflex/app.py @@ -9,6 +9,7 @@ import copy import functools import inspect import io +import json import multiprocessing import os import platform @@ -63,7 +64,7 @@ from reflex.components.core.client_side_routing import ( ) from reflex.components.core.upload import Upload, get_upload_dir from reflex.components.radix import themes -from reflex.config import get_config +from reflex.config import environment, get_config from reflex.event import Event, EventHandler, EventSpec, window_alert from reflex.model import Model, get_db_status from reflex.page import ( @@ -269,13 +270,12 @@ class App(MiddlewareMixin, LifespanMixin, Base): "`connect_error_component` is deprecated, use `overlay_component` instead" ) super().__init__(**kwargs) - base_state_subclasses = BaseState.__subclasses__() # Special case to allow test cases have multiple subclasses of rx.BaseState. - if not is_testing_env() and len(base_state_subclasses) > 1: - # Only one Base State class is allowed. + if not is_testing_env() and BaseState.__subclasses__() != [State]: + # Only rx.State is allowed as Base State subclass. raise ValueError( - "rx.BaseState cannot be subclassed multiple times. use rx.State instead" + "rx.BaseState cannot be subclassed directly. Use rx.State instead" ) if "breakpoints" in self.style: @@ -431,25 +431,12 @@ class App(MiddlewareMixin, LifespanMixin, Base): The generated component. Raises: - VarOperationTypeError: When an invalid component var related function is passed. - TypeError: When an invalid component function is passed. exceptions.MatchTypeError: If the return types of match cases in rx.match are different. """ - from reflex.utils.exceptions import VarOperationTypeError - try: return component if isinstance(component, Component) else component() except exceptions.MatchTypeError: raise - except TypeError as e: - message = str(e) - if "Var" in message: - raise VarOperationTypeError( - "You may be trying to use an invalid Python function on a state var. " - "When referencing a var inside your render code, only limited var operations are supported. " - "See the var operation docs here: https://reflex.dev/docs/vars/var-operations/" - ) from e - raise e def add_page( self, @@ -482,9 +469,8 @@ class App(MiddlewareMixin, LifespanMixin, Base): """ # If the route is not set, get it from the callable. if route is None: - assert isinstance( - component, Callable - ), "Route must be set if component is not a callable." + if not isinstance(component, Callable): + raise ValueError("Route must be set if component is not a callable.") # Format the route. route = format.format_route(component.__name__) else: @@ -824,7 +810,7 @@ class App(MiddlewareMixin, LifespanMixin, Base): for dep in deps: if dep not in state.vars and dep not in state.backend_vars: raise exceptions.VarDependencyError( - f"ComputedVar {var._var_name} on state {state.__name__} has an invalid dependency {dep}" + f"ComputedVar {var._js_expr} on state {state.__name__} has an invalid dependency {dep}" ) for substate in state.class_subclasses: @@ -971,15 +957,16 @@ class App(MiddlewareMixin, LifespanMixin, Base): executor = None if ( platform.system() in ("Linux", "Darwin") - and os.environ.get("REFLEX_COMPILE_PROCESSES") is not None + and (number_of_processes := environment.REFLEX_COMPILE_PROCESSES) + is not None ): executor = concurrent.futures.ProcessPoolExecutor( - max_workers=int(os.environ.get("REFLEX_COMPILE_PROCESSES", 0)) or None, + max_workers=number_of_processes, mp_context=multiprocessing.get_context("fork"), ) else: executor = concurrent.futures.ThreadPoolExecutor( - max_workers=int(os.environ.get("REFLEX_COMPILE_THREADS", 0)) or None, + max_workers=environment.REFLEX_COMPILE_THREADS ) with executor: @@ -1528,20 +1515,28 @@ class EventNamespace(AsyncNamespace): async def on_event(self, sid, data): """Event for receiving front-end websocket events. + Raises: + RuntimeError: If the Socket.IO is badly initialized. + Args: sid: The Socket.IO session id. data: The event data. """ + fields = json.loads(data) # Get the event. - event = Event.parse_raw(data) + event = Event( + **{k: v for k, v in fields.items() if k not in ("handler", "event_actions")} + ) self.token_to_sid[event.token] = sid self.sid_to_token[sid] = event.token # Get the event environment. - assert self.app.sio is not None + if self.app.sio is None: + raise RuntimeError("Socket.IO is not initialized.") environ = self.app.sio.get_environ(sid, self.namespace) - assert environ is not None + if environ is None: + raise RuntimeError("Socket.IO environ is not initialized.") # Get the client headers. headers = { diff --git a/reflex/app_mixins/lifespan.py b/reflex/app_mixins/lifespan.py index 2b5ed8b58..ef882a2ea 100644 --- a/reflex/app_mixins/lifespan.py +++ b/reflex/app_mixins/lifespan.py @@ -6,11 +6,13 @@ import asyncio import contextlib import functools import inspect -import sys from typing import Callable, Coroutine, Set, Union from fastapi import FastAPI +from reflex.utils import console +from reflex.utils.exceptions import InvalidLifespanTaskType + from .mixin import AppMixin @@ -26,6 +28,7 @@ class LifespanMixin(AppMixin): try: async with contextlib.AsyncExitStack() as stack: for task in self.lifespan_tasks: + run_msg = f"Started lifespan task: {task.__name__} as {{type}}" # type: ignore if isinstance(task, asyncio.Task): running_tasks.append(task) else: @@ -35,15 +38,19 @@ class LifespanMixin(AppMixin): _t = task() if isinstance(_t, contextlib._AsyncGeneratorContextManager): await stack.enter_async_context(_t) + console.debug(run_msg.format(type="asynccontextmanager")) elif isinstance(_t, Coroutine): - running_tasks.append(asyncio.create_task(_t)) + task_ = asyncio.create_task(_t) + task_.add_done_callback(lambda t: t.result()) + running_tasks.append(task_) + console.debug(run_msg.format(type="coroutine")) + else: + console.debug(run_msg.format(type="function")) yield finally: - cancel_kwargs = ( - {"msg": "lifespan_cleanup"} if sys.version_info >= (3, 9) else {} - ) for task in running_tasks: - task.cancel(**cancel_kwargs) + console.debug(f"Canceling lifespan task: {task}") + task.cancel(msg="lifespan_cleanup") def register_lifespan_task(self, task: Callable | asyncio.Task, **task_kwargs): """Register a task to run during the lifespan of the app. @@ -51,7 +58,18 @@ class LifespanMixin(AppMixin): Args: task: The task to register. task_kwargs: The kwargs of the task. + + Raises: + InvalidLifespanTaskType: If the task is a generator function. """ + if inspect.isgeneratorfunction(task) or inspect.isasyncgenfunction(task): + raise InvalidLifespanTaskType( + f"Task {task.__name__} of type generator must be decorated with contextlib.asynccontextmanager." + ) + if task_kwargs: + original_task = task task = functools.partial(task, **task_kwargs) # type: ignore + functools.update_wrapper(task, original_task) # type: ignore self.lifespan_tasks.add(task) # type: ignore + console.debug(f"Registered lifespan task: {task.__name__}") # type: ignore diff --git a/reflex/app_module_for_backend.py b/reflex/app_module_for_backend.py index cae136354..8109fc3d6 100644 --- a/reflex/app_module_for_backend.py +++ b/reflex/app_module_for_backend.py @@ -15,7 +15,7 @@ if constants.CompileVars.APP != "app": telemetry.send("compile") app_module = get_app(reload=False) app = getattr(app_module, constants.CompileVars.APP) -# For py3.8 and py3.9 compatibility when redis is used, we MUST add any decorator pages +# For py3.9 compatibility when redis is used, we MUST add any decorator pages # before compiling the app in a thread to avoid event loop error (REF-2172). app._apply_decorated_pages() compile_future = ThreadPoolExecutor(max_workers=1).submit(app._compile) diff --git a/reflex/base.py b/reflex/base.py index 5a2a6d2a9..c334ddf56 100644 --- a/reflex/base.py +++ b/reflex/base.py @@ -47,6 +47,9 @@ def validate_field_name(bases: List[Type["BaseModel"]], field_name: str) -> None # shadowed state vars when reloading app via utils.prerequisites.get_app(reload=True) pydantic_main.validate_field_name = validate_field_name # type: ignore +if TYPE_CHECKING: + from reflex.vars import Var + class Base(BaseModel): # pyright: ignore [reportUnboundVariable] """The base class subclassed by all Reflex classes. @@ -92,7 +95,7 @@ class Base(BaseModel): # pyright: ignore [reportUnboundVariable] return self @classmethod - def get_fields(cls) -> dict[str, Any]: + def get_fields(cls) -> dict[str, ModelField]: """Get the fields of the object. Returns: @@ -101,7 +104,7 @@ class Base(BaseModel): # pyright: ignore [reportUnboundVariable] return cls.__fields__ @classmethod - def add_field(cls, var: Any, default_value: Any): + def add_field(cls, var: Var, default_value: Any): """Add a pydantic field after class definition. Used by State.add_var() to correctly handle the new variable. @@ -110,7 +113,7 @@ class Base(BaseModel): # pyright: ignore [reportUnboundVariable] var: The variable to add a pydantic field for. default_value: The default value of the field """ - var_name = var._var_name.split(".")[-1] + var_name = var._var_field_name new_field = ModelField.infer( name=var_name, value=default_value, @@ -133,13 +136,4 @@ class Base(BaseModel): # pyright: ignore [reportUnboundVariable] # Seems like this function signature was wrong all along? # If the user wants a field that we know of, get it and pass it off to _get_value key = getattr(self, key) - return self._get_value( - key, - to_dict=True, - by_alias=False, - include=None, - exclude=None, - exclude_unset=False, - exclude_defaults=False, - exclude_none=False, - ) + return key diff --git a/reflex/compiler/compiler.py b/reflex/compiler/compiler.py index 00d4acc22..909299635 100644 --- a/reflex/compiler/compiler.py +++ b/reflex/compiler/compiler.py @@ -2,7 +2,6 @@ from __future__ import annotations -import os from datetime import datetime from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union @@ -16,14 +15,13 @@ from reflex.components.component import ( CustomComponent, StatefulComponent, ) -from reflex.config import get_config -from reflex.ivars.base import LiteralVar +from reflex.config import environment, get_config from reflex.state import BaseState from reflex.style import SYSTEM_COLOR_MODE from reflex.utils.exec import is_prod_mode from reflex.utils.imports import ImportVar from reflex.utils.prerequisites import get_web_dir -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var def _compile_document_root(root: Component) -> str: @@ -41,6 +39,20 @@ def _compile_document_root(root: Component) -> str: ) +def _normalize_library_name(lib: str) -> str: + """Normalize the library name. + + Args: + lib: The library name to normalize. + + Returns: + The normalized library name. + """ + if lib == "react": + return "React" + return lib.replace("@", "").replace("/", "_").replace("-", "_") + + def _compile_app(app_root: Component) -> str: """Compile the app template component. @@ -50,15 +62,25 @@ def _compile_app(app_root: Component) -> str: Returns: The compiled app. """ + from reflex.components.dynamic import bundled_libraries + + window_libraries = [ + (_normalize_library_name(name), name) for name in bundled_libraries + ] + [ + ("utils_context", f"/{constants.Dirs.UTILS}/context"), + ("utils_state", f"/{constants.Dirs.UTILS}/state"), + ] + return templates.APP_ROOT.render( imports=utils.compile_imports(app_root._get_all_imports()), custom_codes=app_root._get_all_custom_code(), hooks={**app_root._get_all_hooks_internal(), **app_root._get_all_hooks()}, + window_libraries=window_libraries, render=app_root.render(), ) -def _compile_theme(theme: dict) -> str: +def _compile_theme(theme: str) -> str: """Compile the theme. Args: @@ -172,7 +194,7 @@ def _compile_root_stylesheet(stylesheets: list[str]) -> str: stylesheet_full_path = ( Path.cwd() / constants.Dirs.APP_ASSETS / stylesheet.strip("/") ) - if not os.path.exists(stylesheet_full_path): + if not stylesheet_full_path.exists(): raise FileNotFoundError( f"The stylesheet file {stylesheet_full_path} does not exist." ) @@ -378,7 +400,7 @@ def compile_theme(style: ComponentStyle) -> tuple[str, str]: theme = utils.create_theme(style) # Compile the theme. - code = _compile_theme(theme) + code = _compile_theme(str(LiteralVar.create(theme))) return output_path, code @@ -504,7 +526,7 @@ def remove_tailwind_from_postcss() -> tuple[str, str]: def purge_web_pages_dir(): """Empty out .web/pages directory.""" - if not is_prod_mode() and os.environ.get("REFLEX_PERSIST_WEB_DIR"): + if not is_prod_mode() and environment.REFLEX_PERSIST_WEB_DIR: # Skip purging the web directory in dev mode if REFLEX_PERSIST_WEB_DIR is set. return diff --git a/reflex/compiler/utils.py b/reflex/compiler/utils.py index 1b69539ac..40640faa6 100644 --- a/reflex/compiler/utils.py +++ b/reflex/compiler/utils.py @@ -2,12 +2,12 @@ from __future__ import annotations -import os from pathlib import Path from typing import Any, Callable, Dict, Optional, Type, Union from urllib.parse import urlparse from reflex.utils.prerequisites import get_web_dir +from reflex.vars.base import Var try: from pydantic.v1.fields import ModelField @@ -28,11 +28,11 @@ from reflex.components.base import ( Title, ) from reflex.components.component import Component, ComponentStyle, CustomComponent -from reflex.state import BaseState, Cookie, LocalStorage, SessionStorage +from reflex.istate.storage import Cookie, LocalStorage, SessionStorage +from reflex.state import BaseState from reflex.style import Style from reflex.utils import console, format, imports, path_ops from reflex.utils.imports import ImportVar, ParsedImportDict -from reflex.vars import Var # To re-export this function. merge_imports = imports.merge_imports @@ -44,6 +44,9 @@ def compile_import_statement(fields: list[ImportVar]) -> tuple[str, list[str]]: Args: fields: The set of fields to import from the library. + Raises: + ValueError: If there is more than one default import. + Returns: The libraries for default and rest. default: default library. When install "import def from library". @@ -54,7 +57,8 @@ def compile_import_statement(fields: list[ImportVar]) -> tuple[str, list[str]]: # Check for default imports. defaults = {field for field in fields_set if field.is_default} - assert len(defaults) < 2 + if len(defaults) >= 2: + raise ValueError("Only one default import is allowed.") # Get the default import, and the specific imports. default = next(iter({field.name for field in defaults}), "") @@ -92,6 +96,9 @@ def compile_imports(import_dict: ParsedImportDict) -> list[dict]: Args: import_dict: The import dict to compile. + Raises: + ValueError: If an import in the dict is invalid. + Returns: The list of import dict. """ @@ -106,8 +113,10 @@ def compile_imports(import_dict: ParsedImportDict) -> list[dict]: continue if not lib: - assert not default, "No default field allowed for empty library." - assert rest is not None and len(rest) > 0, "No fields to import." + if default: + raise ValueError("No default field allowed for empty library.") + if rest is None or len(rest) == 0: + raise ValueError("No fields to import.") for module in sorted(rest): import_dicts.append(get_import_dict(module)) continue @@ -152,8 +161,10 @@ def compile_state(state: Type[BaseState]) -> dict: console.warn( f"Failed to compile initial state with computed vars, excluding them: {e}" ) - initial_state = state(_reflex_internal_init=True).dict(include_computed=False) - return format.format_state(initial_state) + initial_state = state(_reflex_internal_init=True).dict( + initial=True, include_computed=False + ) + return initial_state def _compile_client_storage_field( @@ -266,7 +277,7 @@ def compile_custom_component( } # Concatenate the props. - props = [prop._var_name for prop in component.get_prop_vars()] + props = [prop._js_expr for prop in component.get_prop_vars()] # Compile the component. return ( @@ -427,11 +438,11 @@ def add_meta( Returns: The component with the metadata added. """ - meta_tags = [Meta.create(**item) for item in meta] - - children: list[Any] = [ - Title.create(title), + meta_tags = [ + item if isinstance(item, Component) else Meta.create(**item) for item in meta ] + + children: list[Any] = [Title.create(title)] if description: children.append(Description.create(content=description)) children.append(Image.create(content=image)) @@ -446,16 +457,16 @@ def add_meta( return page -def write_page(path: str, code: str): +def write_page(path: str | Path, code: str): """Write the given code to the given path. Args: path: The path to write the code to. code: The code to write. """ - path_ops.mkdir(os.path.dirname(path)) - with open(path, "w", encoding="utf-8") as f: - f.write(code) + path = Path(path) + path_ops.mkdir(path.parent) + path.write_text(code, encoding="utf-8") def empty_dir(path: str | Path, keep_files: list[str] | None = None): diff --git a/reflex/components/base/app_wrap.py b/reflex/components/base/app_wrap.py index 7d6a085b4..c7cfe6505 100644 --- a/reflex/components/base/app_wrap.py +++ b/reflex/components/base/app_wrap.py @@ -2,7 +2,7 @@ from reflex.components.base.fragment import Fragment from reflex.components.component import Component -from reflex.ivars.base import ImmutableVar +from reflex.vars.base import Var class AppWrap(Fragment): @@ -15,4 +15,4 @@ class AppWrap(Fragment): Returns: A new AppWrap component containing {children}. """ - return super().create(ImmutableVar.create("children")) + return super().create(Var(_js_expr="children")) diff --git a/reflex/components/base/app_wrap.pyi b/reflex/components/base/app_wrap.pyi index 576f8cd69..c4cb45469 100644 --- a/reflex/components/base/app_wrap.pyi +++ b/reflex/components/base/app_wrap.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.base.fragment import Fragment -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class AppWrap(Fragment): @overload @@ -22,41 +22,21 @@ class AppWrap(Fragment): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AppWrap": """Create a new AppWrap component. diff --git a/reflex/components/base/bare.py b/reflex/components/base/bare.py index 2ed0cb590..ada511ef2 100644 --- a/reflex/components/base/bare.py +++ b/reflex/components/base/bare.py @@ -7,8 +7,7 @@ from typing import Any, Iterator from reflex.components.component import Component from reflex.components.tags import Tag from reflex.components.tags.tagless import Tagless -from reflex.ivars.base import ImmutableVar -from reflex.vars import Var +from reflex.vars import ArrayVar, BooleanVar, ObjectVar, Var class Bare(Component): @@ -26,16 +25,16 @@ class Bare(Component): Returns: The component. """ - if isinstance(contents, ImmutableVar): - return cls(contents=contents) if isinstance(contents, Var): - contents = contents.to(str) + return cls(contents=contents) else: contents = str(contents) if contents is not None else "" return cls(contents=contents) # type: ignore def _render(self) -> Tag: - if isinstance(self.contents, ImmutableVar): + if isinstance(self.contents, Var): + if isinstance(self.contents, (BooleanVar, ObjectVar, ArrayVar)): + return Tagless(contents=f"{{{str(self.contents.to_string())}}}") return Tagless(contents=f"{{{str(self.contents)}}}") return Tagless(contents=str(self.contents)) diff --git a/reflex/components/base/body.pyi b/reflex/components/base/body.pyi index 57ff1b7b7..74f3333e5 100644 --- a/reflex/components/base/body.pyi +++ b/reflex/components/base/body.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Body(Component): @overload @@ -22,41 +22,21 @@ class Body(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Body": """Create the component. diff --git a/reflex/components/base/document.pyi b/reflex/components/base/document.pyi index 77065d845..a4a956369 100644 --- a/reflex/components/base/document.pyi +++ b/reflex/components/base/document.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class NextDocumentLib(Component): @overload @@ -22,41 +22,21 @@ class NextDocumentLib(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "NextDocumentLib": """Create the component. @@ -89,41 +69,21 @@ class Html(NextDocumentLib): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Html": """Create the component. @@ -155,41 +115,21 @@ class DocumentHead(NextDocumentLib): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DocumentHead": """Create the component. @@ -221,41 +161,21 @@ class Main(NextDocumentLib): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Main": """Create the component. @@ -287,41 +207,21 @@ class NextScript(NextDocumentLib): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "NextScript": """Create the component. diff --git a/reflex/components/base/error_boundary.py b/reflex/components/base/error_boundary.py index 058976498..83becc034 100644 --- a/reflex/components/base/error_boundary.py +++ b/reflex/components/base/error_boundary.py @@ -2,17 +2,32 @@ from __future__ import annotations -from typing import List +from typing import Dict, List, Tuple from reflex.compiler.compiler import _compile_component from reflex.components.component import Component from reflex.components.el import div, p -from reflex.constants import Hooks, Imports -from reflex.event import EventChain, EventHandler -from reflex.ivars.base import ImmutableVar -from reflex.ivars.function import FunctionVar -from reflex.utils.imports import ImportVar -from reflex.vars import Var +from reflex.event import EventHandler +from reflex.state import FrontendEventExceptionState +from reflex.vars.base import Var + + +def on_error_spec( + error: Var[Dict[str, str]], info: Var[Dict[str, str]] +) -> Tuple[Var[str], Var[str]]: + """The spec for the on_error event handler. + + Args: + error: The error message. + info: Additional information about the error. + + Returns: + The arguments for the event handler. + """ + return ( + error.stack, + info.componentStack, + ) class ErrorBoundary(Component): @@ -22,31 +37,13 @@ class ErrorBoundary(Component): tag = "ErrorBoundary" # Fired when the boundary catches an error. - on_error: EventHandler[lambda error, info: [error, info]] = ImmutableVar( # type: ignore - "logFrontendError" - ).to(FunctionVar, EventChain) + on_error: EventHandler[on_error_spec] # Rendered instead of the children when an error is caught. - Fallback_component: Var[Component] = ImmutableVar.create_safe("Fallback")._replace( + Fallback_component: Var[Component] = Var(_js_expr="Fallback")._replace( _var_type=Component ) - def add_imports(self) -> dict[str, list[ImportVar]]: - """Add imports for the component. - - Returns: - The imports to add. - """ - return Imports.EVENTS - - def add_hooks(self) -> List[str | Var]: - """Add hooks for the component. - - Returns: - The hooks to add. - """ - return [Hooks.EVENTS, Hooks.FRONTEND_ERRORS] - def add_custom_code(self) -> List[str]: """Add custom Javascript code into the page that contains this component. @@ -58,7 +55,7 @@ class ErrorBoundary(Component): fallback_container = div( p("Ooops...Unknown Reflex error has occured:"), p( - ImmutableVar.create("error.message"), + Var(_js_expr="error.message"), color="red", ), p("Please contact the support."), @@ -76,5 +73,20 @@ class ErrorBoundary(Component): """ ] + @classmethod + def create(cls, *children, **props): + """Create an ErrorBoundary component. + + Args: + *children: The children of the component. + **props: The props of the component. + + Returns: + The ErrorBoundary component. + """ + if "on_error" not in props: + props["on_error"] = FrontendEventExceptionState.handle_frontend_exception + return super().create(*children, **props) + error_boundary = ErrorBoundary.create diff --git a/reflex/components/base/error_boundary.pyi b/reflex/components/base/error_boundary.pyi index 4777b09e9..c84742851 100644 --- a/reflex/components/base/error_boundary.pyi +++ b/reflex/components/base/error_boundary.pyi @@ -3,69 +3,50 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Optional, Union, overload +from typing import Any, Dict, List, Optional, Tuple, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.utils.imports import ImportVar -from reflex.vars import Var +from reflex.vars.base import Var + +def on_error_spec( + error: Var[Dict[str, str]], info: Var[Dict[str, str]] +) -> Tuple[Var[str], Var[str]]: ... class ErrorBoundary(Component): - def add_imports(self) -> dict[str, list[ImportVar]]: ... - def add_hooks(self) -> List[str | Var]: ... def add_custom_code(self) -> List[str]: ... @overload @classmethod def create( # type: ignore cls, *children, - Fallback_component: Optional[Union[Var[Component], Component]] = None, + Fallback_component: Optional[Union[Component, Var[Component]]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_error: Optional[EventType[str, str]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ErrorBoundary": - """Create the component. + """Create an ErrorBoundary component. Args: *children: The children of the component. @@ -79,7 +60,7 @@ class ErrorBoundary(Component): **props: The props of the component. Returns: - The component. + The ErrorBoundary component. """ ... diff --git a/reflex/components/base/fragment.pyi b/reflex/components/base/fragment.pyi index fae72cc9c..b49bf4cad 100644 --- a/reflex/components/base/fragment.pyi +++ b/reflex/components/base/fragment.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Fragment(Component): @overload @@ -22,41 +22,21 @@ class Fragment(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Fragment": """Create the component. diff --git a/reflex/components/base/head.pyi b/reflex/components/base/head.pyi index 041457137..148dbe486 100644 --- a/reflex/components/base/head.pyi +++ b/reflex/components/base/head.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component, MemoizationLeaf -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class NextHeadLib(Component): @overload @@ -22,41 +22,21 @@ class NextHeadLib(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "NextHeadLib": """Create the component. @@ -88,41 +68,21 @@ class Head(NextHeadLib, MemoizationLeaf): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Head": """Create a new memoization leaf component. diff --git a/reflex/components/base/link.py b/reflex/components/base/link.py index 1c11ab262..3ea34f212 100644 --- a/reflex/components/base/link.py +++ b/reflex/components/base/link.py @@ -1,7 +1,7 @@ """Display the title of the current page.""" from reflex.components.component import Component -from reflex.vars import Var +from reflex.vars.base import Var class RawLink(Component): diff --git a/reflex/components/base/link.pyi b/reflex/components/base/link.pyi index 80388a327..61ff66029 100644 --- a/reflex/components/base/link.pyi +++ b/reflex/components/base/link.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class RawLink(Component): @overload @@ -24,41 +24,21 @@ class RawLink(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RawLink": """Create the component. @@ -99,41 +79,21 @@ class ScriptTag(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ScriptTag": """Create the component. diff --git a/reflex/components/base/meta.py b/reflex/components/base/meta.py index 55cb42f0a..526233c8b 100644 --- a/reflex/components/base/meta.py +++ b/reflex/components/base/meta.py @@ -16,13 +16,15 @@ class Title(Component): def render(self) -> dict: """Render the title component. + Raises: + ValueError: If the title is not a single string. + Returns: The rendered title component. """ # Make sure the title is a single string. - assert len(self.children) == 1 and isinstance( - self.children[0], Bare - ), "Title must be a single string." + if len(self.children) != 1 or not isinstance(self.children[0], Bare): + raise ValueError("Title must be a single string.") return super().render() diff --git a/reflex/components/base/meta.pyi b/reflex/components/base/meta.pyi index 372d202f9..e91626cde 100644 --- a/reflex/components/base/meta.pyi +++ b/reflex/components/base/meta.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Title(Component): def render(self) -> dict: ... @@ -23,41 +23,21 @@ class Title(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Title": """Create the component. @@ -94,41 +74,21 @@ class Meta(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Meta": """Create the component. @@ -170,41 +130,21 @@ class Description(Meta): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Description": """Create the component. @@ -246,41 +186,21 @@ class Image(Meta): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Image": """Create the component. diff --git a/reflex/components/base/script.py b/reflex/components/base/script.py index 7b0596966..eb37d53e7 100644 --- a/reflex/components/base/script.py +++ b/reflex/components/base/script.py @@ -8,9 +8,8 @@ from __future__ import annotations from typing import Literal from reflex.components.component import Component -from reflex.event import EventHandler -from reflex.ivars.base import LiteralVar -from reflex.vars import Var +from reflex.event import EventHandler, empty_event +from reflex.vars.base import LiteralVar, Var class Script(Component): @@ -36,13 +35,13 @@ class Script(Component): ) # Triggered when the script is loading - on_load: EventHandler[lambda: []] + on_load: EventHandler[empty_event] # Triggered when the script has loaded - on_ready: EventHandler[lambda: []] + on_ready: EventHandler[empty_event] # Triggered when the script has errored - on_error: EventHandler[lambda: []] + on_error: EventHandler[empty_event] @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/base/script.pyi b/reflex/components/base/script.pyi index 311485b66..2d13180bc 100644 --- a/reflex/components/base/script.pyi +++ b/reflex/components/base/script.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Script(Component): @overload @@ -19,8 +19,8 @@ class Script(Component): src: Optional[Union[Var[str], str]] = None, strategy: Optional[ Union[ - Var[Literal["afterInteractive", "beforeInteractive", "lazyOnload"]], Literal["afterInteractive", "beforeInteractive", "lazyOnload"], + Var[Literal["afterInteractive", "beforeInteractive", "lazyOnload"]], ] ] = None, style: Optional[Style] = None, @@ -29,44 +29,24 @@ class Script(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_load: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_ready: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_error: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_load: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_ready: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Script": """Create an inline or user-defined script. diff --git a/reflex/components/component.py b/reflex/components/component.py index 6d4fdded1..a0d9c93b0 100644 --- a/reflex/components/component.py +++ b/reflex/components/component.py @@ -25,6 +25,7 @@ import reflex.state from reflex.base import Base from reflex.compiler.templates import STATEFUL_COMPONENT from reflex.components.core.breakpoints import Breakpoints +from reflex.components.dynamic import load_dynamic_serializer from reflex.components.tags import Tag from reflex.constants import ( Dirs, @@ -35,20 +36,30 @@ from reflex.constants import ( MemoizationMode, PageNames, ) +from reflex.constants.compiler import SpecialAttributes from reflex.event import ( EventChain, + EventChainVar, EventHandler, EventSpec, + EventVar, call_event_fn, call_event_handler, + empty_event, get_handler_args, ) -from reflex.ivars.base import ImmutableVar, LiteralVar from reflex.style import Style, format_as_emotion from reflex.utils import format, imports, types -from reflex.utils.imports import ImportDict, ImportVar, ParsedImportDict, parse_imports -from reflex.utils.serializers import serializer -from reflex.vars import BaseVar, ImmutableVarData, Var, VarData +from reflex.utils.imports import ( + ImmutableParsedImportDict, + ImportDict, + ImportVar, + ParsedImportDict, + parse_imports, +) +from reflex.vars import VarData +from reflex.vars.base import LiteralVar, Var +from reflex.vars.sequence import LiteralArrayVar class BaseComponent(Base, ABC): @@ -189,7 +200,7 @@ class Component(BaseComponent, ABC): class_name: Any = None # Special component props. - special_props: Set[Var] = set() + special_props: List[Var] = [] # Whether the component should take the focus once the page is loaded autofocus: bool = False @@ -441,9 +452,17 @@ class Component(BaseComponent, ABC): not passed_types and not types._issubclass(passed_type, expected_type, value) ): - value_name = value._var_name if isinstance(value, Var) else value + value_name = value._js_expr if isinstance(value, Var) else value + + additional_info = ( + " You can call `.bool()` on the value to convert it to a boolean." + if expected_type is bool and isinstance(value, Var) + else "" + ) + raise TypeError( - f"Invalid var passed for prop {type(self).__name__}.{key}, expected type {expected_type}, got value {value_name} of type {passed_types or passed_type}." + f"Invalid var passed for prop {type(self).__name__}.{key}, expected type {expected_type}, got value {value_name} of type {passed_type}." + + additional_info ) # Check if the key is an event trigger. if key in component_specific_triggers: @@ -457,13 +476,24 @@ class Component(BaseComponent, ABC): for key in kwargs["event_triggers"]: del kwargs[key] + # Place data_ and aria_ attributes into custom_attrs + special_attributes = tuple( + key + for key in kwargs + if key not in fields and SpecialAttributes.is_special(key) + ) + if special_attributes: + custom_attrs = kwargs.setdefault("custom_attrs", {}) + for key in special_attributes: + custom_attrs[format.to_kebab_case(key)] = kwargs.pop(key) + # Add style props to the component. style = kwargs.get("style", {}) if isinstance(style, List): # Merge styles, the later ones overriding keys in the earlier ones. style = {k: v for style_dict in style for k, v in style_dict.items()} - if isinstance(style, Breakpoints): + if isinstance(style, (Breakpoints, Var)): style = { # Assign the Breakpoints to the self-referential selector to avoid squashing down to a regular dict. "&": style, @@ -476,13 +506,16 @@ class Component(BaseComponent, ABC): **{attr: value for attr, value in kwargs.items() if attr not in fields}, } ) - if "custom_attrs" not in kwargs: - kwargs["custom_attrs"] = {} # Convert class_name to str if it's list class_name = kwargs.get("class_name", "") if isinstance(class_name, (List, tuple)): - kwargs["class_name"] = " ".join(class_name) + if any(isinstance(c, Var) for c in class_name): + kwargs["class_name"] = LiteralArrayVar.create( + class_name, _var_type=List[str] + ).join(" ") + else: + kwargs["class_name"] = " ".join(class_name) # Construct the component. super().__init__(*args, **kwargs) @@ -491,7 +524,11 @@ class Component(BaseComponent, ABC): self, args_spec: Any, value: Union[ - Var, EventHandler, EventSpec, List[Union[EventHandler, EventSpec]], Callable + Var, + EventHandler, + EventSpec, + List[Union[EventHandler, EventSpec, EventVar]], + Callable, ], ) -> Union[EventChain, Var]: """Create an event chain from a variety of input types. @@ -508,11 +545,16 @@ class Component(BaseComponent, ABC): """ # If it's an event chain var, return it. if isinstance(value, Var): - if value._var_type is not EventChain: + if isinstance(value, EventChainVar): + return value + elif isinstance(value, EventVar): + value = [value] + elif issubclass(value._var_type, (EventChain, EventSpec)): + return self._create_event_chain(args_spec, value.guess_type()) + else: raise ValueError( - f"Invalid event chain: {repr(value)} of type {type(value)}" + f"Invalid event chain: {str(value)} of type {value._var_type}" ) - return value elif isinstance(value, EventChain): # Trust that the caller knows what they're doing passing an EventChain directly return value @@ -523,7 +565,7 @@ class Component(BaseComponent, ABC): # If the input is a list of event handlers, create an event chain. if isinstance(value, List): - events: list[EventSpec] = [] + events: List[Union[EventSpec, EventVar]] = [] for v in value: if isinstance(v, (EventHandler, EventSpec)): # Call the event handler to get the event. @@ -537,6 +579,8 @@ class Component(BaseComponent, ABC): "lambda inside an EventChain list." ) events.extend(result) + elif isinstance(v, EventVar): + events.append(v) else: raise ValueError(f"Invalid event: {v}") @@ -546,32 +590,30 @@ class Component(BaseComponent, ABC): if isinstance(result, Var): # Recursively call this function if the lambda returned an EventChain Var. return self._create_event_chain(args_spec, result) - events = result + events = [*result] # Otherwise, raise an error. else: raise ValueError(f"Invalid event chain: {value}") # Add args to the event specs if necessary. - events = [e.with_args(get_handler_args(e)) for e in events] - - # Collect event_actions from each spec - event_actions = {} - for e in events: - event_actions.update(e.event_actions) + events = [ + (e.with_args(get_handler_args(e)) if isinstance(e, EventSpec) else e) + for e in events + ] # Return the event chain. if isinstance(args_spec, Var): return EventChain( events=events, args_spec=None, - event_actions=event_actions, + event_actions={}, ) else: return EventChain( events=events, args_spec=args_spec, - event_actions=event_actions, + event_actions={}, ) def get_event_triggers(self) -> Dict[str, Any]: @@ -582,21 +624,21 @@ class Component(BaseComponent, ABC): """ default_triggers = { - EventTriggers.ON_FOCUS: lambda: [], - EventTriggers.ON_BLUR: lambda: [], - EventTriggers.ON_CLICK: lambda: [], - EventTriggers.ON_CONTEXT_MENU: lambda: [], - EventTriggers.ON_DOUBLE_CLICK: lambda: [], - EventTriggers.ON_MOUSE_DOWN: lambda: [], - EventTriggers.ON_MOUSE_ENTER: lambda: [], - EventTriggers.ON_MOUSE_LEAVE: lambda: [], - EventTriggers.ON_MOUSE_MOVE: lambda: [], - EventTriggers.ON_MOUSE_OUT: lambda: [], - EventTriggers.ON_MOUSE_OVER: lambda: [], - EventTriggers.ON_MOUSE_UP: lambda: [], - EventTriggers.ON_SCROLL: lambda: [], - EventTriggers.ON_MOUNT: lambda: [], - EventTriggers.ON_UNMOUNT: lambda: [], + EventTriggers.ON_FOCUS: empty_event, + EventTriggers.ON_BLUR: empty_event, + EventTriggers.ON_CLICK: empty_event, + EventTriggers.ON_CONTEXT_MENU: empty_event, + EventTriggers.ON_DOUBLE_CLICK: empty_event, + EventTriggers.ON_MOUSE_DOWN: empty_event, + EventTriggers.ON_MOUSE_ENTER: empty_event, + EventTriggers.ON_MOUSE_LEAVE: empty_event, + EventTriggers.ON_MOUSE_MOVE: empty_event, + EventTriggers.ON_MOUSE_OUT: empty_event, + EventTriggers.ON_MOUSE_OVER: empty_event, + EventTriggers.ON_MOUSE_UP: empty_event, + EventTriggers.ON_SCROLL: empty_event, + EventTriggers.ON_MOUNT: empty_event, + EventTriggers.ON_UNMOUNT: empty_event, } # Look for component specific triggers, @@ -605,9 +647,9 @@ class Component(BaseComponent, ABC): if types._issubclass(field.type_, EventHandler): args_spec = None annotation = field.annotation - if hasattr(annotation, "__metadata__"): - args_spec = annotation.__metadata__[0] - default_triggers[field.name] = args_spec or (lambda: []) + if (metadata := getattr(annotation, "__metadata__", None)) is not None: + args_spec = metadata[0] + default_triggers[field.name] = args_spec or (empty_event) # type: ignore return default_triggers def __repr__(self) -> str: @@ -647,7 +689,7 @@ class Component(BaseComponent, ABC): """ # Create the base tag. tag = Tag( - name=self.tag if not self.alias else self.alias, + name=(self.tag if not self.alias else self.alias) or "", special_props=self.special_props, ) @@ -661,7 +703,7 @@ class Component(BaseComponent, ABC): # Add ref to element if `id` is not None. ref = self.get_ref() if ref is not None: - props["ref"] = ImmutableVar.create(ref) + props["ref"] = Var(_js_expr=ref) else: props = props.copy() @@ -1006,8 +1048,11 @@ class Component(BaseComponent, ABC): elif isinstance(event, EventChain): event_args = [] for spec in event.events: - for args in spec.args: - event_args.extend(args) + if isinstance(spec, EventSpec): + for args in spec.args: + event_args.extend(args) + else: + event_args.append(spec) yield event_trigger, event_args def _get_vars(self, include_children: bool = False) -> list[Var]: @@ -1036,10 +1081,10 @@ class Component(BaseComponent, ABC): # Style keeps track of its own VarData instance, so embed in a temp Var that is yielded. if isinstance(self.style, dict) and self.style or isinstance(self.style, Var): vars.append( - ImmutableVar( - _var_name="style", + Var( + _js_expr="style", _var_type=str, - _var_data=ImmutableVarData.merge(self.style._var_data), + _var_data=VarData.merge(self.style._var_data), ) ) @@ -1081,8 +1126,12 @@ class Component(BaseComponent, ABC): for trigger in self.event_triggers.values(): if isinstance(trigger, EventChain): for event in trigger.events: - if event.handler.state_full_name: - return True + if isinstance(event, EventSpec): + if event.handler.state_full_name: + return True + else: + if event._var_state: + return True elif isinstance(trigger, Var) and trigger._var_state: return True return False @@ -1303,9 +1352,15 @@ class Component(BaseComponent, ABC): # Collect imports from Vars used directly by this component. var_datas = [var._get_all_var_data() for var in self._get_vars()] - var_imports = [ - var_data.imports for var_data in var_datas if var_data is not None - ] + var_imports: List[ImmutableParsedImportDict] = list( + map( + lambda var_data: var_data.imports, + filter( + None, + var_datas, + ), + ) + ) added_import_dicts: list[ParsedImportDict] = [] for clz in self._iter_parent_classes_with_method("add_imports"): @@ -1352,9 +1407,9 @@ class Component(BaseComponent, ABC): on_mount = self.event_triggers.get(EventTriggers.ON_MOUNT, None) on_unmount = self.event_triggers.get(EventTriggers.ON_UNMOUNT, None) if on_mount is not None: - on_mount = format.format_event_chain(on_mount) + on_mount = str(LiteralVar.create(on_mount)) + "()" if on_unmount is not None: - on_unmount = format.format_event_chain(on_unmount) + on_unmount = str(LiteralVar.create(on_unmount)) + "()" if on_mount is not None or on_unmount is not None: return f""" useEffect(() => {{ @@ -1372,7 +1427,7 @@ class Component(BaseComponent, ABC): """ ref = self.get_ref() if ref is not None: - return f"const {ref} = useRef(null); {str(ImmutableVar.create_safe(ref).as_ref())} = {ref};" + return f"const {ref} = useRef(null); {str(Var(_js_expr=ref).as_ref())} = {ref};" def _get_vars_hooks(self) -> dict[str, None]: """Get the hooks required by vars referenced in this component. @@ -1513,7 +1568,7 @@ class Component(BaseComponent, ABC): The ref name. """ # do not create a ref if the id is dynamic or unspecified - if self.id is None or isinstance(self.id, (BaseVar, ImmutableVar)): + if self.id is None or isinstance(self.id, Var): return None return format.format_ref(self.id) @@ -1651,7 +1706,7 @@ class CustomComponent(Component): value = self._create_event_chain( value=value, args_spec=event_triggers_in_component_declaration.get( - key, lambda: [] + key, empty_event ), ) self.props[format.to_camel_case(key)] = value @@ -1714,10 +1769,14 @@ class CustomComponent(Component): Args: seen: The tags of the components that have already been seen. + Raises: + ValueError: If the tag is not set. + Returns: The set of custom components. """ - assert self.tag is not None, "The tag must be set." + if self.tag is None: + raise ValueError("The tag must be set.") # Store the seen components in a set to avoid infinite recursion. if seen is None: @@ -1752,15 +1811,15 @@ class CustomComponent(Component): """ return super()._render(props=self.props) - def get_prop_vars(self) -> List[ImmutableVar]: + def get_prop_vars(self) -> List[Var]: """Get the prop vars. Returns: The prop vars. """ return [ - ImmutableVar( - _var_name=name, + Var( + _js_expr=name, _var_type=( prop._var_type if types._isinstance(prop, Var) else type(prop) ), @@ -1866,19 +1925,6 @@ class NoSSRComponent(Component): return "".join((library_import, mod_import, opts_fragment)) -@serializer -def serialize_component(comp: Component): - """Serialize a component. - - Args: - comp: The component to serialize. - - Returns: - The serialized component. - """ - return str(comp) - - class StatefulComponent(BaseComponent): """A component that depends on state and is rendered outside of the page component. @@ -2130,9 +2176,7 @@ class StatefulComponent(BaseComponent): # Get the actual EventSpec and render it. event = component.event_triggers[event_trigger] - rendered_chain = format.format_prop(event) - if isinstance(rendered_chain, str): - rendered_chain = rendered_chain.strip("{}") + rendered_chain = str(LiteralVar.create(event)) # Hash the rendered EventChain to get a deterministic function name. chain_hash = md5(str(rendered_chain).encode("utf-8")).hexdigest() @@ -2141,9 +2185,10 @@ class StatefulComponent(BaseComponent): # Calculate Var dependencies accessed by the handler for useCallback dep array. var_deps = ["addEvents", "Event"] for arg in event_args: - if arg._get_all_var_data() is None: + var_data = arg._get_all_var_data() + if var_data is None: continue - for hook in arg._get_all_var_data().hooks: + for hook in var_data.hooks: var_deps.extend(cls._get_hook_deps(hook)) memo_var_data = VarData.merge( *[var._get_all_var_data() for var in event_args], @@ -2154,7 +2199,7 @@ class StatefulComponent(BaseComponent): # Store the memoized function name and hook code for this event trigger. trigger_memo[event_trigger] = ( - ImmutableVar.create_safe(memo_name)._replace( + Var(_js_expr=memo_name)._replace( _var_type=EventChain, merge_var_data=memo_var_data ), f"const {memo_name} = useCallback({rendered_chain}, [{', '.join(var_deps)}])", @@ -2227,7 +2272,7 @@ class StatefulComponent(BaseComponent): Returns: The tag to render. """ - return dict(Tag(name=self.tag)) + return dict(Tag(name=self.tag or "")) def __str__(self) -> str: """Represent the component in React. @@ -2292,3 +2337,6 @@ class MemoizationLeaf(Component): update={"disposition": MemoizationDisposition.ALWAYS} ) return comp + + +load_dynamic_serializer() diff --git a/reflex/components/core/banner.py b/reflex/components/core/banner.py index 4c4f587ee..29897cffa 100644 --- a/reflex/components/core/banner.py +++ b/reflex/components/core/banner.py @@ -18,57 +18,53 @@ from reflex.components.radix.themes.typography.text import Text from reflex.components.sonner.toast import Toaster, ToastProps from reflex.constants import Dirs, Hooks, Imports from reflex.constants.compiler import CompileVars -from reflex.ivars.base import ImmutableVar, LiteralVar -from reflex.ivars.function import FunctionStringVar -from reflex.ivars.number import BooleanVar -from reflex.ivars.sequence import LiteralArrayVar from reflex.utils.imports import ImportVar -from reflex.vars import ImmutableVarData, Var, VarData +from reflex.vars import VarData +from reflex.vars.base import LiteralVar, Var +from reflex.vars.function import FunctionStringVar +from reflex.vars.number import BooleanVar +from reflex.vars.sequence import LiteralArrayVar connect_error_var_data: VarData = VarData( # type: ignore imports=Imports.EVENTS, hooks={Hooks.EVENTS: None}, ) -connect_errors: Var = ImmutableVar.create_safe( - value=CompileVars.CONNECT_ERROR, +connect_errors = Var( + _js_expr=CompileVars.CONNECT_ERROR, _var_data=connect_error_var_data +) + +connection_error = Var( + _js_expr="((connectErrors.length > 0) ? connectErrors[connectErrors.length - 1].message : '')", _var_data=connect_error_var_data, ) -connection_error: Var = ImmutableVar.create_safe( - value="((connectErrors.length > 0) ? connectErrors[connectErrors.length - 1].message : '')", - _var_data=connect_error_var_data, +connection_errors_count = Var( + _js_expr="connectErrors.length", _var_data=connect_error_var_data ) -connection_errors_count: Var = ImmutableVar.create_safe( - value="connectErrors.length", - _var_data=connect_error_var_data, -) - -has_connection_errors: Var = ImmutableVar.create_safe( - value="(connectErrors.length > 0)", - _var_data=connect_error_var_data, +has_connection_errors = Var( + _js_expr="(connectErrors.length > 0)", _var_data=connect_error_var_data ).to(BooleanVar) -has_too_many_connection_errors: Var = ImmutableVar.create_safe( - value="(connectErrors.length >= 2)", - _var_data=connect_error_var_data, +has_too_many_connection_errors = Var( + _js_expr="(connectErrors.length >= 2)", _var_data=connect_error_var_data ).to(BooleanVar) -class WebsocketTargetURL(ImmutableVar): +class WebsocketTargetURL(Var): """A component that renders the websocket target URL.""" @classmethod - def create(cls) -> ImmutableVar: + def create(cls) -> Var: """Create a websocket target URL component. Returns: The websocket target URL component. """ - return ImmutableVar( - _var_name="getBackendURL(env.EVENT).href", - _var_data=ImmutableVarData( + return Var( + _js_expr="getBackendURL(env.EVENT).href", + _var_data=VarData( imports={ "/env.json": [ImportVar(tag="env", is_default=True)], f"/{Dirs.STATE_PATH}": [ImportVar(tag="getBackendURL")], @@ -125,8 +121,8 @@ class ConnectionToaster(Toaster): ), ).call( # TODO: This breaks the assumption that Vars are JS expressions - ImmutableVar.create_safe( - f""" + Var( + _js_expr=f""" () => {{ if ({str(has_too_many_connection_errors)}) {{ if (!userDismissed) {{ @@ -238,7 +234,7 @@ class WifiOffPulse(Icon): Returns: The icon component with default props applied. """ - pulse_var = ImmutableVar.create("pulse") + pulse_var = Var(_js_expr="pulse") return super().create( "wifi_off", color=props.pop("color", "crimson"), diff --git a/reflex/components/core/banner.pyi b/reflex/components/core/banner.pyi index 6327afe0b..7c2be272c 100644 --- a/reflex/components/core/banner.pyi +++ b/reflex/components/core/banner.pyi @@ -3,28 +3,41 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import Component from reflex.components.el.elements.typography import Div from reflex.components.lucide.icon import Icon from reflex.components.sonner.toast import Toaster, ToastProps -from reflex.event import EventHandler, EventSpec -from reflex.ivars.base import ImmutableVar +from reflex.constants.compiler import CompileVars +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportVar -from reflex.vars import Var, VarData +from reflex.vars import VarData +from reflex.vars.base import Var +from reflex.vars.number import BooleanVar connect_error_var_data: VarData -connect_errors: Var -connection_error: Var -connection_errors_count: Var -has_connection_errors: Var -has_too_many_connection_errors: Var +connect_errors = Var( + _js_expr=CompileVars.CONNECT_ERROR, _var_data=connect_error_var_data +) +connection_error = Var( + _js_expr="((connectErrors.length > 0) ? connectErrors[connectErrors.length - 1].message : '')", + _var_data=connect_error_var_data, +) +connection_errors_count = Var( + _js_expr="connectErrors.length", _var_data=connect_error_var_data +) +has_connection_errors = Var( + _js_expr="(connectErrors.length > 0)", _var_data=connect_error_var_data +).to(BooleanVar) +has_too_many_connection_errors = Var( + _js_expr="(connectErrors.length >= 2)", _var_data=connect_error_var_data +).to(BooleanVar) -class WebsocketTargetURL(ImmutableVar): +class WebsocketTargetURL(Var): @classmethod - def create(cls) -> ImmutableVar: ... # type: ignore + def create(cls) -> Var: ... # type: ignore def default_connection_error() -> list[str | Var | Component]: ... @@ -41,24 +54,24 @@ class ConnectionToaster(Toaster): visible_toasts: Optional[Union[Var[int], int]] = None, position: Optional[ Union[ + Literal[ + "bottom-center", + "bottom-left", + "bottom-right", + "top-center", + "top-left", + "top-right", + ], Var[ Literal[ - "top-left", - "top-center", - "top-right", - "bottom-left", "bottom-center", + "bottom-left", "bottom-right", + "top-center", + "top-left", + "top-right", ] ], - Literal[ - "top-left", - "top-center", - "top-right", - "bottom-left", - "bottom-center", - "bottom-right", - ], ] ] = None, close_button: Optional[Union[Var[bool], bool]] = None, @@ -66,9 +79,9 @@ class ConnectionToaster(Toaster): dir: Optional[Union[Var[str], str]] = None, hotkey: Optional[Union[Var[str], str]] = None, invert: Optional[Union[Var[bool], bool]] = None, - toast_options: Optional[Union[Var[ToastProps], ToastProps]] = None, + toast_options: Optional[Union[ToastProps, Var[ToastProps]]] = None, gap: Optional[Union[Var[int], int]] = None, - loading_icon: Optional[Union[Var[Icon], Icon]] = None, + loading_icon: Optional[Union[Icon, Var[Icon]]] = None, pause_when_page_is_hidden: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -76,41 +89,21 @@ class ConnectionToaster(Toaster): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ConnectionToaster": """Create a connection toaster component. @@ -156,41 +149,21 @@ class ConnectionBanner(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ConnectionBanner": """Create a connection banner component. @@ -215,41 +188,21 @@ class ConnectionModal(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ConnectionModal": """Create a connection banner component. @@ -275,41 +228,21 @@ class WifiOffPulse(Icon): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "WifiOffPulse": """Create a wifi_off icon with an animated opacity pulse. @@ -338,71 +271,51 @@ class ConnectionPulser(Div): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ConnectionPulser": """Create a connection pulser component. diff --git a/reflex/components/core/client_side_routing.py b/reflex/components/core/client_side_routing.py index 618467f39..efa622f81 100644 --- a/reflex/components/core/client_side_routing.py +++ b/reflex/components/core/client_side_routing.py @@ -13,9 +13,9 @@ from __future__ import annotations from reflex import constants from reflex.components.component import Component from reflex.components.core.cond import cond -from reflex.vars import Var +from reflex.vars.base import Var -route_not_found: Var = Var.create_safe(constants.ROUTE_NOT_FOUND, _var_is_string=False) +route_not_found: Var = Var(_js_expr=constants.ROUTE_NOT_FOUND) class ClientSideRouting(Component): diff --git a/reflex/components/core/client_side_routing.pyi b/reflex/components/core/client_side_routing.pyi index 605293ee8..1d528daaf 100644 --- a/reflex/components/core/client_side_routing.pyi +++ b/reflex/components/core/client_side_routing.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var route_not_found: Var @@ -26,41 +26,21 @@ class ClientSideRouting(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ClientSideRouting": """Create the component. @@ -95,41 +75,21 @@ class Default404Page(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Default404Page": """Create the component. diff --git a/reflex/components/core/clipboard.py b/reflex/components/core/clipboard.py index 9b0edcc29..88aa2d145 100644 --- a/reflex/components/core/clipboard.py +++ b/reflex/components/core/clipboard.py @@ -2,14 +2,15 @@ from __future__ import annotations -from typing import Dict, List, Union +from typing import Dict, List, Tuple, Union from reflex.components.base.fragment import Fragment from reflex.components.tags.tag import Tag -from reflex.event import EventChain, EventHandler +from reflex.event import EventChain, EventHandler, identity_event from reflex.utils.format import format_prop, wrap from reflex.utils.imports import ImportVar -from reflex.vars import Var, get_unique_variable_name +from reflex.vars import get_unique_variable_name +from reflex.vars.base import Var class Clipboard(Fragment): @@ -19,7 +20,7 @@ class Clipboard(Fragment): targets: Var[List[str]] # Called when the user pastes data into the document. Data is a list of tuples of (mime_type, data). Binary types will be base64 encoded as a data uri. - on_paste: EventHandler[lambda data: [data]] + on_paste: EventHandler[identity_event(List[Tuple[str, str]])] # Save the original event actions for the on_paste event. on_paste_event_actions: Var[Dict[str, Union[bool, int]]] @@ -85,8 +86,8 @@ class Clipboard(Fragment): return [ "usePasteHandler(%s, %s, %s)" % ( - self.targets._var_name_unwrapped, - self.on_paste_event_actions._var_name_unwrapped, + str(self.targets), + str(self.on_paste_event_actions), on_paste, ) ] diff --git a/reflex/components/core/clipboard.pyi b/reflex/components/core/clipboard.pyi index aaeac985c..489a9bcc5 100644 --- a/reflex/components/core/clipboard.pyi +++ b/reflex/components/core/clipboard.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Optional, Union, overload +from typing import Any, Dict, List, Optional, Union, overload from reflex.components.base.fragment import Fragment -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportVar -from reflex.vars import Var +from reflex.vars.base import Var class Clipboard(Fragment): @overload @@ -17,9 +17,9 @@ class Clipboard(Fragment): def create( # type: ignore cls, *children, - targets: Optional[Union[Var[List[str]], List[str]]] = None, + targets: Optional[Union[List[str], Var[List[str]]]] = None, on_paste_event_actions: Optional[ - Union[Var[Dict[str, Union[bool, int]]], Dict[str, Union[bool, int]]] + Union[Dict[str, Union[bool, int]], Var[Dict[str, Union[bool, int]]]] ] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -27,42 +27,22 @@ class Clipboard(Fragment): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_paste: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_paste: Optional[EventType[list[tuple[str, str]]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Clipboard": """Create a Clipboard component. diff --git a/reflex/components/core/cond.py b/reflex/components/core/cond.py index 6e6272665..1590875d3 100644 --- a/reflex/components/core/cond.py +++ b/reflex/components/core/cond.py @@ -8,11 +8,11 @@ from reflex.components.base.fragment import Fragment from reflex.components.component import BaseComponent, Component, MemoizationLeaf from reflex.components.tags import CondTag, Tag from reflex.constants import Dirs -from reflex.ivars.base import ImmutableVar, LiteralVar -from reflex.ivars.number import ternary_operation from reflex.style import LIGHT_COLOR_MODE, resolved_color_mode from reflex.utils.imports import ImportDict, ImportVar -from reflex.vars import Var, VarData +from reflex.vars import VarData +from reflex.vars.base import LiteralVar, Var +from reflex.vars.number import ternary_operation _IS_TRUE_IMPORT: ImportDict = { f"/{Dirs.STATE_PATH}": [ImportVar(tag="isTrue")], @@ -94,7 +94,7 @@ class Cond(MemoizationLeaf): ).set( props=tag.format_props(), ), - cond_state=f"isTrue({self.cond._var_full_name})", + cond_state=f"isTrue({str(self.cond)})", ) def add_imports(self) -> ImportDict: @@ -103,10 +103,11 @@ class Cond(MemoizationLeaf): Returns: The import dict for the component. """ - cond_imports: dict[str, str | ImportVar | list[str | ImportVar]] = getattr( - VarData.merge(self.cond._get_all_var_data()), "imports", {} - ) - return {**cond_imports, **_IS_TRUE_IMPORT} + var_data = VarData.merge(self.cond._get_all_var_data()) + + imports = var_data.old_school_imports() if var_data else {} + + return {**imports, **_IS_TRUE_IMPORT} @overload @@ -118,10 +119,10 @@ def cond(condition: Any, c1: Component) -> Component: ... @overload -def cond(condition: Any, c1: Any, c2: Any) -> ImmutableVar: ... +def cond(condition: Any, c1: Any, c2: Any) -> Var: ... -def cond(condition: Any, c1: Any, c2: Any = None) -> Component | ImmutableVar: +def cond(condition: Any, c1: Any, c2: Any = None) -> Component | Var: """Create a conditional component or Prop. Args: @@ -135,17 +136,15 @@ def cond(condition: Any, c1: Any, c2: Any = None) -> Component | ImmutableVar: Raises: ValueError: If the arguments are invalid. """ - if isinstance(condition, Var) and not isinstance(condition, ImmutableVar): - condition._var_is_local = True # Convert the condition to a Var. cond_var = LiteralVar.create(condition) - assert cond_var is not None, "The condition must be set." + if cond_var is None: + raise ValueError("The condition must be set.") # If the first component is a component, create a Cond component. if isinstance(c1, BaseComponent): - assert c2 is None or isinstance( - c2, BaseComponent - ), "Both arguments must be components." + if c2 is not None and not isinstance(c2, BaseComponent): + raise ValueError("Both arguments must be components.") return Cond.create(cond_var, c1, c2) # Otherwise, create a conditional Var. diff --git a/reflex/components/core/debounce.py b/reflex/components/core/debounce.py index 4dc7c14a1..07ad1d69e 100644 --- a/reflex/components/core/debounce.py +++ b/reflex/components/core/debounce.py @@ -6,8 +6,9 @@ from typing import Any, Type, Union from reflex.components.component import Component from reflex.constants import EventTriggers -from reflex.event import EventHandler -from reflex.vars import Var, VarData +from reflex.event import EventHandler, empty_event +from reflex.vars import VarData +from reflex.vars.base import Var DEFAULT_DEBOUNCE_TIMEOUT = 300 @@ -45,7 +46,7 @@ class DebounceInput(Component): element: Var[Type[Component]] # Fired when the input value changes - on_change: EventHandler[lambda e0: [e0.value]] + on_change: EventHandler[empty_event] @classmethod def create(cls, *children: Component, **props: Any) -> Component: @@ -106,23 +107,20 @@ class DebounceInput(Component): props[field] = getattr(child, field) child_ref = child.get_ref() if props.get("input_ref") is None and child_ref: - props["input_ref"] = Var.create_safe( - child_ref, _var_is_local=False, _var_is_string=False - ) + props["input_ref"] = Var(_js_expr=child_ref, _var_type=str) props["id"] = child.id # Set the child element to wrap, including any imports/hooks from the child. props.setdefault( "element", - Var.create_safe( - "{%s}" % (child.alias or child.tag), - _var_is_local=False, - _var_is_string=False, + Var( + _js_expr=str(child.alias or child.tag), + _var_type=Type[Component], _var_data=VarData( imports=child._get_imports(), hooks=child._get_hooks_internal(), ), - ).to(Type[Component]), + ), ) component = super().create(**props) diff --git a/reflex/components/core/debounce.pyi b/reflex/components/core/debounce.pyi index 486fcc284..6d7b76510 100644 --- a/reflex/components/core/debounce.pyi +++ b/reflex/components/core/debounce.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Type, Union, overload +from typing import Any, Dict, Optional, Type, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var DEFAULT_DEBOUNCE_TIMEOUT = 300 @@ -22,51 +22,31 @@ class DebounceInput(Component): debounce_timeout: Optional[Union[Var[int], int]] = None, force_notify_by_enter: Optional[Union[Var[bool], bool]] = None, force_notify_on_blur: Optional[Union[Var[bool], bool]] = None, - value: Optional[Union[Var[Union[float, int, str]], str, int, float]] = None, + value: Optional[Union[Var[Union[float, int, str]], float, int, str]] = None, input_ref: Optional[Union[Var[str], str]] = None, - element: Optional[Union[Var[Type[Component]], Type[Component]]] = None, + element: Optional[Union[Type[Component], Var[Type[Component]]]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DebounceInput": """Create a DebounceInput component. diff --git a/reflex/components/core/foreach.py b/reflex/components/core/foreach.py index 78e8933d9..a3f97d594 100644 --- a/reflex/components/core/foreach.py +++ b/reflex/components/core/foreach.py @@ -9,9 +9,8 @@ from reflex.components.base.fragment import Fragment from reflex.components.component import Component from reflex.components.tags import IterTag from reflex.constants import MemoizationMode -from reflex.ivars.base import ImmutableVar from reflex.state import ComponentState -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var class ForeachVarError(TypeError): @@ -52,10 +51,10 @@ class Foreach(Component): ForeachVarError: If the iterable is of type Any. TypeError: If the render function is a ComponentState. """ - iterable = ImmutableVar.create_safe(iterable) + iterable = LiteralVar.create(iterable) if iterable._var_type == Any: raise ForeachVarError( - f"Could not foreach over var `{iterable._var_full_name}` of type Any. " + f"Could not foreach over var `{str(iterable)}` of type Any. " "(If you are trying to foreach over a state var, add a type annotation to the var). " "See https://reflex.dev/docs/library/dynamic-rendering/foreach/" ) @@ -127,7 +126,7 @@ class Foreach(Component): return dict( tag, - iterable_state=tag.iterable._var_full_name, + iterable_state=str(tag.iterable), arg_name=tag.arg_var_name, arg_index=tag.get_index_var_arg(), iterable_type=tag.iterable._var_type.mro()[0].__name__, diff --git a/reflex/components/core/html.py b/reflex/components/core/html.py index 812bf64be..cfe46e591 100644 --- a/reflex/components/core/html.py +++ b/reflex/components/core/html.py @@ -3,7 +3,7 @@ from typing import Dict from reflex.components.el.elements.typography import Div -from reflex.vars import Var +from reflex.vars.base import Var class Html(Div): diff --git a/reflex/components/core/html.pyi b/reflex/components/core/html.pyi index c3d2ed06f..7f3ff603d 100644 --- a/reflex/components/core/html.pyi +++ b/reflex/components/core/html.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.el.elements.typography import Div -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Html(Div): @overload @@ -17,73 +17,53 @@ class Html(Div): cls, *children, dangerouslySetInnerHTML: Optional[ - Union[Var[Dict[str, str]], Dict[str, str]] + Union[Dict[str, str], Var[Dict[str, str]]] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Html": """Create a html component. diff --git a/reflex/components/core/match.py b/reflex/components/core/match.py index 3ddef38c6..8b9382c89 100644 --- a/reflex/components/core/match.py +++ b/reflex/components/core/match.py @@ -6,12 +6,12 @@ from typing import Any, Dict, List, Optional, Tuple, Union from reflex.components.base import Fragment from reflex.components.component import BaseComponent, Component, MemoizationLeaf from reflex.components.tags import MatchTag, Tag -from reflex.ivars.base import ImmutableVar, LiteralVar from reflex.style import Style from reflex.utils import format, types from reflex.utils.exceptions import MatchTypeError from reflex.utils.imports import ImportDict -from reflex.vars import ImmutableVarData, Var, VarData +from reflex.vars import VarData +from reflex.vars.base import LiteralVar, Var class Match(MemoizationLeaf): @@ -187,7 +187,7 @@ class Match(MemoizationLeaf): if not types._issubclass(type(case[-1]), return_type): raise MatchTypeError( f"Match cases should have the same return types. Case {index} with return " - f"value `{case[-1]._var_name if isinstance(case[-1], Var) else textwrap.shorten(str(case[-1]), width=250)}`" + f"value `{case[-1]._js_expr if isinstance(case[-1], Var) else textwrap.shorten(str(case[-1]), width=250)}`" f" of type {type(case[-1])!r} is not {return_type}" ) @@ -232,14 +232,14 @@ class Match(MemoizationLeaf): ) or not types._isinstance(default, Var): raise ValueError("Return types of match cases should be Vars.") - return ImmutableVar( - _var_name=format.format_match( - cond=match_cond_var._var_name_unwrapped, - match_cases=match_cases, # type: ignore + return Var( + _js_expr=format.format_match( + cond=str(match_cond_var), + match_cases=match_cases, default=default, # type: ignore ), _var_type=default._var_type, # type: ignore - _var_data=ImmutableVarData.merge( + _var_data=VarData.merge( match_cond_var._get_all_var_data(), *[el._get_all_var_data() for case in match_cases for el in case], default._get_all_var_data(), # type: ignore @@ -267,7 +267,8 @@ class Match(MemoizationLeaf): Returns: The import dict. """ - return getattr(VarData.merge(self.cond._get_all_var_data()), "imports", {}) + var_data = VarData.merge(self.cond._get_all_var_data()) + return var_data.old_school_imports() if var_data else {} match = Match.create diff --git a/reflex/components/core/upload.py b/reflex/components/core/upload.py index df9146c4d..89665bb31 100644 --- a/reflex/components/core/upload.py +++ b/reflex/components/core/upload.py @@ -2,13 +2,13 @@ from __future__ import annotations -import os from pathlib import Path -from typing import Callable, ClassVar, Dict, List, Optional +from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf from reflex.components.el.elements.forms import Input from reflex.components.radix.themes.layout.box import Box +from reflex.config import environment from reflex.constants import Dirs from reflex.event import ( CallableEventSpec, @@ -19,10 +19,10 @@ from reflex.event import ( call_script, parse_args_spec, ) -from reflex.ivars.base import ImmutableCallableVar, ImmutableVar -from reflex.ivars.sequence import LiteralStringVar from reflex.utils.imports import ImportVar -from reflex.vars import ImmutableVarData, Var, VarData +from reflex.vars import VarData +from reflex.vars.base import CallableVar, LiteralVar, Var +from reflex.vars.sequence import LiteralStringVar DEFAULT_UPLOAD_ID: str = "default" @@ -37,8 +37,8 @@ upload_files_context_var_data: VarData = VarData( ) -@ImmutableCallableVar -def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: +@CallableVar +def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> Var: """Get the file upload drop trigger. This var is passed to the dropzone component to update the file list when a @@ -58,17 +58,17 @@ def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: }}) """ - return ImmutableVar( - _var_name=var_name, + return Var( + _js_expr=var_name, _var_type=EventChain, - _var_data=ImmutableVarData.merge( + _var_data=VarData.merge( upload_files_context_var_data, id_var._get_all_var_data() ), ) -@ImmutableCallableVar -def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: +@CallableVar +def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> Var: """Get the list of selected files. Args: @@ -78,10 +78,10 @@ def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: A var referencing the list of selected file paths. """ id_var = LiteralStringVar.create(id_) - return ImmutableVar( - _var_name=f"(filesById[{str(id_var)}] ? filesById[{str(id_var)}].map((f) => (f.path || f.name)) : [])", + return Var( + _js_expr=f"(filesById[{str(id_var)}] ? filesById[{str(id_var)}].map((f) => (f.path || f.name)) : [])", _var_type=List[str], - _var_data=ImmutableVarData.merge( + _var_data=VarData.merge( upload_files_context_var_data, id_var._get_all_var_data() ), ).guess_type() @@ -113,7 +113,7 @@ def cancel_upload(upload_id: str) -> EventSpec: An event spec that cancels the upload when triggered. """ return call_script( - f"upload_controllers[{Var.create_safe(upload_id, _var_is_string=True)._var_name_unwrapped}]?.abort()" + f"upload_controllers[{str(LiteralVar.create(upload_id))}]?.abort()" ) @@ -125,23 +125,20 @@ def get_upload_dir() -> Path: """ Upload.is_used = True - uploaded_files_dir = Path( - os.environ.get("REFLEX_UPLOADED_FILES_DIR", "./uploaded_files") - ) + uploaded_files_dir = environment.REFLEX_UPLOADED_FILES_DIR uploaded_files_dir.mkdir(parents=True, exist_ok=True) return uploaded_files_dir -uploaded_files_url_prefix: Var = Var.create_safe( - "${getBackendURL(env.UPLOAD)}", - _var_is_string=False, +uploaded_files_url_prefix = Var( + _js_expr="getBackendURL(env.UPLOAD)", _var_data=VarData( imports={ f"/{Dirs.STATE_PATH}": "getBackendURL", "/env.json": ImportVar(tag="env", is_default=True), } ), -) +).to(str) def get_upload_url(file_path: str) -> Var[str]: @@ -155,12 +152,10 @@ def get_upload_url(file_path: str) -> Var[str]: """ Upload.is_used = True - return Var.create_safe( - f"{uploaded_files_url_prefix}/{file_path}", _var_is_string=True - ) + return uploaded_files_url_prefix + "/" + file_path -def _on_drop_spec(files: Var): +def _on_drop_spec(files: Var) -> Tuple[Var[Any]]: """Args spec for the on_drop event trigger. Args: @@ -169,7 +164,7 @@ def _on_drop_spec(files: Var): Returns: Signature for on_drop handler including the files to upload. """ - return [files] + return (files,) class UploadFilesProvider(Component): @@ -182,7 +177,7 @@ class UploadFilesProvider(Component): class Upload(MemoizationLeaf): """A file upload component.""" - library = "react-dropzone@14.2.3" + library = "react-dropzone@14.2.10" tag = "ReactDropzone" @@ -250,9 +245,7 @@ class Upload(MemoizationLeaf): } # The file input to use. upload = Input.create(type="file") - upload.special_props = { - ImmutableVar(_var_name="...getInputProps()", _var_type=None) - } + upload.special_props = [Var(_js_expr="{...getInputProps()}", _var_type=None)] # The dropzone to use. zone = Box.create( @@ -260,9 +253,7 @@ class Upload(MemoizationLeaf): *children, **{k: v for k, v in props.items() if k not in supported_props}, ) - zone.special_props = { - ImmutableVar(_var_name="...getRootProps()", _var_type=None) - } + zone.special_props = [Var(_js_expr="{...getRootProps()}", _var_type=None)] # Create the component. upload_props["id"] = props.get("id", DEFAULT_UPLOAD_ID) @@ -299,7 +290,7 @@ class Upload(MemoizationLeaf): Returns: The updated arg_value tuple when arg is "files", otherwise the original arg_value. """ - if arg_value[0]._var_name == "files": + if arg_value[0]._js_expr == "files": placeholder = parse_args_spec(_on_drop_spec)[0] return (arg_value[0], placeholder) return arg_value diff --git a/reflex/components/core/upload.pyi b/reflex/components/core/upload.pyi index ff5085514..5bbae892f 100644 --- a/reflex/components/core/upload.pyi +++ b/reflex/components/core/upload.pyi @@ -4,31 +4,41 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ from pathlib import Path -from typing import Any, Callable, ClassVar, Dict, List, Optional, Union, overload +from typing import Any, ClassVar, Dict, List, Optional, Union, overload from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf +from reflex.constants import Dirs from reflex.event import ( CallableEventSpec, - EventHandler, EventSpec, + EventType, ) -from reflex.ivars.base import ImmutableCallableVar, ImmutableVar from reflex.style import Style -from reflex.vars import Var, VarData +from reflex.utils.imports import ImportVar +from reflex.vars import VarData +from reflex.vars.base import CallableVar, Var DEFAULT_UPLOAD_ID: str upload_files_context_var_data: VarData -@ImmutableCallableVar -def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: ... -@ImmutableCallableVar -def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: ... +@CallableVar +def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> Var: ... +@CallableVar +def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> Var: ... @CallableEventSpec def clear_selected_files(id_: str = DEFAULT_UPLOAD_ID) -> EventSpec: ... def cancel_upload(upload_id: str) -> EventSpec: ... def get_upload_dir() -> Path: ... -uploaded_files_url_prefix: Var +uploaded_files_url_prefix = Var( + _js_expr="getBackendURL(env.UPLOAD)", + _var_data=VarData( + imports={ + f"/{Dirs.STATE_PATH}": "getBackendURL", + "/env.json": ImportVar(tag="env", is_default=True), + } + ), +).to(str) def get_upload_url(file_path: str) -> Var[str]: ... @@ -44,41 +54,21 @@ class UploadFilesProvider(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "UploadFilesProvider": """Create the component. @@ -106,7 +96,7 @@ class Upload(MemoizationLeaf): def create( # type: ignore cls, *children, - accept: Optional[Union[Var[Optional[Dict[str, List]]], Dict[str, List]]] = None, + accept: Optional[Union[Dict[str, List], Var[Optional[Dict[str, List]]]]] = None, disabled: Optional[Union[Var[bool], bool]] = None, max_files: Optional[Union[Var[int], int]] = None, max_size: Optional[Union[Var[int], int]] = None, @@ -121,42 +111,22 @@ class Upload(MemoizationLeaf): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_drop: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_drop: Optional[EventType[Any]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Upload": """Create an upload component. @@ -191,7 +161,7 @@ class StyledUpload(Upload): def create( # type: ignore cls, *children, - accept: Optional[Union[Var[Optional[Dict[str, List]]], Dict[str, List]]] = None, + accept: Optional[Union[Dict[str, List], Var[Optional[Dict[str, List]]]]] = None, disabled: Optional[Union[Var[bool], bool]] = None, max_files: Optional[Union[Var[int], int]] = None, max_size: Optional[Union[Var[int], int]] = None, @@ -206,42 +176,22 @@ class StyledUpload(Upload): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_drop: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_drop: Optional[EventType[Any]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "StyledUpload": """Create the styled upload component. @@ -276,7 +226,7 @@ class UploadNamespace(ComponentNamespace): @staticmethod def __call__( *children, - accept: Optional[Union[Var[Optional[Dict[str, List]]], Dict[str, List]]] = None, + accept: Optional[Union[Dict[str, List], Var[Optional[Dict[str, List]]]]] = None, disabled: Optional[Union[Var[bool], bool]] = None, max_files: Optional[Union[Var[int], int]] = None, max_size: Optional[Union[Var[int], int]] = None, @@ -291,42 +241,22 @@ class UploadNamespace(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_drop: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_drop: Optional[EventType[Any]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "StyledUpload": """Create the styled upload component. diff --git a/reflex/components/datadisplay/__init__.py b/reflex/components/datadisplay/__init__.py index fe613ee52..1aff69676 100644 --- a/reflex/components/datadisplay/__init__.py +++ b/reflex/components/datadisplay/__init__.py @@ -8,7 +8,6 @@ _SUBMOD_ATTRS: dict[str, list[str]] = { "code": [ "CodeBlock", "code_block", - "LiteralCodeBlockTheme", "LiteralCodeLanguage", ], "dataeditor": ["data_editor", "data_editor_theme", "DataEditorTheme"], diff --git a/reflex/components/datadisplay/__init__.pyi b/reflex/components/datadisplay/__init__.pyi index 4882c83df..32b29d106 100644 --- a/reflex/components/datadisplay/__init__.pyi +++ b/reflex/components/datadisplay/__init__.pyi @@ -4,7 +4,6 @@ # ------------------------------------------------------ from .code import CodeBlock as CodeBlock -from .code import LiteralCodeBlockTheme as LiteralCodeBlockTheme from .code import LiteralCodeLanguage as LiteralCodeLanguage from .code import code_block as code_block from .dataeditor import DataEditorTheme as DataEditorTheme diff --git a/reflex/components/datadisplay/code.py b/reflex/components/datadisplay/code.py index 779d4c5d3..3b4fa39d1 100644 --- a/reflex/components/datadisplay/code.py +++ b/reflex/components/datadisplay/code.py @@ -2,71 +2,20 @@ from __future__ import annotations -from typing import Dict, Literal, Optional, Union +import dataclasses +from typing import ClassVar, Dict, Literal, Optional, Union -from typing_extensions import get_args - -from reflex.components.component import Component +from reflex.components.component import Component, ComponentNamespace from reflex.components.core.cond import color_mode_cond from reflex.components.lucide.icon import Icon from reflex.components.radix.themes.components.button import Button from reflex.components.radix.themes.layout.box import Box from reflex.constants.colors import Color from reflex.event import set_clipboard -from reflex.ivars.base import ImmutableVar, LiteralVar from reflex.style import Style -from reflex.utils import format +from reflex.utils import console, format from reflex.utils.imports import ImportDict, ImportVar -from reflex.vars import Var - -LiteralCodeBlockTheme = Literal[ - "a11y-dark", - "atom-dark", - "cb", - "coldark-cold", - "coldark-dark", - "coy", - "coy-without-shadows", - "darcula", - "dark", - "dracula", - "duotone-dark", - "duotone-earth", - "duotone-forest", - "duotone-light", - "duotone-sea", - "duotone-space", - "funky", - "ghcolors", - "gruvbox-dark", - "gruvbox-light", - "holi-theme", - "hopscotch", - "light", # not present in react-syntax-highlighter styles - "lucario", - "material-dark", - "material-light", - "material-oceanic", - "night-owl", - "nord", - "okaidia", - "one-dark", - "one-light", - "pojoaque", - "prism", - "shades-of-purple", - "solarized-dark-atom", - "solarizedlight", - "synthwave84", - "tomorrow", - "twilight", - "vs", - "vs-dark", - "vsc-dark-plus", - "xonokai", - "z-touch", -] - +from reflex.vars.base import LiteralVar, Var, VarData LiteralCodeLanguage = Literal[ "abap", @@ -351,31 +300,95 @@ LiteralCodeLanguage = Literal[ ] -def replace_quotes_with_camel_case(value: str) -> str: - """Replaces quotes in the given string with camel case format. +def construct_theme_var(theme: str) -> Var[Theme]: + """Construct a theme var. Args: - value (str): The string to be processed. + theme: The theme to construct. Returns: - str: The processed string with quotes replaced by camel case. + The constructed theme var. """ - for theme in get_args(LiteralCodeBlockTheme): - value = value.replace(f'"{theme}"', format.to_camel_case(theme)) - return value + return Var( + theme, + _var_data=VarData( + imports={ + f"react-syntax-highlighter/dist/cjs/styles/prism/{format.to_kebab_case(theme)}": [ + ImportVar(tag=theme, is_default=True, install=False) + ] + } + ), + ) + + +@dataclasses.dataclass(init=False) +class Theme: + """Themes for the CodeBlock component.""" + + a11y_dark: ClassVar[Var[Theme]] = construct_theme_var("a11yDark") + atom_dark: ClassVar[Var[Theme]] = construct_theme_var("atomDark") + cb: ClassVar[Var[Theme]] = construct_theme_var("cb") + coldark_cold: ClassVar[Var[Theme]] = construct_theme_var("coldarkCold") + coldark_dark: ClassVar[Var[Theme]] = construct_theme_var("coldarkDark") + coy: ClassVar[Var[Theme]] = construct_theme_var("coy") + coy_without_shadows: ClassVar[Var[Theme]] = construct_theme_var("coyWithoutShadows") + darcula: ClassVar[Var[Theme]] = construct_theme_var("darcula") + dark: ClassVar[Var[Theme]] = construct_theme_var("oneDark") + dracula: ClassVar[Var[Theme]] = construct_theme_var("dracula") + duotone_dark: ClassVar[Var[Theme]] = construct_theme_var("duotoneDark") + duotone_earth: ClassVar[Var[Theme]] = construct_theme_var("duotoneEarth") + duotone_forest: ClassVar[Var[Theme]] = construct_theme_var("duotoneForest") + duotone_light: ClassVar[Var[Theme]] = construct_theme_var("duotoneLight") + duotone_sea: ClassVar[Var[Theme]] = construct_theme_var("duotoneSea") + duotone_space: ClassVar[Var[Theme]] = construct_theme_var("duotoneSpace") + funky: ClassVar[Var[Theme]] = construct_theme_var("funky") + ghcolors: ClassVar[Var[Theme]] = construct_theme_var("ghcolors") + gruvbox_dark: ClassVar[Var[Theme]] = construct_theme_var("gruvboxDark") + gruvbox_light: ClassVar[Var[Theme]] = construct_theme_var("gruvboxLight") + holi_theme: ClassVar[Var[Theme]] = construct_theme_var("holiTheme") + hopscotch: ClassVar[Var[Theme]] = construct_theme_var("hopscotch") + light: ClassVar[Var[Theme]] = construct_theme_var("oneLight") + lucario: ClassVar[Var[Theme]] = construct_theme_var("lucario") + material_dark: ClassVar[Var[Theme]] = construct_theme_var("materialDark") + material_light: ClassVar[Var[Theme]] = construct_theme_var("materialLight") + material_oceanic: ClassVar[Var[Theme]] = construct_theme_var("materialOceanic") + night_owl: ClassVar[Var[Theme]] = construct_theme_var("nightOwl") + nord: ClassVar[Var[Theme]] = construct_theme_var("nord") + okaidia: ClassVar[Var[Theme]] = construct_theme_var("okaidia") + one_dark: ClassVar[Var[Theme]] = construct_theme_var("oneDark") + one_light: ClassVar[Var[Theme]] = construct_theme_var("oneLight") + pojoaque: ClassVar[Var[Theme]] = construct_theme_var("pojoaque") + prism: ClassVar[Var[Theme]] = construct_theme_var("prism") + shades_of_purple: ClassVar[Var[Theme]] = construct_theme_var("shadesOfPurple") + solarized_dark_atom: ClassVar[Var[Theme]] = construct_theme_var("solarizedDarkAtom") + solarizedlight: ClassVar[Var[Theme]] = construct_theme_var("solarizedlight") + synthwave84: ClassVar[Var[Theme]] = construct_theme_var("synthwave84") + tomorrow: ClassVar[Var[Theme]] = construct_theme_var("tomorrow") + twilight: ClassVar[Var[Theme]] = construct_theme_var("twilight") + vs: ClassVar[Var[Theme]] = construct_theme_var("vs") + vs_dark: ClassVar[Var[Theme]] = construct_theme_var("vsDark") + vsc_dark_plus: ClassVar[Var[Theme]] = construct_theme_var("vscDarkPlus") + xonokai: ClassVar[Var[Theme]] = construct_theme_var("xonokai") + z_touch: ClassVar[Var[Theme]] = construct_theme_var("zTouch") + + +for theme_name in dir(Theme): + if theme_name.startswith("_"): + continue + setattr(Theme, theme_name, getattr(Theme, theme_name)._replace(_var_type=Theme)) class CodeBlock(Component): """A code block.""" - library = "react-syntax-highlighter@15.5.0" + library = "react-syntax-highlighter@15.6.1" tag = "PrismAsyncLight" alias = "SyntaxHighlighter" # The theme to use ("light" or "dark"). - theme: Var[LiteralCodeBlockTheme] = "one-light" # type: ignore + theme: Var[Union[Theme, str]] = Theme.one_light # The language to use. language: Var[LiteralCodeLanguage] = "python" # type: ignore @@ -406,31 +419,6 @@ class CodeBlock(Component): """ imports_: ImportDict = {} - themeString = str(self.theme) - - selected_themes = [] - - for possibleTheme in get_args(LiteralCodeBlockTheme): - if format.to_camel_case(possibleTheme) in themeString: - selected_themes.append(possibleTheme) - if possibleTheme in themeString: - selected_themes.append(possibleTheme) - - selected_themes = sorted(set(map(self.convert_theme_name, selected_themes))) - - imports_.update( - { - f"react-syntax-highlighter/dist/cjs/styles/prism/{theme}": [ - ImportVar( - tag=format.to_camel_case(theme), - is_default=True, - install=False, - ) - ] - for theme in selected_themes - } - ) - if ( self.language is not None and (language_without_quotes := str(self.language).replace('"', "")) @@ -481,14 +469,20 @@ class CodeBlock(Component): if "theme" not in props: # Default color scheme responds to global color mode. props["theme"] = color_mode_cond( - light=ImmutableVar.create_safe("oneLight"), - dark=ImmutableVar.create_safe("oneDark"), + light=Theme.one_light, + dark=Theme.one_dark, ) # react-syntax-highlighter doesnt have an explicit "light" or "dark" theme so we use one-light and one-dark # themes respectively to ensure code compatibility. if "theme" in props and not isinstance(props["theme"], Var): - props["theme"] = cls.convert_theme_name(props["theme"]) + props["theme"] = getattr(Theme, format.to_snake_case(props["theme"])) # type: ignore + console.deprecate( + feature_name="theme prop as string", + reason="Use code_block.themes instead.", + deprecation_version="0.6.0", + removal_version="0.7.0", + ) if can_copy: code = children[0] @@ -534,9 +528,7 @@ class CodeBlock(Component): def _render(self): out = super()._render() - theme = self.theme._replace( - _var_name=replace_quotes_with_camel_case(str(self.theme)) - ) + theme = self.theme out.add_props(style=theme).remove_props("theme", "code").add_props( children=self.code @@ -544,19 +536,13 @@ class CodeBlock(Component): return out - @staticmethod - def convert_theme_name(theme) -> str: - """Convert theme names to appropriate names. - Args: - theme: The theme name. +class CodeblockNamespace(ComponentNamespace): + """Namespace for the CodeBlock component.""" - Returns: - The right theme name. - """ - if theme in ["light", "dark"]: - return f"one-{theme}" - return theme + themes = Theme + + __call__ = CodeBlock.create -code_block = CodeBlock.create +code_block = CodeblockNamespace() diff --git a/reflex/components/datadisplay/code.pyi b/reflex/components/datadisplay/code.pyi index 015cc0708..0bf3dd956 100644 --- a/reflex/components/datadisplay/code.pyi +++ b/reflex/components/datadisplay/code.pyi @@ -3,62 +3,16 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +import dataclasses +from typing import Any, ClassVar, Dict, Literal, Optional, Union, overload -from reflex.components.component import Component +from reflex.components.component import Component, ComponentNamespace from reflex.constants.colors import Color -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var -LiteralCodeBlockTheme = Literal[ - "a11y-dark", - "atom-dark", - "cb", - "coldark-cold", - "coldark-dark", - "coy", - "coy-without-shadows", - "darcula", - "dark", - "dracula", - "duotone-dark", - "duotone-earth", - "duotone-forest", - "duotone-light", - "duotone-sea", - "duotone-space", - "funky", - "ghcolors", - "gruvbox-dark", - "gruvbox-light", - "holi-theme", - "hopscotch", - "light", - "lucario", - "material-dark", - "material-light", - "material-oceanic", - "night-owl", - "nord", - "okaidia", - "one-dark", - "one-light", - "pojoaque", - "prism", - "shades-of-purple", - "solarized-dark-atom", - "solarizedlight", - "synthwave84", - "tomorrow", - "twilight", - "vs", - "vs-dark", - "vsc-dark-plus", - "xonokai", - "z-touch", -] LiteralCodeLanguage = Literal[ "abap", "abnf", @@ -341,7 +295,59 @@ LiteralCodeLanguage = Literal[ "zig", ] -def replace_quotes_with_camel_case(value: str) -> str: ... +def construct_theme_var(theme: str) -> Var[Theme]: ... +@dataclasses.dataclass(init=False) +class Theme: + a11y_dark: ClassVar[Var[Theme]] = construct_theme_var("a11yDark") + atom_dark: ClassVar[Var[Theme]] = construct_theme_var("atomDark") + cb: ClassVar[Var[Theme]] = construct_theme_var("cb") + coldark_cold: ClassVar[Var[Theme]] = construct_theme_var("coldarkCold") + coldark_dark: ClassVar[Var[Theme]] = construct_theme_var("coldarkDark") + coy: ClassVar[Var[Theme]] = construct_theme_var("coy") + coy_without_shadows: ClassVar[Var[Theme]] = construct_theme_var("coyWithoutShadows") + darcula: ClassVar[Var[Theme]] = construct_theme_var("darcula") + dark: ClassVar[Var[Theme]] = construct_theme_var("oneDark") + dracula: ClassVar[Var[Theme]] = construct_theme_var("dracula") + duotone_dark: ClassVar[Var[Theme]] = construct_theme_var("duotoneDark") + duotone_earth: ClassVar[Var[Theme]] = construct_theme_var("duotoneEarth") + duotone_forest: ClassVar[Var[Theme]] = construct_theme_var("duotoneForest") + duotone_light: ClassVar[Var[Theme]] = construct_theme_var("duotoneLight") + duotone_sea: ClassVar[Var[Theme]] = construct_theme_var("duotoneSea") + duotone_space: ClassVar[Var[Theme]] = construct_theme_var("duotoneSpace") + funky: ClassVar[Var[Theme]] = construct_theme_var("funky") + ghcolors: ClassVar[Var[Theme]] = construct_theme_var("ghcolors") + gruvbox_dark: ClassVar[Var[Theme]] = construct_theme_var("gruvboxDark") + gruvbox_light: ClassVar[Var[Theme]] = construct_theme_var("gruvboxLight") + holi_theme: ClassVar[Var[Theme]] = construct_theme_var("holiTheme") + hopscotch: ClassVar[Var[Theme]] = construct_theme_var("hopscotch") + light: ClassVar[Var[Theme]] = construct_theme_var("oneLight") + lucario: ClassVar[Var[Theme]] = construct_theme_var("lucario") + material_dark: ClassVar[Var[Theme]] = construct_theme_var("materialDark") + material_light: ClassVar[Var[Theme]] = construct_theme_var("materialLight") + material_oceanic: ClassVar[Var[Theme]] = construct_theme_var("materialOceanic") + night_owl: ClassVar[Var[Theme]] = construct_theme_var("nightOwl") + nord: ClassVar[Var[Theme]] = construct_theme_var("nord") + okaidia: ClassVar[Var[Theme]] = construct_theme_var("okaidia") + one_dark: ClassVar[Var[Theme]] = construct_theme_var("oneDark") + one_light: ClassVar[Var[Theme]] = construct_theme_var("oneLight") + pojoaque: ClassVar[Var[Theme]] = construct_theme_var("pojoaque") + prism: ClassVar[Var[Theme]] = construct_theme_var("prism") + shades_of_purple: ClassVar[Var[Theme]] = construct_theme_var("shadesOfPurple") + solarized_dark_atom: ClassVar[Var[Theme]] = construct_theme_var("solarizedDarkAtom") + solarizedlight: ClassVar[Var[Theme]] = construct_theme_var("solarizedlight") + synthwave84: ClassVar[Var[Theme]] = construct_theme_var("synthwave84") + tomorrow: ClassVar[Var[Theme]] = construct_theme_var("tomorrow") + twilight: ClassVar[Var[Theme]] = construct_theme_var("twilight") + vs: ClassVar[Var[Theme]] = construct_theme_var("vs") + vs_dark: ClassVar[Var[Theme]] = construct_theme_var("vsDark") + vsc_dark_plus: ClassVar[Var[Theme]] = construct_theme_var("vscDarkPlus") + xonokai: ClassVar[Var[Theme]] = construct_theme_var("xonokai") + z_touch: ClassVar[Var[Theme]] = construct_theme_var("zTouch") + +for theme_name in dir(Theme): + if theme_name.startswith("_"): + continue + setattr(Theme, theme_name, getattr(Theme, theme_name)._replace(_var_type=Theme)) class CodeBlock(Component): def add_imports(self) -> ImportDict: ... @@ -352,108 +358,290 @@ class CodeBlock(Component): *children, can_copy: Optional[bool] = False, copy_button: Optional[Union[Component, bool]] = None, - theme: Optional[ - Union[ - Var[ - Literal[ - "a11y-dark", - "atom-dark", - "cb", - "coldark-cold", - "coldark-dark", - "coy", - "coy-without-shadows", - "darcula", - "dark", - "dracula", - "duotone-dark", - "duotone-earth", - "duotone-forest", - "duotone-light", - "duotone-sea", - "duotone-space", - "funky", - "ghcolors", - "gruvbox-dark", - "gruvbox-light", - "holi-theme", - "hopscotch", - "light", - "lucario", - "material-dark", - "material-light", - "material-oceanic", - "night-owl", - "nord", - "okaidia", - "one-dark", - "one-light", - "pojoaque", - "prism", - "shades-of-purple", - "solarized-dark-atom", - "solarizedlight", - "synthwave84", - "tomorrow", - "twilight", - "vs", - "vs-dark", - "vsc-dark-plus", - "xonokai", - "z-touch", - ] - ], - Literal[ - "a11y-dark", - "atom-dark", - "cb", - "coldark-cold", - "coldark-dark", - "coy", - "coy-without-shadows", - "darcula", - "dark", - "dracula", - "duotone-dark", - "duotone-earth", - "duotone-forest", - "duotone-light", - "duotone-sea", - "duotone-space", - "funky", - "ghcolors", - "gruvbox-dark", - "gruvbox-light", - "holi-theme", - "hopscotch", - "light", - "lucario", - "material-dark", - "material-light", - "material-oceanic", - "night-owl", - "nord", - "okaidia", - "one-dark", - "one-light", - "pojoaque", - "prism", - "shades-of-purple", - "solarized-dark-atom", - "solarizedlight", - "synthwave84", - "tomorrow", - "twilight", - "vs", - "vs-dark", - "vsc-dark-plus", - "xonokai", - "z-touch", - ], - ] - ] = None, + theme: Optional[Union[Theme, Var[Union[Theme, str]], str]] = None, language: Optional[ Union[ + Literal[ + "abap", + "abnf", + "actionscript", + "ada", + "agda", + "al", + "antlr4", + "apacheconf", + "apex", + "apl", + "applescript", + "aql", + "arduino", + "arff", + "asciidoc", + "asm6502", + "asmatmel", + "aspnet", + "autohotkey", + "autoit", + "avisynth", + "avro-idl", + "bash", + "basic", + "batch", + "bbcode", + "bicep", + "birb", + "bison", + "bnf", + "brainfuck", + "brightscript", + "bro", + "bsl", + "c", + "cfscript", + "chaiscript", + "cil", + "clike", + "clojure", + "cmake", + "cobol", + "coffeescript", + "concurnas", + "coq", + "core", + "cpp", + "crystal", + "csharp", + "cshtml", + "csp", + "css", + "css-extras", + "csv", + "cypher", + "d", + "dart", + "dataweave", + "dax", + "dhall", + "diff", + "django", + "dns-zone-file", + "docker", + "dot", + "ebnf", + "editorconfig", + "eiffel", + "ejs", + "elixir", + "elm", + "erb", + "erlang", + "etlua", + "excel-formula", + "factor", + "false", + "firestore-security-rules", + "flow", + "fortran", + "fsharp", + "ftl", + "gap", + "gcode", + "gdscript", + "gedcom", + "gherkin", + "git", + "glsl", + "gml", + "gn", + "go", + "go-module", + "graphql", + "groovy", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hlsl", + "hoon", + "hpkp", + "hsts", + "http", + "ichigojam", + "icon", + "icu-message-format", + "idris", + "iecst", + "ignore", + "index", + "inform7", + "ini", + "io", + "j", + "java", + "javadoc", + "javadoclike", + "javascript", + "javastacktrace", + "jexl", + "jolie", + "jq", + "js-extras", + "js-templates", + "jsdoc", + "json", + "json5", + "jsonp", + "jsstacktrace", + "jsx", + "julia", + "keepalived", + "keyman", + "kotlin", + "kumir", + "kusto", + "latex", + "latte", + "less", + "lilypond", + "liquid", + "lisp", + "livescript", + "llvm", + "log", + "lolcode", + "lua", + "magma", + "makefile", + "markdown", + "markup", + "markup-templating", + "matlab", + "maxscript", + "mel", + "mermaid", + "mizar", + "mongodb", + "monkey", + "moonscript", + "n1ql", + "n4js", + "nand2tetris-hdl", + "naniscript", + "nasm", + "neon", + "nevod", + "nginx", + "nim", + "nix", + "nsis", + "objectivec", + "ocaml", + "opencl", + "openqasm", + "oz", + "parigp", + "parser", + "pascal", + "pascaligo", + "pcaxis", + "peoplecode", + "perl", + "php", + "php-extras", + "phpdoc", + "plsql", + "powerquery", + "powershell", + "processing", + "prolog", + "promql", + "properties", + "protobuf", + "psl", + "pug", + "puppet", + "pure", + "purebasic", + "purescript", + "python", + "q", + "qml", + "qore", + "qsharp", + "r", + "racket", + "reason", + "regex", + "rego", + "renpy", + "rest", + "rip", + "roboconf", + "robotframework", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shell-session", + "smali", + "smalltalk", + "smarty", + "sml", + "solidity", + "solution-file", + "soy", + "sparql", + "splunk-spl", + "sqf", + "sql", + "squirrel", + "stan", + "stylus", + "swift", + "systemd", + "t4-cs", + "t4-templating", + "t4-vb", + "tap", + "tcl", + "textile", + "toml", + "tremor", + "tsx", + "tt2", + "turtle", + "twig", + "typescript", + "typoscript", + "unrealscript", + "uorazor", + "uri", + "v", + "vala", + "vbnet", + "velocity", + "verilog", + "vhdl", + "vim", + "visual-basic", + "warpscript", + "wasm", + "web-idl", + "wiki", + "wolfram", + "wren", + "xeora", + "xml-doc", + "xojo", + "xquery", + "yaml", + "yang", + "zig", + ], Var[ Literal[ "abap", @@ -737,6 +925,77 @@ class CodeBlock(Component): "zig", ] ], + ] + ] = None, + code: Optional[Union[Var[str], str]] = None, + show_line_numbers: Optional[Union[Var[bool], bool]] = None, + starting_line_number: Optional[Union[Var[int], int]] = None, + wrap_long_lines: Optional[Union[Var[bool], bool]] = None, + custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None, + code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + **props, + ) -> "CodeBlock": + """Create a text component. + + Args: + *children: The children of the component. + can_copy: Whether a copy button should appears. + copy_button: A custom copy button to override the default one. + theme: The theme to use ("light" or "dark"). + language: The language to use. + code: The code to display. + show_line_numbers: If this is enabled line numbers will be shown next to the code block. + starting_line_number: The starting line number to use. + wrap_long_lines: Whether to wrap long lines. + custom_style: A custom style for the code block. + code_tag_props: Props passed down to the code tag. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props to pass to the component. + + Returns: + The text component. + """ + ... + + def add_style(self): ... + +class CodeblockNamespace(ComponentNamespace): + themes = Theme + + @staticmethod + def __call__( + *children, + can_copy: Optional[bool] = False, + copy_button: Optional[Union[Component, bool]] = None, + theme: Optional[Union[Theme, Var[Union[Theme, str]], str]] = None, + language: Optional[ + Union[ Literal[ "abap", "abnf", @@ -1018,6 +1277,289 @@ class CodeBlock(Component): "yang", "zig", ], + Var[ + Literal[ + "abap", + "abnf", + "actionscript", + "ada", + "agda", + "al", + "antlr4", + "apacheconf", + "apex", + "apl", + "applescript", + "aql", + "arduino", + "arff", + "asciidoc", + "asm6502", + "asmatmel", + "aspnet", + "autohotkey", + "autoit", + "avisynth", + "avro-idl", + "bash", + "basic", + "batch", + "bbcode", + "bicep", + "birb", + "bison", + "bnf", + "brainfuck", + "brightscript", + "bro", + "bsl", + "c", + "cfscript", + "chaiscript", + "cil", + "clike", + "clojure", + "cmake", + "cobol", + "coffeescript", + "concurnas", + "coq", + "core", + "cpp", + "crystal", + "csharp", + "cshtml", + "csp", + "css", + "css-extras", + "csv", + "cypher", + "d", + "dart", + "dataweave", + "dax", + "dhall", + "diff", + "django", + "dns-zone-file", + "docker", + "dot", + "ebnf", + "editorconfig", + "eiffel", + "ejs", + "elixir", + "elm", + "erb", + "erlang", + "etlua", + "excel-formula", + "factor", + "false", + "firestore-security-rules", + "flow", + "fortran", + "fsharp", + "ftl", + "gap", + "gcode", + "gdscript", + "gedcom", + "gherkin", + "git", + "glsl", + "gml", + "gn", + "go", + "go-module", + "graphql", + "groovy", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hlsl", + "hoon", + "hpkp", + "hsts", + "http", + "ichigojam", + "icon", + "icu-message-format", + "idris", + "iecst", + "ignore", + "index", + "inform7", + "ini", + "io", + "j", + "java", + "javadoc", + "javadoclike", + "javascript", + "javastacktrace", + "jexl", + "jolie", + "jq", + "js-extras", + "js-templates", + "jsdoc", + "json", + "json5", + "jsonp", + "jsstacktrace", + "jsx", + "julia", + "keepalived", + "keyman", + "kotlin", + "kumir", + "kusto", + "latex", + "latte", + "less", + "lilypond", + "liquid", + "lisp", + "livescript", + "llvm", + "log", + "lolcode", + "lua", + "magma", + "makefile", + "markdown", + "markup", + "markup-templating", + "matlab", + "maxscript", + "mel", + "mermaid", + "mizar", + "mongodb", + "monkey", + "moonscript", + "n1ql", + "n4js", + "nand2tetris-hdl", + "naniscript", + "nasm", + "neon", + "nevod", + "nginx", + "nim", + "nix", + "nsis", + "objectivec", + "ocaml", + "opencl", + "openqasm", + "oz", + "parigp", + "parser", + "pascal", + "pascaligo", + "pcaxis", + "peoplecode", + "perl", + "php", + "php-extras", + "phpdoc", + "plsql", + "powerquery", + "powershell", + "processing", + "prolog", + "promql", + "properties", + "protobuf", + "psl", + "pug", + "puppet", + "pure", + "purebasic", + "purescript", + "python", + "q", + "qml", + "qore", + "qsharp", + "r", + "racket", + "reason", + "regex", + "rego", + "renpy", + "rest", + "rip", + "roboconf", + "robotframework", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shell-session", + "smali", + "smalltalk", + "smarty", + "sml", + "solidity", + "solution-file", + "soy", + "sparql", + "splunk-spl", + "sqf", + "sql", + "squirrel", + "stan", + "stylus", + "swift", + "systemd", + "t4-cs", + "t4-templating", + "t4-vb", + "tap", + "tcl", + "textile", + "toml", + "tremor", + "tsx", + "tt2", + "turtle", + "twig", + "typescript", + "typoscript", + "unrealscript", + "uorazor", + "uri", + "v", + "vala", + "vbnet", + "velocity", + "verilog", + "vhdl", + "vim", + "visual-basic", + "warpscript", + "wasm", + "web-idl", + "wiki", + "wolfram", + "wren", + "xeora", + "xml-doc", + "xojo", + "xquery", + "yaml", + "yang", + "zig", + ] + ], ] ] = None, code: Optional[Union[Var[str], str]] = None, @@ -1025,48 +1567,28 @@ class CodeBlock(Component): starting_line_number: Optional[Union[Var[int], int]] = None, wrap_long_lines: Optional[Union[Var[bool], bool]] = None, custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None, - code_tag_props: Optional[Union[Var[Dict[str, str]], Dict[str, str]]] = None, + code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CodeBlock": """Create a text component. @@ -1096,8 +1618,4 @@ class CodeBlock(Component): """ ... - def add_style(self): ... - @staticmethod - def convert_theme_name(theme) -> str: ... - -code_block = CodeBlock.create +code_block = CodeblockNamespace() diff --git a/reflex/components/datadisplay/dataeditor.py b/reflex/components/datadisplay/dataeditor.py index f3296e0b7..b9bd4cebf 100644 --- a/reflex/components/datadisplay/dataeditor.py +++ b/reflex/components/datadisplay/dataeditor.py @@ -3,17 +3,20 @@ from __future__ import annotations from enum import Enum -from typing import Any, Dict, List, Literal, Optional, Union +from typing import Any, Dict, List, Literal, Optional, Tuple, Union + +from typing_extensions import TypedDict from reflex.base import Base from reflex.components.component import Component, NoSSRComponent from reflex.components.literals import LiteralRowMarker -from reflex.event import EventHandler -from reflex.ivars.base import ImmutableVar +from reflex.event import EventHandler, empty_event, identity_event from reflex.utils import console, format, types from reflex.utils.imports import ImportDict, ImportVar from reflex.utils.serializers import serializer -from reflex.vars import Var, get_unique_variable_name +from reflex.vars import get_unique_variable_name +from reflex.vars.base import Var +from reflex.vars.sequence import ArrayVar # TODO: Fix the serialization issue for custom types. @@ -106,17 +109,76 @@ class DataEditorTheme(Base): text_medium: Optional[str] = None -def on_edit_spec(pos, data: dict[str, Any]): - """The on edit spec function. +class Bounds(TypedDict): + """The bounds of the group header.""" - Args: - pos: The position of the edit event. - data: The data of the edit event. + x: int + y: int + width: int + height: int - Returns: - The position and data. - """ - return [pos, data] + +class CompatSelection(TypedDict): + """The selection.""" + + items: list + + +class Rectangle(TypedDict): + """The bounds of the group header.""" + + x: int + y: int + width: int + height: int + + +class GridSelectionCurrent(TypedDict): + """The current selection.""" + + cell: tuple[int, int] + range: Rectangle + rangeStack: list[Rectangle] + + +class GridSelection(TypedDict): + """The grid selection.""" + + current: Optional[GridSelectionCurrent] + columns: CompatSelection + rows: CompatSelection + + +class GroupHeaderClickedEventArgs(TypedDict): + """The arguments for the group header clicked event.""" + + kind: str + group: str + location: tuple[int, int] + bounds: Bounds + isEdge: bool + shiftKey: bool + ctrlKey: bool + metaKey: bool + isTouch: bool + localEventX: int + localEventY: int + button: int + buttons: int + scrollEdge: tuple[int, int] + + +class GridCell(TypedDict): + """The grid cell.""" + + span: Optional[List[int]] + + +class GridColumn(TypedDict): + """The grid column.""" + + title: str + group: Optional[str] class DataEditor(NoSSRComponent): @@ -124,10 +186,10 @@ class DataEditor(NoSSRComponent): tag = "DataEditor" is_default = True - library: str = "@glideapps/glide-data-grid@^5.3.0" + library: str = "@glideapps/glide-data-grid@^6.0.3" lib_dependencies: List[str] = [ "lodash@^4.17.21", - "marked@^4.0.10", + "marked@^14.1.2", "react-responsive-carousel@^3.2.7", ] @@ -222,52 +284,56 @@ class DataEditor(NoSSRComponent): theme: Var[Union[DataEditorTheme, Dict]] # Fired when a cell is activated. - on_cell_activated: EventHandler[lambda pos: [pos]] + on_cell_activated: EventHandler[identity_event(Tuple[int, int])] # Fired when a cell is clicked. - on_cell_clicked: EventHandler[lambda pos: [pos]] + on_cell_clicked: EventHandler[identity_event(Tuple[int, int])] # Fired when a cell is right-clicked. - on_cell_context_menu: EventHandler[lambda pos: [pos]] + on_cell_context_menu: EventHandler[identity_event(Tuple[int, int])] # Fired when a cell is edited. - on_cell_edited: EventHandler[on_edit_spec] + on_cell_edited: EventHandler[identity_event(Tuple[int, int], GridCell)] # Fired when a group header is clicked. - on_group_header_clicked: EventHandler[on_edit_spec] + on_group_header_clicked: EventHandler[identity_event(Tuple[int, int], GridCell)] # Fired when a group header is right-clicked. - on_group_header_context_menu: EventHandler[lambda grp_idx, data: [grp_idx, data]] + on_group_header_context_menu: EventHandler[ + identity_event(int, GroupHeaderClickedEventArgs) + ] # Fired when a group header is renamed. - on_group_header_renamed: EventHandler[lambda idx, val: [idx, val]] + on_group_header_renamed: EventHandler[identity_event(str, str)] # Fired when a header is clicked. - on_header_clicked: EventHandler[lambda pos: [pos]] + on_header_clicked: EventHandler[identity_event(Tuple[int, int])] # Fired when a header is right-clicked. - on_header_context_menu: EventHandler[lambda pos: [pos]] + on_header_context_menu: EventHandler[identity_event(Tuple[int, int])] # Fired when a header menu item is clicked. - on_header_menu_click: EventHandler[lambda col, pos: [col, pos]] + on_header_menu_click: EventHandler[identity_event(int, Rectangle)] # Fired when an item is hovered. - on_item_hovered: EventHandler[lambda pos: [pos]] + on_item_hovered: EventHandler[identity_event(Tuple[int, int])] # Fired when a selection is deleted. - on_delete: EventHandler[lambda selection: [selection]] + on_delete: EventHandler[identity_event(GridSelection)] # Fired when editing is finished. - on_finished_editing: EventHandler[lambda new_value, movement: [new_value, movement]] + on_finished_editing: EventHandler[ + identity_event(Union[GridCell, None], tuple[int, int]) + ] # Fired when a row is appended. - on_row_appended: EventHandler[lambda: []] + on_row_appended: EventHandler[empty_event] # Fired when the selection is cleared. - on_selection_cleared: EventHandler[lambda: []] + on_selection_cleared: EventHandler[empty_event] # Fired when a column is resized. - on_column_resize: EventHandler[lambda col, width: [col, width]] + on_column_resize: EventHandler[identity_event(GridColumn, int)] def add_imports(self) -> ImportDict: """Add imports for the component. @@ -294,12 +360,12 @@ class DataEditor(NoSSRComponent): # Define the name of the getData callback associated with this component and assign to get_cell_content. data_callback = f"getData_{editor_id}" - self.get_cell_content = ImmutableVar.create(data_callback) # type: ignore + self.get_cell_content = Var(_js_expr=data_callback) # type: ignore code = [f"function {data_callback}([col, row])" "{"] - columns_path = f"{self.columns._var_full_name}" - data_path = f"{self.data._var_full_name}" + columns_path = str(self.columns) + data_path = str(self.data) code.extend( [ @@ -328,10 +394,14 @@ class DataEditor(NoSSRComponent): columns = props.get("columns", []) data = props.get("data", []) - rows = props.get("rows", None) + rows = props.get("rows") # If rows is not provided, determine from data. if rows is None: + if isinstance(data, Var) and not isinstance(data, ArrayVar): + raise ValueError( + "DataEditor data must be an ArrayVar if rows is not provided." + ) props["rows"] = data.length() if isinstance(data, Var) else len(data) if not isinstance(columns, Var) and len(columns): @@ -402,9 +472,9 @@ def serialize_dataeditortheme(theme: DataEditorTheme): Returns: The serialized theme. """ - return format.json_dumps( - {format.to_camel_case(k): v for k, v in theme.__dict__.items() if v is not None} - ) + return { + format.to_camel_case(k): v for k, v in theme.__dict__.items() if v is not None + } data_editor = DataEditor.create diff --git a/reflex/components/datadisplay/dataeditor.pyi b/reflex/components/datadisplay/dataeditor.pyi index b40890b73..6402aaf42 100644 --- a/reflex/components/datadisplay/dataeditor.pyi +++ b/reflex/components/datadisplay/dataeditor.pyi @@ -4,15 +4,17 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ from enum import Enum -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload + +from typing_extensions import TypedDict from reflex.base import Base from reflex.components.component import NoSSRComponent -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict from reflex.utils.serializers import serializer -from reflex.vars import Var +from reflex.vars.base import Var class GridColumnIcons(Enum): Array = "array" @@ -76,7 +78,53 @@ class DataEditorTheme(Base): text_light: Optional[str] text_medium: Optional[str] -def on_edit_spec(pos, data: dict[str, Any]): ... +class Bounds(TypedDict): + x: int + y: int + width: int + height: int + +class CompatSelection(TypedDict): + items: list + +class Rectangle(TypedDict): + x: int + y: int + width: int + height: int + +class GridSelectionCurrent(TypedDict): + cell: tuple[int, int] + range: Rectangle + rangeStack: list[Rectangle] + +class GridSelection(TypedDict): + current: Optional[GridSelectionCurrent] + columns: CompatSelection + rows: CompatSelection + +class GroupHeaderClickedEventArgs(TypedDict): + kind: str + group: str + location: tuple[int, int] + bounds: Bounds + isEdge: bool + shiftKey: bool + ctrlKey: bool + metaKey: bool + isTouch: bool + localEventX: int + localEventY: int + button: int + buttons: int + scrollEdge: tuple[int, int] + +class GridCell(TypedDict): + span: Optional[List[int]] + +class GridColumn(TypedDict): + title: str + group: Optional[str] class DataEditor(NoSSRComponent): def add_imports(self) -> ImportDict: ... @@ -88,9 +136,9 @@ class DataEditor(NoSSRComponent): *children, rows: Optional[Union[Var[int], int]] = None, columns: Optional[ - Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]] + Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]] ] = None, - data: Optional[Union[Var[List[List[Any]]], List[List[Any]]]] = None, + data: Optional[Union[List[List[Any]], Var[List[List[Any]]]]] = None, get_cell_content: Optional[Union[Var[str], str]] = None, get_cell_for_selection: Optional[Union[Var[bool], bool]] = None, on_paste: Optional[Union[Var[bool], bool]] = None, @@ -106,8 +154,8 @@ class DataEditor(NoSSRComponent): row_height: Optional[Union[Var[int], int]] = None, row_markers: Optional[ Union[ - Var[Literal["none", "number", "checkbox", "both", "clickable-number"]], - Literal["none", "number", "checkbox", "both", "clickable-number"], + Literal["both", "checkbox", "clickable-number", "none", "number"], + Var[Literal["both", "checkbox", "clickable-number", "none", "number"]], ] ] = None, row_marker_start_index: Optional[Union[Var[int], int]] = None, @@ -117,8 +165,8 @@ class DataEditor(NoSSRComponent): vertical_border: Optional[Union[Var[bool], bool]] = None, column_select: Optional[ Union[ - Var[Literal["none", "single", "multi"]], - Literal["none", "single", "multi"], + Literal["multi", "none", "single"], + Var[Literal["multi", "none", "single"]], ] ] = None, prevent_diagonal_scrolling: Optional[Union[Var[bool], bool]] = None, @@ -127,7 +175,7 @@ class DataEditor(NoSSRComponent): scroll_offset_x: Optional[Union[Var[int], int]] = None, scroll_offset_y: Optional[Union[Var[int], int]] = None, theme: Optional[ - Union[Var[Union[DataEditorTheme, Dict]], DataEditorTheme, Dict] + Union[DataEditorTheme, Dict, Var[Union[DataEditorTheme, Dict]]] ] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -135,87 +183,41 @@ class DataEditor(NoSSRComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_cell_activated: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_cell_clicked: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_cell_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_cell_edited: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_column_resize: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_delete: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_cell_activated: Optional[EventType[tuple[int, int]]] = None, + on_cell_clicked: Optional[EventType[tuple[int, int]]] = None, + on_cell_context_menu: Optional[EventType[tuple[int, int]]] = None, + on_cell_edited: Optional[EventType[tuple[int, int], GridCell]] = None, + on_click: Optional[EventType[[]]] = None, + on_column_resize: Optional[EventType[GridColumn, int]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_delete: Optional[EventType[GridSelection]] = None, + on_double_click: Optional[EventType[[]]] = None, on_finished_editing: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_group_header_clicked: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + EventType[Union[GridCell, None], tuple[int, int]] ] = None, + on_focus: Optional[EventType[[]]] = None, + on_group_header_clicked: Optional[EventType[tuple[int, int], GridCell]] = None, on_group_header_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_group_header_renamed: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_header_clicked: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_header_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_header_menu_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_item_hovered: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_row_appended: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_selection_cleared: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + EventType[int, GroupHeaderClickedEventArgs] ] = None, + on_group_header_renamed: Optional[EventType[str, str]] = None, + on_header_clicked: Optional[EventType[tuple[int, int]]] = None, + on_header_context_menu: Optional[EventType[tuple[int, int]]] = None, + on_header_menu_click: Optional[EventType[int, Rectangle]] = None, + on_item_hovered: Optional[EventType[tuple[int, int]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_row_appended: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_selection_cleared: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DataEditor": """Create the DataEditor component. diff --git a/reflex/components/datadisplay/logo.py b/reflex/components/datadisplay/logo.py index c00c8ebae..beb9b9d10 100644 --- a/reflex/components/datadisplay/logo.py +++ b/reflex/components/datadisplay/logo.py @@ -12,31 +12,33 @@ def logo(**props): Returns: The logo component. """ - light_mode_logo = """ - - - - - - -""" - dark_mode_logo = """ - - - - - - -""" + def logo_path(d): + return rx.el.svg.path( + d=d, + fill=rx.color_mode_cond("#110F1F", "white"), + ) + + paths = [ + "M0 11.5999V0.399902H8.96V4.8799H6.72V2.6399H2.24V4.8799H6.72V7.1199H2.24V11.5999H0ZM6.72 11.5999V7.1199H8.96V11.5999H6.72Z", + "M11.2 11.5999V0.399902H17.92V2.6399H13.44V4.8799H17.92V7.1199H13.44V9.3599H17.92V11.5999H11.2Z", + "M20.16 11.5999V0.399902H26.88V2.6399H22.4V4.8799H26.88V7.1199H22.4V11.5999H20.16Z", + "M29.12 11.5999V0.399902H31.36V9.3599H35.84V11.5999H29.12Z", + "M38.08 11.5999V0.399902H44.8V2.6399H40.32V4.8799H44.8V7.1199H40.32V9.3599H44.8V11.5999H38.08Z", + "M47.04 4.8799V0.399902H49.28V4.8799H47.04ZM53.76 4.8799V0.399902H56V4.8799H53.76ZM49.28 7.1199V4.8799H53.76V7.1199H49.28ZM47.04 11.5999V7.1199H49.28V11.5999H47.04ZM53.76 11.5999V7.1199H56V11.5999H53.76Z", + ] return rx.center( rx.link( rx.hstack( "Built with ", - rx.color_mode_cond( - rx.html(light_mode_logo), - rx.html(dark_mode_logo), + rx.el.svg( + *[logo_path(d) for d in paths], + width="56", + height="12", + viewBox="0 0 56 12", + fill="none", + xmlns="http://www.w3.org/2000/svg", ), text_align="center", align="center", diff --git a/reflex/components/datadisplay/shiki_code_block.py b/reflex/components/datadisplay/shiki_code_block.py new file mode 100644 index 000000000..46199a6e4 --- /dev/null +++ b/reflex/components/datadisplay/shiki_code_block.py @@ -0,0 +1,813 @@ +"""Shiki syntax hghlighter component.""" + +from __future__ import annotations + +import re +from collections import defaultdict +from typing import Any, Literal, Optional, Union + +from reflex.base import Base +from reflex.components.component import Component, ComponentNamespace +from reflex.components.core.colors import color +from reflex.components.core.cond import color_mode_cond +from reflex.components.el.elements.forms import Button +from reflex.components.lucide.icon import Icon +from reflex.components.radix.themes.layout.box import Box +from reflex.event import call_script, set_clipboard +from reflex.style import Style +from reflex.utils.exceptions import VarTypeError +from reflex.utils.imports import ImportVar +from reflex.vars.base import LiteralVar, Var +from reflex.vars.function import FunctionStringVar +from reflex.vars.sequence import StringVar, string_replace_operation + + +def copy_script() -> Any: + """Copy script for the code block and modify the child SVG element. + + + Returns: + Any: The result of calling the script. + """ + return call_script( + f""" +// Event listener for the parent click +document.addEventListener('click', function(event) {{ + // Find the closest div (parent element) + const parent = event.target.closest('div'); + // If the parent is found + if (parent) {{ + // Find the SVG element within the parent + const svgIcon = parent.querySelector('svg'); + // If the SVG exists, proceed with the script + if (svgIcon) {{ + const originalPath = svgIcon.innerHTML; + const checkmarkPath = ''; // Checkmark SVG path + function transition(element, scale, opacity) {{ + element.style.transform = `scale(${{scale}})`; + element.style.opacity = opacity; + }} + // Animate the SVG + transition(svgIcon, 0, '0'); + setTimeout(() => {{ + svgIcon.innerHTML = checkmarkPath; // Replace content with checkmark + svgIcon.setAttribute('viewBox', '0 0 24 24'); // Adjust viewBox if necessary + transition(svgIcon, 1, '1'); + setTimeout(() => {{ + transition(svgIcon, 0, '0'); + setTimeout(() => {{ + svgIcon.innerHTML = originalPath; // Restore original SVG content + transition(svgIcon, 1, '1'); + }}, 125); + }}, 600); + }}, 125); + }} else {{ + // console.error('SVG element not found within the parent.'); + }} + }} else {{ + // console.error('Parent element not found.'); + }} +}}); +""" + ) + + +SHIKIJS_TRANSFORMER_FNS = { + "transformerNotationDiff", + "transformerNotationHighlight", + "transformerNotationWordHighlight", + "transformerNotationFocus", + "transformerNotationErrorLevel", + "transformerRenderWhitespace", + "transformerMetaHighlight", + "transformerMetaWordHighlight", + "transformerCompactLineOptions", + # TODO: this transformer when included adds a weird behavior which removes other code lines. Need to figure out why. + # "transformerRemoveLineBreak", + "transformerRemoveNotationEscape", +} +LINE_NUMBER_STYLING = { + "code": { + "counter-reset": "step", + "counter-increment": "step 0", + "display": "grid", + "line-height": "1.7", + "font-size": "0.875em", + }, + "code .line::before": { + "content": "counter(step)", + "counter-increment": "step", + "width": "1rem", + "margin-right": "1.5rem", + "display": "inline-block", + "text-align": "right", + "color": "rgba(115,138,148,.4)", + }, +} +BOX_PARENT_STYLING = { + "pre": { + "margin": "0", + "padding": "24px", + "background": "transparent", + "overflow-x": "auto", + "border-radius": "6px", + }, +} + +THEME_MAPPING = { + "light": "one-light", + "dark": "one-dark-pro", + "a11y-dark": "github-dark", +} +LANGUAGE_MAPPING = {"bash": "shellscript"} +LiteralCodeLanguage = Literal[ + "abap", + "actionscript-3", + "ada", + "angular-html", + "angular-ts", + "apache", + "apex", + "apl", + "applescript", + "ara", + "asciidoc", + "asm", + "astro", + "awk", + "ballerina", + "bat", + "beancount", + "berry", + "bibtex", + "bicep", + "blade", + "c", + "cadence", + "clarity", + "clojure", + "cmake", + "cobol", + "codeowners", + "codeql", + "coffee", + "common-lisp", + "coq", + "cpp", + "crystal", + "csharp", + "css", + "csv", + "cue", + "cypher", + "d", + "dart", + "dax", + "desktop", + "diff", + "docker", + "dotenv", + "dream-maker", + "edge", + "elixir", + "elm", + "emacs-lisp", + "erb", + "erlang", + "fennel", + "fish", + "fluent", + "fortran-fixed-form", + "fortran-free-form", + "fsharp", + "gdresource", + "gdscript", + "gdshader", + "genie", + "gherkin", + "git-commit", + "git-rebase", + "gleam", + "glimmer-js", + "glimmer-ts", + "glsl", + "gnuplot", + "go", + "graphql", + "groovy", + "hack", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hjson", + "hlsl", + "html", + "html-derivative", + "http", + "hxml", + "hy", + "imba", + "ini", + "java", + "javascript", + "jinja", + "jison", + "json", + "json5", + "jsonc", + "jsonl", + "jsonnet", + "jssm", + "jsx", + "julia", + "kotlin", + "kusto", + "latex", + "lean", + "less", + "liquid", + "log", + "logo", + "lua", + "luau", + "make", + "markdown", + "marko", + "matlab", + "mdc", + "mdx", + "mermaid", + "mojo", + "move", + "narrat", + "nextflow", + "nginx", + "nim", + "nix", + "nushell", + "objective-c", + "objective-cpp", + "ocaml", + "pascal", + "perl", + "php", + "plsql", + "po", + "postcss", + "powerquery", + "powershell", + "prisma", + "prolog", + "proto", + "pug", + "puppet", + "purescript", + "python", + "qml", + "qmldir", + "qss", + "r", + "racket", + "raku", + "razor", + "reg", + "regexp", + "rel", + "riscv", + "rst", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shaderlab", + "shellscript", + "shellsession", + "smalltalk", + "solidity", + "soy", + "sparql", + "splunk", + "sql", + "ssh-config", + "stata", + "stylus", + "svelte", + "swift", + "system-verilog", + "systemd", + "tasl", + "tcl", + "templ", + "terraform", + "tex", + "toml", + "ts-tags", + "tsv", + "tsx", + "turtle", + "twig", + "typescript", + "typespec", + "typst", + "v", + "vala", + "vb", + "verilog", + "vhdl", + "viml", + "vue", + "vue-html", + "vyper", + "wasm", + "wenyan", + "wgsl", + "wikitext", + "wolfram", + "xml", + "xsl", + "yaml", + "zenscript", + "zig", +] +LiteralCodeTheme = Literal[ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "houston", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plain", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", +] + + +class ShikiBaseTransformers(Base): + """Base for creating transformers.""" + + library: str + fns: list[FunctionStringVar] + style: Optional[Style] + + +class ShikiJsTransformer(ShikiBaseTransformers): + """A Wrapped shikijs transformer.""" + + library: str = "@shikijs/transformers" + fns: list[FunctionStringVar] = [ + FunctionStringVar.create(fn) for fn in SHIKIJS_TRANSFORMER_FNS + ] + style: Optional[Style] = Style( + { + "code": {"line-height": "1.7", "font-size": "0.875em", "display": "grid"}, + # Diffs + ".diff": { + "margin": "0 -24px", + "padding": "0 24px", + "width": "calc(100% + 48px)", + "display": "inline-block", + }, + ".diff.add": { + "background-color": "rgba(16, 185, 129, .14)", + "position": "relative", + }, + ".diff.remove": { + "background-color": "rgba(244, 63, 94, .14)", + "opacity": "0.7", + "position": "relative", + }, + ".diff.remove:after": { + "position": "absolute", + "left": "10px", + "content": "'-'", + "color": "#b34e52", + }, + ".diff.add:after": { + "position": "absolute", + "left": "10px", + "content": "'+'", + "color": "#18794e", + }, + # Highlight + ".highlighted": { + "background-color": "rgba(142, 150, 170, .14)", + "margin": "0 -24px", + "padding": "0 24px", + "width": "calc(100% + 48px)", + "display": "inline-block", + }, + ".highlighted.error": { + "background-color": "rgba(244, 63, 94, .14)", + }, + ".highlighted.warning": { + "background-color": "rgba(234, 179, 8, .14)", + }, + # Highlighted Word + ".highlighted-word": { + "background-color": color("gray", 2), + "border": f"1px solid {color('gray', 5)}", + "padding": "1px 3px", + "margin": "-1px -3px", + "border-radius": "4px", + }, + # Focused Lines + ".has-focused .line:not(.focused)": { + "opacity": "0.7", + "filter": "blur(0.095rem)", + "transition": "filter .35s, opacity .35s", + }, + ".has-focused:hover .line:not(.focused)": { + "opacity": "1", + "filter": "none", + }, + # White Space + # ".tab, .space": { + # "position": "relative", + # }, + # ".tab::before": { + # "content": "'⇥'", + # "position": "absolute", + # "opacity": "0.3", + # }, + # ".space::before": { + # "content": "'·'", + # "position": "absolute", + # "opacity": "0.3", + # }, + } + ) + + def __init__(self, **kwargs): + """Initialize the transformer. + + Args: + kwargs: Kwargs to initialize the props. + + """ + fns = kwargs.pop("fns", None) + style = kwargs.pop("style", None) + if fns: + kwargs["fns"] = [ + ( + FunctionStringVar.create(x) + if not isinstance(x, FunctionStringVar) + else x + ) + for x in fns + ] + + if style: + kwargs["style"] = Style(style) + super().__init__(**kwargs) + + +class ShikiCodeBlock(Component): + """A Code block.""" + + library = "/components/shiki/code" + + tag = "Code" + + alias = "ShikiCode" + + lib_dependencies: list[str] = ["shiki"] + + # The language to use. + language: Var[LiteralCodeLanguage] = Var.create("python") + + # The theme to use ("light" or "dark"). + theme: Var[LiteralCodeTheme] = Var.create("one-light") + + # The set of themes to use for different modes. + themes: Var[Union[list[dict[str, Any]], dict[str, str]]] + + # The code to display. + code: Var[str] + + # The transformers to use for the syntax highlighter. + transformers: Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]] = Var.create( + [] + ) + + @classmethod + def create( + cls, + *children, + **props, + ) -> Component: + """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/). + + Args: + *children: The children of the component. + **props: The props to pass to the component. + + Returns: + The code block component. + """ + # Separate props for the code block and the wrapper + code_block_props = {} + code_wrapper_props = {} + + class_props = cls.get_props() + + # Distribute props between the code block and wrapper + for key, value in props.items(): + (code_block_props if key in class_props else code_wrapper_props)[key] = ( + value + ) + + code_block_props["code"] = children[0] + code_block = super().create(**code_block_props) + + transformer_styles = {} + # Collect styles from transformers and wrapper + for transformer in code_block.transformers._var_value: # type: ignore + if isinstance(transformer, ShikiBaseTransformers) and transformer.style: + transformer_styles.update(transformer.style) + transformer_styles.update(code_wrapper_props.pop("style", {})) + + return Box.create( + code_block, + *children[1:], + style=Style({**transformer_styles, **BOX_PARENT_STYLING}), + **code_wrapper_props, + ) + + def add_imports(self) -> dict[str, list[str]]: + """Add the necessary imports. + We add all referenced transformer functions as imports from their corresponding + libraries. + + Returns: + Imports for the component. + """ + imports = defaultdict(list) + for transformer in self.transformers._var_value: + if isinstance(transformer, ShikiBaseTransformers): + imports[transformer.library].extend( + [ImportVar(tag=str(fn)) for fn in transformer.fns] + ) + ( + self.lib_dependencies.append(transformer.library) + if transformer.library not in self.lib_dependencies + else None + ) + return imports + + @classmethod + def create_transformer(cls, library: str, fns: list[str]) -> ShikiBaseTransformers: + """Create a transformer from a third party library. + + Args: + library: The name of the library. + fns: The str names of the functions/callables to invoke from the library. + + Returns: + A transformer for the specified library. + + Raises: + ValueError: If a supplied function name is not valid str. + """ + if any(not isinstance(fn_name, str) for fn_name in fns): + raise ValueError( + f"the function names should be str names of functions in the specified transformer: {library!r}" + ) + return ShikiBaseTransformers( # type: ignore + library=library, fns=[FunctionStringVar.create(fn) for fn in fns] + ) + + def _render(self, props: dict[str, Any] | None = None): + """Renders the component with the given properties, processing transformers if present. + + Args: + props: Optional properties to pass to the render function. + + Returns: + Rendered component output. + """ + # Ensure props is initialized from class attributes if not provided + props = props or { + attr.rstrip("_"): getattr(self, attr) for attr in self.get_props() + } + + # Extract transformers and apply transformations + transformers = props.get("transformers") + if transformers is not None: + transformed_values = self._process_transformers(transformers._var_value) + props["transformers"] = LiteralVar.create(transformed_values) + + return super()._render(props) + + def _process_transformers(self, transformer_list: list) -> list: + """Processes a list of transformers, applying transformations where necessary. + + Args: + transformer_list: List of transformer objects or values. + + Returns: + list: A list of transformed values. + """ + processed = [] + + for transformer in transformer_list: + if isinstance(transformer, ShikiBaseTransformers): + processed.extend(fn.call() for fn in transformer.fns) + else: + processed.append(transformer) + + return processed + + +class ShikiHighLevelCodeBlock(ShikiCodeBlock): + """High level component for the shiki syntax highlighter.""" + + # If this is enabled, the default transformers(shikijs transformer) will be used. + use_transformers: Var[bool] + + # If this is enabled line numbers will be shown next to the code block. + show_line_numbers: Var[bool] + + # Whether a copy button should appear. + can_copy: Var[bool] = Var.create(False) + + # copy_button: A custom copy button to override the default one. + copy_button: Var[Optional[Union[Component, bool]]] = Var.create(None) + + @classmethod + def create( + cls, + *children, + **props, + ) -> Component: + """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/). + + Args: + *children: The children of the component. + **props: The props to pass to the component. + + Returns: + The code block component. + """ + use_transformers = props.pop("use_transformers", False) + show_line_numbers = props.pop("show_line_numbers", False) + language = props.pop("language", None) + can_copy = props.pop("can_copy", False) + copy_button = props.pop("copy_button", None) + + if use_transformers: + props["transformers"] = [ShikiJsTransformer()] + + if language is not None: + props["language"] = cls._map_languages(language) + + # line numbers are generated via css + if show_line_numbers: + props["style"] = {**LINE_NUMBER_STYLING, **props.get("style", {})} + + theme = props.pop("theme", None) + props["theme"] = props["theme"] = ( + cls._map_themes(theme) + if theme is not None + else color_mode_cond( # Default color scheme responds to global color mode. + light="one-light", + dark="one-dark-pro", + ) + ) + + if can_copy: + code = children[0] + copy_button = ( # type: ignore + copy_button + if copy_button is not None + else Button.create( + Icon.create(tag="copy", size=16, color=color("gray", 11)), + on_click=[ + set_clipboard(cls._strip_transformer_triggers(code)), # type: ignore + copy_script(), + ], + style=Style( + { + "position": "absolute", + "top": "4px", + "right": "4px", + "background": color("gray", 3), + "border": "1px solid", + "border-color": color("gray", 5), + "border-radius": "6px", + "padding": "5px", + "opacity": "1", + "cursor": "pointer", + "_hover": { + "background": color("gray", 4), + }, + "transition": "background 0.250s ease-out", + "&>svg": { + "transition": "transform 0.250s ease-out, opacity 0.250s ease-out", + }, + "_active": { + "background": color("gray", 5), + }, + } + ), + ) + ) + + if copy_button: + return ShikiCodeBlock.create( + children[0], copy_button, position="relative", **props + ) + else: + return ShikiCodeBlock.create(children[0], **props) + + @staticmethod + def _map_themes(theme: str) -> str: + if isinstance(theme, str) and theme in THEME_MAPPING: + return THEME_MAPPING[theme] + return theme + + @staticmethod + def _map_languages(language: str) -> str: + if isinstance(language, str) and language in LANGUAGE_MAPPING: + return LANGUAGE_MAPPING[language] + return language + + @staticmethod + def _strip_transformer_triggers(code: str | StringVar) -> StringVar | str: + if not isinstance(code, (StringVar, str)): + raise VarTypeError( + f"code should be string literal or a StringVar type. Got {type(code)} instead." + ) + regex_pattern = r"[\/#]+ *\[!code.*?\]" + + if isinstance(code, Var): + return string_replace_operation( + code, StringVar(_js_expr=f"/{regex_pattern}/g", _var_type=str), "" + ) + if isinstance(code, str): + return re.sub(regex_pattern, "", code) + + +class TransformerNamespace(ComponentNamespace): + """Namespace for the Transformers.""" + + shikijs = ShikiJsTransformer + + +class CodeblockNamespace(ComponentNamespace): + """Namespace for the CodeBlock component.""" + + root = staticmethod(ShikiCodeBlock.create) + create_transformer = staticmethod(ShikiCodeBlock.create_transformer) + transformers = TransformerNamespace() + __call__ = staticmethod(ShikiHighLevelCodeBlock.create) + + +code_block = CodeblockNamespace() diff --git a/reflex/components/datadisplay/shiki_code_block.pyi b/reflex/components/datadisplay/shiki_code_block.pyi new file mode 100644 index 000000000..bcf2719e9 --- /dev/null +++ b/reflex/components/datadisplay/shiki_code_block.pyi @@ -0,0 +1,2211 @@ +"""Stub file for reflex/components/datadisplay/shiki_code_block.py""" + +# ------------------- DO NOT EDIT ---------------------- +# This file was generated by `reflex/utils/pyi_generator.py`! +# ------------------------------------------------------ +from typing import Any, Dict, Literal, Optional, Union, overload + +from reflex.base import Base +from reflex.components.component import Component, ComponentNamespace +from reflex.event import EventType +from reflex.style import Style +from reflex.vars.base import Var +from reflex.vars.function import FunctionStringVar + +def copy_script() -> Any: ... + +SHIKIJS_TRANSFORMER_FNS = { + "transformerNotationDiff", + "transformerNotationHighlight", + "transformerNotationWordHighlight", + "transformerNotationFocus", + "transformerNotationErrorLevel", + "transformerRenderWhitespace", + "transformerMetaHighlight", + "transformerMetaWordHighlight", + "transformerCompactLineOptions", + "transformerRemoveNotationEscape", +} +LINE_NUMBER_STYLING = { + "code": { + "counter-reset": "step", + "counter-increment": "step 0", + "display": "grid", + "line-height": "1.7", + "font-size": "0.875em", + }, + "code .line::before": { + "content": "counter(step)", + "counter-increment": "step", + "width": "1rem", + "margin-right": "1.5rem", + "display": "inline-block", + "text-align": "right", + "color": "rgba(115,138,148,.4)", + }, +} +BOX_PARENT_STYLING = { + "pre": { + "margin": "0", + "padding": "24px", + "background": "transparent", + "overflow-x": "auto", + "border-radius": "6px", + } +} +THEME_MAPPING = { + "light": "one-light", + "dark": "one-dark-pro", + "a11y-dark": "github-dark", +} +LANGUAGE_MAPPING = {"bash": "shellscript"} +LiteralCodeLanguage = Literal[ + "abap", + "actionscript-3", + "ada", + "angular-html", + "angular-ts", + "apache", + "apex", + "apl", + "applescript", + "ara", + "asciidoc", + "asm", + "astro", + "awk", + "ballerina", + "bat", + "beancount", + "berry", + "bibtex", + "bicep", + "blade", + "c", + "cadence", + "clarity", + "clojure", + "cmake", + "cobol", + "codeowners", + "codeql", + "coffee", + "common-lisp", + "coq", + "cpp", + "crystal", + "csharp", + "css", + "csv", + "cue", + "cypher", + "d", + "dart", + "dax", + "desktop", + "diff", + "docker", + "dotenv", + "dream-maker", + "edge", + "elixir", + "elm", + "emacs-lisp", + "erb", + "erlang", + "fennel", + "fish", + "fluent", + "fortran-fixed-form", + "fortran-free-form", + "fsharp", + "gdresource", + "gdscript", + "gdshader", + "genie", + "gherkin", + "git-commit", + "git-rebase", + "gleam", + "glimmer-js", + "glimmer-ts", + "glsl", + "gnuplot", + "go", + "graphql", + "groovy", + "hack", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hjson", + "hlsl", + "html", + "html-derivative", + "http", + "hxml", + "hy", + "imba", + "ini", + "java", + "javascript", + "jinja", + "jison", + "json", + "json5", + "jsonc", + "jsonl", + "jsonnet", + "jssm", + "jsx", + "julia", + "kotlin", + "kusto", + "latex", + "lean", + "less", + "liquid", + "log", + "logo", + "lua", + "luau", + "make", + "markdown", + "marko", + "matlab", + "mdc", + "mdx", + "mermaid", + "mojo", + "move", + "narrat", + "nextflow", + "nginx", + "nim", + "nix", + "nushell", + "objective-c", + "objective-cpp", + "ocaml", + "pascal", + "perl", + "php", + "plsql", + "po", + "postcss", + "powerquery", + "powershell", + "prisma", + "prolog", + "proto", + "pug", + "puppet", + "purescript", + "python", + "qml", + "qmldir", + "qss", + "r", + "racket", + "raku", + "razor", + "reg", + "regexp", + "rel", + "riscv", + "rst", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shaderlab", + "shellscript", + "shellsession", + "smalltalk", + "solidity", + "soy", + "sparql", + "splunk", + "sql", + "ssh-config", + "stata", + "stylus", + "svelte", + "swift", + "system-verilog", + "systemd", + "tasl", + "tcl", + "templ", + "terraform", + "tex", + "toml", + "ts-tags", + "tsv", + "tsx", + "turtle", + "twig", + "typescript", + "typespec", + "typst", + "v", + "vala", + "vb", + "verilog", + "vhdl", + "viml", + "vue", + "vue-html", + "vyper", + "wasm", + "wenyan", + "wgsl", + "wikitext", + "wolfram", + "xml", + "xsl", + "yaml", + "zenscript", + "zig", +] +LiteralCodeTheme = Literal[ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "houston", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plain", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", +] + +class ShikiBaseTransformers(Base): + library: str + fns: list[FunctionStringVar] + style: Optional[Style] + +class ShikiJsTransformer(ShikiBaseTransformers): + library: str + fns: list[FunctionStringVar] + style: Optional[Style] + +class ShikiCodeBlock(Component): + @overload + @classmethod + def create( # type: ignore + cls, + *children, + language: Optional[ + Union[ + Literal[ + "abap", + "actionscript-3", + "ada", + "angular-html", + "angular-ts", + "apache", + "apex", + "apl", + "applescript", + "ara", + "asciidoc", + "asm", + "astro", + "awk", + "ballerina", + "bat", + "beancount", + "berry", + "bibtex", + "bicep", + "blade", + "c", + "cadence", + "clarity", + "clojure", + "cmake", + "cobol", + "codeowners", + "codeql", + "coffee", + "common-lisp", + "coq", + "cpp", + "crystal", + "csharp", + "css", + "csv", + "cue", + "cypher", + "d", + "dart", + "dax", + "desktop", + "diff", + "docker", + "dotenv", + "dream-maker", + "edge", + "elixir", + "elm", + "emacs-lisp", + "erb", + "erlang", + "fennel", + "fish", + "fluent", + "fortran-fixed-form", + "fortran-free-form", + "fsharp", + "gdresource", + "gdscript", + "gdshader", + "genie", + "gherkin", + "git-commit", + "git-rebase", + "gleam", + "glimmer-js", + "glimmer-ts", + "glsl", + "gnuplot", + "go", + "graphql", + "groovy", + "hack", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hjson", + "hlsl", + "html", + "html-derivative", + "http", + "hxml", + "hy", + "imba", + "ini", + "java", + "javascript", + "jinja", + "jison", + "json", + "json5", + "jsonc", + "jsonl", + "jsonnet", + "jssm", + "jsx", + "julia", + "kotlin", + "kusto", + "latex", + "lean", + "less", + "liquid", + "log", + "logo", + "lua", + "luau", + "make", + "markdown", + "marko", + "matlab", + "mdc", + "mdx", + "mermaid", + "mojo", + "move", + "narrat", + "nextflow", + "nginx", + "nim", + "nix", + "nushell", + "objective-c", + "objective-cpp", + "ocaml", + "pascal", + "perl", + "php", + "plsql", + "po", + "postcss", + "powerquery", + "powershell", + "prisma", + "prolog", + "proto", + "pug", + "puppet", + "purescript", + "python", + "qml", + "qmldir", + "qss", + "r", + "racket", + "raku", + "razor", + "reg", + "regexp", + "rel", + "riscv", + "rst", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shaderlab", + "shellscript", + "shellsession", + "smalltalk", + "solidity", + "soy", + "sparql", + "splunk", + "sql", + "ssh-config", + "stata", + "stylus", + "svelte", + "swift", + "system-verilog", + "systemd", + "tasl", + "tcl", + "templ", + "terraform", + "tex", + "toml", + "ts-tags", + "tsv", + "tsx", + "turtle", + "twig", + "typescript", + "typespec", + "typst", + "v", + "vala", + "vb", + "verilog", + "vhdl", + "viml", + "vue", + "vue-html", + "vyper", + "wasm", + "wenyan", + "wgsl", + "wikitext", + "wolfram", + "xml", + "xsl", + "yaml", + "zenscript", + "zig", + ], + Var[ + Literal[ + "abap", + "actionscript-3", + "ada", + "angular-html", + "angular-ts", + "apache", + "apex", + "apl", + "applescript", + "ara", + "asciidoc", + "asm", + "astro", + "awk", + "ballerina", + "bat", + "beancount", + "berry", + "bibtex", + "bicep", + "blade", + "c", + "cadence", + "clarity", + "clojure", + "cmake", + "cobol", + "codeowners", + "codeql", + "coffee", + "common-lisp", + "coq", + "cpp", + "crystal", + "csharp", + "css", + "csv", + "cue", + "cypher", + "d", + "dart", + "dax", + "desktop", + "diff", + "docker", + "dotenv", + "dream-maker", + "edge", + "elixir", + "elm", + "emacs-lisp", + "erb", + "erlang", + "fennel", + "fish", + "fluent", + "fortran-fixed-form", + "fortran-free-form", + "fsharp", + "gdresource", + "gdscript", + "gdshader", + "genie", + "gherkin", + "git-commit", + "git-rebase", + "gleam", + "glimmer-js", + "glimmer-ts", + "glsl", + "gnuplot", + "go", + "graphql", + "groovy", + "hack", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hjson", + "hlsl", + "html", + "html-derivative", + "http", + "hxml", + "hy", + "imba", + "ini", + "java", + "javascript", + "jinja", + "jison", + "json", + "json5", + "jsonc", + "jsonl", + "jsonnet", + "jssm", + "jsx", + "julia", + "kotlin", + "kusto", + "latex", + "lean", + "less", + "liquid", + "log", + "logo", + "lua", + "luau", + "make", + "markdown", + "marko", + "matlab", + "mdc", + "mdx", + "mermaid", + "mojo", + "move", + "narrat", + "nextflow", + "nginx", + "nim", + "nix", + "nushell", + "objective-c", + "objective-cpp", + "ocaml", + "pascal", + "perl", + "php", + "plsql", + "po", + "postcss", + "powerquery", + "powershell", + "prisma", + "prolog", + "proto", + "pug", + "puppet", + "purescript", + "python", + "qml", + "qmldir", + "qss", + "r", + "racket", + "raku", + "razor", + "reg", + "regexp", + "rel", + "riscv", + "rst", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shaderlab", + "shellscript", + "shellsession", + "smalltalk", + "solidity", + "soy", + "sparql", + "splunk", + "sql", + "ssh-config", + "stata", + "stylus", + "svelte", + "swift", + "system-verilog", + "systemd", + "tasl", + "tcl", + "templ", + "terraform", + "tex", + "toml", + "ts-tags", + "tsv", + "tsx", + "turtle", + "twig", + "typescript", + "typespec", + "typst", + "v", + "vala", + "vb", + "verilog", + "vhdl", + "viml", + "vue", + "vue-html", + "vyper", + "wasm", + "wenyan", + "wgsl", + "wikitext", + "wolfram", + "xml", + "xsl", + "yaml", + "zenscript", + "zig", + ] + ], + ] + ] = None, + theme: Optional[ + Union[ + Literal[ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "houston", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plain", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", + ], + Var[ + Literal[ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "houston", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plain", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", + ] + ], + ] + ] = None, + themes: Optional[ + Union[ + Var[Union[dict[str, str], list[dict[str, Any]]]], + dict[str, str], + list[dict[str, Any]], + ] + ] = None, + code: Optional[Union[Var[str], str]] = None, + transformers: Optional[ + Union[ + Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]], + list[Union[ShikiBaseTransformers, dict[str, Any]]], + ] + ] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + **props, + ) -> "ShikiCodeBlock": + """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/). + + Args: + *children: The children of the component. + language: The language to use. + theme: The theme to use ("light" or "dark"). + themes: The set of themes to use for different modes. + code: The code to display. + transformers: The transformers to use for the syntax highlighter. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props to pass to the component. + + Returns: + The code block component. + """ + ... + + def add_imports(self) -> dict[str, list[str]]: ... + @classmethod + def create_transformer( + cls, library: str, fns: list[str] + ) -> ShikiBaseTransformers: ... + +class ShikiHighLevelCodeBlock(ShikiCodeBlock): + @overload + @classmethod + def create( # type: ignore + cls, + *children, + use_transformers: Optional[Union[Var[bool], bool]] = None, + show_line_numbers: Optional[Union[Var[bool], bool]] = None, + can_copy: Optional[Union[Var[bool], bool]] = None, + copy_button: Optional[ + Union[Component, Var[Optional[Union[Component, bool]]], bool] + ] = None, + language: Optional[ + Union[ + Literal[ + "abap", + "actionscript-3", + "ada", + "angular-html", + "angular-ts", + "apache", + "apex", + "apl", + "applescript", + "ara", + "asciidoc", + "asm", + "astro", + "awk", + "ballerina", + "bat", + "beancount", + "berry", + "bibtex", + "bicep", + "blade", + "c", + "cadence", + "clarity", + "clojure", + "cmake", + "cobol", + "codeowners", + "codeql", + "coffee", + "common-lisp", + "coq", + "cpp", + "crystal", + "csharp", + "css", + "csv", + "cue", + "cypher", + "d", + "dart", + "dax", + "desktop", + "diff", + "docker", + "dotenv", + "dream-maker", + "edge", + "elixir", + "elm", + "emacs-lisp", + "erb", + "erlang", + "fennel", + "fish", + "fluent", + "fortran-fixed-form", + "fortran-free-form", + "fsharp", + "gdresource", + "gdscript", + "gdshader", + "genie", + "gherkin", + "git-commit", + "git-rebase", + "gleam", + "glimmer-js", + "glimmer-ts", + "glsl", + "gnuplot", + "go", + "graphql", + "groovy", + "hack", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hjson", + "hlsl", + "html", + "html-derivative", + "http", + "hxml", + "hy", + "imba", + "ini", + "java", + "javascript", + "jinja", + "jison", + "json", + "json5", + "jsonc", + "jsonl", + "jsonnet", + "jssm", + "jsx", + "julia", + "kotlin", + "kusto", + "latex", + "lean", + "less", + "liquid", + "log", + "logo", + "lua", + "luau", + "make", + "markdown", + "marko", + "matlab", + "mdc", + "mdx", + "mermaid", + "mojo", + "move", + "narrat", + "nextflow", + "nginx", + "nim", + "nix", + "nushell", + "objective-c", + "objective-cpp", + "ocaml", + "pascal", + "perl", + "php", + "plsql", + "po", + "postcss", + "powerquery", + "powershell", + "prisma", + "prolog", + "proto", + "pug", + "puppet", + "purescript", + "python", + "qml", + "qmldir", + "qss", + "r", + "racket", + "raku", + "razor", + "reg", + "regexp", + "rel", + "riscv", + "rst", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shaderlab", + "shellscript", + "shellsession", + "smalltalk", + "solidity", + "soy", + "sparql", + "splunk", + "sql", + "ssh-config", + "stata", + "stylus", + "svelte", + "swift", + "system-verilog", + "systemd", + "tasl", + "tcl", + "templ", + "terraform", + "tex", + "toml", + "ts-tags", + "tsv", + "tsx", + "turtle", + "twig", + "typescript", + "typespec", + "typst", + "v", + "vala", + "vb", + "verilog", + "vhdl", + "viml", + "vue", + "vue-html", + "vyper", + "wasm", + "wenyan", + "wgsl", + "wikitext", + "wolfram", + "xml", + "xsl", + "yaml", + "zenscript", + "zig", + ], + Var[ + Literal[ + "abap", + "actionscript-3", + "ada", + "angular-html", + "angular-ts", + "apache", + "apex", + "apl", + "applescript", + "ara", + "asciidoc", + "asm", + "astro", + "awk", + "ballerina", + "bat", + "beancount", + "berry", + "bibtex", + "bicep", + "blade", + "c", + "cadence", + "clarity", + "clojure", + "cmake", + "cobol", + "codeowners", + "codeql", + "coffee", + "common-lisp", + "coq", + "cpp", + "crystal", + "csharp", + "css", + "csv", + "cue", + "cypher", + "d", + "dart", + "dax", + "desktop", + "diff", + "docker", + "dotenv", + "dream-maker", + "edge", + "elixir", + "elm", + "emacs-lisp", + "erb", + "erlang", + "fennel", + "fish", + "fluent", + "fortran-fixed-form", + "fortran-free-form", + "fsharp", + "gdresource", + "gdscript", + "gdshader", + "genie", + "gherkin", + "git-commit", + "git-rebase", + "gleam", + "glimmer-js", + "glimmer-ts", + "glsl", + "gnuplot", + "go", + "graphql", + "groovy", + "hack", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hjson", + "hlsl", + "html", + "html-derivative", + "http", + "hxml", + "hy", + "imba", + "ini", + "java", + "javascript", + "jinja", + "jison", + "json", + "json5", + "jsonc", + "jsonl", + "jsonnet", + "jssm", + "jsx", + "julia", + "kotlin", + "kusto", + "latex", + "lean", + "less", + "liquid", + "log", + "logo", + "lua", + "luau", + "make", + "markdown", + "marko", + "matlab", + "mdc", + "mdx", + "mermaid", + "mojo", + "move", + "narrat", + "nextflow", + "nginx", + "nim", + "nix", + "nushell", + "objective-c", + "objective-cpp", + "ocaml", + "pascal", + "perl", + "php", + "plsql", + "po", + "postcss", + "powerquery", + "powershell", + "prisma", + "prolog", + "proto", + "pug", + "puppet", + "purescript", + "python", + "qml", + "qmldir", + "qss", + "r", + "racket", + "raku", + "razor", + "reg", + "regexp", + "rel", + "riscv", + "rst", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shaderlab", + "shellscript", + "shellsession", + "smalltalk", + "solidity", + "soy", + "sparql", + "splunk", + "sql", + "ssh-config", + "stata", + "stylus", + "svelte", + "swift", + "system-verilog", + "systemd", + "tasl", + "tcl", + "templ", + "terraform", + "tex", + "toml", + "ts-tags", + "tsv", + "tsx", + "turtle", + "twig", + "typescript", + "typespec", + "typst", + "v", + "vala", + "vb", + "verilog", + "vhdl", + "viml", + "vue", + "vue-html", + "vyper", + "wasm", + "wenyan", + "wgsl", + "wikitext", + "wolfram", + "xml", + "xsl", + "yaml", + "zenscript", + "zig", + ] + ], + ] + ] = None, + theme: Optional[ + Union[ + Literal[ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "houston", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plain", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", + ], + Var[ + Literal[ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "houston", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plain", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", + ] + ], + ] + ] = None, + themes: Optional[ + Union[ + Var[Union[dict[str, str], list[dict[str, Any]]]], + dict[str, str], + list[dict[str, Any]], + ] + ] = None, + code: Optional[Union[Var[str], str]] = None, + transformers: Optional[ + Union[ + Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]], + list[Union[ShikiBaseTransformers, dict[str, Any]]], + ] + ] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + **props, + ) -> "ShikiHighLevelCodeBlock": + """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/). + + Args: + *children: The children of the component. + use_transformers: If this is enabled, the default transformers(shikijs transformer) will be used. + show_line_numbers: If this is enabled line numbers will be shown next to the code block. + can_copy: Whether a copy button should appear. + copy_button: copy_button: A custom copy button to override the default one. + language: The language to use. + theme: The theme to use ("light" or "dark"). + themes: The set of themes to use for different modes. + code: The code to display. + transformers: The transformers to use for the syntax highlighter. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props to pass to the component. + + Returns: + The code block component. + """ + ... + +class TransformerNamespace(ComponentNamespace): + shikijs = ShikiJsTransformer + +class CodeblockNamespace(ComponentNamespace): + root = staticmethod(ShikiCodeBlock.create) + create_transformer = staticmethod(ShikiCodeBlock.create_transformer) + transformers = TransformerNamespace() + + @staticmethod + def __call__( + *children, + use_transformers: Optional[Union[Var[bool], bool]] = None, + show_line_numbers: Optional[Union[Var[bool], bool]] = None, + can_copy: Optional[Union[Var[bool], bool]] = None, + copy_button: Optional[ + Union[Component, Var[Optional[Union[Component, bool]]], bool] + ] = None, + language: Optional[ + Union[ + Literal[ + "abap", + "actionscript-3", + "ada", + "angular-html", + "angular-ts", + "apache", + "apex", + "apl", + "applescript", + "ara", + "asciidoc", + "asm", + "astro", + "awk", + "ballerina", + "bat", + "beancount", + "berry", + "bibtex", + "bicep", + "blade", + "c", + "cadence", + "clarity", + "clojure", + "cmake", + "cobol", + "codeowners", + "codeql", + "coffee", + "common-lisp", + "coq", + "cpp", + "crystal", + "csharp", + "css", + "csv", + "cue", + "cypher", + "d", + "dart", + "dax", + "desktop", + "diff", + "docker", + "dotenv", + "dream-maker", + "edge", + "elixir", + "elm", + "emacs-lisp", + "erb", + "erlang", + "fennel", + "fish", + "fluent", + "fortran-fixed-form", + "fortran-free-form", + "fsharp", + "gdresource", + "gdscript", + "gdshader", + "genie", + "gherkin", + "git-commit", + "git-rebase", + "gleam", + "glimmer-js", + "glimmer-ts", + "glsl", + "gnuplot", + "go", + "graphql", + "groovy", + "hack", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hjson", + "hlsl", + "html", + "html-derivative", + "http", + "hxml", + "hy", + "imba", + "ini", + "java", + "javascript", + "jinja", + "jison", + "json", + "json5", + "jsonc", + "jsonl", + "jsonnet", + "jssm", + "jsx", + "julia", + "kotlin", + "kusto", + "latex", + "lean", + "less", + "liquid", + "log", + "logo", + "lua", + "luau", + "make", + "markdown", + "marko", + "matlab", + "mdc", + "mdx", + "mermaid", + "mojo", + "move", + "narrat", + "nextflow", + "nginx", + "nim", + "nix", + "nushell", + "objective-c", + "objective-cpp", + "ocaml", + "pascal", + "perl", + "php", + "plsql", + "po", + "postcss", + "powerquery", + "powershell", + "prisma", + "prolog", + "proto", + "pug", + "puppet", + "purescript", + "python", + "qml", + "qmldir", + "qss", + "r", + "racket", + "raku", + "razor", + "reg", + "regexp", + "rel", + "riscv", + "rst", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shaderlab", + "shellscript", + "shellsession", + "smalltalk", + "solidity", + "soy", + "sparql", + "splunk", + "sql", + "ssh-config", + "stata", + "stylus", + "svelte", + "swift", + "system-verilog", + "systemd", + "tasl", + "tcl", + "templ", + "terraform", + "tex", + "toml", + "ts-tags", + "tsv", + "tsx", + "turtle", + "twig", + "typescript", + "typespec", + "typst", + "v", + "vala", + "vb", + "verilog", + "vhdl", + "viml", + "vue", + "vue-html", + "vyper", + "wasm", + "wenyan", + "wgsl", + "wikitext", + "wolfram", + "xml", + "xsl", + "yaml", + "zenscript", + "zig", + ], + Var[ + Literal[ + "abap", + "actionscript-3", + "ada", + "angular-html", + "angular-ts", + "apache", + "apex", + "apl", + "applescript", + "ara", + "asciidoc", + "asm", + "astro", + "awk", + "ballerina", + "bat", + "beancount", + "berry", + "bibtex", + "bicep", + "blade", + "c", + "cadence", + "clarity", + "clojure", + "cmake", + "cobol", + "codeowners", + "codeql", + "coffee", + "common-lisp", + "coq", + "cpp", + "crystal", + "csharp", + "css", + "csv", + "cue", + "cypher", + "d", + "dart", + "dax", + "desktop", + "diff", + "docker", + "dotenv", + "dream-maker", + "edge", + "elixir", + "elm", + "emacs-lisp", + "erb", + "erlang", + "fennel", + "fish", + "fluent", + "fortran-fixed-form", + "fortran-free-form", + "fsharp", + "gdresource", + "gdscript", + "gdshader", + "genie", + "gherkin", + "git-commit", + "git-rebase", + "gleam", + "glimmer-js", + "glimmer-ts", + "glsl", + "gnuplot", + "go", + "graphql", + "groovy", + "hack", + "haml", + "handlebars", + "haskell", + "haxe", + "hcl", + "hjson", + "hlsl", + "html", + "html-derivative", + "http", + "hxml", + "hy", + "imba", + "ini", + "java", + "javascript", + "jinja", + "jison", + "json", + "json5", + "jsonc", + "jsonl", + "jsonnet", + "jssm", + "jsx", + "julia", + "kotlin", + "kusto", + "latex", + "lean", + "less", + "liquid", + "log", + "logo", + "lua", + "luau", + "make", + "markdown", + "marko", + "matlab", + "mdc", + "mdx", + "mermaid", + "mojo", + "move", + "narrat", + "nextflow", + "nginx", + "nim", + "nix", + "nushell", + "objective-c", + "objective-cpp", + "ocaml", + "pascal", + "perl", + "php", + "plsql", + "po", + "postcss", + "powerquery", + "powershell", + "prisma", + "prolog", + "proto", + "pug", + "puppet", + "purescript", + "python", + "qml", + "qmldir", + "qss", + "r", + "racket", + "raku", + "razor", + "reg", + "regexp", + "rel", + "riscv", + "rst", + "ruby", + "rust", + "sas", + "sass", + "scala", + "scheme", + "scss", + "shaderlab", + "shellscript", + "shellsession", + "smalltalk", + "solidity", + "soy", + "sparql", + "splunk", + "sql", + "ssh-config", + "stata", + "stylus", + "svelte", + "swift", + "system-verilog", + "systemd", + "tasl", + "tcl", + "templ", + "terraform", + "tex", + "toml", + "ts-tags", + "tsv", + "tsx", + "turtle", + "twig", + "typescript", + "typespec", + "typst", + "v", + "vala", + "vb", + "verilog", + "vhdl", + "viml", + "vue", + "vue-html", + "vyper", + "wasm", + "wenyan", + "wgsl", + "wikitext", + "wolfram", + "xml", + "xsl", + "yaml", + "zenscript", + "zig", + ] + ], + ] + ] = None, + theme: Optional[ + Union[ + Literal[ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "houston", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plain", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", + ], + Var[ + Literal[ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "houston", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plain", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", + ] + ], + ] + ] = None, + themes: Optional[ + Union[ + Var[Union[dict[str, str], list[dict[str, Any]]]], + dict[str, str], + list[dict[str, Any]], + ] + ] = None, + code: Optional[Union[Var[str], str]] = None, + transformers: Optional[ + Union[ + Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]], + list[Union[ShikiBaseTransformers, dict[str, Any]]], + ] + ] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + **props, + ) -> "ShikiHighLevelCodeBlock": + """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/). + + Args: + *children: The children of the component. + use_transformers: If this is enabled, the default transformers(shikijs transformer) will be used. + show_line_numbers: If this is enabled line numbers will be shown next to the code block. + can_copy: Whether a copy button should appear. + copy_button: copy_button: A custom copy button to override the default one. + language: The language to use. + theme: The theme to use ("light" or "dark"). + themes: The set of themes to use for different modes. + code: The code to display. + transformers: The transformers to use for the syntax highlighter. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props to pass to the component. + + Returns: + The code block component. + """ + ... + +code_block = CodeblockNamespace() diff --git a/reflex/components/dynamic.py b/reflex/components/dynamic.py new file mode 100644 index 000000000..9c498fb61 --- /dev/null +++ b/reflex/components/dynamic.py @@ -0,0 +1,186 @@ +"""Components that are dynamically generated on the backend.""" + +from typing import TYPE_CHECKING, Union + +from reflex import constants +from reflex.utils import imports +from reflex.utils.exceptions import DynamicComponentMissingLibrary +from reflex.utils.format import format_library_name +from reflex.utils.serializers import serializer +from reflex.vars import Var, get_unique_variable_name +from reflex.vars.base import VarData, transform + +if TYPE_CHECKING: + from reflex.components.component import Component + + +def get_cdn_url(lib: str) -> str: + """Get the CDN URL for a library. + + Args: + lib: The library to get the CDN URL for. + + Returns: + The CDN URL for the library. + """ + return f"https://cdn.jsdelivr.net/npm/{lib}" + "/+esm" + + +bundled_libraries = {"react", "@radix-ui/themes", "@emotion/react", "next/link"} + + +def bundle_library(component: Union["Component", str]): + """Bundle a library with the component. + + Args: + component: The component to bundle the library with. + + Raises: + DynamicComponentMissingLibrary: Raised when a dynamic component is missing a library. + """ + if isinstance(component, str): + bundled_libraries.add(component) + return + if component.library is None: + raise DynamicComponentMissingLibrary("Component must have a library to bundle.") + bundled_libraries.add(format_library_name(component.library)) + + +def load_dynamic_serializer(): + """Load the serializer for dynamic components.""" + # Causes a circular import, so we import here. + from reflex.components.component import Component + + @serializer + def make_component(component: Component) -> str: + """Generate the code for a dynamic component. + + Args: + component: The component to generate code for. + + Returns: + The generated code + """ + # Causes a circular import, so we import here. + from reflex.compiler import templates, utils + + rendered_components = {} + # Include dynamic imports in the shared component. + if dynamic_imports := component._get_all_dynamic_imports(): + rendered_components.update( + {dynamic_import: None for dynamic_import in dynamic_imports} + ) + + # Include custom code in the shared component. + rendered_components.update( + {code: None for code in component._get_all_custom_code()}, + ) + + rendered_components[ + templates.STATEFUL_COMPONENT.render( + tag_name="MySSRComponent", + memo_trigger_hooks=[], + component=component, + ) + ] = None + + libs_in_window = bundled_libraries + + imports = {} + for lib, names in component._get_all_imports().items(): + formatted_lib_name = format_library_name(lib) + if ( + not lib.startswith((".", "/")) + and not lib.startswith("http") + and formatted_lib_name not in libs_in_window + ): + imports[get_cdn_url(lib)] = names + else: + imports[lib] = names + + module_code_lines = templates.STATEFUL_COMPONENTS.render( + imports=utils.compile_imports(imports), + memoized_code="\n".join(rendered_components), + ).splitlines()[1:] + + # Rewrite imports from `/` to destructure from window + for ix, line in enumerate(module_code_lines[:]): + if line.startswith("import "): + if 'from "/' in line: + module_code_lines[ix] = ( + line.replace("import ", "const ", 1).replace( + " from ", " = window['__reflex'][", 1 + ) + + "]" + ) + else: + for lib in libs_in_window: + if f'from "{lib}"' in line: + module_code_lines[ix] = ( + line.replace("import ", "const ", 1) + .replace( + f' from "{lib}"', f" = window.__reflex['{lib}']", 1 + ) + .replace(" as ", ": ") + ) + if line.startswith("export function"): + module_code_lines[ix] = line.replace( + "export function", "export default function", 1 + ) + + module_code_lines.insert(0, "const React = window.__reflex.react;") + + return "\n".join( + [ + "//__reflex_evaluate", + "/** @jsx jsx */", + "const { jsx } = window.__reflex['@emotion/react']", + *module_code_lines, + ] + ) + + @transform + def evaluate_component(js_string: Var[str]) -> Var[Component]: + """Evaluate a component. + + Args: + js_string: The JavaScript string to evaluate. + + Returns: + The evaluated JavaScript string. + """ + unique_var_name = get_unique_variable_name() + + return js_string._replace( + _js_expr=unique_var_name, + _var_type=Component, + merge_var_data=VarData.merge( + VarData( + imports={ + f"/{constants.Dirs.STATE_PATH}": [ + imports.ImportVar(tag="evalReactComponent"), + ], + "react": [ + imports.ImportVar(tag="useState"), + imports.ImportVar(tag="useEffect"), + ], + }, + hooks={ + f"const [{unique_var_name}, set_{unique_var_name}] = useState(null);": None, + "useEffect(() => {" + "let isMounted = true;" + f"evalReactComponent({str(js_string)})" + ".then((component) => {" + "if (isMounted) {" + f"set_{unique_var_name}(component);" + "}" + "});" + "return () => {" + "isMounted = false;" + "};" + "}" + f", [{str(js_string)}]);": None, + }, + ), + ), + ) diff --git a/reflex/components/el/__init__.pyi b/reflex/components/el/__init__.pyi index adf657b7e..4815bcd27 100644 --- a/reflex/components/el/__init__.pyi +++ b/reflex/components/el/__init__.pyi @@ -3,6 +3,7 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ +from . import elements as elements from .elements.forms import Button as Button from .elements.forms import Fieldset as Fieldset from .elements.forms import Form as Form diff --git a/reflex/components/el/element.pyi b/reflex/components/el/element.pyi index f18d9008c..f6d76cd02 100644 --- a/reflex/components/el/element.pyi +++ b/reflex/components/el/element.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Element(Component): @overload @@ -22,41 +22,21 @@ class Element(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Element": """Create the component. diff --git a/reflex/components/el/elements/base.py b/reflex/components/el/elements/base.py index 5eb8aa70c..a9748ae25 100644 --- a/reflex/components/el/elements/base.py +++ b/reflex/components/el/elements/base.py @@ -3,7 +3,7 @@ from typing import Union from reflex.components.el.element import Element -from reflex.vars import Var as Var +from reflex.vars.base import Var class BaseHTML(Element): diff --git a/reflex/components/el/elements/base.pyi b/reflex/components/el/elements/base.pyi index d802cc2ee..6e943d0d0 100644 --- a/reflex/components/el/elements/base.pyi +++ b/reflex/components/el/elements/base.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.el.element import Element -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class BaseHTML(Element): @overload @@ -16,71 +16,51 @@ class BaseHTML(Element): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "BaseHTML": """Create the component. diff --git a/reflex/components/el/elements/forms.py b/reflex/components/el/elements/forms.py index f6ad10162..a343991d5 100644 --- a/reflex/components/el/elements/forms.py +++ b/reflex/components/el/elements/forms.py @@ -3,30 +3,35 @@ from __future__ import annotations from hashlib import md5 -from typing import Any, Dict, Iterator, Set, Union +from typing import Any, Dict, Iterator, Set, Tuple, Union from jinja2 import Environment from reflex.components.el.element import Element from reflex.components.tags.tag import Tag from reflex.constants import Dirs, EventTriggers -from reflex.event import EventChain, EventHandler -from reflex.ivars.base import ImmutableVar, LiteralVar -from reflex.utils.format import format_event_chain +from reflex.event import ( + EventChain, + EventHandler, + input_event, + key_event, + prevent_default, +) from reflex.utils.imports import ImportDict -from reflex.vars import Var, VarData +from reflex.vars import VarData +from reflex.vars.base import LiteralVar, Var from .base import BaseHTML -FORM_DATA = ImmutableVar.create("form_data") +FORM_DATA = Var(_js_expr="form_data") HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string( """ const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => { const $form = ev.target ev.preventDefault() - const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}} + const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}}; - {{ on_submit_event_chain }} + ({{ on_submit_event_chain }}()); if ({{ reset_on_submit }}) { $form.reset() @@ -97,6 +102,15 @@ class Fieldset(Element): name: Var[Union[str, int, bool]] +def on_submit_event_spec() -> Tuple[Var[Dict[str, Any]]]: + """Event handler spec for the on_submit event. + + Returns: + The event handler spec. + """ + return (FORM_DATA,) + + class Form(BaseHTML): """Display the form element.""" @@ -136,7 +150,7 @@ class Form(BaseHTML): handle_submit_unique_name: Var[str] # Fired when the form is submitted - on_submit: EventHandler[lambda e0: [FORM_DATA]] + on_submit: EventHandler[on_submit_event_spec] @classmethod def create(cls, *children, **props): @@ -149,6 +163,9 @@ class Form(BaseHTML): Returns: The form component. """ + if "on_submit" not in props: + props["on_submit"] = prevent_default + if "handle_submit_unique_name" in props: return super().create(*children, **props) @@ -186,8 +203,8 @@ class Form(BaseHTML): handle_submit_unique_name=self.handle_submit_unique_name, form_data=FORM_DATA, field_ref_mapping=str(LiteralVar.create(self._get_form_refs())), - on_submit_event_chain=format_event_chain( - self.event_triggers[EventTriggers.ON_SUBMIT] + on_submit_event_chain=str( + LiteralVar.create(self.event_triggers[EventTriggers.ON_SUBMIT]) ), reset_on_submit=self.reset_on_submit, ) @@ -198,8 +215,8 @@ class Form(BaseHTML): if EventTriggers.ON_SUBMIT in self.event_triggers: render_tag.add_props( **{ - EventTriggers.ON_SUBMIT: ImmutableVar( - _var_name=f"handleSubmit_{self.handle_submit_unique_name}", + EventTriggers.ON_SUBMIT: Var( + _js_expr=f"handleSubmit_{self.handle_submit_unique_name}", _var_type=EventChain, ) } @@ -213,15 +230,15 @@ class Form(BaseHTML): # when ref start with refs_ it's an array of refs, so we need different method # to collect data if ref.startswith("refs_"): - ref_var = ImmutableVar.create_safe(ref[:-3]).as_ref() - form_refs[ref[len("refs_") : -3]] = ImmutableVar.create_safe( - f"getRefValues({str(ref_var)})", + ref_var = Var(_js_expr=ref[:-3]).as_ref() + form_refs[ref[len("refs_") : -3]] = Var( + _js_expr=f"getRefValues({str(ref_var)})", _var_data=VarData.merge(ref_var._get_all_var_data()), ) else: - ref_var = ImmutableVar.create_safe(ref).as_ref() - form_refs[ref[4:]] = ImmutableVar.create_safe( - f"getRefValue({str(ref_var)})", + ref_var = Var(_js_expr=ref).as_ref() + form_refs[ref[4:]] = Var( + _js_expr=f"getRefValue({str(ref_var)})", _var_data=VarData.merge(ref_var._get_all_var_data()), ) # print(repr(form_refs)) @@ -343,19 +360,19 @@ class Input(BaseHTML): value: Var[Union[str, int, float]] # Fired when the input value changes - on_change: EventHandler[lambda e0: [e0.target.value]] + on_change: EventHandler[input_event] # Fired when the input gains focus - on_focus: EventHandler[lambda e0: [e0.target.value]] + on_focus: EventHandler[input_event] # Fired when the input loses focus - on_blur: EventHandler[lambda e0: [e0.target.value]] + on_blur: EventHandler[input_event] # Fired when a key is pressed down - on_key_down: EventHandler[lambda e0: [e0.key]] + on_key_down: EventHandler[key_event] # Fired when a key is released - on_key_up: EventHandler[lambda e0: [e0.key]] + on_key_up: EventHandler[key_event] class Label(BaseHTML): @@ -494,7 +511,7 @@ class Select(BaseHTML): size: Var[Union[str, int, bool]] # Fired when the select value changes - on_change: EventHandler[lambda e0: [e0.target.value]] + on_change: EventHandler[input_event] AUTO_HEIGHT_JS = """ @@ -584,19 +601,19 @@ class Textarea(BaseHTML): wrap: Var[Union[str, int, bool]] # Fired when the input value changes - on_change: EventHandler[lambda e0: [e0.target.value]] + on_change: EventHandler[input_event] # Fired when the input gains focus - on_focus: EventHandler[lambda e0: [e0.target.value]] + on_focus: EventHandler[input_event] # Fired when the input loses focus - on_blur: EventHandler[lambda e0: [e0.target.value]] + on_blur: EventHandler[input_event] # Fired when a key is pressed down - on_key_down: EventHandler[lambda e0: [e0.key]] + on_key_down: EventHandler[key_event] # Fired when a key is released - on_key_up: EventHandler[lambda e0: [e0.key]] + on_key_up: EventHandler[key_event] def _exclude_props(self) -> list[str]: return super()._exclude_props() + [ @@ -625,19 +642,15 @@ class Textarea(BaseHTML): "Cannot combine `enter_key_submit` with `on_key_down`.", ) tag.add_props( - on_key_down=Var.create_safe( - f"(e) => enterKeySubmitOnKeyDown(e, {self.enter_key_submit._var_name_unwrapped})", - _var_is_local=False, - _var_is_string=False, + on_key_down=Var( + _js_expr=f"(e) => enterKeySubmitOnKeyDown(e, {str(self.enter_key_submit)})", _var_data=VarData.merge(self.enter_key_submit._get_all_var_data()), ) ) if self.auto_height is not None: tag.add_props( - on_input=Var.create_safe( - f"(e) => autoHeightOnInput(e, {self.auto_height._var_name_unwrapped})", - _var_is_local=False, - _var_is_string=False, + on_input=Var( + _js_expr=f"(e) => autoHeightOnInput(e, {str(self.auto_height)})", _var_data=VarData.merge(self.auto_height._get_all_var_data()), ) ) diff --git a/reflex/components/el/elements/forms.pyi b/reflex/components/el/elements/forms.pyi index 7eca3f854..135291213 100644 --- a/reflex/components/el/elements/forms.pyi +++ b/reflex/components/el/elements/forms.pyi @@ -3,22 +3,21 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Tuple, Union, overload from jinja2 import Environment from reflex.components.el.element import Element -from reflex.event import EventHandler, EventSpec -from reflex.ivars.base import ImmutableVar +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML -FORM_DATA = ImmutableVar.create("form_data") +FORM_DATA = Var(_js_expr="form_data") HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string( - "\n const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => {\n const $form = ev.target\n ev.preventDefault()\n const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}}\n\n {{ on_submit_event_chain }}\n\n if ({{ reset_on_submit }}) {\n $form.reset()\n }\n })\n " + "\n const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => {\n const $form = ev.target\n ev.preventDefault()\n const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}};\n\n ({{ on_submit_event_chain }}());\n\n if ({{ reset_on_submit }}) {\n $form.reset()\n }\n })\n " ) class Button(BaseHTML): @@ -27,86 +26,66 @@ class Button(BaseHTML): def create( # type: ignore cls, *children, - auto_focus: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, disabled: Optional[Union[Var[bool], bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form_action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form_action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_enc_type: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_no_validate: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Button": """Create the component. @@ -159,71 +138,51 @@ class Datalist(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Datalist": """Create the component. @@ -265,50 +224,30 @@ class Fieldset(Element): def create( # type: ignore cls, *children, - disabled: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + disabled: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Fieldset": """Create the component. @@ -331,93 +270,75 @@ class Fieldset(Element): """ ... +def on_submit_event_spec() -> Tuple[Var[Dict[str, Any]]]: ... + class Form(BaseHTML): @overload @classmethod def create( # type: ignore cls, *children, - accept: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + accept: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, accept_charset: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_complete: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - enc_type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - no_validate: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + enc_type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + no_validate: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, reset_on_submit: Optional[Union[Var[bool], bool]] = None, handle_submit_unique_name: Optional[Union[Var[str], str]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_submit: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_submit: Optional[EventType[Dict[str, Any]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Form": """Create a form component. @@ -473,115 +394,93 @@ class Input(BaseHTML): def create( # type: ignore cls, *children, - accept: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - alt: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + accept: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + alt: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_complete: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - auto_focus: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - capture: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - checked: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + capture: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + checked: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, default_checked: Optional[Union[Var[bool], bool]] = None, default_value: Optional[Union[Var[str], str]] = None, - dirname: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - disabled: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form_action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dirname: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + disabled: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form_action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_enc_type: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_no_validate: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - list: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - max: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - max_length: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - min_length: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - min: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - multiple: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - pattern: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - placeholder: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - read_only: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - required: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - size: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - step: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - use_map: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[float, int, str]], str, int, float]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + list: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + max: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + max_length: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + min_length: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + min: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + multiple: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + pattern: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + placeholder: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + read_only: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + required: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + size: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + step: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + use_map: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[float, int, str]], float, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[str]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[str]] = None, + on_key_down: Optional[EventType[str]] = None, + on_key_up: Optional[EventType[str]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Input": """Create the component. @@ -656,73 +555,53 @@ class Label(BaseHTML): def create( # type: ignore cls, *children, - html_for: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + html_for: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Label": """Create the component. @@ -766,71 +645,51 @@ class Legend(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Legend": """Create the component. @@ -872,78 +731,58 @@ class Meter(BaseHTML): def create( # type: ignore cls, *children, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - high: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - low: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - max: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - min: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - optimum: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + high: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + low: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + max: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + min: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + optimum: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Meter": """Create the component. @@ -992,73 +831,53 @@ class Optgroup(BaseHTML): def create( # type: ignore cls, *children, - disabled: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - label: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + disabled: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + label: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Optgroup": """Create the component. @@ -1102,75 +921,55 @@ class Option(BaseHTML): def create( # type: ignore cls, *children, - disabled: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - label: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - selected: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + disabled: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + label: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + selected: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Option": """Create the component. @@ -1216,74 +1015,54 @@ class Output(BaseHTML): def create( # type: ignore cls, *children, - html_for: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + html_for: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Output": """Create the component. @@ -1328,74 +1107,54 @@ class Progress(BaseHTML): def create( # type: ignore cls, *children, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - max: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + max: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Progress": """Create the component. @@ -1441,81 +1200,61 @@ class Select(BaseHTML): cls, *children, auto_complete: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - auto_focus: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - disabled: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - multiple: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - required: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - size: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + disabled: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + multiple: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + required: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + size: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Select": """Create the component. @@ -1569,94 +1308,72 @@ class Textarea(BaseHTML): cls, *children, auto_complete: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - auto_focus: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_height: Optional[Union[Var[bool], bool]] = None, - cols: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - dirname: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - disabled: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cols: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + dirname: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + disabled: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_submit: Optional[Union[Var[bool], bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - max_length: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - min_length: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - placeholder: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - read_only: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - required: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - rows: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - wrap: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + max_length: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + min_length: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + placeholder: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + read_only: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + required: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + rows: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + wrap: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[str]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[str]] = None, + on_key_down: Optional[EventType[str]] = None, + on_key_up: Optional[EventType[str]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Textarea": """Create the component. diff --git a/reflex/components/el/elements/inline.py b/reflex/components/el/elements/inline.py index 4364c1ead..d1bdf6b87 100644 --- a/reflex/components/el/elements/inline.py +++ b/reflex/components/el/elements/inline.py @@ -2,7 +2,7 @@ from typing import Union -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML diff --git a/reflex/components/el/elements/inline.pyi b/reflex/components/el/elements/inline.pyi index dfddf5f10..336e4d3de 100644 --- a/reflex/components/el/elements/inline.pyi +++ b/reflex/components/el/elements/inline.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML @@ -17,82 +17,62 @@ class A(BaseHTML): def create( # type: ignore cls, *children, - download: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - href: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - href_lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - media: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - ping: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + download: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + href: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + href_lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + media: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + ping: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, referrer_policy: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - rel: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - shape: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + rel: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + shape: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "A": """Create the component. @@ -143,71 +123,51 @@ class Abbr(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Abbr": """Create the component. @@ -249,71 +209,51 @@ class B(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "B": """Create the component. @@ -355,71 +295,51 @@ class Bdi(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Bdi": """Create the component. @@ -461,71 +381,51 @@ class Bdo(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Bdo": """Create the component. @@ -567,71 +467,51 @@ class Br(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Br": """Create the component. @@ -673,71 +553,51 @@ class Cite(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Cite": """Create the component. @@ -779,71 +639,51 @@ class Code(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Code": """Create the component. @@ -885,72 +725,52 @@ class Data(BaseHTML): def create( # type: ignore cls, *children, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Data": """Create the component. @@ -993,71 +813,51 @@ class Dfn(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Dfn": """Create the component. @@ -1099,71 +899,51 @@ class Em(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Em": """Create the component. @@ -1205,71 +985,51 @@ class I(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "I": """Create the component. @@ -1311,71 +1071,51 @@ class Kbd(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Kbd": """Create the component. @@ -1417,71 +1157,51 @@ class Mark(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Mark": """Create the component. @@ -1523,72 +1243,52 @@ class Q(BaseHTML): def create( # type: ignore cls, *children, - cite: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cite: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Q": """Create the component. @@ -1631,71 +1331,51 @@ class Rp(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Rp": """Create the component. @@ -1737,71 +1417,51 @@ class Rt(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Rt": """Create the component. @@ -1843,71 +1503,51 @@ class Ruby(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Ruby": """Create the component. @@ -1949,71 +1589,51 @@ class S(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "S": """Create the component. @@ -2055,71 +1675,51 @@ class Samp(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Samp": """Create the component. @@ -2161,71 +1761,51 @@ class Small(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Small": """Create the component. @@ -2267,71 +1847,51 @@ class Span(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Span": """Create the component. @@ -2373,71 +1933,51 @@ class Strong(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Strong": """Create the component. @@ -2479,71 +2019,51 @@ class Sub(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Sub": """Create the component. @@ -2585,71 +2105,51 @@ class Sup(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Sup": """Create the component. @@ -2691,72 +2191,52 @@ class Time(BaseHTML): def create( # type: ignore cls, *children, - date_time: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + date_time: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Time": """Create the component. @@ -2799,71 +2279,51 @@ class U(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "U": """Create the component. @@ -2905,71 +2365,51 @@ class Wbr(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Wbr": """Create the component. diff --git a/reflex/components/el/elements/media.py b/reflex/components/el/elements/media.py index 7f006bf65..9935902ad 100644 --- a/reflex/components/el/elements/media.py +++ b/reflex/components/el/elements/media.py @@ -4,7 +4,7 @@ from typing import Any, Union from reflex import Component, ComponentNamespace from reflex.constants.colors import Color -from reflex.vars import Var as Var +from reflex.vars.base import Var from .base import BaseHTML @@ -317,6 +317,42 @@ class Svg(BaseHTML): xmlns: Var[str] +class Text(BaseHTML): + """The SVG text component.""" + + tag = "text" + # The x coordinate of the starting point of the text baseline. + x: Var[Union[str, int]] + # The y coordinate of the starting point of the text baseline. + y: Var[Union[str, int]] + # Shifts the text position horizontally from a previous text element. + dx: Var[Union[str, int]] + # Shifts the text position vertically from a previous text element. + dy: Var[Union[str, int]] + # Rotates orientation of each individual glyph. + rotate: Var[Union[str, int]] + # How the text is stretched or compressed to fit the width defined by the text_length attribute. + length_adjust: Var[str] + # A width that the text should be scaled to fit. + text_length: Var[Union[str, int]] + + +class Line(BaseHTML): + """The SVG line component.""" + + tag = "line" + # The x-axis coordinate of the line starting point. + x1: Var[Union[str, int]] + # The x-axis coordinate of the the line ending point. + x2: Var[Union[str, int]] + # The y-axis coordinate of the line starting point. + y1: Var[Union[str, int]] + # The y-axis coordinate of the the line ending point. + y2: Var[Union[str, int]] + # The total path length, in user units. + path_length: Var[int] + + class Circle(BaseHTML): """The SVG circle component.""" @@ -331,6 +367,22 @@ class Circle(BaseHTML): path_length: Var[int] +class Ellipse(BaseHTML): + """The SVG ellipse component.""" + + tag = "ellipse" + # The x position of the center of the ellipse. + cx: Var[Union[str, int]] + # The y position of the center of the ellipse. + cy: Var[Union[str, int]] + # The radius of the ellipse on the x axis. + rx: Var[Union[str, int]] + # The radius of the ellipse on the y axis. + ry: Var[Union[str, int]] + # The total length for the ellipse's circumference, in user units. + path_length: Var[int] + + class Rect(BaseHTML): """The SVG rect component.""" @@ -394,6 +446,39 @@ class LinearGradient(BaseHTML): y2: Var[Union[str, int, bool]] +class RadialGradient(BaseHTML): + """Display the radialGradient element.""" + + tag = "radialGradient" + + # The x coordinate of the end circle of the radial gradient. + cx: Var[Union[str, int, bool]] + + # The y coordinate of the end circle of the radial gradient. + cy: Var[Union[str, int, bool]] + + # The radius of the start circle of the radial gradient. + fr: Var[Union[str, int, bool]] + + # The x coordinate of the start circle of the radial gradient. + fx: Var[Union[str, int, bool]] + + # The y coordinate of the start circle of the radial gradient. + fy: Var[Union[str, int, bool]] + + # Units for the gradient. + gradient_units: Var[Union[str, bool]] + + # Transform applied to the gradient. + gradient_transform: Var[Union[str, bool]] + + # The radius of the end circle of the radial gradient. + r: Var[Union[str, int, bool]] + + # Method used to spread the gradient. + spread_method: Var[Union[str, bool]] + + class Stop(BaseHTML): """Display the stop element.""" @@ -421,12 +506,16 @@ class Path(BaseHTML): class SVG(ComponentNamespace): """SVG component namespace.""" + text = staticmethod(Text.create) + line = staticmethod(Line.create) circle = staticmethod(Circle.create) + ellipse = staticmethod(Ellipse.create) rect = staticmethod(Rect.create) polygon = staticmethod(Polygon.create) path = staticmethod(Path.create) stop = staticmethod(Stop.create) linear_gradient = staticmethod(LinearGradient.create) + radial_gradient = staticmethod(RadialGradient.create) defs = staticmethod(Defs.create) __call__ = staticmethod(Svg.create) diff --git a/reflex/components/el/elements/media.pyi b/reflex/components/el/elements/media.pyi index cf673ddf9..382f3c79c 100644 --- a/reflex/components/el/elements/media.pyi +++ b/reflex/components/el/elements/media.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex import ComponentNamespace from reflex.constants.colors import Color -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML @@ -19,84 +19,64 @@ class Area(BaseHTML): def create( # type: ignore cls, *children, - alt: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - coords: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - download: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - href: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - href_lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - media: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - ping: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + alt: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + coords: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + download: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + href: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + href_lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + media: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + ping: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, referrer_policy: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - rel: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - shape: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + rel: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + shape: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Area": """Create the component. @@ -149,81 +129,61 @@ class Audio(BaseHTML): def create( # type: ignore cls, *children, - auto_play: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - buffered: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - controls: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_play: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + buffered: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + controls: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, cross_origin: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - loop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - muted: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - preload: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + loop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + muted: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + preload: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Audio": """Create the component. @@ -273,89 +233,69 @@ class Img(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - alt: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + alt: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, cross_origin: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - decoding: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + decoding: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, intrinsicsize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - ismap: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - loading: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + ismap: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + loading: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, referrer_policy: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - sizes: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src: Optional[Union[Var[Any], Any]] = None, - src_set: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - use_map: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + sizes: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src: Optional[Union[Any, Var[Any]]] = None, + src_set: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + use_map: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Img": """Override create method to apply source attribute to value if user fails to pass in attribute. @@ -410,72 +350,52 @@ class Map(BaseHTML): def create( # type: ignore cls, *children, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Map": """Create the component. @@ -518,76 +438,56 @@ class Track(BaseHTML): def create( # type: ignore cls, *children, - default: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - kind: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - label: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src_lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + default: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + kind: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + label: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src_lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Track": """Create the component. @@ -634,85 +534,65 @@ class Video(BaseHTML): def create( # type: ignore cls, *children, - auto_play: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - buffered: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - controls: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_play: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + buffered: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + controls: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, cross_origin: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - loop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - muted: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + loop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + muted: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, plays_inline: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - poster: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - preload: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + poster: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + preload: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Video": """Create the component. @@ -764,73 +644,53 @@ class Embed(BaseHTML): def create( # type: ignore cls, *children, - src: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + src: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Embed": """Create the component. @@ -874,82 +734,62 @@ class Iframe(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - allow: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - csp: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - loading: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + allow: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + csp: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + loading: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, referrer_policy: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - sandbox: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src_doc: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + sandbox: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src_doc: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Iframe": """Create the component. @@ -1000,76 +840,56 @@ class Object(BaseHTML): def create( # type: ignore cls, *children, - data: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - use_map: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + data: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + use_map: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Object": """Create the component. @@ -1116,71 +936,51 @@ class Picture(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Picture": """Create the component. @@ -1222,71 +1022,51 @@ class Portal(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Portal": """Create the component. @@ -1328,76 +1108,56 @@ class Source(BaseHTML): def create( # type: ignore cls, *children, - media: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - sizes: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - src_set: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + media: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + sizes: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + src_set: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Source": """Create the component. @@ -1444,74 +1204,54 @@ class Svg(BaseHTML): def create( # type: ignore cls, *children, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, xmlns: Optional[Union[Var[str], str]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Svg": """Create the component. @@ -1550,81 +1290,257 @@ class Svg(BaseHTML): """ ... -class Circle(BaseHTML): +class Text(BaseHTML): @overload @classmethod def create( # type: ignore cls, *children, - cx: Optional[Union[Var[Union[int, str]], str, int]] = None, - cy: Optional[Union[Var[Union[int, str]], str, int]] = None, - r: Optional[Union[Var[Union[int, str]], str, int]] = None, - path_length: Optional[Union[Var[int], int]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + x: Optional[Union[Var[Union[int, str]], int, str]] = None, + y: Optional[Union[Var[Union[int, str]], int, str]] = None, + dx: Optional[Union[Var[Union[int, str]], int, str]] = None, + dy: Optional[Union[Var[Union[int, str]], int, str]] = None, + rotate: Optional[Union[Var[Union[int, str]], int, str]] = None, + length_adjust: Optional[Union[Var[str], str]] = None, + text_length: Optional[Union[Var[Union[int, str]], int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + **props, + ) -> "Text": + """Create the component. + + Args: + *children: The children of the component. + x: The x coordinate of the starting point of the text baseline. + y: The y coordinate of the starting point of the text baseline. + dx: Shifts the text position horizontally from a previous text element. + dy: Shifts the text position vertically from a previous text element. + rotate: Rotates orientation of each individual glyph. + length_adjust: How the text is stretched or compressed to fit the width defined by the text_length attribute. + text_length: A width that the text should be scaled to fit. + access_key: Provides a hint for generating a keyboard shortcut for the current element. + auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user. + content_editable: Indicates whether the element's content is editable. + context_menu: Defines the ID of a element which will serve as the element's context menu. + dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left) + draggable: Defines whether the element can be dragged. + enter_key_hint: Hints what media types the media element is able to play. + hidden: Defines whether the element is hidden. + input_mode: Defines the type of the element. + item_prop: Defines the name of the element for metadata purposes. + lang: Defines the language used in the element. + role: Defines the role of the element. + slot: Assigns a slot in a shadow DOM shadow tree to an element. + spell_check: Defines whether the element may be checked for spelling errors. + tab_index: Defines the position of the current element in the tabbing order. + title: Defines a tooltip for the element. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props of the component. + + Returns: + The component. + """ + ... + +class Line(BaseHTML): + @overload + @classmethod + def create( # type: ignore + cls, + *children, + x1: Optional[Union[Var[Union[int, str]], int, str]] = None, + x2: Optional[Union[Var[Union[int, str]], int, str]] = None, + y1: Optional[Union[Var[Union[int, str]], int, str]] = None, + y2: Optional[Union[Var[Union[int, str]], int, str]] = None, + path_length: Optional[Union[Var[int], int]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + auto_capitalize: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + content_editable: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + context_menu: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + enter_key_hint: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + **props, + ) -> "Line": + """Create the component. + + Args: + *children: The children of the component. + x1: The x-axis coordinate of the line starting point. + x2: The x-axis coordinate of the the line ending point. + y1: The y-axis coordinate of the line starting point. + y2: The y-axis coordinate of the the line ending point. + path_length: The total path length, in user units. + access_key: Provides a hint for generating a keyboard shortcut for the current element. + auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user. + content_editable: Indicates whether the element's content is editable. + context_menu: Defines the ID of a element which will serve as the element's context menu. + dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left) + draggable: Defines whether the element can be dragged. + enter_key_hint: Hints what media types the media element is able to play. + hidden: Defines whether the element is hidden. + input_mode: Defines the type of the element. + item_prop: Defines the name of the element for metadata purposes. + lang: Defines the language used in the element. + role: Defines the role of the element. + slot: Assigns a slot in a shadow DOM shadow tree to an element. + spell_check: Defines whether the element may be checked for spelling errors. + tab_index: Defines the position of the current element in the tabbing order. + title: Defines a tooltip for the element. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props of the component. + + Returns: + The component. + """ + ... + +class Circle(BaseHTML): + @overload + @classmethod + def create( # type: ignore + cls, + *children, + cx: Optional[Union[Var[Union[int, str]], int, str]] = None, + cy: Optional[Union[Var[Union[int, str]], int, str]] = None, + r: Optional[Union[Var[Union[int, str]], int, str]] = None, + path_length: Optional[Union[Var[int], int]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + auto_capitalize: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + content_editable: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + context_menu: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + enter_key_hint: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Circle": """Create the component. @@ -1664,84 +1580,160 @@ class Circle(BaseHTML): """ ... -class Rect(BaseHTML): +class Ellipse(BaseHTML): @overload @classmethod def create( # type: ignore cls, *children, - x: Optional[Union[Var[Union[int, str]], str, int]] = None, - y: Optional[Union[Var[Union[int, str]], str, int]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, - rx: Optional[Union[Var[Union[int, str]], str, int]] = None, - ry: Optional[Union[Var[Union[int, str]], str, int]] = None, + cx: Optional[Union[Var[Union[int, str]], int, str]] = None, + cy: Optional[Union[Var[Union[int, str]], int, str]] = None, + rx: Optional[Union[Var[Union[int, str]], int, str]] = None, + ry: Optional[Union[Var[Union[int, str]], int, str]] = None, path_length: Optional[Union[Var[int], int]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + **props, + ) -> "Ellipse": + """Create the component. + + Args: + *children: The children of the component. + cx: The x position of the center of the ellipse. + cy: The y position of the center of the ellipse. + rx: The radius of the ellipse on the x axis. + ry: The radius of the ellipse on the y axis. + path_length: The total length for the ellipse's circumference, in user units. + access_key: Provides a hint for generating a keyboard shortcut for the current element. + auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user. + content_editable: Indicates whether the element's content is editable. + context_menu: Defines the ID of a element which will serve as the element's context menu. + dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left) + draggable: Defines whether the element can be dragged. + enter_key_hint: Hints what media types the media element is able to play. + hidden: Defines whether the element is hidden. + input_mode: Defines the type of the element. + item_prop: Defines the name of the element for metadata purposes. + lang: Defines the language used in the element. + role: Defines the role of the element. + slot: Assigns a slot in a shadow DOM shadow tree to an element. + spell_check: Defines whether the element may be checked for spelling errors. + tab_index: Defines the position of the current element in the tabbing order. + title: Defines a tooltip for the element. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props of the component. + + Returns: + The component. + """ + ... + +class Rect(BaseHTML): + @overload + @classmethod + def create( # type: ignore + cls, + *children, + x: Optional[Union[Var[Union[int, str]], int, str]] = None, + y: Optional[Union[Var[Union[int, str]], int, str]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, + rx: Optional[Union[Var[Union[int, str]], int, str]] = None, + ry: Optional[Union[Var[Union[int, str]], int, str]] = None, + path_length: Optional[Union[Var[int], int]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + auto_capitalize: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + content_editable: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + context_menu: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + enter_key_hint: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Rect": """Create the component. @@ -1792,71 +1784,51 @@ class Polygon(BaseHTML): *children, points: Optional[Union[Var[str], str]] = None, path_length: Optional[Union[Var[int], int]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Polygon": """Create the component. @@ -1900,71 +1872,51 @@ class Defs(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Defs": """Create the component. @@ -2006,78 +1958,58 @@ class LinearGradient(BaseHTML): def create( # type: ignore cls, *children, - gradient_units: Optional[Union[Var[Union[bool, str]], str, bool]] = None, - gradient_transform: Optional[Union[Var[Union[bool, str]], str, bool]] = None, - spread_method: Optional[Union[Var[Union[bool, str]], str, bool]] = None, - x1: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - x2: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - y1: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - y2: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + gradient_units: Optional[Union[Var[Union[bool, str]], bool, str]] = None, + gradient_transform: Optional[Union[Var[Union[bool, str]], bool, str]] = None, + spread_method: Optional[Union[Var[Union[bool, str]], bool, str]] = None, + x1: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + x2: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + y1: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + y2: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "LinearGradient": """Create the component. @@ -2120,84 +2052,168 @@ class LinearGradient(BaseHTML): """ ... -class Stop(BaseHTML): +class RadialGradient(BaseHTML): @overload @classmethod def create( # type: ignore cls, *children, - offset: Optional[Union[Var[Union[float, int, str]], str, float, int]] = None, - stop_color: Optional[ - Union[Var[Union[Color, bool, str]], str, Color, bool] - ] = None, - stop_opacity: Optional[ - Union[Var[Union[bool, float, int, str]], str, float, int, bool] - ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cx: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + cy: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + fr: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + fx: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + fy: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + gradient_units: Optional[Union[Var[Union[bool, str]], bool, str]] = None, + gradient_transform: Optional[Union[Var[Union[bool, str]], bool, str]] = None, + r: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spread_method: Optional[Union[Var[Union[bool, str]], bool, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + **props, + ) -> "RadialGradient": + """Create the component. + + Args: + *children: The children of the component. + cx: The x coordinate of the end circle of the radial gradient. + cy: The y coordinate of the end circle of the radial gradient. + fr: The radius of the start circle of the radial gradient. + fx: The x coordinate of the start circle of the radial gradient. + fy: The y coordinate of the start circle of the radial gradient. + gradient_units: Units for the gradient. + gradient_transform: Transform applied to the gradient. + r: The radius of the end circle of the radial gradient. + spread_method: Method used to spread the gradient. + access_key: Provides a hint for generating a keyboard shortcut for the current element. + auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user. + content_editable: Indicates whether the element's content is editable. + context_menu: Defines the ID of a element which will serve as the element's context menu. + dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left) + draggable: Defines whether the element can be dragged. + enter_key_hint: Hints what media types the media element is able to play. + hidden: Defines whether the element is hidden. + input_mode: Defines the type of the element. + item_prop: Defines the name of the element for metadata purposes. + lang: Defines the language used in the element. + role: Defines the role of the element. + slot: Assigns a slot in a shadow DOM shadow tree to an element. + spell_check: Defines whether the element may be checked for spelling errors. + tab_index: Defines the position of the current element in the tabbing order. + title: Defines a tooltip for the element. + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props of the component. + + Returns: + The component. + """ + ... + +class Stop(BaseHTML): + @overload + @classmethod + def create( # type: ignore + cls, + *children, + offset: Optional[Union[Var[Union[float, int, str]], float, int, str]] = None, + stop_color: Optional[ + Union[Color, Var[Union[Color, bool, str]], bool, str] ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + stop_opacity: Optional[ + Union[Var[Union[bool, float, int, str]], bool, float, int, str] ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + auto_capitalize: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + content_editable: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + context_menu: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + enter_key_hint: Optional[ + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Stop": """Create the component. @@ -2242,72 +2258,52 @@ class Path(BaseHTML): def create( # type: ignore cls, *children, - d: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + d: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Path": """Create the component. @@ -2345,85 +2341,69 @@ class Path(BaseHTML): ... class SVG(ComponentNamespace): + text = staticmethod(Text.create) + line = staticmethod(Line.create) circle = staticmethod(Circle.create) + ellipse = staticmethod(Ellipse.create) rect = staticmethod(Rect.create) polygon = staticmethod(Polygon.create) path = staticmethod(Path.create) stop = staticmethod(Stop.create) linear_gradient = staticmethod(LinearGradient.create) + radial_gradient = staticmethod(RadialGradient.create) defs = staticmethod(Defs.create) @staticmethod def __call__( *children, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, xmlns: Optional[Union[Var[str], str]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Svg": """Create the component. diff --git a/reflex/components/el/elements/metadata.py b/reflex/components/el/elements/metadata.py index 9a4d18b73..983a8f3a0 100644 --- a/reflex/components/el/elements/metadata.py +++ b/reflex/components/el/elements/metadata.py @@ -1,9 +1,9 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Set, Union +from typing import List, Union from reflex.components.el.element import Element -from reflex.vars import Var as Var +from reflex.vars.base import Var from .base import BaseHTML @@ -89,9 +89,7 @@ class StyleEl(Element): # noqa: E742 media: Var[Union[str, int, bool]] - special_props: Set[Var] = { - Var.create_safe("suppressHydrationWarning", _var_is_string=False) - } + special_props: List[Var] = [Var(_js_expr="suppressHydrationWarning")] base = Base.create diff --git a/reflex/components/el/elements/metadata.pyi b/reflex/components/el/elements/metadata.pyi index cb7e1dca9..498695a80 100644 --- a/reflex/components/el/elements/metadata.pyi +++ b/reflex/components/el/elements/metadata.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.el.element import Element -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML @@ -18,73 +18,53 @@ class Base(BaseHTML): def create( # type: ignore cls, *children, - href: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + href: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Base": """Create the component. @@ -126,71 +106,51 @@ class Head(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Head": """Create the component. @@ -233,83 +193,63 @@ class Link(BaseHTML): cls, *children, cross_origin: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - href: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - href_lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - integrity: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - media: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + href: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + href_lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + integrity: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + media: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, referrer_policy: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - rel: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - sizes: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + rel: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + sizes: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Link": """Create the component. @@ -360,75 +300,55 @@ class Meta(BaseHTML): def create( # type: ignore cls, *children, - char_set: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - content: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - http_equiv: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + char_set: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + content: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + http_equiv: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Meta": """Create the component. @@ -480,41 +400,21 @@ class Title(Element): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Title": """Create the component. @@ -540,48 +440,28 @@ class StyleEl(Element): def create( # type: ignore cls, *children, - media: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + media: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "StyleEl": """Create the component. diff --git a/reflex/components/el/elements/other.py b/reflex/components/el/elements/other.py index 560ed5138..fa7c6cdec 100644 --- a/reflex/components/el/elements/other.py +++ b/reflex/components/el/elements/other.py @@ -2,7 +2,7 @@ from typing import Union -from reflex.vars import Var as Var +from reflex.vars.base import Var from .base import BaseHTML diff --git a/reflex/components/el/elements/other.pyi b/reflex/components/el/elements/other.pyi index 89b50b085..db884a78b 100644 --- a/reflex/components/el/elements/other.pyi +++ b/reflex/components/el/elements/other.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML @@ -17,72 +17,52 @@ class Details(BaseHTML): def create( # type: ignore cls, *children, - open: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + open: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Details": """Create the component. @@ -125,72 +105,52 @@ class Dialog(BaseHTML): def create( # type: ignore cls, *children, - open: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + open: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Dialog": """Create the component. @@ -233,71 +193,51 @@ class Summary(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Summary": """Create the component. @@ -339,71 +279,51 @@ class Slot(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Slot": """Create the component. @@ -445,71 +365,51 @@ class Template(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Template": """Create the component. @@ -551,71 +451,51 @@ class Math(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Math": """Create the component. @@ -657,72 +537,52 @@ class Html(BaseHTML): def create( # type: ignore cls, *children, - manifest: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + manifest: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Html": """Create the component. diff --git a/reflex/components/el/elements/scripts.py b/reflex/components/el/elements/scripts.py index 09a9fd17a..b53306e02 100644 --- a/reflex/components/el/elements/scripts.py +++ b/reflex/components/el/elements/scripts.py @@ -2,7 +2,7 @@ from typing import Union -from reflex.vars import Var as Var +from reflex.vars.base import Var from .base import BaseHTML diff --git a/reflex/components/el/elements/scripts.pyi b/reflex/components/el/elements/scripts.pyi index 9923d8c6b..774fcfc22 100644 --- a/reflex/components/el/elements/scripts.pyi +++ b/reflex/components/el/elements/scripts.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML @@ -17,71 +17,51 @@ class Canvas(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Canvas": """Create the component. @@ -123,71 +103,51 @@ class Noscript(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Noscript": """Create the component. @@ -229,84 +189,64 @@ class Script(BaseHTML): def create( # type: ignore cls, *children, - async_: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - char_set: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + async_: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + char_set: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, cross_origin: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - defer: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - integrity: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - language: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + defer: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + integrity: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + language: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, referrer_policy: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - src: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + src: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Script": """Create the component. diff --git a/reflex/components/el/elements/sectioning.py b/reflex/components/el/elements/sectioning.py index e1544bd15..6aea8c1e3 100644 --- a/reflex/components/el/elements/sectioning.py +++ b/reflex/components/el/elements/sectioning.py @@ -1,7 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from reflex.vars import Var as Var - from .base import BaseHTML diff --git a/reflex/components/el/elements/sectioning.pyi b/reflex/components/el/elements/sectioning.pyi index 2d1cc457d..963d2d651 100644 --- a/reflex/components/el/elements/sectioning.pyi +++ b/reflex/components/el/elements/sectioning.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML @@ -17,71 +17,51 @@ class Body(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Body": """Create the component. @@ -123,71 +103,51 @@ class Address(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Address": """Create the component. @@ -229,71 +189,51 @@ class Article(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Article": """Create the component. @@ -335,71 +275,51 @@ class Aside(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Aside": """Create the component. @@ -441,71 +361,51 @@ class Footer(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Footer": """Create the component. @@ -547,71 +447,51 @@ class Header(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Header": """Create the component. @@ -653,71 +533,51 @@ class H1(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "H1": """Create the component. @@ -759,71 +619,51 @@ class H2(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "H2": """Create the component. @@ -865,71 +705,51 @@ class H3(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "H3": """Create the component. @@ -971,71 +791,51 @@ class H4(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "H4": """Create the component. @@ -1077,71 +877,51 @@ class H5(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "H5": """Create the component. @@ -1183,71 +963,51 @@ class H6(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "H6": """Create the component. @@ -1289,71 +1049,51 @@ class Main(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Main": """Create the component. @@ -1395,71 +1135,51 @@ class Nav(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Nav": """Create the component. @@ -1501,71 +1221,51 @@ class Section(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Section": """Create the component. diff --git a/reflex/components/el/elements/tables.py b/reflex/components/el/elements/tables.py index 007879358..8f6cfcba4 100644 --- a/reflex/components/el/elements/tables.py +++ b/reflex/components/el/elements/tables.py @@ -2,7 +2,7 @@ from typing import Union -from reflex.vars import Var as Var +from reflex.vars.base import Var from .base import BaseHTML diff --git a/reflex/components/el/elements/tables.pyi b/reflex/components/el/elements/tables.pyi index 39ca144b8..4d874f460 100644 --- a/reflex/components/el/elements/tables.pyi +++ b/reflex/components/el/elements/tables.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML @@ -17,72 +17,52 @@ class Caption(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Caption": """Create the component. @@ -125,73 +105,53 @@ class Col(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Col": """Create the component. @@ -235,73 +195,53 @@ class Colgroup(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Colgroup": """Create the component. @@ -345,73 +285,53 @@ class Table(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - summary: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + summary: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Table": """Create the component. @@ -455,72 +375,52 @@ class Tbody(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Tbody": """Create the component. @@ -563,75 +463,55 @@ class Td(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - col_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - headers: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - row_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + row_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Td": """Create the component. @@ -677,72 +557,52 @@ class Tfoot(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Tfoot": """Create the component. @@ -785,76 +645,56 @@ class Th(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - col_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - headers: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - row_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - scope: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + row_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + scope: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Th": """Create the component. @@ -901,72 +741,52 @@ class Thead(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Thead": """Create the component. @@ -1009,72 +829,52 @@ class Tr(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Tr": """Create the component. diff --git a/reflex/components/el/elements/typography.py b/reflex/components/el/elements/typography.py index dccad7a6d..7c55ecce7 100644 --- a/reflex/components/el/elements/typography.py +++ b/reflex/components/el/elements/typography.py @@ -2,7 +2,7 @@ from typing import Union -from reflex.vars import Var as Var +from reflex.vars.base import Var from .base import BaseHTML diff --git a/reflex/components/el/elements/typography.pyi b/reflex/components/el/elements/typography.pyi index 926376441..548371ce6 100644 --- a/reflex/components/el/elements/typography.pyi +++ b/reflex/components/el/elements/typography.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import BaseHTML @@ -17,72 +17,52 @@ class Blockquote(BaseHTML): def create( # type: ignore cls, *children, - cite: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cite: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Blockquote": """Create the component. @@ -125,71 +105,51 @@ class Dd(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Dd": """Create the component. @@ -231,71 +191,51 @@ class Div(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Div": """Create the component. @@ -337,71 +277,51 @@ class Dl(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Dl": """Create the component. @@ -443,71 +363,51 @@ class Dt(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Dt": """Create the component. @@ -549,71 +449,51 @@ class Figcaption(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Figcaption": """Create the component. @@ -655,72 +535,52 @@ class Hr(BaseHTML): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Hr": """Create the component. @@ -763,71 +623,51 @@ class Li(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Li": """Create the component. @@ -869,72 +709,52 @@ class Menu(BaseHTML): def create( # type: ignore cls, *children, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Menu": """Create the component. @@ -977,74 +797,54 @@ class Ol(BaseHTML): def create( # type: ignore cls, *children, - reversed: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - start: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + reversed: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + start: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Ol": """Create the component. @@ -1089,71 +889,51 @@ class P(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "P": """Create the component. @@ -1195,71 +975,51 @@ class Pre(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Pre": """Create the component. @@ -1301,71 +1061,51 @@ class Ul(BaseHTML): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Ul": """Create the component. @@ -1407,73 +1147,53 @@ class Ins(BaseHTML): def create( # type: ignore cls, *children, - cite: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - date_time: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cite: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + date_time: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Ins": """Create the component. @@ -1517,73 +1237,53 @@ class Del(BaseHTML): def create( # type: ignore cls, *children, - cite: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - date_time: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cite: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + date_time: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Del": """Create the component. diff --git a/reflex/components/gridjs/datatable.py b/reflex/components/gridjs/datatable.py index 47069843b..bd568d84a 100644 --- a/reflex/components/gridjs/datatable.py +++ b/reflex/components/gridjs/datatable.py @@ -6,19 +6,18 @@ from typing import Any, Dict, List, Union from reflex.components.component import Component from reflex.components.tags import Tag -from reflex.ivars.base import ImmutableComputedVar from reflex.utils import types from reflex.utils.imports import ImportDict from reflex.utils.serializers import serialize -from reflex.vars import ComputedVar, Var +from reflex.vars.base import LiteralVar, Var, is_computed_var class Gridjs(Component): """A component that wraps a nivo bar component.""" - library = "gridjs-react@6.0.1" + library = "gridjs-react@6.1.1" - lib_dependencies: List[str] = ["gridjs@6.0.6"] + lib_dependencies: List[str] = ["gridjs@6.2.0"] class DataTable(Gridjs): @@ -66,17 +65,14 @@ class DataTable(Gridjs): # The annotation should be provided if data is a computed var. We need this to know how to # render pandas dataframes. - if ( - isinstance(data, (ComputedVar, ImmutableComputedVar)) - and data._var_type == Any - ): + if is_computed_var(data) and data._var_type == Any: raise ValueError( "Annotation of the computed var assigned to the data field should be provided." ) if ( columns is not None - and isinstance(columns, (ComputedVar, ImmutableComputedVar)) + and is_computed_var(columns) and columns._var_type == Any ): raise ValueError( @@ -101,8 +97,6 @@ class DataTable(Gridjs): "column field should be specified when the data field is a list type" ) - print("props", props) - # Create the component. return super().create( *children, @@ -120,19 +114,20 @@ class DataTable(Gridjs): def _render(self) -> Tag: if isinstance(self.data, Var) and types.is_dataframe(self.data._var_type): self.columns = self.data._replace( - _var_name=f"{self.data._var_name}.columns", + _js_expr=f"{self.data._js_expr}.columns", _var_type=List[Any], ) self.data = self.data._replace( - _var_name=f"{self.data._var_name}.data", + _js_expr=f"{self.data._js_expr}.data", _var_type=List[List[Any]], ) if types.is_dataframe(type(self.data)): # If given a pandas df break up the data and columns data = serialize(self.data) - assert isinstance(data, dict), "Serialized dataframe should be a dict." - self.columns = Var.create_safe(data["columns"]) - self.data = Var.create_safe(data["data"]) + if not isinstance(data, dict): + raise ValueError("Serialized dataframe should be a dict.") + self.columns = LiteralVar.create(data["columns"]) + self.data = LiteralVar.create(data["data"]) # Render the table. return super()._render() diff --git a/reflex/components/gridjs/datatable.pyi b/reflex/components/gridjs/datatable.pyi index 8f0a427b1..ec4a5405a 100644 --- a/reflex/components/gridjs/datatable.pyi +++ b/reflex/components/gridjs/datatable.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Optional, Union, overload +from typing import Any, Dict, List, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var class Gridjs(Component): @overload @@ -23,41 +23,21 @@ class Gridjs(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Gridjs": """Create the component. @@ -84,52 +64,32 @@ class DataTable(Gridjs): cls, *children, data: Optional[Any] = None, - columns: Optional[Union[Var[List], List]] = None, + columns: Optional[Union[List, Var[List]]] = None, search: Optional[Union[Var[bool], bool]] = None, sort: Optional[Union[Var[bool], bool]] = None, resizable: Optional[Union[Var[bool], bool]] = None, - pagination: Optional[Union[Var[Union[Dict, bool]], bool, Dict]] = None, + pagination: Optional[Union[Dict, Var[Union[Dict, bool]], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DataTable": """Create a datatable component. diff --git a/reflex/components/lucide/icon.py b/reflex/components/lucide/icon.py index f593621d2..1ee68aaa3 100644 --- a/reflex/components/lucide/icon.py +++ b/reflex/components/lucide/icon.py @@ -2,7 +2,7 @@ from reflex.components.component import Component from reflex.utils import format -from reflex.vars import Var +from reflex.vars.base import Var class LucideIconComponent(Component): diff --git a/reflex/components/lucide/icon.pyi b/reflex/components/lucide/icon.pyi index 325322b45..661d91dbe 100644 --- a/reflex/components/lucide/icon.pyi +++ b/reflex/components/lucide/icon.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class LucideIconComponent(Component): @overload @@ -22,41 +22,21 @@ class LucideIconComponent(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "LucideIconComponent": """Create the component. @@ -89,41 +69,21 @@ class Icon(LucideIconComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Icon": """Initialize the Icon component. diff --git a/reflex/components/markdown/markdown.py b/reflex/components/markdown/markdown.py index cd560d00b..b790bf7a1 100644 --- a/reflex/components/markdown/markdown.py +++ b/reflex/components/markdown/markdown.py @@ -17,25 +17,27 @@ from reflex.components.radix.themes.typography.heading import Heading from reflex.components.radix.themes.typography.link import Link from reflex.components.radix.themes.typography.text import Text from reflex.components.tags.tag import Tag -from reflex.ivars.base import ImmutableVar, LiteralVar from reflex.utils import types from reflex.utils.imports import ImportDict, ImportVar -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var +from reflex.vars.function import ARRAY_ISARRAY +from reflex.vars.number import ternary_operation # Special vars used in the component map. -_CHILDREN = ImmutableVar.create_safe("children") -_PROPS = ImmutableVar.create_safe("...props") -_MOCK_ARG = ImmutableVar.create_safe("") +_CHILDREN = Var(_js_expr="children", _var_type=str) +_PROPS = Var(_js_expr="...props") +_PROPS_IN_TAG = Var(_js_expr="{...props}") +_MOCK_ARG = Var(_js_expr="", _var_type=str) # Special remark plugins. -_REMARK_MATH = ImmutableVar.create_safe("remarkMath") -_REMARK_GFM = ImmutableVar.create_safe("remarkGfm") -_REMARK_UNWRAP_IMAGES = ImmutableVar.create_safe("remarkUnwrapImages") +_REMARK_MATH = Var(_js_expr="remarkMath") +_REMARK_GFM = Var(_js_expr="remarkGfm") +_REMARK_UNWRAP_IMAGES = Var(_js_expr="remarkUnwrapImages") _REMARK_PLUGINS = LiteralVar.create([_REMARK_MATH, _REMARK_GFM, _REMARK_UNWRAP_IMAGES]) # Special rehype plugins. -_REHYPE_KATEX = ImmutableVar.create_safe("rehypeKatex") -_REHYPE_RAW = ImmutableVar.create_safe("rehypeRaw") +_REHYPE_KATEX = Var(_js_expr="rehypeKatex") +_REHYPE_RAW = Var(_js_expr="rehypeRaw") _REHYPE_PLUGINS = LiteralVar.create([_REHYPE_KATEX, _REHYPE_RAW]) # These tags do NOT get props passed to them @@ -95,12 +97,16 @@ class Markdown(Component): *children: The children of the component. **props: The properties of the component. + Raises: + ValueError: If the children are not valid. + Returns: The markdown component. """ - assert ( - len(children) == 1 and types._isinstance(children[0], Union[str, Var]) - ), "Markdown component must have exactly one child containing the markdown source." + if len(children) != 1 or not types._isinstance(children[0], Union[str, Var]): + raise ValueError( + "Markdown component must have exactly one child containing the markdown source." + ) # Update the base component map with the custom component map. component_map = {**get_base_component_map(), **props.pop("component_map", {})} @@ -147,34 +153,34 @@ class Markdown(Component): Returns: The imports for the markdown component. """ - from reflex.components.datadisplay.code import CodeBlock + from reflex.components.datadisplay.code import CodeBlock, Theme from reflex.components.radix.themes.typography.code import Code return [ { "": "katex/dist/katex.min.css", "remark-math@5.1.1": ImportVar( - tag=_REMARK_MATH._var_name, is_default=True + tag=_REMARK_MATH._js_expr, is_default=True ), "remark-gfm@3.0.1": ImportVar( - tag=_REMARK_GFM._var_name, is_default=True + tag=_REMARK_GFM._js_expr, is_default=True ), "remark-unwrap-images@4.0.0": ImportVar( - tag=_REMARK_UNWRAP_IMAGES._var_name, is_default=True + tag=_REMARK_UNWRAP_IMAGES._js_expr, is_default=True ), "rehype-katex@6.0.3": ImportVar( - tag=_REHYPE_KATEX._var_name, is_default=True + tag=_REHYPE_KATEX._js_expr, is_default=True ), "rehype-raw@6.1.1": ImportVar( - tag=_REHYPE_RAW._var_name, is_default=True + tag=_REHYPE_RAW._js_expr, is_default=True ), }, *[ component(_MOCK_ARG)._get_all_imports() # type: ignore for component in self.component_map.values() ], - CodeBlock.create(theme="light")._get_imports(), # type: ignore, - Code.create()._get_imports(), # type: ignore, + CodeBlock.create(theme=Theme.light)._get_imports(), + Code.create()._get_imports(), ] def get_component(self, tag: str, **props) -> Component: @@ -194,21 +200,26 @@ class Markdown(Component): if tag not in self.component_map: raise ValueError(f"No markdown component found for tag: {tag}.") - special_props = {_PROPS} - children = [_CHILDREN] + special_props = [_PROPS_IN_TAG] + children = [ + _CHILDREN + if tag != "codeblock" + # For codeblock, the mapping for some cases returns an array of elements. Let's join them into a string. + else ternary_operation( + ARRAY_ISARRAY.call(_CHILDREN), # type: ignore + _CHILDREN.to(list).join("\n"), + _CHILDREN, + ).to(str) + ] # For certain tags, the props from the markdown renderer are not actually valid for the component. if tag in NO_PROPS_TAGS: - special_props = set() + special_props = [] # If the children are set as a prop, don't pass them as children. children_prop = props.pop("children", None) if children_prop is not None: - special_props.add( - Var.create_safe( - f"children={{{str(children_prop)}}}", _var_is_string=False - ) - ) + special_props.append(Var(_js_expr=f"children={{{str(children_prop)}}}")) children = [] # Get the component. component = self.component_map[tag](*children, **props).set( @@ -228,21 +239,22 @@ class Markdown(Component): """ return str(self.get_component(tag, **props)).replace("\n", "") - def format_component_map(self) -> dict[str, str]: + def format_component_map(self) -> dict[str, Var]: """Format the component map for rendering. Returns: The formatted component map. """ components = { - tag: f"{{({{node, {_CHILDREN._var_name}, {_PROPS._var_name}}}) => ({self.format_component(tag)})}}" + tag: Var( + _js_expr=f"(({{node, {_CHILDREN._js_expr}, {_PROPS._js_expr}}}) => ({self.format_component(tag)}))" + ) for tag in self.component_map } # Separate out inline code and code blocks. - components[ - "code" - ] = f"""{{({{node, inline, className, {_CHILDREN._var_name}, {_PROPS._var_name}}}) => {{ + components["code"] = Var( + _js_expr=f"""(({{node, inline, className, {_CHILDREN._js_expr}, {_PROPS._js_expr}}}) => {{ const match = (className || '').match(/language-(?.*)/); const language = match ? match[1] : ''; if (language) {{ @@ -258,9 +270,10 @@ class Markdown(Component): return inline ? ( {self.format_component("code")} ) : ( - {self.format_component("codeblock", language=ImmutableVar.create_safe("language"))} + {self.format_component("codeblock", language=Var(_js_expr="language", _var_type=str))} ); - }}}}""".replace("\n", " ") + }})""".replace("\n", " ") + ) return components @@ -285,7 +298,7 @@ class Markdown(Component): function {self._get_component_map_name()} () {{ {formatted_hooks} return ( - {str(ImmutableVar.create_safe(self.format_component_map()))} + {str(LiteralVar.create(self.format_component_map()))} ) }} """ @@ -297,9 +310,7 @@ class Markdown(Component): .add_props( remark_plugins=_REMARK_PLUGINS, rehype_plugins=_REHYPE_PLUGINS, - components=ImmutableVar.create_safe( - f"{self._get_component_map_name()}()" - ), + components=Var(_js_expr=f"{self._get_component_map_name()}()"), ) .remove_props("componentMap", "componentMapHash") ) diff --git a/reflex/components/markdown/markdown.pyi b/reflex/components/markdown/markdown.pyi index 299cb99ff..1cad04013 100644 --- a/reflex/components/markdown/markdown.pyi +++ b/reflex/components/markdown/markdown.pyi @@ -7,21 +7,21 @@ from functools import lru_cache from typing import Any, Callable, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.ivars.base import ImmutableVar, LiteralVar +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var -_CHILDREN = ImmutableVar.create_safe("children") -_PROPS = ImmutableVar.create_safe("...props") -_MOCK_ARG = ImmutableVar.create_safe("") -_REMARK_MATH = ImmutableVar.create_safe("remarkMath") -_REMARK_GFM = ImmutableVar.create_safe("remarkGfm") -_REMARK_UNWRAP_IMAGES = ImmutableVar.create_safe("remarkUnwrapImages") +_CHILDREN = Var(_js_expr="children", _var_type=str) +_PROPS = Var(_js_expr="...props") +_PROPS_IN_TAG = Var(_js_expr="{...props}") +_MOCK_ARG = Var(_js_expr="", _var_type=str) +_REMARK_MATH = Var(_js_expr="remarkMath") +_REMARK_GFM = Var(_js_expr="remarkGfm") +_REMARK_UNWRAP_IMAGES = Var(_js_expr="remarkUnwrapImages") _REMARK_PLUGINS = LiteralVar.create([_REMARK_MATH, _REMARK_GFM, _REMARK_UNWRAP_IMAGES]) -_REHYPE_KATEX = ImmutableVar.create_safe("rehypeKatex") -_REHYPE_RAW = ImmutableVar.create_safe("rehypeRaw") +_REHYPE_KATEX = Var(_js_expr="rehypeKatex") +_REHYPE_RAW = Var(_js_expr="rehypeRaw") _REHYPE_PLUGINS = LiteralVar.create([_REHYPE_KATEX, _REHYPE_RAW]) NO_PROPS_TAGS = ("ul", "ol", "li") @@ -42,41 +42,21 @@ class Markdown(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Markdown": """Create a markdown component. @@ -93,6 +73,9 @@ class Markdown(Component): custom_attrs: custom attribute **props: The properties of the component. + Raises: + ValueError: If the children are not valid. + Returns: The markdown component. """ @@ -101,4 +84,4 @@ class Markdown(Component): def add_imports(self) -> ImportDict | list[ImportDict]: ... def get_component(self, tag: str, **props) -> Component: ... def format_component(self, tag: str, **props) -> str: ... - def format_component_map(self) -> dict[str, str]: ... + def format_component_map(self) -> dict[str, Var]: ... diff --git a/reflex/components/moment/moment.py b/reflex/components/moment/moment.py index 958ba6c57..51b09d55d 100644 --- a/reflex/components/moment/moment.py +++ b/reflex/components/moment/moment.py @@ -1,26 +1,27 @@ """Moment component for humanized date rendering.""" +import dataclasses from typing import List, Optional -from reflex.base import Base from reflex.components.component import Component, NoSSRComponent -from reflex.event import EventHandler +from reflex.event import EventHandler, identity_event from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var -class MomentDelta(Base): +@dataclasses.dataclass(frozen=True) +class MomentDelta: """A delta used for add/subtract prop in Moment.""" - years: Optional[int] - quarters: Optional[int] - months: Optional[int] - weeks: Optional[int] - days: Optional[int] - hours: Optional[int] - minutess: Optional[int] - seconds: Optional[int] - milliseconds: Optional[int] + years: Optional[int] = dataclasses.field(default=None) + quarters: Optional[int] = dataclasses.field(default=None) + months: Optional[int] = dataclasses.field(default=None) + weeks: Optional[int] = dataclasses.field(default=None) + days: Optional[int] = dataclasses.field(default=None) + hours: Optional[int] = dataclasses.field(default=None) + minutess: Optional[int] = dataclasses.field(default=None) + seconds: Optional[int] = dataclasses.field(default=None) + milliseconds: Optional[int] = dataclasses.field(default=None) class Moment(NoSSRComponent): @@ -92,7 +93,7 @@ class Moment(NoSSRComponent): tz: Var[str] # Fires when the date changes. - on_change: EventHandler[lambda date: [date]] + on_change: EventHandler[identity_event(str)] def add_imports(self) -> ImportDict: """Add the imports for the Moment component. diff --git a/reflex/components/moment/moment.pyi b/reflex/components/moment/moment.pyi index 05c7ffc96..ccffbb8d1 100644 --- a/reflex/components/moment/moment.pyi +++ b/reflex/components/moment/moment.pyi @@ -3,16 +3,17 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +import dataclasses +from typing import Any, Dict, Optional, Union, overload -from reflex.base import Base from reflex.components.component import NoSSRComponent -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var -class MomentDelta(Base): +@dataclasses.dataclass(frozen=True) +class MomentDelta: years: Optional[int] quarters: Optional[int] months: Optional[int] @@ -34,8 +35,8 @@ class Moment(NoSSRComponent): format: Optional[Union[Var[str], str]] = None, trim: Optional[Union[Var[bool], bool]] = None, parse: Optional[Union[Var[str], str]] = None, - add: Optional[Union[Var[MomentDelta], MomentDelta]] = None, - subtract: Optional[Union[Var[MomentDelta], MomentDelta]] = None, + add: Optional[Union[MomentDelta, Var[MomentDelta]]] = None, + subtract: Optional[Union[MomentDelta, Var[MomentDelta]]] = None, from_now: Optional[Union[Var[bool], bool]] = None, from_now_during: Optional[Union[Var[int], int]] = None, to_now: Optional[Union[Var[bool], bool]] = None, @@ -56,42 +57,22 @@ class Moment(NoSSRComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Moment": """Create a Moment component. diff --git a/reflex/components/next/base.pyi b/reflex/components/next/base.pyi index c8b9934d8..1d49c5e66 100644 --- a/reflex/components/next/base.pyi +++ b/reflex/components/next/base.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class NextComponent(Component): ... @@ -24,41 +24,21 @@ class NextComponent(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "NextComponent": """Create the component. diff --git a/reflex/components/next/image.py b/reflex/components/next/image.py index 817bf590a..fe74b0935 100644 --- a/reflex/components/next/image.py +++ b/reflex/components/next/image.py @@ -2,9 +2,9 @@ from typing import Any, Literal, Optional, Union -from reflex.event import EventHandler +from reflex.event import EventHandler, empty_event from reflex.utils import types -from reflex.vars import Var +from reflex.vars.base import Var from .base import NextComponent @@ -56,10 +56,10 @@ class Image(NextComponent): blurDataURL: Var[str] # Fires when the image has loaded. - on_load: EventHandler[lambda: []] + on_load: EventHandler[empty_event] # Fires when the image has an error. - on_error: EventHandler[lambda: []] + on_error: EventHandler[empty_event] @classmethod def create( diff --git a/reflex/components/next/image.pyi b/reflex/components/next/image.pyi index e6b902cb0..5d72584a9 100644 --- a/reflex/components/next/image.pyi +++ b/reflex/components/next/image.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import NextComponent @@ -19,16 +19,16 @@ class Image(NextComponent): *children, width: Optional[Union[int, str]] = None, height: Optional[Union[int, str]] = None, - src: Optional[Union[Var[Any], Any]] = None, + src: Optional[Union[Any, Var[Any]]] = None, alt: Optional[Union[Var[str], str]] = None, - loader: Optional[Union[Var[Any], Any]] = None, + loader: Optional[Union[Any, Var[Any]]] = None, fill: Optional[Union[Var[bool], bool]] = None, sizes: Optional[Union[Var[str], str]] = None, quality: Optional[Union[Var[int], int]] = None, priority: Optional[Union[Var[bool], bool]] = None, placeholder: Optional[Union[Var[str], str]] = None, loading: Optional[ - Union[Var[Literal["lazy", "eager"]], Literal["lazy", "eager"]] + Union[Literal["eager", "lazy"], Var[Literal["eager", "lazy"]]] ] = None, blurDataURL: Optional[Union[Var[str], str]] = None, style: Optional[Style] = None, @@ -37,43 +37,23 @@ class Image(NextComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_load: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_error: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_load: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Image": """Create an Image component from next/image. diff --git a/reflex/components/next/link.py b/reflex/components/next/link.py index be32cd8e5..0f7c81296 100644 --- a/reflex/components/next/link.py +++ b/reflex/components/next/link.py @@ -1,7 +1,7 @@ """A link component.""" from reflex.components.component import Component -from reflex.vars import Var +from reflex.vars.base import Var class NextLink(Component): diff --git a/reflex/components/next/link.pyi b/reflex/components/next/link.pyi index c25ca8258..fa9ae530f 100644 --- a/reflex/components/next/link.pyi +++ b/reflex/components/next/link.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class NextLink(Component): @overload @@ -24,41 +24,21 @@ class NextLink(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "NextLink": """Create the component. diff --git a/reflex/components/next/video.py b/reflex/components/next/video.py index ae6007671..435f4401f 100644 --- a/reflex/components/next/video.py +++ b/reflex/components/next/video.py @@ -3,7 +3,7 @@ from typing import Optional from reflex.components.component import Component -from reflex.vars import Var +from reflex.vars.base import Var from .base import NextComponent diff --git a/reflex/components/next/video.pyi b/reflex/components/next/video.pyi index 13b39a4f8..f8c93b6f1 100644 --- a/reflex/components/next/video.pyi +++ b/reflex/components/next/video.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import NextComponent @@ -26,41 +26,21 @@ class Video(NextComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Video": """Create a Video component. diff --git a/reflex/components/plotly/plotly.py b/reflex/components/plotly/plotly.py index a2393fdca..c93488d40 100644 --- a/reflex/components/plotly/plotly.py +++ b/reflex/components/plotly/plotly.py @@ -9,7 +9,7 @@ from reflex.components.component import Component, NoSSRComponent from reflex.components.core.cond import color_mode_cond from reflex.event import EventHandler from reflex.utils import console -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var try: from plotly.graph_objects import Figure, layout @@ -30,7 +30,7 @@ def _event_data_signature(e0: Var) -> List[Any]: Returns: The event key extracted from the event data (if defined). """ - return [Var.create_safe(f"{e0}?.event", _var_is_string=False)] + return [Var(_js_expr=f"{e0}?.event")] def _event_points_data_signature(e0: Var) -> List[Any]: @@ -43,11 +43,8 @@ def _event_points_data_signature(e0: Var) -> List[Any]: The event data and the extracted points. """ return [ - Var.create_safe(f"{e0}?.event", _var_is_string=False), - Var.create_safe( - f"extractPoints({e0}?.points)", - _var_is_string=False, - ), + Var(_js_expr=f"{e0}?.event"), + Var(_js_expr=f"extractPoints({e0}?.points)"), ] @@ -97,26 +94,26 @@ class Plotly(NoSSRComponent): library = "react-plotly.js@2.6.0" - lib_dependencies: List[str] = ["plotly.js@2.22.0"] + lib_dependencies: List[str] = ["plotly.js@2.35.2"] tag = "Plot" is_default = True # The figure to display. This can be a plotly figure or a plotly data json. - data: Var[Figure] + data: Var[Figure] # type: ignore # The layout of the graph. layout: Var[Dict] # The template for visual appearance of the graph. - template: Var[Template] + template: Var[Template] # type: ignore # The config of the graph. config: Var[Dict] # If true, the graph will resize when the window is resized. - use_resize_handler: Var[bool] = Var.create_safe(True) + use_resize_handler: Var[bool] = LiteralVar.create(True) # Fired after the plot is redrawn. on_after_plot: EventHandler[_passthrough_signature] @@ -242,8 +239,8 @@ const extractPoints = (points) => { from plotly.io import templates responsive_template = color_mode_cond( - light=Var.create_safe(templates["plotly"]).to(dict), - dark=Var.create_safe(templates["plotly_dark"]).to(dict), + light=LiteralVar.create(templates["plotly"]), + dark=LiteralVar.create(templates["plotly_dark"]), ) if isinstance(responsive_template, Var): # Mark the conditional Var as a Template to avoid type mismatch @@ -263,30 +260,20 @@ const extractPoints = (points) => { # Why is this not a literal dict? Great question... it didn't work # reliably because of how _var_name_unwrapped strips the outer curly # brackets if any of the contained Vars depend on state. - layout_dict = Var.create_safe( - f"{{'layout': {self.layout.to(dict)._var_name_unwrapped}}}" - ).to(dict) + layout_dict = LiteralVar.create({"layout": self.layout}) merge_dicts.append(layout_dict) if self.template is not None: - template_dict = Var.create_safe( - {"layout": {"template": self.template.to(dict)}} - ) - template_dict._var_data = None # To avoid stripping outer curly brackets - merge_dicts.append(template_dict) + template_dict = LiteralVar.create({"layout": {"template": self.template}}) + merge_dicts.append(template_dict.without_data()) if merge_dicts: - tag.special_props.add( + tag.special_props.append( # Merge all dictionaries and spread the result over props. - Var.create_safe( - f"{{...mergician({figure._var_name_unwrapped}," - f"{','.join(md._var_name_unwrapped for md in merge_dicts)})}}", - _var_is_string=False, + Var( + _js_expr=f"{{...mergician({str(figure)}," + f"{','.join(str(md) for md in merge_dicts)})}}", ), ) else: # Spread the figure dict over props, nothing to merge. - tag.special_props.add( - Var.create_safe( - f"{{...{figure._var_name_unwrapped}}}", _var_is_string=False - ) - ) + tag.special_props.append(Var(_js_expr=f"{{...{str(figure)}}}")) return tag diff --git a/reflex/components/plotly/plotly.pyi b/reflex/components/plotly/plotly.pyi index c308e160f..29464415d 100644 --- a/reflex/components/plotly/plotly.pyi +++ b/reflex/components/plotly/plotly.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.base import Base from reflex.components.component import NoSSRComponent -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils import console -from reflex.vars import Var +from reflex.vars.base import Var try: from plotly.graph_objects import Figure, layout @@ -34,10 +34,10 @@ class Plotly(NoSSRComponent): def create( # type: ignore cls, *children, - data: Optional[Union[Var[Figure], Figure]] = None, # type: ignore - layout: Optional[Union[Var[Dict], Dict]] = None, - template: Optional[Union[Var[Template], Template]] = None, # type: ignore - config: Optional[Union[Var[Dict], Dict]] = None, + data: Optional[Union[Figure, Var[Figure]]] = None, # type: ignore + layout: Optional[Union[Dict, Var[Dict]]] = None, + template: Optional[Union[Template, Var[Template]]] = None, # type: ignore + config: Optional[Union[Dict, Var[Dict]]] = None, use_resize_handler: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -45,91 +45,39 @@ class Plotly(NoSSRComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_after_plot: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_animated: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_animating_frame: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_animation_interrupted: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_autosize: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_before_hover: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_button_clicked: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_deselect: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_hover: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_redraw: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_relayout: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_relayouting: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_restyle: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_selected: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_selecting: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_transition_interrupted: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_transitioning: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_unhover: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_after_plot: Optional[EventType] = None, + on_animated: Optional[EventType] = None, + on_animating_frame: Optional[EventType] = None, + on_animation_interrupted: Optional[EventType] = None, + on_autosize: Optional[EventType] = None, + on_before_hover: Optional[EventType] = None, + on_blur: Optional[EventType[[]]] = None, + on_button_clicked: Optional[EventType] = None, + on_click: Optional[EventType] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_deselect: Optional[EventType] = None, + on_double_click: Optional[EventType] = None, + on_focus: Optional[EventType[[]]] = None, + on_hover: Optional[EventType] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_redraw: Optional[EventType] = None, + on_relayout: Optional[EventType] = None, + on_relayouting: Optional[EventType] = None, + on_restyle: Optional[EventType] = None, + on_scroll: Optional[EventType[[]]] = None, + on_selected: Optional[EventType] = None, + on_selecting: Optional[EventType] = None, + on_transition_interrupted: Optional[EventType] = None, + on_transitioning: Optional[EventType] = None, + on_unhover: Optional[EventType] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Plotly": """Create the Plotly component. diff --git a/reflex/components/props.py b/reflex/components/props.py index a66ba7f2f..92dbe8144 100644 --- a/reflex/components/props.py +++ b/reflex/components/props.py @@ -4,7 +4,7 @@ from __future__ import annotations from reflex.base import Base from reflex.utils import format -from reflex.utils.serializers import serialize +from reflex.vars.object import LiteralObjectVar class PropsBase(Base): @@ -20,12 +20,23 @@ class PropsBase(Base): Returns: The object as a Javascript Object literal. """ - return format.unwrap_vars( - self.__config__.json_dumps( - { - format.to_camel_case(key): value - for key, value in self.dict().items() - }, - default=serialize, - ) - ) + return LiteralObjectVar.create( + {format.to_camel_case(key): value for key, value in self.dict().items()} + ).json() + + def dict(self, *args, **kwargs): + """Convert the object to a dictionary. + + Keys will be converted to camelCase. + + Args: + *args: Arguments to pass to the parent class. + **kwargs: Keyword arguments to pass to the parent class. + + Returns: + The object as a dictionary. + """ + return { + format.to_camel_case(key): value + for key, value in super().dict(*args, **kwargs).items() + } diff --git a/reflex/components/radix/__init__.pyi b/reflex/components/radix/__init__.pyi index 8ba6c242b..f4e81666a 100644 --- a/reflex/components/radix/__init__.pyi +++ b/reflex/components/radix/__init__.pyi @@ -55,6 +55,7 @@ from .themes.layout.container import container as container from .themes.layout.flex import flex as flex from .themes.layout.grid import grid as grid from .themes.layout.list import list_item as list_item +from .themes.layout.list import list_ns as list # noqa from .themes.layout.list import ordered_list as ordered_list from .themes.layout.list import unordered_list as unordered_list from .themes.layout.section import section as section diff --git a/reflex/components/radix/primitives/__init__.pyi b/reflex/components/radix/primitives/__init__.pyi index 0fec0fc40..e7461e9a7 100644 --- a/reflex/components/radix/primitives/__init__.pyi +++ b/reflex/components/radix/primitives/__init__.pyi @@ -6,3 +6,4 @@ from .accordion import accordion as accordion from .drawer import drawer as drawer from .form import form as form +from .progress import progress as progress diff --git a/reflex/components/radix/primitives/accordion.py b/reflex/components/radix/primitives/accordion.py index da32d747b..bbcecb1d8 100644 --- a/reflex/components/radix/primitives/accordion.py +++ b/reflex/components/radix/primitives/accordion.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Literal, Optional, Union +from typing import Any, List, Literal, Optional, Tuple, Union from reflex.components.component import Component, ComponentNamespace from reflex.components.core.colors import color @@ -11,9 +11,9 @@ from reflex.components.lucide.icon import Icon from reflex.components.radix.primitives.base import RadixPrimitiveComponent from reflex.components.radix.themes.base import LiteralAccentColor, LiteralRadius from reflex.event import EventHandler -from reflex.ivars.base import LiteralVar from reflex.style import Style -from reflex.vars import Var, get_uuid_string_var +from reflex.vars import get_uuid_string_var +from reflex.vars.base import LiteralVar, Var LiteralAccordionType = Literal["single", "multiple"] LiteralAccordionDir = Literal["ltr", "rtl"] @@ -71,6 +71,18 @@ class AccordionComponent(RadixPrimitiveComponent): return ["color_scheme", "variant"] +def on_value_change(value: Var[str | List[str]]) -> Tuple[Var[str | List[str]]]: + """Handle the on_value_change event. + + Args: + value: The value of the event. + + Returns: + The value of the event. + """ + return (value,) + + class AccordionRoot(AccordionComponent): """An accordion component.""" @@ -114,7 +126,7 @@ class AccordionRoot(AccordionComponent): _valid_children: List[str] = ["AccordionItem"] # Fired when the opened the accordions changes. - on_value_change: EventHandler[lambda e0: [e0]] + on_value_change: EventHandler[on_value_change] def _exclude_props(self) -> list[str]: return super()._exclude_props() + [ diff --git a/reflex/components/radix/primitives/accordion.pyi b/reflex/components/radix/primitives/accordion.pyi index edf011183..b975cfebe 100644 --- a/reflex/components/radix/primitives/accordion.pyi +++ b/reflex/components/radix/primitives/accordion.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload from reflex.components.component import Component, ComponentNamespace from reflex.components.lucide.icon import Icon from reflex.components.radix.primitives.base import RadixPrimitiveComponent -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var LiteralAccordionType = Literal["single", "multiple"] LiteralAccordionDir = Literal["ltr", "rtl"] @@ -28,70 +28,70 @@ class AccordionComponent(RadixPrimitiveComponent): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "soft", "surface", "outline", "ghost"]], - Literal["classic", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "surface"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -101,41 +101,21 @@ class AccordionComponent(RadixPrimitiveComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AccordionComponent": """Create the component. @@ -158,6 +138,8 @@ class AccordionComponent(RadixPrimitiveComponent): """ ... +def on_value_change(value: Var[str | List[str]]) -> Tuple[Var[str | List[str]]]: ... + class AccordionRoot(AccordionComponent): def add_style(self): ... @overload @@ -166,25 +148,25 @@ class AccordionRoot(AccordionComponent): cls, *children, type: Optional[ - Union[Var[Literal["single", "multiple"]], Literal["single", "multiple"]] + Union[Literal["multiple", "single"], Var[Literal["multiple", "single"]]] ] = None, - value: Optional[Union[Var[Union[List[str], str]], str, List[str]]] = None, + value: Optional[Union[List[str], Var[Union[List[str], str]], str]] = None, default_value: Optional[ - Union[Var[Union[List[str], str]], str, List[str]] + Union[List[str], Var[Union[List[str], str]], str] ] = None, collapsible: Optional[Union[Var[bool], bool]] = None, disabled: Optional[Union[Var[bool], bool]] = None, - dir: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None, + dir: Optional[Union[Literal["ltr", "rtl"], Var[Literal["ltr", "rtl"]]]] = None, orientation: Optional[ Union[ - Var[Literal["vertical", "horizontal"]], - Literal["vertical", "horizontal"], + Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, duration: Optional[Union[Var[int], int]] = None, @@ -192,70 +174,70 @@ class AccordionRoot(AccordionComponent): show_dividers: Optional[Union[Var[bool], bool]] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "soft", "surface", "outline", "ghost"]], - Literal["classic", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "surface"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -265,44 +247,22 @@ class AccordionRoot(AccordionComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_value_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + on_value_change: Optional[EventType[str | List[str]]] = None, **props, ) -> "AccordionRoot": """Create the component. @@ -348,70 +308,70 @@ class AccordionItem(AccordionComponent): disabled: Optional[Union[Var[bool], bool]] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "soft", "surface", "outline", "ghost"]], - Literal["classic", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "surface"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -421,41 +381,21 @@ class AccordionItem(AccordionComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AccordionItem": """Create an accordion item. @@ -492,70 +432,70 @@ class AccordionHeader(AccordionComponent): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "soft", "surface", "outline", "ghost"]], - Literal["classic", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "surface"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -565,41 +505,21 @@ class AccordionHeader(AccordionComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AccordionHeader": """Create the Accordion header component. @@ -632,70 +552,70 @@ class AccordionTrigger(AccordionComponent): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "soft", "surface", "outline", "ghost"]], - Literal["classic", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "surface"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -705,41 +625,21 @@ class AccordionTrigger(AccordionComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AccordionTrigger": """Create the Accordion trigger component. @@ -777,41 +677,21 @@ class AccordionIcon(Icon): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AccordionIcon": """Create the Accordion icon component. @@ -841,70 +721,70 @@ class AccordionContent(AccordionComponent): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "soft", "surface", "outline", "ghost"]], - Literal["classic", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "surface"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -914,41 +794,21 @@ class AccordionContent(AccordionComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AccordionContent": """Create the Accordion content component. diff --git a/reflex/components/radix/primitives/base.py b/reflex/components/radix/primitives/base.py index 857e80b5a..479cd2912 100644 --- a/reflex/components/radix/primitives/base.py +++ b/reflex/components/radix/primitives/base.py @@ -5,7 +5,7 @@ from typing import List from reflex.components.component import Component from reflex.components.tags.tag import Tag from reflex.utils import format -from reflex.vars import Var +from reflex.vars.base import Var class RadixPrimitiveComponent(Component): diff --git a/reflex/components/radix/primitives/base.pyi b/reflex/components/radix/primitives/base.pyi index a94b2263c..3eacd3f07 100644 --- a/reflex/components/radix/primitives/base.pyi +++ b/reflex/components/radix/primitives/base.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class RadixPrimitiveComponent(Component): @overload @@ -23,41 +23,21 @@ class RadixPrimitiveComponent(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadixPrimitiveComponent": """Create the component. @@ -91,41 +71,21 @@ class RadixPrimitiveComponentWithClassName(RadixPrimitiveComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadixPrimitiveComponentWithClassName": """Create the component. diff --git a/reflex/components/radix/primitives/drawer.py b/reflex/components/radix/primitives/drawer.py index 1c8a91837..6fe4d10dd 100644 --- a/reflex/components/radix/primitives/drawer.py +++ b/reflex/components/radix/primitives/drawer.py @@ -10,8 +10,9 @@ from reflex.components.component import Component, ComponentNamespace from reflex.components.radix.primitives.base import RadixPrimitiveComponent from reflex.components.radix.themes.base import Theme from reflex.components.radix.themes.layout.flex import Flex -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, empty_event, identity_event +from reflex.utils import console +from reflex.vars.base import Var class DrawerComponent(RadixPrimitiveComponent): @@ -60,7 +61,7 @@ class DrawerRoot(DrawerComponent): preventScrollRestoration: Var[bool] # Fires when the drawer is opened. - on_open_change: EventHandler[lambda e0: [e0]] + on_open_change: EventHandler[identity_event(bool)] class DrawerTrigger(DrawerComponent): @@ -127,20 +128,20 @@ class DrawerContent(DrawerComponent): base_style.update(style) return {"css": base_style} - # Fired when the drawer content is opened. - on_open_auto_focus: EventHandler[lambda e0: [e0.target.value]] + # Fired when the drawer content is opened. Deprecated. + on_open_auto_focus: EventHandler[empty_event] - # Fired when the drawer content is closed. - on_close_auto_focus: EventHandler[lambda e0: [e0.target.value]] + # Fired when the drawer content is closed. Deprecated. + on_close_auto_focus: EventHandler[empty_event] - # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0.target.value]] + # Fired when the escape key is pressed. Deprecated. + on_escape_key_down: EventHandler[empty_event] - # Fired when the pointer is down outside the drawer content. - on_pointer_down_outside: EventHandler[lambda e0: [e0.target.value]] + # Fired when the pointer is down outside the drawer content. Deprecated. + on_pointer_down_outside: EventHandler[empty_event] - # Fired when interacting outside the drawer content. - on_interact_outside: EventHandler[lambda e0: [e0.target.value]] + # Fired when interacting outside the drawer content. Deprecated. + on_interact_outside: EventHandler[empty_event] @classmethod def create(cls, *children, **props): @@ -157,6 +158,23 @@ class DrawerContent(DrawerComponent): Returns: The drawer content. """ + deprecated_properties = [ + "on_open_auto_focus", + "on_close_auto_focus", + "on_escape_key_down", + "on_pointer_down_outside", + "on_interact_outside", + ] + + for prop in deprecated_properties: + if prop in props: + console.deprecate( + feature_name="drawer content events", + reason=f"The `{prop}` event is deprecated and will be removed in 0.7.0.", + deprecation_version="0.6.3", + removal_version="0.7.0", + ) + comp = super().create(*children, **props) return Theme.create(comp) diff --git a/reflex/components/radix/primitives/drawer.pyi b/reflex/components/radix/primitives/drawer.pyi index c40bdf53d..c4493ee9b 100644 --- a/reflex/components/radix/primitives/drawer.pyi +++ b/reflex/components/radix/primitives/drawer.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.radix.primitives.base import RadixPrimitiveComponent -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class DrawerComponent(RadixPrimitiveComponent): @overload @@ -24,41 +24,21 @@ class DrawerComponent(RadixPrimitiveComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerComponent": """Create the component. @@ -96,8 +76,8 @@ class DrawerRoot(DrawerComponent): modal: Optional[Union[Var[bool], bool]] = None, direction: Optional[ Union[ - Var[Literal["top", "bottom", "left", "right"]], - Literal["top", "bottom", "left", "right"], + Literal["bottom", "left", "right", "top"], + Var[Literal["bottom", "left", "right", "top"]], ] ] = None, preventScrollRestoration: Optional[Union[Var[bool], bool]] = None, @@ -108,44 +88,22 @@ class DrawerRoot(DrawerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerRoot": """Create the component. @@ -188,41 +146,21 @@ class DrawerTrigger(DrawerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerTrigger": """Create a new DrawerTrigger instance. @@ -249,41 +187,21 @@ class DrawerPortal(DrawerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerPortal": """Create the component. @@ -317,56 +235,26 @@ class DrawerContent(DrawerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_interact_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_close_auto_focus: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_interact_outside: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_auto_focus: Optional[EventType[[]]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerContent": """Create a Drawer Content. @@ -404,41 +292,21 @@ class DrawerOverlay(DrawerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerOverlay": """Create the component. @@ -472,41 +340,21 @@ class DrawerClose(DrawerTrigger): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerClose": """Create a new DrawerTrigger instance. @@ -533,41 +381,21 @@ class DrawerTitle(DrawerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerTitle": """Create the component. @@ -601,41 +429,21 @@ class DrawerDescription(DrawerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerDescription": """Create the component. @@ -678,8 +486,8 @@ class Drawer(ComponentNamespace): modal: Optional[Union[Var[bool], bool]] = None, direction: Optional[ Union[ - Var[Literal["top", "bottom", "left", "right"]], - Literal["top", "bottom", "left", "right"], + Literal["bottom", "left", "right", "top"], + Var[Literal["bottom", "left", "right", "top"]], ] ] = None, preventScrollRestoration: Optional[Union[Var[bool], bool]] = None, @@ -690,44 +498,22 @@ class Drawer(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerRoot": """Create the component. diff --git a/reflex/components/radix/primitives/form.py b/reflex/components/radix/primitives/form.py index 3b871d0af..4d4be7e40 100644 --- a/reflex/components/radix/primitives/form.py +++ b/reflex/components/radix/primitives/form.py @@ -8,8 +8,8 @@ from reflex.components.component import ComponentNamespace from reflex.components.core.debounce import DebounceInput from reflex.components.el.elements.forms import Form as HTMLForm from reflex.components.radix.themes.components.text_field import TextFieldRoot -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, empty_event +from reflex.vars.base import Var from .base import RadixPrimitiveComponentWithClassName @@ -17,7 +17,7 @@ from .base import RadixPrimitiveComponentWithClassName class FormComponent(RadixPrimitiveComponentWithClassName): """Base class for all @radix-ui/react-form components.""" - library = "@radix-ui/react-form@^0.0.3" + library = "@radix-ui/react-form@^0.1.0" class FormRoot(FormComponent, HTMLForm): @@ -28,7 +28,7 @@ class FormRoot(FormComponent, HTMLForm): alias = "RadixFormRoot" # Fired when the errors are cleared. - on_clear_server_errors: EventHandler[lambda: []] + on_clear_server_errors: EventHandler[empty_event] def add_style(self) -> dict[str, Any] | None: """Add style to the component. diff --git a/reflex/components/radix/primitives/form.pyi b/reflex/components/radix/primitives/form.pyi index 758630c4a..2139f0c23 100644 --- a/reflex/components/radix/primitives/form.pyi +++ b/reflex/components/radix/primitives/form.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.el.elements.forms import Form as HTMLForm -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .base import RadixPrimitiveComponentWithClassName @@ -26,41 +26,21 @@ class FormComponent(RadixPrimitiveComponentWithClassName): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FormComponent": """Create the component. @@ -89,90 +69,68 @@ class FormRoot(FormComponent, HTMLForm): cls, *children, as_child: Optional[Union[Var[bool], bool]] = None, - accept: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + accept: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, accept_charset: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_complete: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - enc_type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - no_validate: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + enc_type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + no_validate: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, reset_on_submit: Optional[Union[Var[bool], bool]] = None, handle_submit_unique_name: Optional[Union[Var[str], str]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_clear_server_errors: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_submit: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_clear_server_errors: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_submit: Optional[EventType[Dict[str, Any]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FormRoot": """Create a form component. @@ -236,41 +194,21 @@ class FormField(FormComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FormField": """Create the component. @@ -307,41 +245,21 @@ class FormLabel(FormComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FormLabel": """Create the component. @@ -375,41 +293,21 @@ class FormControl(FormComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FormControl": """Create a Form Control component. @@ -457,6 +355,18 @@ class FormMessage(FormComponent): name: Optional[Union[Var[str], str]] = None, match: Optional[ Union[ + Literal[ + "badInput", + "patternMismatch", + "rangeOverflow", + "rangeUnderflow", + "stepMismatch", + "tooLong", + "tooShort", + "typeMismatch", + "valid", + "valueMissing", + ], Var[ Literal[ "badInput", @@ -471,18 +381,6 @@ class FormMessage(FormComponent): "valueMissing", ] ], - Literal[ - "badInput", - "patternMismatch", - "rangeOverflow", - "rangeUnderflow", - "stepMismatch", - "tooLong", - "tooShort", - "typeMismatch", - "valid", - "valueMissing", - ], ] ] = None, force_match: Optional[Union[Var[bool], bool]] = None, @@ -493,41 +391,21 @@ class FormMessage(FormComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FormMessage": """Create the component. @@ -564,41 +442,21 @@ class FormValidityState(FormComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FormValidityState": """Create the component. @@ -632,41 +490,21 @@ class FormSubmit(FormComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FormSubmit": """Create the component. @@ -696,90 +534,68 @@ class Form(FormRoot): cls, *children, as_child: Optional[Union[Var[bool], bool]] = None, - accept: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + accept: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, accept_charset: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_complete: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - enc_type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - no_validate: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + enc_type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + no_validate: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, reset_on_submit: Optional[Union[Var[bool], bool]] = None, handle_submit_unique_name: Optional[Union[Var[str], str]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_clear_server_errors: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_submit: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_clear_server_errors: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_submit: Optional[EventType[Dict[str, Any]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Form": """Create a form component. @@ -840,90 +656,68 @@ class FormNamespace(ComponentNamespace): def __call__( *children, as_child: Optional[Union[Var[bool], bool]] = None, - accept: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + accept: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, accept_charset: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_complete: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - enc_type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - no_validate: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + enc_type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + no_validate: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, reset_on_submit: Optional[Union[Var[bool], bool]] = None, handle_submit_unique_name: Optional[Union[Var[str], str]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_clear_server_errors: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_submit: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_clear_server_errors: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_submit: Optional[EventType[Dict[str, Any]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Form": """Create a form component. diff --git a/reflex/components/radix/primitives/progress.py b/reflex/components/radix/primitives/progress.py index 976daf505..72aee1038 100644 --- a/reflex/components/radix/primitives/progress.py +++ b/reflex/components/radix/primitives/progress.py @@ -9,7 +9,7 @@ from reflex.components.core.colors import color from reflex.components.radix.primitives.accordion import DEFAULT_ANIMATION_DURATION from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName from reflex.components.radix.themes.base import LiteralAccentColor, LiteralRadius -from reflex.vars import Var +from reflex.vars.base import Var class ProgressComponent(RadixPrimitiveComponentWithClassName): diff --git a/reflex/components/radix/primitives/progress.pyi b/reflex/components/radix/primitives/progress.pyi index f1c817587..c760c0a57 100644 --- a/reflex/components/radix/primitives/progress.pyi +++ b/reflex/components/radix/primitives/progress.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class ProgressComponent(RadixPrimitiveComponentWithClassName): @overload @@ -24,41 +24,21 @@ class ProgressComponent(RadixPrimitiveComponentWithClassName): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ProgressComponent": """Create the component. @@ -88,8 +68,8 @@ class ProgressRoot(ProgressComponent): *children, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -99,41 +79,21 @@ class ProgressRoot(ProgressComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ProgressRoot": """Create the component. @@ -166,63 +126,63 @@ class ProgressIndicator(ProgressComponent): max: Optional[Union[Var[Optional[int]], int]] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -233,41 +193,21 @@ class ProgressIndicator(ProgressComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ProgressIndicator": """Create the component. @@ -299,63 +239,63 @@ class Progress(ProgressRoot): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -363,8 +303,8 @@ class Progress(ProgressRoot): max: Optional[Union[Var[Optional[int]], int]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -374,41 +314,21 @@ class Progress(ProgressRoot): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Progress": """High-level API for progress bar. @@ -441,63 +361,63 @@ class ProgressNamespace(ComponentNamespace): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -505,8 +425,8 @@ class ProgressNamespace(ComponentNamespace): max: Optional[Union[Var[Optional[int]], int]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, @@ -516,41 +436,21 @@ class ProgressNamespace(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Progress": """High-level API for progress bar. diff --git a/reflex/components/radix/primitives/slider.py b/reflex/components/radix/primitives/slider.py index b8abd23b5..10a0079a4 100644 --- a/reflex/components/radix/primitives/slider.py +++ b/reflex/components/radix/primitives/slider.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import Any, List, Literal +from typing import Any, List, Literal, Tuple from reflex.components.component import Component, ComponentNamespace from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName from reflex.event import EventHandler -from reflex.vars import Var +from reflex.vars.base import Var LiteralSliderOrientation = Literal["horizontal", "vertical"] LiteralSliderDir = Literal["ltr", "rtl"] @@ -19,6 +19,20 @@ class SliderComponent(RadixPrimitiveComponentWithClassName): library = "@radix-ui/react-slider@^1.1.2" +def on_value_event_spec( + value: Var[List[int]], +) -> Tuple[Var[List[int]]]: + """Event handler spec for the value event. + + Args: + value: The value of the event. + + Returns: + The event handler spec. + """ + return (value,) # type: ignore + + class SliderRoot(SliderComponent): """The Slider component comtaining all slider parts.""" @@ -48,10 +62,10 @@ class SliderRoot(SliderComponent): min_steps_between_thumbs: Var[int] # Fired when the value of a thumb changes. - on_value_change: EventHandler[lambda e0: [e0]] + on_value_change: EventHandler[on_value_event_spec] # Fired when a thumb is released. - on_value_commit: EventHandler[lambda e0: [e0]] + on_value_commit: EventHandler[on_value_event_spec] def add_style(self) -> dict[str, Any] | None: """Add style to the component. diff --git a/reflex/components/radix/primitives/slider.pyi b/reflex/components/radix/primitives/slider.pyi index 9ce737df4..3d57fbe5c 100644 --- a/reflex/components/radix/primitives/slider.pyi +++ b/reflex/components/radix/primitives/slider.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload from reflex.components.component import Component, ComponentNamespace from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var LiteralSliderOrientation = Literal["horizontal", "vertical"] LiteralSliderDir = Literal["ltr", "rtl"] @@ -27,41 +27,21 @@ class SliderComponent(RadixPrimitiveComponentWithClassName): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SliderComponent": """Create the component. @@ -82,6 +62,8 @@ class SliderComponent(RadixPrimitiveComponentWithClassName): """ ... +def on_value_event_spec(value: Var[List[int]]) -> Tuple[Var[List[int]]]: ... + class SliderRoot(SliderComponent): def add_style(self) -> dict[str, Any] | None: ... @overload @@ -89,17 +71,17 @@ class SliderRoot(SliderComponent): def create( # type: ignore cls, *children, - default_value: Optional[Union[Var[List[int]], List[int]]] = None, - value: Optional[Union[Var[List[int]], List[int]]] = None, + default_value: Optional[Union[List[int], Var[List[int]]]] = None, + value: Optional[Union[List[int], Var[List[int]]]] = None, name: Optional[Union[Var[str], str]] = None, disabled: Optional[Union[Var[bool], bool]] = None, orientation: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, - dir: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None, + dir: Optional[Union[Literal["ltr", "rtl"], Var[Literal["ltr", "rtl"]]]] = None, inverted: Optional[Union[Var[bool], bool]] = None, min: Optional[Union[Var[int], int]] = None, max: Optional[Union[Var[int], int]] = None, @@ -112,47 +94,23 @@ class SliderRoot(SliderComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_value_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_value_commit: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + on_value_change: Optional[EventType[List[int]]] = None, + on_value_commit: Optional[EventType[List[int]]] = None, **props, ) -> "SliderRoot": """Create the component. @@ -187,41 +145,21 @@ class SliderTrack(SliderComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SliderTrack": """Create the component. @@ -256,41 +194,21 @@ class SliderRange(SliderComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SliderRange": """Create the component. @@ -325,41 +243,21 @@ class SliderThumb(SliderComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SliderThumb": """Create the component. diff --git a/reflex/components/radix/themes/base.py b/reflex/components/radix/themes/base.py index 5a7fb2d99..e41c5e7b0 100644 --- a/reflex/components/radix/themes/base.py +++ b/reflex/components/radix/themes/base.py @@ -7,9 +7,8 @@ from typing import Any, Dict, Literal from reflex.components import Component from reflex.components.tags import Tag from reflex.config import get_config -from reflex.ivars.base import ImmutableVar from reflex.utils.imports import ImportDict, ImportVar -from reflex.vars import Var +from reflex.vars.base import Var LiteralAlign = Literal["start", "center", "end", "baseline", "stretch"] LiteralJustify = Literal["start", "center", "end", "between"] @@ -236,8 +235,8 @@ class Theme(RadixThemesComponent): def _render(self, props: dict[str, Any] | None = None) -> Tag: tag = super()._render(props) tag.add_props( - css=ImmutableVar.create( - f"{{...theme.styles.global[':root'], ...theme.styles.global.body}}" + css=Var( + _js_expr=f"{{...theme.styles.global[':root'], ...theme.styles.global.body}}" ), ) return tag @@ -262,26 +261,6 @@ class ThemePanel(RadixThemesComponent): """ return {"react": "useEffect"} - def add_hooks(self) -> list[str]: - """Add a hook on the ThemePanel to clear chakra-ui-color-mode. - - Returns: - The hooks to render. - """ - # The panel freezes the tab if the user color preference differs from the - # theme "appearance", so clear it out when theme panel is used. - return [ - """ - useEffect(() => { - if (typeof window !== 'undefined') { - window.onbeforeunload = () => { - localStorage.removeItem('chakra-ui-color-mode'); - } - window.onbeforeunload(); - } - }, [])""" - ] - class RadixThemesColorModeProvider(Component): """Next-themes integration for radix themes components.""" diff --git a/reflex/components/radix/themes/base.pyi b/reflex/components/radix/themes/base.pyi index 5aea55d90..0f0de5401 100644 --- a/reflex/components/radix/themes/base.pyi +++ b/reflex/components/radix/themes/base.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components import Component -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var LiteralAlign = Literal["start", "center", "end", "baseline", "stretch"] LiteralJustify = Literal["start", "center", "end", "between"] @@ -57,44 +57,44 @@ class CommonMarginProps(Component): *children, m: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, mx: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, my: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, mt: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, mr: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, mb: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, ml: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, style: Optional[Style] = None, @@ -103,41 +103,21 @@ class CommonMarginProps(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CommonMarginProps": """Create the component. @@ -177,41 +157,21 @@ class RadixLoadingProp(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadixLoadingProp": """Create the component. @@ -244,41 +204,21 @@ class RadixThemesComponent(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadixThemesComponent": """Create a new component instance. @@ -313,41 +253,21 @@ class RadixThemesTriggerComponent(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadixThemesTriggerComponent": """Create a new RadixThemesTriggerComponent instance. @@ -367,96 +287,96 @@ class Theme(RadixThemesComponent): def create( # type: ignore cls, *children, - color_mode: Optional[Literal["inherit", "light", "dark"]] = None, + color_mode: Optional[Literal["dark", "inherit", "light"]] = None, theme_panel: Optional[bool] = False, has_background: Optional[Union[Var[bool], bool]] = None, appearance: Optional[ Union[ - Var[Literal["inherit", "light", "dark"]], - Literal["inherit", "light", "dark"], + Literal["dark", "inherit", "light"], + Var[Literal["dark", "inherit", "light"]], ] ] = None, accent_color: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, gray_color: Optional[ Union[ - Var[Literal["gray", "mauve", "slate", "sage", "olive", "sand", "auto"]], - Literal["gray", "mauve", "slate", "sage", "olive", "sand", "auto"], + Literal["auto", "gray", "mauve", "olive", "sage", "sand", "slate"], + Var[Literal["auto", "gray", "mauve", "olive", "sage", "sand", "slate"]], ] ] = None, panel_background: Optional[ - Union[Var[Literal["solid", "translucent"]], Literal["solid", "translucent"]] + Union[Literal["solid", "translucent"], Var[Literal["solid", "translucent"]]] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, scaling: Optional[ Union[ - Var[Literal["90%", "95%", "100%", "105%", "110%"]], - Literal["90%", "95%", "100%", "105%", "110%"], + Literal["100%", "105%", "110%", "90%", "95%"], + Var[Literal["100%", "105%", "110%", "90%", "95%"]], ] ] = None, style: Optional[Style] = None, @@ -465,41 +385,21 @@ class Theme(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Theme": """Create a new Radix Theme specification. @@ -532,7 +432,6 @@ class Theme(RadixThemesComponent): class ThemePanel(RadixThemesComponent): def add_imports(self) -> dict[str, str]: ... - def add_hooks(self) -> list[str]: ... @overload @classmethod def create( # type: ignore @@ -545,41 +444,21 @@ class ThemePanel(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ThemePanel": """Create a new component instance. @@ -615,41 +494,21 @@ class RadixThemesColorModeProvider(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadixThemesColorModeProvider": """Create the component. diff --git a/reflex/components/radix/themes/color_mode.py b/reflex/components/radix/themes/color_mode.py index 0331d7184..b1083ba94 100644 --- a/reflex/components/radix/themes/color_mode.py +++ b/reflex/components/radix/themes/color_mode.py @@ -17,14 +17,13 @@ rx.text( from __future__ import annotations -from typing import Literal, get_args +from typing import Dict, List, Literal, get_args from reflex.components.component import BaseComponent from reflex.components.core.cond import Cond, color_mode_cond, cond from reflex.components.lucide.icon import Icon from reflex.components.radix.themes.components.dropdown_menu import dropdown_menu from reflex.components.radix.themes.components.switch import Switch -from reflex.ivars.base import ImmutableVar from reflex.style import ( LIGHT_COLOR_MODE, color_mode, @@ -32,7 +31,8 @@ from reflex.style import ( set_color_mode, toggle_color_mode, ) -from reflex.vars import Var +from reflex.vars.base import Var +from reflex.vars.sequence import LiteralArrayVar from .components.icon_button import IconButton @@ -66,9 +66,9 @@ class ColorModeIcon(Cond): LiteralPosition = Literal["top-left", "top-right", "bottom-left", "bottom-right"] -position_values = get_args(LiteralPosition) +position_values: List[str] = list(get_args(LiteralPosition)) -position_map = { +position_map: Dict[str, List[str]] = { "position": position_values, "left": ["top-left", "bottom-left"], "right": ["top-right", "bottom-right"], @@ -78,8 +78,8 @@ position_map = { # needed to inverse contains for find -def _find(const, var): - return Var.create_safe(const, _var_is_string=False).contains(var) +def _find(const: List[str], var): + return LiteralArrayVar.create(const).contains(var) def _set_var_default(props, position, prop, default1, default2=""): @@ -184,7 +184,7 @@ class ColorModeSwitch(Switch): ) -class ColorModeNamespace(ImmutableVar): +class ColorModeNamespace(Var): """Namespace for color mode components.""" icon = staticmethod(ColorModeIcon.create) @@ -193,7 +193,7 @@ class ColorModeNamespace(ImmutableVar): color_mode = color_mode_var_and_namespace = ColorModeNamespace( - _var_name=color_mode._var_name, + _js_expr=color_mode._js_expr, _var_type=color_mode._var_type, _var_data=color_mode.get_default_value(), ) diff --git a/reflex/components/radix/themes/color_mode.pyi b/reflex/components/radix/themes/color_mode.pyi index a746068c3..d856b0bbd 100644 --- a/reflex/components/radix/themes/color_mode.pyi +++ b/reflex/components/radix/themes/color_mode.pyi @@ -3,20 +3,19 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, get_args, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.components.component import BaseComponent from reflex.components.core.breakpoints import Breakpoints from reflex.components.core.cond import Cond from reflex.components.lucide.icon import Icon from reflex.components.radix.themes.components.switch import Switch -from reflex.event import EventHandler, EventSpec -from reflex.ivars.base import ImmutableVar +from reflex.event import EventType from reflex.style import ( Style, color_mode, ) -from reflex.vars import Var +from reflex.vars.base import Var from .components.icon_button import IconButton @@ -29,7 +28,7 @@ class ColorModeIcon(Cond): def create( # type: ignore cls, *children, - cond: Optional[Union[Var[Any], Any]] = None, + cond: Optional[Union[Any, Var[Any]]] = None, comp1: Optional[BaseComponent] = None, comp2: Optional[BaseComponent] = None, style: Optional[Style] = None, @@ -38,41 +37,21 @@ class ColorModeIcon(Cond): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ColorModeIcon": """Create an icon component based on color_mode. @@ -87,14 +66,8 @@ class ColorModeIcon(Cond): ... LiteralPosition = Literal["top-left", "top-right", "bottom-left", "bottom-right"] -position_values = get_args(LiteralPosition) -position_map = { - "position": position_values, - "left": ["top-left", "bottom-left"], - "right": ["top-right", "bottom-right"], - "top": ["top-left", "top-right"], - "bottom": ["bottom-left", "bottom-right"], -} +position_values: List[str] +position_map: Dict[str, List[str]] class ColorModeIconButton(IconButton): @overload @@ -105,130 +78,130 @@ class ColorModeIconButton(IconButton): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4"]], + Literal["1", "2", "3", "4"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"], ] ], - Literal["1", "2", "3", "4"], - Breakpoints[str, Literal["1", "2", "3", "4"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]], - Literal["classic", "solid", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "solid", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "solid", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, - auto_focus: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, disabled: Optional[Union[Var[bool], bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form_action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form_action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_enc_type: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_no_validate: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, loading: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -236,41 +209,21 @@ class ColorModeIconButton(IconButton): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ColorModeIconButton": """Create a icon button component that calls toggle_color_mode on click. @@ -340,87 +293,87 @@ class ColorModeSwitch(Switch): value: Optional[Union[Var[str], str]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "full"]], Literal["none", "small", "full"] + Literal["full", "none", "small"], Var[Literal["full", "none", "small"]] ] ] = None, style: Optional[Style] = None, @@ -429,42 +382,22 @@ class ColorModeSwitch(Switch): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[bool]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ColorModeSwitch": """Create a switch component bound to color_mode. @@ -496,13 +429,13 @@ class ColorModeSwitch(Switch): """ ... -class ColorModeNamespace(ImmutableVar): +class ColorModeNamespace(Var): icon = staticmethod(ColorModeIcon.create) button = staticmethod(ColorModeIconButton.create) switch = staticmethod(ColorModeSwitch.create) color_mode = color_mode_var_and_namespace = ColorModeNamespace( - _var_name=color_mode._var_name, + _js_expr=color_mode._js_expr, _var_type=color_mode._var_type, _var_data=color_mode.get_default_value(), ) diff --git a/reflex/components/radix/themes/components/alert_dialog.py b/reflex/components/radix/themes/components/alert_dialog.py index e8dfb57b2..f3c8ec319 100644 --- a/reflex/components/radix/themes/components/alert_dialog.py +++ b/reflex/components/radix/themes/components/alert_dialog.py @@ -5,8 +5,8 @@ from typing import Literal from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, empty_event, identity_event +from reflex.vars.base import Var from ..base import RadixThemesComponent, RadixThemesTriggerComponent @@ -22,7 +22,7 @@ class AlertDialogRoot(RadixThemesComponent): open: Var[bool] # Fired when the open state changes. - on_open_change: EventHandler[lambda e0: [e0]] + on_open_change: EventHandler[identity_event(bool)] class AlertDialogTrigger(RadixThemesTriggerComponent): @@ -43,13 +43,13 @@ class AlertDialogContent(elements.Div, RadixThemesComponent): force_mount: Var[bool] # Fired when the dialog is opened. - on_open_auto_focus: EventHandler[lambda e0: [e0]] + on_open_auto_focus: EventHandler[empty_event] # Fired when the dialog is closed. - on_close_auto_focus: EventHandler[lambda e0: [e0]] + on_close_auto_focus: EventHandler[empty_event] # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0]] + on_escape_key_down: EventHandler[empty_event] class AlertDialogTitle(RadixThemesComponent): diff --git a/reflex/components/radix/themes/components/alert_dialog.pyi b/reflex/components/radix/themes/components/alert_dialog.pyi index 4cb9e966c..771def7d9 100644 --- a/reflex/components/radix/themes/components/alert_dialog.pyi +++ b/reflex/components/radix/themes/components/alert_dialog.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent, RadixThemesTriggerComponent @@ -29,44 +29,22 @@ class AlertDialogRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AlertDialogRoot": """Create a new component instance. @@ -102,41 +80,21 @@ class AlertDialogTrigger(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AlertDialogTrigger": """Create a new RadixThemesTriggerComponent instance. @@ -158,91 +116,65 @@ class AlertDialogContent(elements.Div, RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4"]], + Literal["1", "2", "3", "4"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"], ] ], - Literal["1", "2", "3", "4"], - Breakpoints[str, Literal["1", "2", "3", "4"]], ] ] = None, force_mount: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_close_auto_focus: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_auto_focus: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AlertDialogContent": """Create a new component instance. @@ -295,41 +227,21 @@ class AlertDialogTitle(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AlertDialogTitle": """Create a new component instance. @@ -364,41 +276,21 @@ class AlertDialogDescription(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AlertDialogDescription": """Create a new component instance. @@ -433,41 +325,21 @@ class AlertDialogAction(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AlertDialogAction": """Create a new RadixThemesTriggerComponent instance. @@ -493,41 +365,21 @@ class AlertDialogCancel(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AlertDialogCancel": """Create a new RadixThemesTriggerComponent instance. diff --git a/reflex/components/radix/themes/components/aspect_ratio.py b/reflex/components/radix/themes/components/aspect_ratio.py index b06b2d564..fc8052c85 100644 --- a/reflex/components/radix/themes/components/aspect_ratio.py +++ b/reflex/components/radix/themes/components/aspect_ratio.py @@ -2,7 +2,7 @@ from typing import Union -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent diff --git a/reflex/components/radix/themes/components/aspect_ratio.pyi b/reflex/components/radix/themes/components/aspect_ratio.pyi index 612c67a29..848d2064a 100644 --- a/reflex/components/radix/themes/components/aspect_ratio.pyi +++ b/reflex/components/radix/themes/components/aspect_ratio.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -24,41 +24,21 @@ class AspectRatio(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AspectRatio": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/avatar.py b/reflex/components/radix/themes/components/avatar.py index 22482f0c9..4f3956e76 100644 --- a/reflex/components/radix/themes/components/avatar.py +++ b/reflex/components/radix/themes/components/avatar.py @@ -3,7 +3,7 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/components/avatar.pyi b/reflex/components/radix/themes/components/avatar.pyi index c0476d543..fc42457da 100644 --- a/reflex/components/radix/themes/components/avatar.pyi +++ b/reflex/components/radix/themes/components/avatar.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -21,10 +21,12 @@ class Avatar(RadixThemesComponent): cls, *children, variant: Optional[ - Union[Var[Literal["solid", "soft"]], Literal["solid", "soft"]] + Union[Literal["soft", "solid"], Var[Literal["soft", "solid"]]] ] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -33,77 +35,75 @@ class Avatar(RadixThemesComponent): Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, src: Optional[Union[Var[str], str]] = None, @@ -114,41 +114,21 @@ class Avatar(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Avatar": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/badge.py b/reflex/components/radix/themes/components/badge.py index fd26b17ab..9391e53c3 100644 --- a/reflex/components/radix/themes/components/badge.py +++ b/reflex/components/radix/themes/components/badge.py @@ -4,7 +4,7 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/components/badge.pyi b/reflex/components/radix/themes/components/badge.pyi index 327fe2b90..405b7b835 100644 --- a/reflex/components/radix/themes/components/badge.pyi +++ b/reflex/components/radix/themes/components/badge.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -21,155 +21,135 @@ class Badge(elements.Span, RadixThemesComponent): *children, variant: Optional[ Union[ - Var[Literal["solid", "soft", "surface", "outline"]], - Literal["solid", "soft", "surface", "outline"], + Literal["outline", "soft", "solid", "surface"], + Var[Literal["outline", "soft", "solid", "surface"]], ] ] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Badge": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/button.py b/reflex/components/radix/themes/components/button.py index 0c52e6ec6..cb44ee684 100644 --- a/reflex/components/radix/themes/components/button.py +++ b/reflex/components/radix/themes/components/button.py @@ -4,7 +4,7 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/components/button.pyi b/reflex/components/radix/themes/components/button.pyi index 95a80c84e..f9702d3b5 100644 --- a/reflex/components/radix/themes/components/button.pyi +++ b/reflex/components/radix/themes/components/button.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( RadixLoadingProp, @@ -27,130 +27,130 @@ class Button(elements.Button, RadixLoadingProp, RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4"]], + Literal["1", "2", "3", "4"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"], ] ], - Literal["1", "2", "3", "4"], - Breakpoints[str, Literal["1", "2", "3", "4"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]], - Literal["classic", "solid", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "solid", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "solid", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, - auto_focus: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, disabled: Optional[Union[Var[bool], bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form_action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form_action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_enc_type: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_no_validate: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, loading: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -158,41 +158,21 @@ class Button(elements.Button, RadixLoadingProp, RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Button": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/callout.py b/reflex/components/radix/themes/components/callout.py index ea8be4623..926e0ad54 100644 --- a/reflex/components/radix/themes/components/callout.py +++ b/reflex/components/radix/themes/components/callout.py @@ -7,7 +7,7 @@ from reflex.components.component import Component, ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements from reflex.components.lucide.icon import Icon -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/components/callout.pyi b/reflex/components/radix/themes/components/callout.pyi index 04e1d1317..18ae5a357 100644 --- a/reflex/components/radix/themes/components/callout.pyi +++ b/reflex/components/radix/themes/components/callout.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -25,149 +25,129 @@ class CalloutRoot(elements.Div, RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["soft", "surface", "outline"]], - Literal["soft", "surface", "outline"], + Literal["outline", "soft", "surface"], + Var[Literal["outline", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CalloutRoot": """Create a new component instance. @@ -217,71 +197,51 @@ class CalloutIcon(elements.Div, RadixThemesComponent): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CalloutIcon": """Create a new component instance. @@ -326,71 +286,51 @@ class CalloutText(elements.P, RadixThemesComponent): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CalloutText": """Create a new component instance. @@ -440,149 +380,129 @@ class Callout(CalloutRoot): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["soft", "surface", "outline"]], - Literal["soft", "surface", "outline"], + Literal["outline", "soft", "surface"], + Var[Literal["outline", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Callout": """Create a callout component. @@ -638,149 +558,129 @@ class CalloutNamespace(ComponentNamespace): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["soft", "surface", "outline"]], - Literal["soft", "surface", "outline"], + Literal["outline", "soft", "surface"], + Var[Literal["outline", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Callout": """Create a callout component. diff --git a/reflex/components/radix/themes/components/card.py b/reflex/components/radix/themes/components/card.py index 574336b1b..4983cdd41 100644 --- a/reflex/components/radix/themes/components/card.py +++ b/reflex/components/radix/themes/components/card.py @@ -4,7 +4,7 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( RadixThemesComponent, diff --git a/reflex/components/radix/themes/components/card.pyi b/reflex/components/radix/themes/components/card.pyi index 142cc7448..dc45bc226 100644 --- a/reflex/components/radix/themes/components/card.pyi +++ b/reflex/components/radix/themes/components/card.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -22,87 +22,67 @@ class Card(elements.Div, RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5"]], + Literal["1", "2", "3", "4", "5"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4", "5"]], Literal["1", "2", "3", "4", "5"], ] ], - Literal["1", "2", "3", "4", "5"], - Breakpoints[str, Literal["1", "2", "3", "4", "5"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["surface", "classic", "ghost"]], - Literal["surface", "classic", "ghost"], + Literal["classic", "ghost", "surface"], + Var[Literal["classic", "ghost", "surface"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Card": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/checkbox.py b/reflex/components/radix/themes/components/checkbox.py index f191ce613..2944b1f11 100644 --- a/reflex/components/radix/themes/components/checkbox.py +++ b/reflex/components/radix/themes/components/checkbox.py @@ -6,9 +6,8 @@ from reflex.components.component import Component, ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.radix.themes.layout.flex import Flex from reflex.components.radix.themes.typography.text import Text -from reflex.event import EventHandler -from reflex.ivars.base import LiteralVar -from reflex.vars import Var +from reflex.event import EventHandler, identity_event +from reflex.vars.base import LiteralVar, Var from ..base import ( LiteralAccentColor, @@ -62,7 +61,7 @@ class Checkbox(RadixThemesComponent): _rename_props = {"onChange": "onCheckedChange"} # Fired when the checkbox is checked or unchecked. - on_change: EventHandler[lambda e0: [e0]] + on_change: EventHandler[identity_event(bool)] class HighLevelCheckbox(RadixThemesComponent): @@ -113,7 +112,7 @@ class HighLevelCheckbox(RadixThemesComponent): _rename_props = {"onChange": "onCheckedChange"} # Fired when the checkbox is checked or unchecked. - on_change: EventHandler[lambda e0: [e0]] + on_change: EventHandler[identity_event(bool)] @classmethod def create(cls, text: Var[str] = LiteralVar.create(""), **props) -> Component: diff --git a/reflex/components/radix/themes/components/checkbox.pyi b/reflex/components/radix/themes/components/checkbox.pyi index 52441eef4..90a9220ef 100644 --- a/reflex/components/radix/themes/components/checkbox.pyi +++ b/reflex/components/radix/themes/components/checkbox.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -25,80 +25,80 @@ class Checkbox(RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -115,42 +115,22 @@ class Checkbox(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[bool]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Checkbox": """Create a new component instance. @@ -193,79 +173,79 @@ class HighLevelCheckbox(RadixThemesComponent): text: Optional[Union[Var[str], str]] = None, spacing: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, size: Optional[ - Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]] + Union[Literal["1", "2", "3"], Var[Literal["1", "2", "3"]]] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -282,42 +262,22 @@ class HighLevelCheckbox(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[bool]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HighLevelCheckbox": """Create a checkbox with a label. @@ -357,79 +317,79 @@ class CheckboxNamespace(ComponentNamespace): text: Optional[Union[Var[str], str]] = None, spacing: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, size: Optional[ - Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]] + Union[Literal["1", "2", "3"], Var[Literal["1", "2", "3"]]] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -446,42 +406,22 @@ class CheckboxNamespace(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[bool]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HighLevelCheckbox": """Create a checkbox with a label. diff --git a/reflex/components/radix/themes/components/checkbox_cards.py b/reflex/components/radix/themes/components/checkbox_cards.py index d5042c355..5f5fc3ae3 100644 --- a/reflex/components/radix/themes/components/checkbox_cards.py +++ b/reflex/components/radix/themes/components/checkbox_cards.py @@ -4,7 +4,7 @@ from types import SimpleNamespace from typing import Literal, Union from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.vars.base import Var from ..base import LiteralAccentColor, RadixThemesComponent diff --git a/reflex/components/radix/themes/components/checkbox_cards.pyi b/reflex/components/radix/themes/components/checkbox_cards.pyi index d7be8a056..062fc1357 100644 --- a/reflex/components/radix/themes/components/checkbox_cards.pyi +++ b/reflex/components/radix/themes/components/checkbox_cards.pyi @@ -4,12 +4,12 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ from types import SimpleNamespace -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -21,83 +21,88 @@ class CheckboxCardsRoot(RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ - Union[Var[Literal["classic", "surface"]], Literal["classic", "surface"]] + Union[Literal["classic", "surface"], Var[Literal["classic", "surface"]]] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, columns: Optional[ Union[ + Breakpoints[ + str, + Union[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], str], + ], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -112,15 +117,15 @@ class CheckboxCardsRoot(RadixThemesComponent): ] ], str, - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, - Union[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], str], - ], ] ] = None, gap: Optional[ Union[ + Breakpoints[ + str, + Union[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], str], + ], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -135,11 +140,6 @@ class CheckboxCardsRoot(RadixThemesComponent): ] ], str, - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, - Union[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], str], - ], ] ] = None, style: Optional[Style] = None, @@ -148,41 +148,21 @@ class CheckboxCardsRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CheckboxCardsRoot": """Create a new component instance. @@ -223,41 +203,21 @@ class CheckboxCardsItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CheckboxCardsItem": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/checkbox_group.py b/reflex/components/radix/themes/components/checkbox_group.py index 754f354b5..f6379e588 100644 --- a/reflex/components/radix/themes/components/checkbox_group.py +++ b/reflex/components/radix/themes/components/checkbox_group.py @@ -4,7 +4,7 @@ from types import SimpleNamespace from typing import List, Literal from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.vars.base import Var from ..base import LiteralAccentColor, RadixThemesComponent diff --git a/reflex/components/radix/themes/components/checkbox_group.pyi b/reflex/components/radix/themes/components/checkbox_group.pyi index 8a730b870..363be0599 100644 --- a/reflex/components/radix/themes/components/checkbox_group.pyi +++ b/reflex/components/radix/themes/components/checkbox_group.pyi @@ -4,12 +4,12 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ from types import SimpleNamespace -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -21,85 +21,85 @@ class CheckboxGroupRoot(RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - default_value: Optional[Union[Var[List[str]], List[str]]] = None, + default_value: Optional[Union[List[str], Var[List[str]]]] = None, name: Optional[Union[Var[str], str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -107,41 +107,21 @@ class CheckboxGroupRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CheckboxGroupRoot": """Create a new component instance. @@ -184,41 +164,21 @@ class CheckboxGroupItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CheckboxGroupItem": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/context_menu.py b/reflex/components/radix/themes/components/context_menu.py index 95a0f2e74..3eb54a457 100644 --- a/reflex/components/radix/themes/components/context_menu.py +++ b/reflex/components/radix/themes/components/context_menu.py @@ -4,8 +4,8 @@ from typing import List, Literal from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Responsive -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, empty_event, identity_event +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, @@ -24,7 +24,7 @@ class ContextMenuRoot(RadixThemesComponent): _invalid_children: List[str] = ["ContextMenuItem"] # Fired when the open state changes. - on_open_change: EventHandler[lambda e0: [e0]] + on_open_change: EventHandler[identity_event(bool)] class ContextMenuTrigger(RadixThemesComponent): @@ -64,19 +64,19 @@ class ContextMenuContent(RadixThemesComponent): avoid_collisions: Var[bool] # Fired when the context menu is closed. - on_close_auto_focus: EventHandler[lambda e0: [e0]] + on_close_auto_focus: EventHandler[empty_event] # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0]] + on_escape_key_down: EventHandler[empty_event] # Fired when a pointer down event happens outside the context menu. - on_pointer_down_outside: EventHandler[lambda e0: [e0]] + on_pointer_down_outside: EventHandler[empty_event] # Fired when focus moves outside the context menu. - on_focus_outside: EventHandler[lambda e0: [e0]] + on_focus_outside: EventHandler[empty_event] # Fired when interacting outside the context menu. - on_interact_outside: EventHandler[lambda e0: [e0]] + on_interact_outside: EventHandler[empty_event] class ContextMenuSub(RadixThemesComponent): @@ -107,16 +107,16 @@ class ContextMenuSubContent(RadixThemesComponent): _valid_parents: List[str] = ["ContextMenuSub"] # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0]] + on_escape_key_down: EventHandler[empty_event] # Fired when a pointer down event happens outside the context menu. - on_pointer_down_outside: EventHandler[lambda e0: [e0]] + on_pointer_down_outside: EventHandler[empty_event] # Fired when focus moves outside the context menu. - on_focus_outside: EventHandler[lambda e0: [e0]] + on_focus_outside: EventHandler[empty_event] # Fired when interacting outside the context menu. - on_interact_outside: EventHandler[lambda e0: [e0]] + on_interact_outside: EventHandler[empty_event] class ContextMenuItem(RadixThemesComponent): diff --git a/reflex/components/radix/themes/components/context_menu.pyi b/reflex/components/radix/themes/components/context_menu.pyi index e2f9d01e2..56d8200e0 100644 --- a/reflex/components/radix/themes/components/context_menu.pyi +++ b/reflex/components/radix/themes/components/context_menu.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -26,44 +26,22 @@ class ContextMenuRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ContextMenuRoot": """Create a new component instance. @@ -100,41 +78,21 @@ class ContextMenuTrigger(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ContextMenuTrigger": """Create a new component instance. @@ -166,73 +124,73 @@ class ContextMenuContent(RadixThemesComponent): *children, size: Optional[ Union[ - Var[Union[Breakpoints[str, Literal["1", "2"]], Literal["1", "2"]]], - Literal["1", "2"], Breakpoints[str, Literal["1", "2"]], + Literal["1", "2"], + Var[Union[Breakpoints[str, Literal["1", "2"]], Literal["1", "2"]]], ] ] = None, variant: Optional[ - Union[Var[Literal["solid", "soft"]], Literal["solid", "soft"]] + Union[Literal["soft", "solid"], Var[Literal["soft", "solid"]]] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -245,56 +203,26 @@ class ContextMenuContent(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_interact_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_close_auto_focus: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_focus_outside: Optional[EventType[[]]] = None, + on_interact_outside: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ContextMenuContent": """Create a new component instance. @@ -335,41 +263,21 @@ class ContextMenuSub(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ContextMenuSub": """Create a new component instance. @@ -405,41 +313,21 @@ class ContextMenuSubTrigger(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ContextMenuSubTrigger": """Create a new component instance. @@ -476,53 +364,25 @@ class ContextMenuSubContent(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_interact_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_focus_outside: Optional[EventType[[]]] = None, + on_interact_outside: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ContextMenuSubContent": """Create a new component instance. @@ -554,63 +414,63 @@ class ContextMenuItem(RadixThemesComponent): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -621,41 +481,21 @@ class ContextMenuItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ContextMenuItem": """Create a new component instance. @@ -692,41 +532,21 @@ class ContextMenuSeparator(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ContextMenuSeparator": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/data_list.py b/reflex/components/radix/themes/components/data_list.py index 8b95d24c6..05d4af074 100644 --- a/reflex/components/radix/themes/components/data_list.py +++ b/reflex/components/radix/themes/components/data_list.py @@ -4,7 +4,7 @@ from types import SimpleNamespace from typing import Literal from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.vars.base import Var from ..base import LiteralAccentColor, RadixThemesComponent diff --git a/reflex/components/radix/themes/components/data_list.pyi b/reflex/components/radix/themes/components/data_list.pyi index 93d00c86b..342fa6e77 100644 --- a/reflex/components/radix/themes/components/data_list.pyi +++ b/reflex/components/radix/themes/components/data_list.pyi @@ -4,12 +4,12 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ from types import SimpleNamespace -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -21,37 +21,37 @@ class DataListRoot(RadixThemesComponent): *children, orientation: Optional[ Union[ + Breakpoints[str, Literal["horizontal", "vertical"]], + Literal["horizontal", "vertical"], Var[ Union[ Breakpoints[str, Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], ] ], - Literal["horizontal", "vertical"], - Breakpoints[str, Literal["horizontal", "vertical"]], ] ] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, trim: Optional[ Union[ + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], Var[ Union[ - Breakpoints[str, Literal["normal", "start", "end", "both"]], - Literal["normal", "start", "end", "both"], + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], ] ], - Literal["normal", "start", "end", "both"], - Breakpoints[str, Literal["normal", "start", "end", "both"]], ] ] = None, style: Optional[Style] = None, @@ -60,41 +60,21 @@ class DataListRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DataListRoot": """Create a new component instance. @@ -128,19 +108,19 @@ class DataListItem(RadixThemesComponent): *children, align: Optional[ Union[ + Breakpoints[ + str, Literal["baseline", "center", "end", "start", "stretch"] + ], + Literal["baseline", "center", "end", "start", "stretch"], Var[ Union[ Breakpoints[ str, - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ], - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ] ], - Literal["start", "center", "end", "baseline", "stretch"], - Breakpoints[ - str, Literal["start", "center", "end", "baseline", "stretch"] - ], ] ] = None, style: Optional[Style] = None, @@ -149,41 +129,21 @@ class DataListItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DataListItem": """Create a new component instance. @@ -214,73 +174,73 @@ class DataListLabel(RadixThemesComponent): cls, *children, width: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, min_width: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, max_width: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -290,41 +250,21 @@ class DataListLabel(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DataListLabel": """Create a new component instance. @@ -363,41 +303,21 @@ class DataListValue(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DataListValue": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/dialog.py b/reflex/components/radix/themes/components/dialog.py index e0d7fae12..e8da506ed 100644 --- a/reflex/components/radix/themes/components/dialog.py +++ b/reflex/components/radix/themes/components/dialog.py @@ -5,8 +5,8 @@ from typing import Literal from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, empty_event, identity_event +from reflex.vars.base import Var from ..base import ( RadixThemesComponent, @@ -23,7 +23,7 @@ class DialogRoot(RadixThemesComponent): open: Var[bool] # Fired when the open state changes. - on_open_change: EventHandler[lambda e0: [e0]] + on_open_change: EventHandler[identity_event(bool)] class DialogTrigger(RadixThemesTriggerComponent): @@ -47,19 +47,19 @@ class DialogContent(elements.Div, RadixThemesComponent): size: Var[Responsive[Literal["1", "2", "3", "4"]]] # Fired when the dialog is opened. - on_open_auto_focus: EventHandler[lambda e0: [e0]] + on_open_auto_focus: EventHandler[empty_event] # Fired when the dialog is closed. - on_close_auto_focus: EventHandler[lambda e0: [e0]] + on_close_auto_focus: EventHandler[empty_event] # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0]] + on_escape_key_down: EventHandler[empty_event] # Fired when the pointer is down outside the dialog. - on_pointer_down_outside: EventHandler[lambda e0: [e0]] + on_pointer_down_outside: EventHandler[empty_event] # Fired when the pointer interacts outside the dialog. - on_interact_outside: EventHandler[lambda e0: [e0]] + on_interact_outside: EventHandler[empty_event] class DialogDescription(RadixThemesComponent): diff --git a/reflex/components/radix/themes/components/dialog.pyi b/reflex/components/radix/themes/components/dialog.pyi index 02b1a6c9f..0713461e9 100644 --- a/reflex/components/radix/themes/components/dialog.pyi +++ b/reflex/components/radix/themes/components/dialog.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent, RadixThemesTriggerComponent @@ -27,44 +27,22 @@ class DialogRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DialogRoot": """Create a new component instance. @@ -100,41 +78,21 @@ class DialogTrigger(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DialogTrigger": """Create a new RadixThemesTriggerComponent instance. @@ -160,41 +118,21 @@ class DialogTitle(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DialogTitle": """Create a new component instance. @@ -225,96 +163,66 @@ class DialogContent(elements.Div, RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4"]], + Literal["1", "2", "3", "4"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"], ] ], - Literal["1", "2", "3", "4"], - Breakpoints[str, Literal["1", "2", "3", "4"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_interact_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_close_auto_focus: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_interact_outside: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_auto_focus: Optional[EventType[[]]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DialogContent": """Create a new component instance. @@ -366,41 +274,21 @@ class DialogDescription(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DialogDescription": """Create a new component instance. @@ -435,41 +323,21 @@ class DialogClose(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DialogClose": """Create a new RadixThemesTriggerComponent instance. @@ -501,44 +369,22 @@ class Dialog(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DialogRoot": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/dropdown_menu.py b/reflex/components/radix/themes/components/dropdown_menu.py index b425ef609..885e8df35 100644 --- a/reflex/components/radix/themes/components/dropdown_menu.py +++ b/reflex/components/radix/themes/components/dropdown_menu.py @@ -4,8 +4,8 @@ from typing import Dict, List, Literal, Union from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Responsive -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, empty_event, identity_event +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, @@ -50,7 +50,7 @@ class DropdownMenuRoot(RadixThemesComponent): _invalid_children: List[str] = ["DropdownMenuItem"] # Fired when the open state changes. - on_open_change: EventHandler[lambda e0: [e0]] + on_open_change: EventHandler[identity_event(bool)] class DropdownMenuTrigger(RadixThemesTriggerComponent): @@ -120,19 +120,19 @@ class DropdownMenuContent(RadixThemesComponent): hide_when_detached: Var[bool] # Fired when the dialog is closed. - on_close_auto_focus: EventHandler[lambda e0: [e0]] + on_close_auto_focus: EventHandler[empty_event] # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0]] + on_escape_key_down: EventHandler[empty_event] # Fired when the pointer is down outside the dialog. - on_pointer_down_outside: EventHandler[lambda e0: [e0]] + on_pointer_down_outside: EventHandler[empty_event] # Fired when focus moves outside the dialog. - on_focus_outside: EventHandler[lambda e0: [e0]] + on_focus_outside: EventHandler[empty_event] # Fired when the pointer interacts outside the dialog. - on_interact_outside: EventHandler[lambda e0: [e0]] + on_interact_outside: EventHandler[empty_event] class DropdownMenuSubTrigger(RadixThemesTriggerComponent): @@ -164,7 +164,7 @@ class DropdownMenuSub(RadixThemesComponent): default_open: Var[bool] # Fired when the open state changes. - on_open_change: EventHandler[lambda e0: [e0.target.value]] + on_open_change: EventHandler[identity_event(bool)] class DropdownMenuSubContent(RadixThemesComponent): @@ -205,16 +205,16 @@ class DropdownMenuSubContent(RadixThemesComponent): _valid_parents: List[str] = ["DropdownMenuSub"] # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0]] + on_escape_key_down: EventHandler[empty_event] # Fired when the pointer is down outside the dialog. - on_pointer_down_outside: EventHandler[lambda e0: [e0]] + on_pointer_down_outside: EventHandler[empty_event] # Fired when focus moves outside the dialog. - on_focus_outside: EventHandler[lambda e0: [e0]] + on_focus_outside: EventHandler[empty_event] # Fired when the pointer interacts outside the dialog. - on_interact_outside: EventHandler[lambda e0: [e0]] + on_interact_outside: EventHandler[empty_event] class DropdownMenuItem(RadixThemesComponent): @@ -240,7 +240,7 @@ class DropdownMenuItem(RadixThemesComponent): _valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSubContent"] # Fired when the item is selected. - on_select: EventHandler[lambda e0: [e0.target.value]] + on_select: EventHandler[empty_event] class DropdownMenuSeparator(RadixThemesComponent): diff --git a/reflex/components/radix/themes/components/dropdown_menu.pyi b/reflex/components/radix/themes/components/dropdown_menu.pyi index df7b23589..8de273be9 100644 --- a/reflex/components/radix/themes/components/dropdown_menu.pyi +++ b/reflex/components/radix/themes/components/dropdown_menu.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent, RadixThemesTriggerComponent @@ -29,51 +29,29 @@ class DropdownMenuRoot(RadixThemesComponent): default_open: Optional[Union[Var[bool], bool]] = None, open: Optional[Union[Var[bool], bool]] = None, modal: Optional[Union[Var[bool], bool]] = None, - dir: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None, + dir: Optional[Union[Literal["ltr", "rtl"], Var[Literal["ltr", "rtl"]]]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DropdownMenuRoot": """Create a new component instance. @@ -113,41 +91,21 @@ class DropdownMenuTrigger(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DropdownMenuTrigger": """Create a new RadixThemesTriggerComponent instance. @@ -169,73 +127,73 @@ class DropdownMenuContent(RadixThemesComponent): *children, size: Optional[ Union[ - Var[Union[Breakpoints[str, Literal["1", "2"]], Literal["1", "2"]]], - Literal["1", "2"], Breakpoints[str, Literal["1", "2"]], + Literal["1", "2"], + Var[Union[Breakpoints[str, Literal["1", "2"]], Literal["1", "2"]]], ] ] = None, variant: Optional[ - Union[Var[Literal["solid", "soft"]], Literal["solid", "soft"]] + Union[Literal["soft", "solid"], Var[Literal["soft", "solid"]]] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -245,30 +203,30 @@ class DropdownMenuContent(RadixThemesComponent): force_mount: Optional[Union[Var[bool], bool]] = None, side: Optional[ Union[ - Var[Literal["top", "right", "bottom", "left"]], - Literal["top", "right", "bottom", "left"], + Literal["bottom", "left", "right", "top"], + Var[Literal["bottom", "left", "right", "top"]], ] ] = None, side_offset: Optional[Union[Var[Union[float, int]], float, int]] = None, align: Optional[ Union[ - Var[Literal["start", "center", "end"]], - Literal["start", "center", "end"], + Literal["center", "end", "start"], + Var[Literal["center", "end", "start"]], ] ] = None, align_offset: Optional[Union[Var[Union[float, int]], float, int]] = None, avoid_collisions: Optional[Union[Var[bool], bool]] = None, collision_padding: Optional[ Union[ + Dict[str, Union[float, int]], Var[Union[Dict[str, Union[float, int]], float, int]], float, int, - Dict[str, Union[float, int]], ] ] = None, arrow_padding: Optional[Union[Var[Union[float, int]], float, int]] = None, sticky: Optional[ - Union[Var[Literal["partial", "always"]], Literal["partial", "always"]] + Union[Literal["always", "partial"], Var[Literal["always", "partial"]]] ] = None, hide_when_detached: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, @@ -277,56 +235,26 @@ class DropdownMenuContent(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_interact_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_close_auto_focus: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_focus_outside: Optional[EventType[[]]] = None, + on_interact_outside: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DropdownMenuContent": """Create a new component instance. @@ -380,41 +308,21 @@ class DropdownMenuSubTrigger(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DropdownMenuSubTrigger": """Create a new RadixThemesTriggerComponent instance. @@ -442,44 +350,22 @@ class DropdownMenuSub(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DropdownMenuSub": """Create a new component instance. @@ -518,15 +404,15 @@ class DropdownMenuSubContent(RadixThemesComponent): avoid_collisions: Optional[Union[Var[bool], bool]] = None, collision_padding: Optional[ Union[ + Dict[str, Union[float, int]], Var[Union[Dict[str, Union[float, int]], float, int]], float, int, - Dict[str, Union[float, int]], ] ] = None, arrow_padding: Optional[Union[Var[Union[float, int]], float, int]] = None, sticky: Optional[ - Union[Var[Literal["partial", "always"]], Literal["partial", "always"]] + Union[Literal["always", "partial"], Var[Literal["always", "partial"]]] ] = None, hide_when_detached: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, @@ -535,53 +421,25 @@ class DropdownMenuSubContent(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_interact_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_focus_outside: Optional[EventType[[]]] = None, + on_interact_outside: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DropdownMenuSubContent": """Create a new component instance. @@ -622,63 +480,63 @@ class DropdownMenuItem(RadixThemesComponent): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -692,42 +550,22 @@ class DropdownMenuItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_select: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_select: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DropdownMenuItem": """Create a new component instance. @@ -767,41 +605,21 @@ class DropdownMenuSeparator(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DropdownMenuSeparator": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/hover_card.py b/reflex/components/radix/themes/components/hover_card.py index a1c5c82d4..e76184795 100644 --- a/reflex/components/radix/themes/components/hover_card.py +++ b/reflex/components/radix/themes/components/hover_card.py @@ -5,8 +5,8 @@ from typing import Literal from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, identity_event +from reflex.vars.base import Var from ..base import ( RadixThemesComponent, @@ -32,7 +32,7 @@ class HoverCardRoot(RadixThemesComponent): close_delay: Var[int] # Fired when the open state changes. - on_open_change: EventHandler[lambda e0: [e0]] + on_open_change: EventHandler[identity_event(bool)] class HoverCardTrigger(RadixThemesTriggerComponent): diff --git a/reflex/components/radix/themes/components/hover_card.pyi b/reflex/components/radix/themes/components/hover_card.pyi index ad56a8302..fa169c852 100644 --- a/reflex/components/radix/themes/components/hover_card.pyi +++ b/reflex/components/radix/themes/components/hover_card.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent, RadixThemesTriggerComponent @@ -30,44 +30,22 @@ class HoverCardRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HoverCardRoot": """Create a new component instance. @@ -106,41 +84,21 @@ class HoverCardTrigger(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HoverCardTrigger": """Create a new RadixThemesTriggerComponent instance. @@ -162,89 +120,69 @@ class HoverCardContent(elements.Div, RadixThemesComponent): *children, side: Optional[ Union[ + Breakpoints[str, Literal["bottom", "left", "right", "top"]], + Literal["bottom", "left", "right", "top"], Var[ Union[ - Breakpoints[str, Literal["top", "right", "bottom", "left"]], - Literal["top", "right", "bottom", "left"], + Breakpoints[str, Literal["bottom", "left", "right", "top"]], + Literal["bottom", "left", "right", "top"], ] ], - Literal["top", "right", "bottom", "left"], - Breakpoints[str, Literal["top", "right", "bottom", "left"]], ] ] = None, side_offset: Optional[Union[Var[int], int]] = None, align: Optional[ Union[ - Var[Literal["start", "center", "end"]], - Literal["start", "center", "end"], + Literal["center", "end", "start"], + Var[Literal["center", "end", "start"]], ] ] = None, avoid_collisions: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HoverCardContent": """Create a new component instance. @@ -305,44 +243,22 @@ class HoverCard(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HoverCardRoot": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/icon_button.py b/reflex/components/radix/themes/components/icon_button.py index 76077057e..2a32afe3a 100644 --- a/reflex/components/radix/themes/components/icon_button.py +++ b/reflex/components/radix/themes/components/icon_button.py @@ -10,7 +10,7 @@ from reflex.components.core.match import Match from reflex.components.el import elements from reflex.components.lucide import Icon from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/components/icon_button.pyi b/reflex/components/radix/themes/components/icon_button.pyi index b5c75a9b6..901c8d6ff 100644 --- a/reflex/components/radix/themes/components/icon_button.pyi +++ b/reflex/components/radix/themes/components/icon_button.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( RadixLoadingProp, @@ -27,130 +27,130 @@ class IconButton(elements.Button, RadixLoadingProp, RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4"]], + Literal["1", "2", "3", "4"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"], ] ], - Literal["1", "2", "3", "4"], - Breakpoints[str, Literal["1", "2", "3", "4"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]], - Literal["classic", "solid", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "solid", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "solid", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, - auto_focus: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, disabled: Optional[Union[Var[bool], bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - form_action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + form_action: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_enc_type: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_method: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, form_no_validate: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - form_target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - value: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form_target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + name: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + value: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, loading: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -158,41 +158,21 @@ class IconButton(elements.Button, RadixLoadingProp, RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "IconButton": """Create a IconButton component. diff --git a/reflex/components/radix/themes/components/inset.py b/reflex/components/radix/themes/components/inset.py index 96f1f61ce..347b9f6b0 100644 --- a/reflex/components/radix/themes/components/inset.py +++ b/reflex/components/radix/themes/components/inset.py @@ -4,7 +4,7 @@ from typing import Literal, Union from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( RadixThemesComponent, diff --git a/reflex/components/radix/themes/components/inset.pyi b/reflex/components/radix/themes/components/inset.pyi index 3671d2a5c..d6b0cce04 100644 --- a/reflex/components/radix/themes/components/inset.pyi +++ b/reflex/components/radix/themes/components/inset.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -23,151 +23,131 @@ class Inset(elements.Div, RadixThemesComponent): *children, side: Optional[ Union[ + Breakpoints[str, Literal["bottom", "left", "right", "top", "x", "y"]], + Literal["bottom", "left", "right", "top", "x", "y"], Var[ Union[ Breakpoints[ - str, Literal["x", "y", "top", "bottom", "right", "left"] + str, Literal["bottom", "left", "right", "top", "x", "y"] ], - Literal["x", "y", "top", "bottom", "right", "left"], + Literal["bottom", "left", "right", "top", "x", "y"], ] ], - Literal["x", "y", "top", "bottom", "right", "left"], - Breakpoints[str, Literal["x", "y", "top", "bottom", "right", "left"]], ] ] = None, clip: Optional[ Union[ + Breakpoints[str, Literal["border-box", "padding-box"]], + Literal["border-box", "padding-box"], Var[ Union[ Breakpoints[str, Literal["border-box", "padding-box"]], Literal["border-box", "padding-box"], ] ], - Literal["border-box", "padding-box"], - Breakpoints[str, Literal["border-box", "padding-box"]], ] ] = None, p: Optional[ Union[ + Breakpoints[str, Union[int, str]], Var[Union[Breakpoints[str, Union[int, str]], int, str]], int, str, - Breakpoints[str, Union[int, str]], ] ] = None, px: Optional[ Union[ + Breakpoints[str, Union[int, str]], Var[Union[Breakpoints[str, Union[int, str]], int, str]], int, str, - Breakpoints[str, Union[int, str]], ] ] = None, py: Optional[ Union[ + Breakpoints[str, Union[int, str]], Var[Union[Breakpoints[str, Union[int, str]], int, str]], int, str, - Breakpoints[str, Union[int, str]], ] ] = None, pt: Optional[ Union[ + Breakpoints[str, Union[int, str]], Var[Union[Breakpoints[str, Union[int, str]], int, str]], int, str, - Breakpoints[str, Union[int, str]], ] ] = None, pr: Optional[ Union[ + Breakpoints[str, Union[int, str]], Var[Union[Breakpoints[str, Union[int, str]], int, str]], int, str, - Breakpoints[str, Union[int, str]], ] ] = None, pb: Optional[ Union[ + Breakpoints[str, Union[int, str]], Var[Union[Breakpoints[str, Union[int, str]], int, str]], int, str, - Breakpoints[str, Union[int, str]], ] ] = None, pl: Optional[ Union[ + Breakpoints[str, Union[int, str]], Var[Union[Breakpoints[str, Union[int, str]], int, str]], int, str, - Breakpoints[str, Union[int, str]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Inset": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/popover.py b/reflex/components/radix/themes/components/popover.py index 7c51cb53b..2535a8a22 100644 --- a/reflex/components/radix/themes/components/popover.py +++ b/reflex/components/radix/themes/components/popover.py @@ -5,8 +5,8 @@ from typing import Literal from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, empty_event, identity_event +from reflex.vars.base import Var from ..base import ( RadixThemesComponent, @@ -26,7 +26,7 @@ class PopoverRoot(RadixThemesComponent): modal: Var[bool] # Fired when the open state changes. - on_open_change: EventHandler[lambda e0: [e0]] + on_open_change: EventHandler[identity_event(bool)] class PopoverTrigger(RadixThemesTriggerComponent): @@ -59,22 +59,22 @@ class PopoverContent(elements.Div, RadixThemesComponent): avoid_collisions: Var[bool] # Fired when the dialog is opened. - on_open_auto_focus: EventHandler[lambda e0: [e0]] + on_open_auto_focus: EventHandler[empty_event] # Fired when the dialog is closed. - on_close_auto_focus: EventHandler[lambda e0: [e0]] + on_close_auto_focus: EventHandler[empty_event] # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0]] + on_escape_key_down: EventHandler[empty_event] # Fired when the pointer is down outside the dialog. - on_pointer_down_outside: EventHandler[lambda e0: [e0]] + on_pointer_down_outside: EventHandler[empty_event] # Fired when focus moves outside the dialog. - on_focus_outside: EventHandler[lambda e0: [e0]] + on_focus_outside: EventHandler[empty_event] # Fired when the pointer interacts outside the dialog. - on_interact_outside: EventHandler[lambda e0: [e0]] + on_interact_outside: EventHandler[empty_event] class PopoverClose(RadixThemesTriggerComponent): diff --git a/reflex/components/radix/themes/components/popover.pyi b/reflex/components/radix/themes/components/popover.pyi index d8bd9d1d6..218392517 100644 --- a/reflex/components/radix/themes/components/popover.pyi +++ b/reflex/components/radix/themes/components/popover.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent, RadixThemesTriggerComponent @@ -28,44 +28,22 @@ class PopoverRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "PopoverRoot": """Create a new component instance. @@ -102,41 +80,21 @@ class PopoverTrigger(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "PopoverTrigger": """Create a new RadixThemesTriggerComponent instance. @@ -158,114 +116,82 @@ class PopoverContent(elements.Div, RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4"]], + Literal["1", "2", "3", "4"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"], ] ], - Literal["1", "2", "3", "4"], - Breakpoints[str, Literal["1", "2", "3", "4"]], ] ] = None, side: Optional[ Union[ - Var[Literal["top", "right", "bottom", "left"]], - Literal["top", "right", "bottom", "left"], + Literal["bottom", "left", "right", "top"], + Var[Literal["bottom", "left", "right", "top"]], ] ] = None, side_offset: Optional[Union[Var[int], int]] = None, align: Optional[ Union[ - Var[Literal["start", "center", "end"]], - Literal["start", "center", "end"], + Literal["center", "end", "start"], + Var[Literal["center", "end", "start"]], ] ] = None, align_offset: Optional[Union[Var[int], int]] = None, avoid_collisions: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_interact_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_close_auto_focus: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_focus_outside: Optional[EventType[[]]] = None, + on_interact_outside: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_auto_focus: Optional[EventType[[]]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "PopoverContent": """Create a new component instance. @@ -322,41 +248,21 @@ class PopoverClose(RadixThemesTriggerComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "PopoverClose": """Create a new RadixThemesTriggerComponent instance. diff --git a/reflex/components/radix/themes/components/progress.py b/reflex/components/radix/themes/components/progress.py index a122130c8..e9fe168c6 100644 --- a/reflex/components/radix/themes/components/progress.py +++ b/reflex/components/radix/themes/components/progress.py @@ -4,7 +4,8 @@ from typing import Literal from reflex.components.component import Component from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.style import Style +from reflex.vars.base import Var from ..base import LiteralAccentColor, RadixThemesComponent @@ -38,6 +39,21 @@ class Progress(RadixThemesComponent): # The duration of the progress bar animation. Once the duration times out, the progress bar will start an indeterminate animation. duration: Var[str] + # The color of the progress bar fill animation. + fill_color: Var[str] + + @staticmethod + def _color_selector(color: str) -> Style: + """Return a style object with the correct color and css selector. + + Args: + color: Color of the fill part. + + Returns: + Style: Style object with the correct css selector and color. + """ + return Style({".rt-ProgressIndicator": {"background_color": color}}) + @classmethod def create(cls, *children, **props) -> Component: """Create a Progress component. @@ -50,6 +66,12 @@ class Progress(RadixThemesComponent): The Progress Component. """ props.setdefault("width", "100%") + if "fill_color" in props: + color = props.get("fill_color", "") + style = props.get("style", {}) + style = style | cls._color_selector(color) + props["style"] = style + return super().create(*children, **props) diff --git a/reflex/components/radix/themes/components/progress.pyi b/reflex/components/radix/themes/components/progress.pyi index a647e94e6..6470842f3 100644 --- a/reflex/components/radix/themes/components/progress.pyi +++ b/reflex/components/radix/themes/components/progress.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -22,132 +22,113 @@ class Progress(RadixThemesComponent): max: Optional[Union[Var[int], int]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, duration: Optional[Union[Var[str], str]] = None, + fill_color: Optional[Union[Var[str], str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Progress": """Create a Progress component. @@ -162,6 +143,7 @@ class Progress(RadixThemesComponent): high_contrast: Whether to render the progress bar with higher contrast color against background radius: Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full" duration: The duration of the progress bar animation. Once the duration times out, the progress bar will start an indeterminate animation. + fill_color: The color of the progress bar fill animation. style: The style of the component. key: A unique key for the component. id: The id for the component. diff --git a/reflex/components/radix/themes/components/radio.py b/reflex/components/radix/themes/components/radio.py index 53cb35f32..fd24bb6b5 100644 --- a/reflex/components/radix/themes/components/radio.py +++ b/reflex/components/radix/themes/components/radio.py @@ -3,7 +3,7 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.vars.base import Var from ..base import LiteralAccentColor, RadixThemesComponent diff --git a/reflex/components/radix/themes/components/radio.pyi b/reflex/components/radix/themes/components/radio.pyi index 5c1b303fa..f1a6b131a 100644 --- a/reflex/components/radix/themes/components/radio.pyi +++ b/reflex/components/radix/themes/components/radio.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -20,80 +20,80 @@ class Radio(RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -104,41 +104,21 @@ class Radio(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Radio": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/radio_cards.py b/reflex/components/radix/themes/components/radio_cards.py index 88688521f..e0aa2a749 100644 --- a/reflex/components/radix/themes/components/radio_cards.py +++ b/reflex/components/radix/themes/components/radio_cards.py @@ -4,8 +4,8 @@ from types import SimpleNamespace from typing import Literal, Union from reflex.components.core.breakpoints import Responsive -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, identity_event +from reflex.vars.base import Var from ..base import LiteralAccentColor, RadixThemesComponent @@ -65,7 +65,7 @@ class RadioCardsRoot(RadixThemesComponent): loop: Var[bool] # Event handler called when the value changes. - on_value_change: EventHandler[lambda e0: [e0]] + on_value_change: EventHandler[identity_event(str)] class RadioCardsItem(RadixThemesComponent): diff --git a/reflex/components/radix/themes/components/radio_cards.pyi b/reflex/components/radix/themes/components/radio_cards.pyi index 2c0bf002b..d2f6a1425 100644 --- a/reflex/components/radix/themes/components/radio_cards.pyi +++ b/reflex/components/radix/themes/components/radio_cards.pyi @@ -4,12 +4,12 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ from types import SimpleNamespace -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -22,83 +22,88 @@ class RadioCardsRoot(RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ - Union[Var[Literal["classic", "surface"]], Literal["classic", "surface"]] + Union[Literal["classic", "surface"], Var[Literal["classic", "surface"]]] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, columns: Optional[ Union[ + Breakpoints[ + str, + Union[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], str], + ], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -113,15 +118,15 @@ class RadioCardsRoot(RadixThemesComponent): ] ], str, - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, - Union[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], str], - ], ] ] = None, gap: Optional[ Union[ + Breakpoints[ + str, + Union[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], str], + ], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -136,11 +141,6 @@ class RadioCardsRoot(RadixThemesComponent): ] ], str, - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, - Union[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], str], - ], ] ] = None, default_value: Optional[Union[Var[str], str]] = None, @@ -150,11 +150,11 @@ class RadioCardsRoot(RadixThemesComponent): required: Optional[Union[Var[bool], bool]] = None, orientation: Optional[ Union[ - Var[Literal["horizontal", "vertical", "undefined"]], - Literal["horizontal", "vertical", "undefined"], + Literal["horizontal", "undefined", "vertical"], + Var[Literal["horizontal", "undefined", "vertical"]], ] ] = None, - dir: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None, + dir: Optional[Union[Literal["ltr", "rtl"], Var[Literal["ltr", "rtl"]]]] = None, loop: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -162,44 +162,22 @@ class RadioCardsRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_value_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + on_value_change: Optional[EventType[str]] = None, **props, ) -> "RadioCardsRoot": """Create a new component instance. @@ -252,41 +230,21 @@ class RadioCardsItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadioCardsItem": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/radio_group.py b/reflex/components/radix/themes/components/radio_group.py index 174abbac6..a55ca3a41 100644 --- a/reflex/components/radix/themes/components/radio_group.py +++ b/reflex/components/radix/themes/components/radio_group.py @@ -9,11 +9,10 @@ from reflex.components.component import Component, ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.radix.themes.layout.flex import Flex from reflex.components.radix.themes.typography.text import Text -from reflex.event import EventHandler -from reflex.ivars.base import ImmutableVar, LiteralVar -from reflex.ivars.sequence import StringVar +from reflex.event import EventHandler, identity_event from reflex.utils import types -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var +from reflex.vars.sequence import StringVar from ..base import ( LiteralAccentColor, @@ -60,7 +59,7 @@ class RadioGroupRoot(RadixThemesComponent): _rename_props = {"onChange": "onValueChange"} # Fired when the value of the radio group changes. - on_change: EventHandler[lambda e0: [e0]] + on_change: EventHandler[identity_event(str)] class RadioGroupItem(RadixThemesComponent): @@ -85,7 +84,7 @@ class HighLevelRadioGroup(RadixThemesComponent): items: Var[List[str]] # The direction of the radio group. - direction: Var[LiteralFlexDirection] = LiteralVar.create("column") + direction: Var[LiteralFlexDirection] = LiteralVar.create("row") # The gap between the items of the radio group. spacing: Var[LiteralSpacing] = LiteralVar.create("2") @@ -138,7 +137,7 @@ class HighLevelRadioGroup(RadixThemesComponent): Raises: TypeError: If the type of items is invalid. """ - direction = props.pop("direction", "column") + direction = props.pop("direction", "row") spacing = props.pop("spacing", "2") size = props.pop("size", "2") variant = props.pop("variant", "classic") @@ -164,11 +163,11 @@ class HighLevelRadioGroup(RadixThemesComponent): ): default_value = LiteralVar.create(default_value) # type: ignore else: - default_value = ImmutableVar.create_safe(default_value).to_string() + default_value = LiteralVar.create(default_value).to_string() def radio_group_item(value: Var) -> Component: item_value = rx.cond( - value._type() == "string", + value.js_type() == "string", value, value.to_string(), ).to(StringVar) diff --git a/reflex/components/radix/themes/components/radio_group.pyi b/reflex/components/radix/themes/components/radio_group.pyi index 559607ae5..f928421c5 100644 --- a/reflex/components/radix/themes/components/radio_group.pyi +++ b/reflex/components/radix/themes/components/radio_group.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -23,80 +23,80 @@ class RadioGroupRoot(RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -112,42 +112,22 @@ class RadioGroupRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadioGroupRoot": """Create a new component instance. @@ -194,41 +174,21 @@ class RadioGroupItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadioGroupItem": """Create a new component instance. @@ -260,87 +220,87 @@ class HighLevelRadioGroup(RadixThemesComponent): def create( # type: ignore cls, *children, - items: Optional[Union[Var[List[str]], List[str]]] = None, + items: Optional[Union[List[str], Var[List[str]]]] = None, direction: Optional[ Union[ - Var[Literal["row", "column", "row-reverse", "column-reverse"]], - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], + Var[Literal["column", "column-reverse", "row", "row-reverse"]], ] ] = None, spacing: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, size: Optional[ - Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]] + Union[Literal["1", "2", "3"], Var[Literal["1", "2", "3"]]] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -356,41 +316,21 @@ class HighLevelRadioGroup(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HighLevelRadioGroup": """Create a radio group component. @@ -432,87 +372,87 @@ class RadioGroup(ComponentNamespace): @staticmethod def __call__( *children, - items: Optional[Union[Var[List[str]], List[str]]] = None, + items: Optional[Union[List[str], Var[List[str]]]] = None, direction: Optional[ Union[ - Var[Literal["row", "column", "row-reverse", "column-reverse"]], - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], + Var[Literal["column", "column-reverse", "row", "row-reverse"]], ] ] = None, spacing: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, size: Optional[ - Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]] + Union[Literal["1", "2", "3"], Var[Literal["1", "2", "3"]]] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -528,41 +468,21 @@ class RadioGroup(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HighLevelRadioGroup": """Create a radio group component. diff --git a/reflex/components/radix/themes/components/scroll_area.py b/reflex/components/radix/themes/components/scroll_area.py index 8920d81d6..bd58118dd 100644 --- a/reflex/components/radix/themes/components/scroll_area.py +++ b/reflex/components/radix/themes/components/scroll_area.py @@ -2,7 +2,7 @@ from typing import Literal -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( RadixThemesComponent, diff --git a/reflex/components/radix/themes/components/scroll_area.pyi b/reflex/components/radix/themes/components/scroll_area.pyi index 8b4e44df5..8deeb0fe9 100644 --- a/reflex/components/radix/themes/components/scroll_area.pyi +++ b/reflex/components/radix/themes/components/scroll_area.pyi @@ -3,11 +3,11 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -19,14 +19,14 @@ class ScrollArea(RadixThemesComponent): *children, scrollbars: Optional[ Union[ - Var[Literal["vertical", "horizontal", "both"]], - Literal["vertical", "horizontal", "both"], + Literal["both", "horizontal", "vertical"], + Var[Literal["both", "horizontal", "vertical"]], ] ] = None, type: Optional[ Union[ - Var[Literal["auto", "always", "scroll", "hover"]], - Literal["auto", "always", "scroll", "hover"], + Literal["always", "auto", "hover", "scroll"], + Var[Literal["always", "auto", "hover", "scroll"]], ] ] = None, scroll_hide_delay: Optional[Union[Var[int], int]] = None, @@ -36,41 +36,21 @@ class ScrollArea(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ScrollArea": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/segmented_control.py b/reflex/components/radix/themes/components/segmented_control.py index 40beb603a..22725eaa6 100644 --- a/reflex/components/radix/themes/components/segmented_control.py +++ b/reflex/components/radix/themes/components/segmented_control.py @@ -3,15 +3,27 @@ from __future__ import annotations from types import SimpleNamespace -from typing import List, Literal, Union +from typing import List, Literal, Tuple, Union from reflex.components.core.breakpoints import Responsive from reflex.event import EventHandler -from reflex.vars import Var +from reflex.vars.base import Var from ..base import LiteralAccentColor, RadixThemesComponent +def on_value_change(value: Var[str | List[str]]) -> Tuple[Var[str | List[str]]]: + """Handle the on_value_change event. + + Args: + value: The value of the event. + + Returns: + The value of the event. + """ + return (value,) + + class SegmentedControlRoot(RadixThemesComponent): """Root element for a SegmentedControl component.""" @@ -23,6 +35,7 @@ class SegmentedControlRoot(RadixThemesComponent): # Variant of button: "classic" | "surface" variant: Var[Literal["classic", "surface"]] + # The type of the segmented control, either "single" for selecting one option or "multiple" for selecting multiple options. type: Var[Literal["single", "multiple"]] # Override theme color for button @@ -34,9 +47,11 @@ class SegmentedControlRoot(RadixThemesComponent): # The default value of the segmented control. default_value: Var[Union[str, List[str]]] + # The current value of the segmented control. value: Var[Union[str, List[str]]] - on_change: EventHandler[lambda e0: [e0]] + # Handles the `onChange` event for the SegmentedControl component. + on_change: EventHandler[on_value_change] _rename_props = {"onChange": "onValueChange"} diff --git a/reflex/components/radix/themes/components/segmented_control.pyi b/reflex/components/radix/themes/components/segmented_control.pyi index f284dab77..cb1990a7c 100644 --- a/reflex/components/radix/themes/components/segmented_control.pyi +++ b/reflex/components/radix/themes/components/segmented_control.pyi @@ -4,15 +4,17 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ from types import SimpleNamespace -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent +def on_value_change(value: Var[str | List[str]]) -> Tuple[Var[str | List[str]]]: ... + class SegmentedControlRoot(RadixThemesComponent): @overload @classmethod @@ -21,135 +23,115 @@ class SegmentedControlRoot(RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ - Union[Var[Literal["classic", "surface"]], Literal["classic", "surface"]] + Union[Literal["classic", "surface"], Var[Literal["classic", "surface"]]] ] = None, type: Optional[ - Union[Var[Literal["single", "multiple"]], Literal["single", "multiple"]] + Union[Literal["multiple", "single"], Var[Literal["multiple", "single"]]] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, default_value: Optional[ - Union[Var[Union[List[str], str]], str, List[str]] + Union[List[str], Var[Union[List[str], str]], str] ] = None, - value: Optional[Union[Var[Union[List[str], str]], str, List[str]]] = None, + value: Optional[Union[List[str], Var[Union[List[str], str]], str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str | List[str]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SegmentedControlRoot": """Create a new component instance. @@ -161,9 +143,11 @@ class SegmentedControlRoot(RadixThemesComponent): *children: Child components. size: The size of the segmented control: "1" | "2" | "3" variant: Variant of button: "classic" | "surface" + type: The type of the segmented control, either "single" for selecting one option or "multiple" for selecting multiple options. color_scheme: Override theme color for button radius: The radius of the segmented control: "none" | "small" | "medium" | "large" | "full" default_value: The default value of the segmented control. + value: The current value of the segmented control. style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -190,41 +174,21 @@ class SegmentedControlItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SegmentedControlItem": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/select.py b/reflex/components/radix/themes/components/select.py index fc10d00de..47a1eaf3f 100644 --- a/reflex/components/radix/themes/components/select.py +++ b/reflex/components/radix/themes/components/select.py @@ -5,7 +5,8 @@ from typing import List, Literal, Union import reflex as rx from reflex.components.component import Component, ComponentNamespace from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.event import empty_event, identity_event +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, @@ -47,10 +48,10 @@ class SelectRoot(RadixThemesComponent): _rename_props = {"onChange": "onValueChange"} # Fired when the value of the select changes. - on_change: rx.EventHandler[lambda e0: [e0]] + on_change: rx.EventHandler[identity_event(str)] # Fired when the select is opened or closed. - on_open_change: rx.EventHandler[lambda e0: [e0]] + on_open_change: rx.EventHandler[identity_event(bool)] class SelectTrigger(RadixThemesComponent): @@ -103,13 +104,13 @@ class SelectContent(RadixThemesComponent): align_offset: Var[int] # Fired when the select content is closed. - on_close_auto_focus: rx.EventHandler[lambda e0: [e0]] + on_close_auto_focus: rx.EventHandler[empty_event] # Fired when the escape key is pressed. - on_escape_key_down: rx.EventHandler[lambda e0: [e0]] + on_escape_key_down: rx.EventHandler[empty_event] # Fired when a pointer down event happens outside the select content. - on_pointer_down_outside: rx.EventHandler[lambda e0: [e0]] + on_pointer_down_outside: rx.EventHandler[empty_event] class SelectGroup(RadixThemesComponent): diff --git a/reflex/components/radix/themes/components/select.pyi b/reflex/components/radix/themes/components/select.pyi index e2657b7ce..e0e184482 100644 --- a/reflex/components/radix/themes/components/select.pyi +++ b/reflex/components/radix/themes/components/select.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -21,13 +21,13 @@ class SelectRoot(RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, default_value: Optional[Union[Var[str], str]] = None, @@ -43,45 +43,23 @@ class SelectRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SelectRoot": """Create a new component instance. @@ -120,76 +98,76 @@ class SelectTrigger(RadixThemesComponent): *children, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft", "ghost"]], - Literal["classic", "surface", "soft", "ghost"], + Literal["classic", "ghost", "soft", "surface"], + Var[Literal["classic", "ghost", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, placeholder: Optional[Union[Var[str], str]] = None, @@ -199,41 +177,21 @@ class SelectTrigger(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SelectTrigger": """Create a new component instance. @@ -267,88 +225,88 @@ class SelectContent(RadixThemesComponent): cls, *children, variant: Optional[ - Union[Var[Literal["solid", "soft"]], Literal["solid", "soft"]] + Union[Literal["soft", "solid"], Var[Literal["soft", "solid"]]] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, position: Optional[ Union[ - Var[Literal["item-aligned", "popper"]], Literal["item-aligned", "popper"], + Var[Literal["item-aligned", "popper"]], ] ] = None, side: Optional[ Union[ - Var[Literal["top", "right", "bottom", "left"]], - Literal["top", "right", "bottom", "left"], + Literal["bottom", "left", "right", "top"], + Var[Literal["bottom", "left", "right", "top"]], ] ] = None, side_offset: Optional[Union[Var[int], int]] = None, align: Optional[ Union[ - Var[Literal["start", "center", "end"]], - Literal["start", "center", "end"], + Literal["center", "end", "start"], + Var[Literal["center", "end", "start"]], ] ] = None, align_offset: Optional[Union[Var[int], int]] = None, @@ -358,50 +316,24 @@ class SelectContent(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_auto_focus: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_close_auto_focus: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SelectContent": """Create a new component instance. @@ -444,41 +376,21 @@ class SelectGroup(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SelectGroup": """Create a new component instance. @@ -515,41 +427,21 @@ class SelectItem(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SelectItem": """Create a new component instance. @@ -586,41 +478,21 @@ class SelectLabel(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SelectLabel": """Create a new component instance. @@ -655,41 +527,21 @@ class SelectSeparator(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SelectSeparator": """Create a new component instance. @@ -718,100 +570,100 @@ class HighLevelSelect(SelectRoot): def create( # type: ignore cls, *children, - items: Optional[Union[Var[List[str]], List[str]]] = None, + items: Optional[Union[List[str], Var[List[str]]]] = None, placeholder: Optional[Union[Var[str], str]] = None, label: Optional[Union[Var[str], str]] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft", "ghost"]], - Literal["classic", "surface", "soft", "ghost"], + Literal["classic", "ghost", "soft", "surface"], + Var[Literal["classic", "ghost", "soft", "surface"]], ] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, width: Optional[Union[Var[str], str]] = None, position: Optional[ Union[ - Var[Literal["item-aligned", "popper"]], Literal["item-aligned", "popper"], + Var[Literal["item-aligned", "popper"]], ] ] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, default_value: Optional[Union[Var[str], str]] = None, @@ -827,45 +679,23 @@ class HighLevelSelect(SelectRoot): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HighLevelSelect": """Create a select component. @@ -914,100 +744,100 @@ class Select(ComponentNamespace): @staticmethod def __call__( *children, - items: Optional[Union[Var[List[str]], List[str]]] = None, + items: Optional[Union[List[str], Var[List[str]]]] = None, placeholder: Optional[Union[Var[str], str]] = None, label: Optional[Union[Var[str], str]] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft", "ghost"]], - Literal["classic", "surface", "soft", "ghost"], + Literal["classic", "ghost", "soft", "surface"], + Var[Literal["classic", "ghost", "soft", "surface"]], ] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, width: Optional[Union[Var[str], str]] = None, position: Optional[ Union[ - Var[Literal["item-aligned", "popper"]], Literal["item-aligned", "popper"], + Var[Literal["item-aligned", "popper"]], ] ] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, default_value: Optional[Union[Var[str], str]] = None, @@ -1023,45 +853,23 @@ class Select(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HighLevelSelect": """Create a select component. diff --git a/reflex/components/radix/themes/components/separator.py b/reflex/components/radix/themes/components/separator.py index 81f83194b..1689717d2 100644 --- a/reflex/components/radix/themes/components/separator.py +++ b/reflex/components/radix/themes/components/separator.py @@ -3,8 +3,7 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive -from reflex.ivars.base import LiteralVar -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/components/separator.pyi b/reflex/components/radix/themes/components/separator.pyi index 15670f51a..0f2895403 100644 --- a/reflex/components/radix/themes/components/separator.pyi +++ b/reflex/components/radix/themes/components/separator.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -22,88 +22,88 @@ class Separator(RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4"]], + Literal["1", "2", "3", "4"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"], ] ], - Literal["1", "2", "3", "4"], - Breakpoints[str, Literal["1", "2", "3", "4"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, orientation: Optional[ Union[ + Breakpoints[str, Literal["horizontal", "vertical"]], + Literal["horizontal", "vertical"], Var[ Union[ Breakpoints[str, Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], ] ], - Literal["horizontal", "vertical"], - Breakpoints[str, Literal["horizontal", "vertical"]], ] ] = None, decorative: Optional[Union[Var[bool], bool]] = None, @@ -113,41 +113,21 @@ class Separator(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Separator": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/skeleton.py b/reflex/components/radix/themes/components/skeleton.py index 0738512aa..1fb6390a1 100644 --- a/reflex/components/radix/themes/components/skeleton.py +++ b/reflex/components/radix/themes/components/skeleton.py @@ -1,7 +1,7 @@ """Skeleton theme from Radix components.""" from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixLoadingProp, RadixThemesComponent diff --git a/reflex/components/radix/themes/components/skeleton.pyi b/reflex/components/radix/themes/components/skeleton.pyi index d6c6bbb03..61b57c275 100644 --- a/reflex/components/radix/themes/components/skeleton.pyi +++ b/reflex/components/radix/themes/components/skeleton.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixLoadingProp, RadixThemesComponent @@ -19,22 +19,22 @@ class Skeleton(RadixLoadingProp, RadixThemesComponent): cls, *children, width: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, min_width: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, max_width: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, height: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, min_height: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, max_height: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, loading: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, @@ -43,41 +43,21 @@ class Skeleton(RadixLoadingProp, RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Skeleton": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/slider.py b/reflex/components/radix/themes/components/slider.py index c03fffe7b..0d99eda27 100644 --- a/reflex/components/radix/themes/components/slider.py +++ b/reflex/components/radix/themes/components/slider.py @@ -1,11 +1,13 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import List, Literal, Optional, Union +from __future__ import annotations + +from typing import List, Literal, Optional, Tuple, Union from reflex.components.component import Component from reflex.components.core.breakpoints import Responsive from reflex.event import EventHandler -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, @@ -13,6 +15,20 @@ from ..base import ( ) +def on_value_event_spec( + value: Var[List[int | float]], +) -> Tuple[Var[List[int | float]]]: + """Event handler spec for the value event. + + Args: + value: The value of the event. + + Returns: + The event handler spec. + """ + return (value,) # type: ignore + + class Slider(RadixThemesComponent): """Provides user selection from a range of values.""" @@ -64,10 +80,10 @@ class Slider(RadixThemesComponent): _rename_props = {"onChange": "onValueChange"} # Fired when the value of the slider changes. - on_change: EventHandler[lambda e0: [e0]] + on_change: EventHandler[on_value_event_spec] # Fired when a thumb is released after being dragged. - on_value_commit: EventHandler[lambda e0: [e0]] + on_value_commit: EventHandler[on_value_event_spec] @classmethod def create( diff --git a/reflex/components/radix/themes/components/slider.pyi b/reflex/components/radix/themes/components/slider.pyi index 362451bfe..dec836835 100644 --- a/reflex/components/radix/themes/components/slider.pyi +++ b/reflex/components/radix/themes/components/slider.pyi @@ -3,15 +3,19 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent +def on_value_event_spec( + value: Var[List[int | float]], +) -> Tuple[Var[List[int | float]]]: ... + class Slider(RadixThemesComponent): @overload @classmethod @@ -22,99 +26,99 @@ class Slider(RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "full"]], Literal["none", "small", "full"] + Literal["full", "none", "small"], Var[Literal["full", "none", "small"]] ] ] = None, default_value: Optional[ Union[ - Var[Union[List[Union[float, int]], float, int]], List[Union[float, int]], + Var[Union[List[Union[float, int]], float, int]], float, int, ] ] = None, value: Optional[ - Union[Var[List[Union[float, int]]], List[Union[float, int]]] + Union[List[Union[float, int]], Var[List[Union[float, int]]]] ] = None, name: Optional[Union[Var[str], str]] = None, min: Optional[Union[Var[Union[float, int]], float, int]] = None, @@ -123,8 +127,8 @@ class Slider(RadixThemesComponent): disabled: Optional[Union[Var[bool], bool]] = None, orientation: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, style: Optional[Style] = None, @@ -133,45 +137,23 @@ class Slider(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_value_commit: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[List[int | float]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + on_value_commit: Optional[EventType[List[int | float]]] = None, **props, ) -> "Slider": """Create a Slider component. diff --git a/reflex/components/radix/themes/components/spinner.py b/reflex/components/radix/themes/components/spinner.py index 22f5bba0b..cc29d6091 100644 --- a/reflex/components/radix/themes/components/spinner.py +++ b/reflex/components/radix/themes/components/spinner.py @@ -3,7 +3,7 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( RadixLoadingProp, diff --git a/reflex/components/radix/themes/components/spinner.pyi b/reflex/components/radix/themes/components/spinner.pyi index 7fa62734a..87033f05c 100644 --- a/reflex/components/radix/themes/components/spinner.pyi +++ b/reflex/components/radix/themes/components/spinner.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixLoadingProp, RadixThemesComponent @@ -22,13 +22,13 @@ class Spinner(RadixLoadingProp, RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, loading: Optional[Union[Var[bool], bool]] = None, @@ -38,41 +38,21 @@ class Spinner(RadixLoadingProp, RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Spinner": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/switch.py b/reflex/components/radix/themes/components/switch.py index f5109faf5..13be32d83 100644 --- a/reflex/components/radix/themes/components/switch.py +++ b/reflex/components/radix/themes/components/switch.py @@ -3,8 +3,8 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, identity_event +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, @@ -59,7 +59,7 @@ class Switch(RadixThemesComponent): _rename_props = {"onChange": "onCheckedChange"} # Fired when the value of the switch changes - on_change: EventHandler[lambda checked: [checked]] + on_change: EventHandler[identity_event(bool)] switch = Switch.create diff --git a/reflex/components/radix/themes/components/switch.pyi b/reflex/components/radix/themes/components/switch.pyi index a0f85dbac..f8871872a 100644 --- a/reflex/components/radix/themes/components/switch.pyi +++ b/reflex/components/radix/themes/components/switch.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -29,87 +29,87 @@ class Switch(RadixThemesComponent): value: Optional[Union[Var[str], str]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "full"]], Literal["none", "small", "full"] + Literal["full", "none", "small"], Var[Literal["full", "none", "small"]] ] ] = None, style: Optional[Style] = None, @@ -118,42 +118,22 @@ class Switch(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[bool]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Switch": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/table.py b/reflex/components/radix/themes/components/table.py index 27b0e3563..e1f03d4e2 100644 --- a/reflex/components/radix/themes/components/table.py +++ b/reflex/components/radix/themes/components/table.py @@ -5,7 +5,7 @@ from typing import List, Literal from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( RadixThemesComponent, diff --git a/reflex/components/radix/themes/components/table.pyi b/reflex/components/radix/themes/components/table.pyi index 9cac240f2..8b1ef355f 100644 --- a/reflex/components/radix/themes/components/table.pyi +++ b/reflex/components/radix/themes/components/table.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -22,85 +22,65 @@ class TableRoot(elements.Table, RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ - Union[Var[Literal["surface", "ghost"]], Literal["surface", "ghost"]] + Union[Literal["ghost", "surface"], Var[Literal["ghost", "surface"]]] ] = None, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - summary: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + summary: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TableRoot": """Create a new component instance. @@ -149,72 +129,52 @@ class TableHeader(elements.Thead, RadixThemesComponent): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TableHeader": """Create a new component instance. @@ -262,75 +222,55 @@ class TableRow(elements.Tr, RadixThemesComponent): *children, align: Optional[ Union[ - Var[Literal["start", "center", "end", "baseline"]], - Literal["start", "center", "end", "baseline"], + Literal["baseline", "center", "end", "start"], + Var[Literal["baseline", "center", "end", "start"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TableRow": """Create a new component instance. @@ -378,80 +318,60 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent): *children, justify: Optional[ Union[ - Var[Literal["start", "center", "end"]], - Literal["start", "center", "end"], + Literal["center", "end", "start"], + Var[Literal["center", "end", "start"]], ] ] = None, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - col_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - headers: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - row_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - scope: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + row_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + scope: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TableColumnHeaderCell": """Create a new component instance. @@ -502,72 +422,52 @@ class TableBody(elements.Tbody, RadixThemesComponent): def create( # type: ignore cls, *children, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TableBody": """Create a new component instance. @@ -615,79 +515,59 @@ class TableCell(elements.Td, RadixThemesComponent): *children, justify: Optional[ Union[ - Var[Literal["start", "center", "end"]], - Literal["start", "center", "end"], + Literal["center", "end", "start"], + Var[Literal["center", "end", "start"]], ] ] = None, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - col_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - headers: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - row_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + row_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TableCell": """Create a new component instance. @@ -739,80 +619,60 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent): *children, justify: Optional[ Union[ - Var[Literal["start", "center", "end"]], - Literal["start", "center", "end"], + Literal["center", "end", "start"], + Var[Literal["center", "end", "start"]], ] ] = None, - align: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - col_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - headers: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - row_span: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - scope: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + row_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + scope: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TableRowHeaderCell": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/tabs.py b/reflex/components/radix/themes/components/tabs.py index 08e09262b..12359b528 100644 --- a/reflex/components/radix/themes/components/tabs.py +++ b/reflex/components/radix/themes/components/tabs.py @@ -7,8 +7,8 @@ from typing import Any, Dict, List, Literal from reflex.components.component import Component, ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.core.colors import color -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, identity_event +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, @@ -42,7 +42,7 @@ class TabsRoot(RadixThemesComponent): _rename_props = {"onChange": "onValueChange"} # Fired when the value of the tabs changes. - on_change: EventHandler[lambda e0: [e0]] + on_change: EventHandler[identity_event(str)] def add_style(self) -> Dict[str, Any] | None: """Add style for the component. diff --git a/reflex/components/radix/themes/components/tabs.pyi b/reflex/components/radix/themes/components/tabs.pyi index 0fb33b16d..4272bf2a3 100644 --- a/reflex/components/radix/themes/components/tabs.pyi +++ b/reflex/components/radix/themes/components/tabs.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -26,13 +26,13 @@ class TabsRoot(RadixThemesComponent): value: Optional[Union[Var[str], str]] = None, orientation: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, - dir: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None, + dir: Optional[Union[Literal["ltr", "rtl"], Var[Literal["ltr", "rtl"]]]] = None, activation_mode: Optional[ - Union[Var[Literal["automatic", "manual"]], Literal["automatic", "manual"]] + Union[Literal["automatic", "manual"], Var[Literal["automatic", "manual"]]] ] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -40,42 +40,22 @@ class TabsRoot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TabsRoot": """Create a new component instance. @@ -112,9 +92,9 @@ class TabsList(RadixThemesComponent): *children, size: Optional[ Union[ - Var[Union[Breakpoints[str, Literal["1", "2"]], Literal["1", "2"]]], - Literal["1", "2"], Breakpoints[str, Literal["1", "2"]], + Literal["1", "2"], + Var[Union[Breakpoints[str, Literal["1", "2"]], Literal["1", "2"]]], ] ] = None, loop: Optional[Union[Var[bool], bool]] = None, @@ -124,41 +104,21 @@ class TabsList(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TabsList": """Create a new component instance. @@ -193,63 +153,63 @@ class TabsTrigger(RadixThemesComponent): disabled: Optional[Union[Var[bool], bool]] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -259,41 +219,21 @@ class TabsTrigger(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TabsTrigger": """Create a TabsTrigger component. @@ -333,41 +273,21 @@ class TabsContent(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TabsContent": """Create a new component instance. @@ -405,13 +325,13 @@ class Tabs(ComponentNamespace): value: Optional[Union[Var[str], str]] = None, orientation: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, - dir: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None, + dir: Optional[Union[Literal["ltr", "rtl"], Var[Literal["ltr", "rtl"]]]] = None, activation_mode: Optional[ - Union[Var[Literal["automatic", "manual"]], Literal["automatic", "manual"]] + Union[Literal["automatic", "manual"], Var[Literal["automatic", "manual"]]] ] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -419,42 +339,22 @@ class Tabs(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TabsRoot": """Create a new component instance. diff --git a/reflex/components/radix/themes/components/text_area.py b/reflex/components/radix/themes/components/text_area.py index 5218f1d7b..9f006c2e3 100644 --- a/reflex/components/radix/themes/components/text_area.py +++ b/reflex/components/radix/themes/components/text_area.py @@ -6,8 +6,7 @@ from reflex.components.component import Component from reflex.components.core.breakpoints import Responsive from reflex.components.core.debounce import DebounceInput from reflex.components.el import elements -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, @@ -82,21 +81,6 @@ class TextArea(RadixThemesComponent, elements.Textarea): # How the text in the textarea is to be wrapped when submitting the form wrap: Var[str] - # Fired when the value of the textarea changes. - on_change: EventHandler[lambda e0: [e0.target.value]] - - # Fired when the textarea is focused. - on_focus: EventHandler[lambda e0: [e0.target.value]] - - # Fired when the textarea is blurred. - on_blur: EventHandler[lambda e0: [e0.target.value]] - - # Fired when a key is pressed down. - on_key_down: EventHandler[lambda e0: [e0.key]] - - # Fired when a key is released. - on_key_up: EventHandler[lambda e0: [e0.key]] - @classmethod def create(cls, *children, **props) -> Component: """Create an Input component. diff --git a/reflex/components/radix/themes/components/text_area.pyi b/reflex/components/radix/themes/components/text_area.pyi index 9a8a47873..f234d9150 100644 --- a/reflex/components/radix/themes/components/text_area.pyi +++ b/reflex/components/radix/themes/components/text_area.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -24,108 +24,108 @@ class TextArea(RadixThemesComponent, elements.Textarea): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, resize: Optional[ Union[ + Breakpoints[str, Literal["both", "horizontal", "none", "vertical"]], + Literal["both", "horizontal", "none", "vertical"], Var[ Union[ Breakpoints[ - str, Literal["none", "vertical", "horizontal", "both"] + str, Literal["both", "horizontal", "none", "vertical"] ], - Literal["none", "vertical", "horizontal", "both"], + Literal["both", "horizontal", "none", "vertical"], ] ], - Literal["none", "vertical", "horizontal", "both"], - Breakpoints[str, Literal["none", "vertical", "horizontal", "both"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, auto_complete: Optional[Union[Var[bool], bool]] = None, auto_focus: Optional[Union[Var[bool], bool]] = None, dirname: Optional[Union[Var[str], str]] = None, disabled: Optional[Union[Var[bool], bool]] = None, - form: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, max_length: Optional[Union[Var[int], int]] = None, min_length: Optional[Union[Var[int], int]] = None, name: Optional[Union[Var[str], str]] = None, @@ -136,78 +136,56 @@ class TextArea(RadixThemesComponent, elements.Textarea): value: Optional[Union[Var[str], str]] = None, wrap: Optional[Union[Var[str], str]] = None, auto_height: Optional[Union[Var[bool], bool]] = None, - cols: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cols: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_submit: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[str]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[str]] = None, + on_key_down: Optional[EventType[str]] = None, + on_key_up: Optional[EventType[str]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TextArea": """Create an Input component. diff --git a/reflex/components/radix/themes/components/text_field.py b/reflex/components/radix/themes/components/text_field.py index 2ab850b13..4277e93e0 100644 --- a/reflex/components/radix/themes/components/text_field.py +++ b/reflex/components/radix/themes/components/text_field.py @@ -8,8 +8,8 @@ from reflex.components.component import Component, ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.core.debounce import DebounceInput from reflex.components.el import elements -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, input_event, key_event +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, @@ -72,19 +72,19 @@ class TextFieldRoot(elements.Div, RadixThemesComponent): value: Var[Union[str, int, float]] # Fired when the value of the textarea changes. - on_change: EventHandler[lambda e0: [e0.target.value]] + on_change: EventHandler[input_event] # Fired when the textarea is focused. - on_focus: EventHandler[lambda e0: [e0.target.value]] + on_focus: EventHandler[input_event] # Fired when the textarea is blurred. - on_blur: EventHandler[lambda e0: [e0.target.value]] + on_blur: EventHandler[input_event] # Fired when a key is pressed down. - on_key_down: EventHandler[lambda e0: [e0.key]] + on_key_down: EventHandler[key_event] # Fired when a key is released. - on_key_up: EventHandler[lambda e0: [e0.key]] + on_key_up: EventHandler[key_event] @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/radix/themes/components/text_field.pyi b/reflex/components/radix/themes/components/text_field.pyi index be58b8e7f..7ea0860b5 100644 --- a/reflex/components/radix/themes/components/text_field.pyi +++ b/reflex/components/radix/themes/components/text_field.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -25,87 +25,87 @@ class TextFieldRoot(elements.Div, RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, auto_complete: Optional[Union[Var[bool], bool]] = None, @@ -118,77 +118,55 @@ class TextFieldRoot(elements.Div, RadixThemesComponent): read_only: Optional[Union[Var[bool], bool]] = None, required: Optional[Union[Var[bool], bool]] = None, type: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[Union[float, int, str]], str, int, float]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + value: Optional[Union[Var[Union[float, int, str]], float, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[str]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[str]] = None, + on_key_down: Optional[EventType[str]] = None, + on_key_up: Optional[EventType[str]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TextFieldRoot": """Create an Input component. @@ -247,63 +225,63 @@ class TextFieldSlot(RadixThemesComponent): *children, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, @@ -313,41 +291,21 @@ class TextFieldSlot(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TextFieldSlot": """Create a new component instance. @@ -379,87 +337,87 @@ class TextField(ComponentNamespace): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, variant: Optional[ Union[ - Var[Literal["classic", "surface", "soft"]], - Literal["classic", "surface", "soft"], + Literal["classic", "soft", "surface"], + Var[Literal["classic", "soft", "surface"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, radius: Optional[ Union[ - Var[Literal["none", "small", "medium", "large", "full"]], - Literal["none", "small", "medium", "large", "full"], + Literal["full", "large", "medium", "none", "small"], + Var[Literal["full", "large", "medium", "none", "small"]], ] ] = None, auto_complete: Optional[Union[Var[bool], bool]] = None, @@ -472,77 +430,55 @@ class TextField(ComponentNamespace): read_only: Optional[Union[Var[bool], bool]] = None, required: Optional[Union[Var[bool], bool]] = None, type: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[Union[float, int, str]], str, int, float]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + value: Optional[Union[Var[Union[float, int, str]], float, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[str]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[str]] = None, + on_key_down: Optional[EventType[str]] = None, + on_key_up: Optional[EventType[str]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "TextFieldRoot": """Create an Input component. diff --git a/reflex/components/radix/themes/components/tooltip.py b/reflex/components/radix/themes/components/tooltip.py index 9a1355be5..ac35c86d1 100644 --- a/reflex/components/radix/themes/components/tooltip.py +++ b/reflex/components/radix/themes/components/tooltip.py @@ -3,9 +3,9 @@ from typing import Dict, Literal, Union from reflex.components.component import Component -from reflex.event import EventHandler +from reflex.event import EventHandler, empty_event, identity_event from reflex.utils import format -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( RadixThemesComponent, @@ -85,13 +85,13 @@ class Tooltip(RadixThemesComponent): aria_label: Var[str] # Fired when the open state changes. - on_open_change: EventHandler[lambda e0: [e0.target.value]] + on_open_change: EventHandler[identity_event(bool)] # Fired when the escape key is pressed. - on_escape_key_down: EventHandler[lambda e0: [e0.target.value]] + on_escape_key_down: EventHandler[empty_event] # Fired when the pointer is down outside the tooltip. - on_pointer_down_outside: EventHandler[lambda e0: [e0.target.value]] + on_pointer_down_outside: EventHandler[empty_event] @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/radix/themes/components/tooltip.pyi b/reflex/components/radix/themes/components/tooltip.pyi index a2344958f..e78dd926d 100644 --- a/reflex/components/radix/themes/components/tooltip.pyi +++ b/reflex/components/radix/themes/components/tooltip.pyi @@ -3,11 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload -from reflex.event import EventHandler, EventSpec +from reflex.event import ( + EventType, +) from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -26,30 +28,30 @@ class Tooltip(RadixThemesComponent): open: Optional[Union[Var[bool], bool]] = None, side: Optional[ Union[ - Var[Literal["top", "right", "bottom", "left"]], - Literal["top", "right", "bottom", "left"], + Literal["bottom", "left", "right", "top"], + Var[Literal["bottom", "left", "right", "top"]], ] ] = None, side_offset: Optional[Union[Var[Union[float, int]], float, int]] = None, align: Optional[ Union[ - Var[Literal["start", "center", "end"]], - Literal["start", "center", "end"], + Literal["center", "end", "start"], + Var[Literal["center", "end", "start"]], ] ] = None, align_offset: Optional[Union[Var[Union[float, int]], float, int]] = None, avoid_collisions: Optional[Union[Var[bool], bool]] = None, collision_padding: Optional[ Union[ + Dict[str, Union[float, int]], Var[Union[Dict[str, Union[float, int]], float, int]], float, int, - Dict[str, Union[float, int]], ] ] = None, arrow_padding: Optional[Union[Var[Union[float, int]], float, int]] = None, sticky: Optional[ - Union[Var[Literal["partial", "always"]], Literal["partial", "always"]] + Union[Literal["always", "partial"], Var[Literal["always", "partial"]]] ] = None, hide_when_detached: Optional[Union[Var[bool], bool]] = None, delay_duration: Optional[Union[Var[Union[float, int]], float, int]] = None, @@ -62,50 +64,24 @@ class Tooltip(RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_escape_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pointer_down_outside: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_escape_key_down: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_pointer_down_outside: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Tooltip": """Initialize the Tooltip component. diff --git a/reflex/components/radix/themes/layout/__init__.pyi b/reflex/components/radix/themes/layout/__init__.pyi index 1420299e0..6712a3068 100644 --- a/reflex/components/radix/themes/layout/__init__.pyi +++ b/reflex/components/radix/themes/layout/__init__.pyi @@ -9,6 +9,7 @@ from .container import container as container from .flex import flex as flex from .grid import grid as grid from .list import list_item as list_item +from .list import list_ns as list # noqa from .list import ordered_list as ordered_list from .list import unordered_list as unordered_list from .section import section as section diff --git a/reflex/components/radix/themes/layout/base.py b/reflex/components/radix/themes/layout/base.py index dd598538e..3ee78d209 100644 --- a/reflex/components/radix/themes/layout/base.py +++ b/reflex/components/radix/themes/layout/base.py @@ -5,7 +5,7 @@ from __future__ import annotations from typing import Literal from reflex.components.core.breakpoints import Responsive -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( CommonMarginProps, diff --git a/reflex/components/radix/themes/layout/base.pyi b/reflex/components/radix/themes/layout/base.pyi index 21fed38ef..df51b07f9 100644 --- a/reflex/components/radix/themes/layout/base.pyi +++ b/reflex/components/radix/themes/layout/base.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import CommonMarginProps, RadixThemesComponent @@ -22,6 +22,10 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): *children, p: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -31,14 +35,14 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, px: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -48,14 +52,14 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, py: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -65,14 +69,14 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, pt: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -82,14 +86,14 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, pr: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -99,14 +103,14 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, pb: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -116,14 +120,14 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, pl: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -133,66 +137,62 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, flex_shrink: Optional[ Union[ - Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]], - Literal["0", "1"], Breakpoints[str, Literal["0", "1"]], + Literal["0", "1"], + Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]], ] ] = None, flex_grow: Optional[ Union[ - Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]], - Literal["0", "1"], Breakpoints[str, Literal["0", "1"]], + Literal["0", "1"], + Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]], ] ] = None, m: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, mx: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, my: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, mt: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, mr: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, mb: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, ml: Optional[ Union[ - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, style: Optional[Style] = None, @@ -201,41 +201,21 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "LayoutComponent": """Create a new component instance. diff --git a/reflex/components/radix/themes/layout/box.pyi b/reflex/components/radix/themes/layout/box.pyi index 6bcd75cad..895725a35 100644 --- a/reflex/components/radix/themes/layout/box.pyi +++ b/reflex/components/radix/themes/layout/box.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -18,71 +18,51 @@ class Box(elements.Div, RadixThemesComponent): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Box": """Create a new component instance. diff --git a/reflex/components/radix/themes/layout/center.pyi b/reflex/components/radix/themes/layout/center.pyi index 93f884898..eb976892e 100644 --- a/reflex/components/radix/themes/layout/center.pyi +++ b/reflex/components/radix/themes/layout/center.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .flex import Flex @@ -22,64 +22,68 @@ class Center(Flex): as_child: Optional[Union[Var[bool], bool]] = None, direction: Optional[ Union[ + Breakpoints[ + str, Literal["column", "column-reverse", "row", "row-reverse"] + ], + Literal["column", "column-reverse", "row", "row-reverse"], Var[ Union[ Breakpoints[ str, - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], ], - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], ] ], - Literal["row", "column", "row-reverse", "column-reverse"], - Breakpoints[ - str, Literal["row", "column", "row-reverse", "column-reverse"] - ], ] ] = None, align: Optional[ Union[ + Breakpoints[ + str, Literal["baseline", "center", "end", "start", "stretch"] + ], + Literal["baseline", "center", "end", "start", "stretch"], Var[ Union[ Breakpoints[ str, - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ], - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ] ], - Literal["start", "center", "end", "baseline", "stretch"], - Breakpoints[ - str, Literal["start", "center", "end", "baseline", "stretch"] - ], ] ] = None, justify: Optional[ Union[ + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], Var[ Union[ - Breakpoints[str, Literal["start", "center", "end", "between"]], - Literal["start", "center", "end", "between"], + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], ] ], - Literal["start", "center", "end", "between"], - Breakpoints[str, Literal["start", "center", "end", "between"]], ] ] = None, wrap: Optional[ Union[ + Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], + Literal["nowrap", "wrap", "wrap-reverse"], Var[ Union[ Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], Literal["nowrap", "wrap", "wrap-reverse"], ] ], - Literal["nowrap", "wrap", "wrap-reverse"], - Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], ] ] = None, spacing: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -89,77 +93,53 @@ class Center(Flex): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Center": """Create a new component instance. diff --git a/reflex/components/radix/themes/layout/container.py b/reflex/components/radix/themes/layout/container.py index 4ed18031d..b1d2fbed3 100644 --- a/reflex/components/radix/themes/layout/container.py +++ b/reflex/components/radix/themes/layout/container.py @@ -6,9 +6,8 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.ivars.base import LiteralVar from reflex.style import STACK_CHILDREN_FULL_WIDTH -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var from ..base import RadixThemesComponent diff --git a/reflex/components/radix/themes/layout/container.pyi b/reflex/components/radix/themes/layout/container.pyi index 3c2013b8e..a5e50b9f3 100644 --- a/reflex/components/radix/themes/layout/container.pyi +++ b/reflex/components/radix/themes/layout/container.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -25,81 +25,61 @@ class Container(elements.Div, RadixThemesComponent): stack_children_full_width: Optional[bool] = False, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4"]], + Literal["1", "2", "3", "4"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"], ] ], - Literal["1", "2", "3", "4"], - Breakpoints[str, Literal["1", "2", "3", "4"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Container": """Create the container component. diff --git a/reflex/components/radix/themes/layout/flex.py b/reflex/components/radix/themes/layout/flex.py index 825c84f42..8be16973d 100644 --- a/reflex/components/radix/themes/layout/flex.py +++ b/reflex/components/radix/themes/layout/flex.py @@ -6,7 +6,7 @@ from typing import Dict, Literal from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAlign, diff --git a/reflex/components/radix/themes/layout/flex.pyi b/reflex/components/radix/themes/layout/flex.pyi index a49f08262..aba864f4f 100644 --- a/reflex/components/radix/themes/layout/flex.pyi +++ b/reflex/components/radix/themes/layout/flex.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -25,64 +25,68 @@ class Flex(elements.Div, RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, direction: Optional[ Union[ + Breakpoints[ + str, Literal["column", "column-reverse", "row", "row-reverse"] + ], + Literal["column", "column-reverse", "row", "row-reverse"], Var[ Union[ Breakpoints[ str, - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], ], - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], ] ], - Literal["row", "column", "row-reverse", "column-reverse"], - Breakpoints[ - str, Literal["row", "column", "row-reverse", "column-reverse"] - ], ] ] = None, align: Optional[ Union[ + Breakpoints[ + str, Literal["baseline", "center", "end", "start", "stretch"] + ], + Literal["baseline", "center", "end", "start", "stretch"], Var[ Union[ Breakpoints[ str, - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ], - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ] ], - Literal["start", "center", "end", "baseline", "stretch"], - Breakpoints[ - str, Literal["start", "center", "end", "baseline", "stretch"] - ], ] ] = None, justify: Optional[ Union[ + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], Var[ Union[ - Breakpoints[str, Literal["start", "center", "end", "between"]], - Literal["start", "center", "end", "between"], + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], ] ], - Literal["start", "center", "end", "between"], - Breakpoints[str, Literal["start", "center", "end", "between"]], ] ] = None, wrap: Optional[ Union[ + Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], + Literal["nowrap", "wrap", "wrap-reverse"], Var[ Union[ Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], Literal["nowrap", "wrap", "wrap-reverse"], ] ], - Literal["nowrap", "wrap", "wrap-reverse"], - Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], ] ] = None, spacing: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -92,77 +96,53 @@ class Flex(elements.Div, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Flex": """Create a new component instance. diff --git a/reflex/components/radix/themes/layout/grid.py b/reflex/components/radix/themes/layout/grid.py index ab7fbdb3b..b9ac28d41 100644 --- a/reflex/components/radix/themes/layout/grid.py +++ b/reflex/components/radix/themes/layout/grid.py @@ -6,7 +6,7 @@ from typing import Dict, Literal from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAlign, diff --git a/reflex/components/radix/themes/layout/grid.pyi b/reflex/components/radix/themes/layout/grid.pyi index c11d1dfcd..faf63712e 100644 --- a/reflex/components/radix/themes/layout/grid.pyi +++ b/reflex/components/radix/themes/layout/grid.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -23,61 +23,65 @@ class Grid(elements.Div, RadixThemesComponent): *children, as_child: Optional[Union[Var[bool], bool]] = None, columns: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, rows: Optional[ - Union[Var[Union[Breakpoints[str, str], str]], str, Breakpoints[str, str]] + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] ] = None, flow: Optional[ Union[ + Breakpoints[ + str, Literal["column", "column-dense", "dense", "row", "row-dense"] + ], + Literal["column", "column-dense", "dense", "row", "row-dense"], Var[ Union[ Breakpoints[ str, Literal[ - "row", "column", "dense", "row-dense", "column-dense" + "column", "column-dense", "dense", "row", "row-dense" ], ], - Literal["row", "column", "dense", "row-dense", "column-dense"], + Literal["column", "column-dense", "dense", "row", "row-dense"], ] ], - Literal["row", "column", "dense", "row-dense", "column-dense"], - Breakpoints[ - str, Literal["row", "column", "dense", "row-dense", "column-dense"] - ], ] ] = None, align: Optional[ Union[ + Breakpoints[ + str, Literal["baseline", "center", "end", "start", "stretch"] + ], + Literal["baseline", "center", "end", "start", "stretch"], Var[ Union[ Breakpoints[ str, - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ], - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ] ], - Literal["start", "center", "end", "baseline", "stretch"], - Breakpoints[ - str, Literal["start", "center", "end", "baseline", "stretch"] - ], ] ] = None, justify: Optional[ Union[ + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], Var[ Union[ - Breakpoints[str, Literal["start", "center", "end", "between"]], - Literal["start", "center", "end", "between"], + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], ] ], - Literal["start", "center", "end", "between"], - Breakpoints[str, Literal["start", "center", "end", "between"]], ] ] = None, spacing: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -87,14 +91,14 @@ class Grid(elements.Div, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, spacing_x: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -104,14 +108,14 @@ class Grid(elements.Div, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, spacing_y: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -121,77 +125,53 @@ class Grid(elements.Div, RadixThemesComponent): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Grid": """Create a new component instance. diff --git a/reflex/components/radix/themes/layout/list.py b/reflex/components/radix/themes/layout/list.py index fb77b223d..699028380 100644 --- a/reflex/components/radix/themes/layout/list.py +++ b/reflex/components/radix/themes/layout/list.py @@ -9,7 +9,7 @@ from reflex.components.core.foreach import Foreach from reflex.components.el.elements.typography import Li, Ol, Ul from reflex.components.lucide.icon import Icon from reflex.components.radix.themes.typography.text import Text -from reflex.vars import Var +from reflex.vars.base import Var LiteralListStyleTypeUnordered = Literal[ "none", diff --git a/reflex/components/radix/themes/layout/list.pyi b/reflex/components/radix/themes/layout/list.pyi index bf8da641c..b72afbaa7 100644 --- a/reflex/components/radix/themes/layout/list.pyi +++ b/reflex/components/radix/themes/layout/list.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Iterable, Literal, Optional, Union, overload +from typing import Any, Dict, Iterable, Literal, Optional, Union, overload from reflex.components.component import Component, ComponentNamespace from reflex.components.el.elements.typography import Li, Ol, Ul -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var LiteralListStyleTypeUnordered = Literal["none", "disc", "circle", "square"] LiteralListStyleTypeOrdered = Literal[ @@ -35,47 +35,47 @@ class BaseList(Component): def create( # type: ignore cls, *children, - items: Optional[Union[Var[Iterable], Iterable]] = None, + items: Optional[Union[Iterable, Var[Iterable]]] = None, list_style_type: Optional[ Union[ + Literal[ + "armenian", + "decimal", + "decimal-leading-zero", + "georgian", + "hiragana", + "katakana", + "lower-alpha", + "lower-greek", + "lower-latin", + "lower-roman", + "none", + "upper-alpha", + "upper-latin", + "upper-roman", + ], + Literal["circle", "disc", "none", "square"], Var[ Union[ Literal[ - "none", + "armenian", "decimal", "decimal-leading-zero", - "lower-roman", - "upper-roman", - "lower-greek", - "lower-latin", - "upper-latin", - "armenian", "georgian", - "lower-alpha", - "upper-alpha", "hiragana", "katakana", + "lower-alpha", + "lower-greek", + "lower-latin", + "lower-roman", + "none", + "upper-alpha", + "upper-latin", + "upper-roman", ], - Literal["none", "disc", "circle", "square"], + Literal["circle", "disc", "none", "square"], ] ], - Literal["none", "disc", "circle", "square"], - Literal[ - "none", - "decimal", - "decimal-leading-zero", - "lower-roman", - "upper-roman", - "lower-greek", - "lower-latin", - "upper-latin", - "armenian", - "georgian", - "lower-alpha", - "upper-alpha", - "hiragana", - "katakana", - ], ] ] = None, style: Optional[Style] = None, @@ -84,41 +84,21 @@ class BaseList(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "BaseList": """Create a list component. @@ -149,73 +129,53 @@ class UnorderedList(BaseList, Ul): def create( # type: ignore cls, *children, - items: Optional[Union[Var[Iterable], Iterable]] = None, + items: Optional[Union[Iterable, Var[Iterable]]] = None, list_style_type: Optional[LiteralListStyleTypeUnordered] = "disc", - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "UnorderedList": """Create a unordered list component. @@ -260,76 +220,56 @@ class OrderedList(BaseList, Ol): def create( # type: ignore cls, *children, - items: Optional[Union[Var[Iterable], Iterable]] = None, + items: Optional[Union[Iterable, Var[Iterable]]] = None, list_style_type: Optional[LiteralListStyleTypeOrdered] = "decimal", - reversed: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - start: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + reversed: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + start: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "OrderedList": """Create an ordered list component. @@ -377,71 +317,51 @@ class ListItem(Li): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ListItem": """Create a list item component. @@ -486,47 +406,47 @@ class List(ComponentNamespace): @staticmethod def __call__( *children, - items: Optional[Union[Var[Iterable], Iterable]] = None, + items: Optional[Union[Iterable, Var[Iterable]]] = None, list_style_type: Optional[ Union[ + Literal[ + "armenian", + "decimal", + "decimal-leading-zero", + "georgian", + "hiragana", + "katakana", + "lower-alpha", + "lower-greek", + "lower-latin", + "lower-roman", + "none", + "upper-alpha", + "upper-latin", + "upper-roman", + ], + Literal["circle", "disc", "none", "square"], Var[ Union[ Literal[ - "none", + "armenian", "decimal", "decimal-leading-zero", - "lower-roman", - "upper-roman", - "lower-greek", - "lower-latin", - "upper-latin", - "armenian", "georgian", - "lower-alpha", - "upper-alpha", "hiragana", "katakana", + "lower-alpha", + "lower-greek", + "lower-latin", + "lower-roman", + "none", + "upper-alpha", + "upper-latin", + "upper-roman", ], - Literal["none", "disc", "circle", "square"], + Literal["circle", "disc", "none", "square"], ] ], - Literal["none", "disc", "circle", "square"], - Literal[ - "none", - "decimal", - "decimal-leading-zero", - "lower-roman", - "upper-roman", - "lower-greek", - "lower-latin", - "upper-latin", - "armenian", - "georgian", - "lower-alpha", - "upper-alpha", - "hiragana", - "katakana", - ], ] ] = None, style: Optional[Style] = None, @@ -535,41 +455,21 @@ class List(ComponentNamespace): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "BaseList": """Create a list component. diff --git a/reflex/components/radix/themes/layout/section.py b/reflex/components/radix/themes/layout/section.py index a3e58be86..68a131751 100644 --- a/reflex/components/radix/themes/layout/section.py +++ b/reflex/components/radix/themes/layout/section.py @@ -6,8 +6,7 @@ from typing import Literal from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.ivars.base import LiteralVar -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var from ..base import RadixThemesComponent diff --git a/reflex/components/radix/themes/layout/section.pyi b/reflex/components/radix/themes/layout/section.pyi index b4e1050d8..9fb790b9f 100644 --- a/reflex/components/radix/themes/layout/section.pyi +++ b/reflex/components/radix/themes/layout/section.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -23,80 +23,60 @@ class Section(elements.Section, RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3"]], + Literal["1", "2", "3"], Var[ Union[ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"] ] ], - Literal["1", "2", "3"], - Breakpoints[str, Literal["1", "2", "3"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Section": """Create a new component instance. diff --git a/reflex/components/radix/themes/layout/spacer.pyi b/reflex/components/radix/themes/layout/spacer.pyi index 652c1a0b0..f83d7a4c9 100644 --- a/reflex/components/radix/themes/layout/spacer.pyi +++ b/reflex/components/radix/themes/layout/spacer.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .flex import Flex @@ -22,64 +22,68 @@ class Spacer(Flex): as_child: Optional[Union[Var[bool], bool]] = None, direction: Optional[ Union[ + Breakpoints[ + str, Literal["column", "column-reverse", "row", "row-reverse"] + ], + Literal["column", "column-reverse", "row", "row-reverse"], Var[ Union[ Breakpoints[ str, - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], ], - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], ] ], - Literal["row", "column", "row-reverse", "column-reverse"], - Breakpoints[ - str, Literal["row", "column", "row-reverse", "column-reverse"] - ], ] ] = None, align: Optional[ Union[ + Breakpoints[ + str, Literal["baseline", "center", "end", "start", "stretch"] + ], + Literal["baseline", "center", "end", "start", "stretch"], Var[ Union[ Breakpoints[ str, - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ], - Literal["start", "center", "end", "baseline", "stretch"], + Literal["baseline", "center", "end", "start", "stretch"], ] ], - Literal["start", "center", "end", "baseline", "stretch"], - Breakpoints[ - str, Literal["start", "center", "end", "baseline", "stretch"] - ], ] ] = None, justify: Optional[ Union[ + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], Var[ Union[ - Breakpoints[str, Literal["start", "center", "end", "between"]], - Literal["start", "center", "end", "between"], + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], ] ], - Literal["start", "center", "end", "between"], - Breakpoints[str, Literal["start", "center", "end", "between"]], ] ] = None, wrap: Optional[ Union[ + Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], + Literal["nowrap", "wrap", "wrap-reverse"], Var[ Union[ Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], Literal["nowrap", "wrap", "wrap-reverse"], ] ], - Literal["nowrap", "wrap", "wrap-reverse"], - Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], ] ] = None, spacing: Optional[ Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -89,77 +93,53 @@ class Spacer(Flex): Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[ - str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] - ], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Spacer": """Create a new component instance. diff --git a/reflex/components/radix/themes/layout/stack.py b/reflex/components/radix/themes/layout/stack.py index 13f80dc1e..94bba4fb6 100644 --- a/reflex/components/radix/themes/layout/stack.py +++ b/reflex/components/radix/themes/layout/stack.py @@ -3,7 +3,7 @@ from __future__ import annotations from reflex.components.component import Component -from reflex.vars import Var +from reflex.vars.base import Var from ..base import LiteralAlign, LiteralSpacing from .flex import Flex, LiteralFlexDirection @@ -33,7 +33,7 @@ class Stack(Flex): """ # Apply the default classname given_class_name = props.pop("class_name", []) - if isinstance(given_class_name, str): + if not isinstance(given_class_name, list): given_class_name = [given_class_name] props["class_name"] = ["rx-Stack", *given_class_name] diff --git a/reflex/components/radix/themes/layout/stack.pyi b/reflex/components/radix/themes/layout/stack.pyi index 4ba630fc2..5eed3db46 100644 --- a/reflex/components/radix/themes/layout/stack.pyi +++ b/reflex/components/radix/themes/layout/stack.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import LiteralAlign, LiteralSpacing from .flex import Flex @@ -24,110 +24,90 @@ class Stack(Flex): as_child: Optional[Union[Var[bool], bool]] = None, direction: Optional[ Union[ + Breakpoints[ + str, Literal["column", "column-reverse", "row", "row-reverse"] + ], + Literal["column", "column-reverse", "row", "row-reverse"], Var[ Union[ Breakpoints[ str, - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], ], - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], ] ], - Literal["row", "column", "row-reverse", "column-reverse"], - Breakpoints[ - str, Literal["row", "column", "row-reverse", "column-reverse"] - ], ] ] = None, justify: Optional[ Union[ + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], Var[ Union[ - Breakpoints[str, Literal["start", "center", "end", "between"]], - Literal["start", "center", "end", "between"], + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], ] ], - Literal["start", "center", "end", "between"], - Breakpoints[str, Literal["start", "center", "end", "between"]], ] ] = None, wrap: Optional[ Union[ + Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], + Literal["nowrap", "wrap", "wrap-reverse"], Var[ Union[ Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], Literal["nowrap", "wrap", "wrap-reverse"], ] ], - Literal["nowrap", "wrap", "wrap-reverse"], - Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Stack": """Create a new instance of the component. @@ -179,100 +159,80 @@ class VStack(Stack): align: Optional[LiteralAlign] = "start", direction: Optional[ Union[ - Var[Literal["row", "column", "row-reverse", "column-reverse"]], - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], + Var[Literal["column", "column-reverse", "row", "row-reverse"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, justify: Optional[ Union[ + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], Var[ Union[ - Breakpoints[str, Literal["start", "center", "end", "between"]], - Literal["start", "center", "end", "between"], + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], ] ], - Literal["start", "center", "end", "between"], - Breakpoints[str, Literal["start", "center", "end", "between"]], ] ] = None, wrap: Optional[ Union[ + Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], + Literal["nowrap", "wrap", "wrap-reverse"], Var[ Union[ Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], Literal["nowrap", "wrap", "wrap-reverse"], ] ], - Literal["nowrap", "wrap", "wrap-reverse"], - Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "VStack": """Create a new instance of the component. @@ -324,100 +284,80 @@ class HStack(Stack): align: Optional[LiteralAlign] = "start", direction: Optional[ Union[ - Var[Literal["row", "column", "row-reverse", "column-reverse"]], - Literal["row", "column", "row-reverse", "column-reverse"], + Literal["column", "column-reverse", "row", "row-reverse"], + Var[Literal["column", "column-reverse", "row", "row-reverse"]], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, justify: Optional[ Union[ + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], Var[ Union[ - Breakpoints[str, Literal["start", "center", "end", "between"]], - Literal["start", "center", "end", "between"], + Breakpoints[str, Literal["between", "center", "end", "start"]], + Literal["between", "center", "end", "start"], ] ], - Literal["start", "center", "end", "between"], - Breakpoints[str, Literal["start", "center", "end", "between"]], ] ] = None, wrap: Optional[ Union[ + Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], + Literal["nowrap", "wrap", "wrap-reverse"], Var[ Union[ Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], Literal["nowrap", "wrap", "wrap-reverse"], ] ], - Literal["nowrap", "wrap", "wrap-reverse"], - Breakpoints[str, Literal["nowrap", "wrap", "wrap-reverse"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "HStack": """Create a new instance of the component. diff --git a/reflex/components/radix/themes/typography/blockquote.py b/reflex/components/radix/themes/typography/blockquote.py index a4f3069b8..a60c05471 100644 --- a/reflex/components/radix/themes/typography/blockquote.py +++ b/reflex/components/radix/themes/typography/blockquote.py @@ -7,7 +7,7 @@ from __future__ import annotations from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/typography/blockquote.pyi b/reflex/components/radix/themes/typography/blockquote.pyi index 3ab3c829b..3a9ae5c72 100644 --- a/reflex/components/radix/themes/typography/blockquote.pyi +++ b/reflex/components/radix/themes/typography/blockquote.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -21,6 +21,8 @@ class Blockquote(elements.Blockquote, RadixThemesComponent): *children, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -29,151 +31,129 @@ class Blockquote(elements.Blockquote, RadixThemesComponent): Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, weight: Optional[ Union[ + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], Var[ Union[ - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], - Literal["light", "regular", "medium", "bold"], + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], ] ], - Literal["light", "regular", "medium", "bold"], - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - cite: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cite: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Blockquote": """Create a new component instance. diff --git a/reflex/components/radix/themes/typography/code.py b/reflex/components/radix/themes/typography/code.py index 2c0212b8b..663f260da 100644 --- a/reflex/components/radix/themes/typography/code.py +++ b/reflex/components/radix/themes/typography/code.py @@ -7,7 +7,7 @@ from __future__ import annotations from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/typography/code.pyi b/reflex/components/radix/themes/typography/code.pyi index f30a39f9a..2cda39ddf 100644 --- a/reflex/components/radix/themes/typography/code.pyi +++ b/reflex/components/radix/themes/typography/code.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -21,12 +21,14 @@ class Code(elements.Code, RadixThemesComponent): *children, variant: Optional[ Union[ - Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]], - Literal["classic", "solid", "soft", "surface", "outline", "ghost"], + Literal["classic", "ghost", "outline", "soft", "solid", "surface"], + Var[Literal["classic", "ghost", "outline", "soft", "solid", "surface"]], ] ] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -35,150 +37,128 @@ class Code(elements.Code, RadixThemesComponent): Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, weight: Optional[ Union[ + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], Var[ Union[ - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], - Literal["light", "regular", "medium", "bold"], + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], ] ], - Literal["light", "regular", "medium", "bold"], - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Code": """Create a new component instance. diff --git a/reflex/components/radix/themes/typography/heading.py b/reflex/components/radix/themes/typography/heading.py index 374fe8dcc..f5fec8bb1 100644 --- a/reflex/components/radix/themes/typography/heading.py +++ b/reflex/components/radix/themes/typography/heading.py @@ -7,7 +7,7 @@ from __future__ import annotations from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/typography/heading.pyi b/reflex/components/radix/themes/typography/heading.pyi index d1fe26218..78ef8ba60 100644 --- a/reflex/components/radix/themes/typography/heading.pyi +++ b/reflex/components/radix/themes/typography/heading.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -23,6 +23,8 @@ class Heading(elements.H1, RadixThemesComponent): as_: Optional[Union[Var[str], str]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -31,174 +33,152 @@ class Heading(elements.H1, RadixThemesComponent): Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, weight: Optional[ Union[ + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], Var[ Union[ - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], - Literal["light", "regular", "medium", "bold"], + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], ] ], - Literal["light", "regular", "medium", "bold"], - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], ] ] = None, align: Optional[ Union[ + Breakpoints[str, Literal["center", "left", "right"]], + Literal["center", "left", "right"], Var[ Union[ - Breakpoints[str, Literal["left", "center", "right"]], - Literal["left", "center", "right"], + Breakpoints[str, Literal["center", "left", "right"]], + Literal["center", "left", "right"], ] ], - Literal["left", "center", "right"], - Breakpoints[str, Literal["left", "center", "right"]], ] ] = None, trim: Optional[ Union[ + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], Var[ Union[ - Breakpoints[str, Literal["normal", "start", "end", "both"]], - Literal["normal", "start", "end", "both"], + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], ] ], - Literal["normal", "start", "end", "both"], - Breakpoints[str, Literal["normal", "start", "end", "both"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Heading": """Create a new component instance. diff --git a/reflex/components/radix/themes/typography/link.py b/reflex/components/radix/themes/typography/link.py index 92fa47173..e51209dce 100644 --- a/reflex/components/radix/themes/typography/link.py +++ b/reflex/components/radix/themes/typography/link.py @@ -14,7 +14,7 @@ from reflex.components.core.cond import cond from reflex.components.el.elements.inline import A from reflex.components.next.link import NextLink from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/typography/link.pyi b/reflex/components/radix/themes/typography/link.pyi index 54cebee64..3e3eaf64b 100644 --- a/reflex/components/radix/themes/typography/link.pyi +++ b/reflex/components/radix/themes/typography/link.pyi @@ -3,16 +3,16 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import MemoizationLeaf from reflex.components.core.breakpoints import Breakpoints from reflex.components.el.elements.inline import A from reflex.components.next.link import NextLink -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -29,6 +29,8 @@ class Link(RadixThemesComponent, A, MemoizationLeaf): as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -37,180 +39,158 @@ class Link(RadixThemesComponent, A, MemoizationLeaf): Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, weight: Optional[ Union[ + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], Var[ Union[ - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], - Literal["light", "regular", "medium", "bold"], + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], ] ], - Literal["light", "regular", "medium", "bold"], - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], ] ] = None, trim: Optional[ Union[ + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], Var[ Union[ - Breakpoints[str, Literal["normal", "start", "end", "both"]], - Literal["normal", "start", "end", "both"], + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], ] ], - Literal["normal", "start", "end", "both"], - Breakpoints[str, Literal["normal", "start", "end", "both"]], ] ] = None, underline: Optional[ Union[ - Var[Literal["auto", "hover", "always", "none"]], - Literal["auto", "hover", "always", "none"], + Literal["always", "auto", "hover", "none"], + Var[Literal["always", "auto", "hover", "none"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, is_external: Optional[Union[Var[bool], bool]] = None, - download: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - href: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - href_lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - media: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - ping: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + download: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + href: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + href_lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + media: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + ping: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, referrer_policy: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - rel: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - shape: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + rel: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + shape: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + target: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Link": """Create a Link component. diff --git a/reflex/components/radix/themes/typography/text.py b/reflex/components/radix/themes/typography/text.py index fe4b17afc..24b09c753 100644 --- a/reflex/components/radix/themes/typography/text.py +++ b/reflex/components/radix/themes/typography/text.py @@ -10,7 +10,7 @@ from typing import Literal from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Responsive from reflex.components.el import elements -from reflex.vars import Var +from reflex.vars.base import Var from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/typography/text.pyi b/reflex/components/radix/themes/typography/text.pyi index 919ed17e0..b4ddc622c 100644 --- a/reflex/components/radix/themes/typography/text.pyi +++ b/reflex/components/radix/themes/typography/text.pyi @@ -3,14 +3,14 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import ComponentNamespace from reflex.components.core.breakpoints import Breakpoints from reflex.components.el import elements -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from ..base import RadixThemesComponent @@ -44,52 +44,54 @@ class Text(elements.Span, RadixThemesComponent): as_child: Optional[Union[Var[bool], bool]] = None, as_: Optional[ Union[ - Var[ - Literal[ - "p", - "label", - "div", - "span", - "b", - "i", - "u", - "abbr", - "cite", - "del", - "em", - "ins", - "kbd", - "mark", - "s", - "samp", - "sub", - "sup", - ] - ], Literal[ - "p", - "label", - "div", - "span", - "b", - "i", - "u", "abbr", + "b", "cite", "del", + "div", "em", + "i", "ins", "kbd", + "label", "mark", + "p", "s", "samp", + "span", "sub", "sup", + "u", + ], + Var[ + Literal[ + "abbr", + "b", + "cite", + "del", + "div", + "em", + "i", + "ins", + "kbd", + "label", + "mark", + "p", + "s", + "samp", + "span", + "sub", + "sup", + "u", + ] ], ] ] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -98,174 +100,152 @@ class Text(elements.Span, RadixThemesComponent): Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, weight: Optional[ Union[ + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], Var[ Union[ - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], - Literal["light", "regular", "medium", "bold"], + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], ] ], - Literal["light", "regular", "medium", "bold"], - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], ] ] = None, align: Optional[ Union[ + Breakpoints[str, Literal["center", "left", "right"]], + Literal["center", "left", "right"], Var[ Union[ - Breakpoints[str, Literal["left", "center", "right"]], - Literal["left", "center", "right"], + Breakpoints[str, Literal["center", "left", "right"]], + Literal["center", "left", "right"], ] ], - Literal["left", "center", "right"], - Breakpoints[str, Literal["left", "center", "right"]], ] ] = None, trim: Optional[ Union[ + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], Var[ Union[ - Breakpoints[str, Literal["normal", "start", "end", "both"]], - Literal["normal", "start", "end", "both"], + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], ] ], - Literal["normal", "start", "end", "both"], - Breakpoints[str, Literal["normal", "start", "end", "both"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Text": """Create a new component instance. @@ -320,53 +300,55 @@ class Span(Text): *children, as_: Optional[ Union[ - Var[ - Literal[ - "p", - "label", - "div", - "span", - "b", - "i", - "u", - "abbr", - "cite", - "del", - "em", - "ins", - "kbd", - "mark", - "s", - "samp", - "sub", - "sup", - ] - ], Literal[ - "p", - "label", - "div", - "span", - "b", - "i", - "u", "abbr", + "b", "cite", "del", + "div", "em", + "i", "ins", "kbd", + "label", "mark", + "p", "s", "samp", + "span", "sub", "sup", + "u", + ], + Var[ + Literal[ + "abbr", + "b", + "cite", + "del", + "div", + "em", + "i", + "ins", + "kbd", + "label", + "mark", + "p", + "s", + "samp", + "span", + "sub", + "sup", + "u", + ] ], ] ] = None, as_child: Optional[Union[Var[bool], bool]] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -375,174 +357,152 @@ class Span(Text): Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, weight: Optional[ Union[ + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], Var[ Union[ - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], - Literal["light", "regular", "medium", "bold"], + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], ] ], - Literal["light", "regular", "medium", "bold"], - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], ] ] = None, align: Optional[ Union[ + Breakpoints[str, Literal["center", "left", "right"]], + Literal["center", "left", "right"], Var[ Union[ - Breakpoints[str, Literal["left", "center", "right"]], - Literal["left", "center", "right"], + Breakpoints[str, Literal["center", "left", "right"]], + Literal["center", "left", "right"], ] ], - Literal["left", "center", "right"], - Breakpoints[str, Literal["left", "center", "right"]], ] ] = None, trim: Optional[ Union[ + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], Var[ Union[ - Breakpoints[str, Literal["normal", "start", "end", "both"]], - Literal["normal", "start", "end", "both"], + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], ] ], - Literal["normal", "start", "end", "both"], - Breakpoints[str, Literal["normal", "start", "end", "both"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Span": """Create a new component instance. @@ -595,71 +555,51 @@ class Em(elements.Em, RadixThemesComponent): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Em": """Create a new component instance. @@ -706,75 +646,55 @@ class Kbd(elements.Kbd, RadixThemesComponent): *children, size: Optional[ Union[ - Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Kbd": """Create a new component instance. @@ -820,72 +740,52 @@ class Quote(elements.Q, RadixThemesComponent): def create( # type: ignore cls, *children, - cite: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + cite: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Quote": """Create a new component instance. @@ -931,71 +831,51 @@ class Strong(elements.Strong, RadixThemesComponent): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Strong": """Create a new component instance. @@ -1047,52 +927,54 @@ class TextNamespace(ComponentNamespace): as_child: Optional[Union[Var[bool], bool]] = None, as_: Optional[ Union[ - Var[ - Literal[ - "p", - "label", - "div", - "span", - "b", - "i", - "u", - "abbr", - "cite", - "del", - "em", - "ins", - "kbd", - "mark", - "s", - "samp", - "sub", - "sup", - ] - ], Literal[ - "p", - "label", - "div", - "span", - "b", - "i", - "u", "abbr", + "b", "cite", "del", + "div", "em", + "i", "ins", "kbd", + "label", "mark", + "p", "s", "samp", + "span", "sub", "sup", + "u", + ], + Var[ + Literal[ + "abbr", + "b", + "cite", + "del", + "div", + "em", + "i", + "ins", + "kbd", + "label", + "mark", + "p", + "s", + "samp", + "span", + "sub", + "sup", + "u", + ] ], ] ] = None, size: Optional[ Union[ + Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], Var[ Union[ Breakpoints[ @@ -1101,174 +983,152 @@ class TextNamespace(ComponentNamespace): Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], ] ], - Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], - Breakpoints[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], ] ] = None, weight: Optional[ Union[ + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], Var[ Union[ - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], - Literal["light", "regular", "medium", "bold"], + Breakpoints[str, Literal["bold", "light", "medium", "regular"]], + Literal["bold", "light", "medium", "regular"], ] ], - Literal["light", "regular", "medium", "bold"], - Breakpoints[str, Literal["light", "regular", "medium", "bold"]], ] ] = None, align: Optional[ Union[ + Breakpoints[str, Literal["center", "left", "right"]], + Literal["center", "left", "right"], Var[ Union[ - Breakpoints[str, Literal["left", "center", "right"]], - Literal["left", "center", "right"], + Breakpoints[str, Literal["center", "left", "right"]], + Literal["center", "left", "right"], ] ], - Literal["left", "center", "right"], - Breakpoints[str, Literal["left", "center", "right"]], ] ] = None, trim: Optional[ Union[ + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], Var[ Union[ - Breakpoints[str, Literal["normal", "start", "end", "both"]], - Literal["normal", "start", "end", "both"], + Breakpoints[str, Literal["both", "end", "normal", "start"]], + Literal["both", "end", "normal", "start"], ] ], - Literal["normal", "start", "end", "both"], - Breakpoints[str, Literal["normal", "start", "end", "both"]], ] ] = None, color_scheme: Optional[ Union[ - Var[ - Literal[ - "tomato", - "red", - "ruby", - "crimson", - "pink", - "plum", - "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", - "sky", - "mint", - "lime", - "yellow", - "amber", - "gold", - "bronze", - "gray", - ] - ], Literal[ - "tomato", - "red", - "ruby", + "amber", + "blue", + "bronze", + "brown", "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", "pink", "plum", "purple", - "violet", - "iris", - "indigo", - "blue", - "cyan", - "teal", - "jade", - "green", - "grass", - "brown", - "orange", + "red", + "ruby", "sky", - "mint", - "lime", + "teal", + "tomato", + "violet", "yellow", - "amber", - "gold", - "bronze", - "gray", + ], + Var[ + Literal[ + "amber", + "blue", + "bronze", + "brown", + "crimson", + "cyan", + "gold", + "grass", + "gray", + "green", + "indigo", + "iris", + "jade", + "lime", + "mint", + "orange", + "pink", + "plum", + "purple", + "red", + "ruby", + "sky", + "teal", + "tomato", + "violet", + "yellow", + ] ], ] ] = None, high_contrast: Optional[Union[Var[bool], bool]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Text": """Create a new component instance. diff --git a/reflex/components/react_player/__init__.py b/reflex/components/react_player/__init__.py index 8c4a4486f..3f807b1a0 100644 --- a/reflex/components/react_player/__init__.py +++ b/reflex/components/react_player/__init__.py @@ -1,5 +1,6 @@ """React Player component for audio and video.""" +from . import react_player from .audio import Audio from .video import Video diff --git a/reflex/components/react_player/audio.pyi b/reflex/components/react_player/audio.pyi index f84122403..1841829af 100644 --- a/reflex/components/react_player/audio.pyi +++ b/reflex/components/react_player/audio.pyi @@ -3,12 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload +import reflex from reflex.components.react_player.react_player import ReactPlayer -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Audio(ReactPlayer): pass @@ -33,73 +34,39 @@ class Audio(ReactPlayer): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_buffer: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_buffer_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click_preview: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_disable_pip: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_duration: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_enable_pip: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_ended: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pause: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_play: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_playback_quality_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_playback_rate_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_buffer: Optional[EventType[[]]] = None, + on_buffer_end: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_click_preview: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_disable_pip: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_duration: Optional[EventType[float]] = None, + on_enable_pip: Optional[EventType[[]]] = None, + on_ended: Optional[EventType[[]]] = None, + on_error: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_pause: Optional[EventType[[]]] = None, + on_play: Optional[EventType[[]]] = None, + on_playback_quality_change: Optional[EventType[[]]] = None, + on_playback_rate_change: Optional[EventType[[]]] = None, on_progress: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_ready: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_seek: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_start: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + EventType[reflex.components.react_player.react_player.Progress] ] = None, + on_ready: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_seek: Optional[EventType[float]] = None, + on_start: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Audio": """Create the component. diff --git a/reflex/components/react_player/react_player.py b/reflex/components/react_player/react_player.py index 1c9b20cea..b2c58b754 100644 --- a/reflex/components/react_player/react_player.py +++ b/reflex/components/react_player/react_player.py @@ -2,9 +2,20 @@ from __future__ import annotations +from typing_extensions import TypedDict + from reflex.components.component import NoSSRComponent -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, empty_event, identity_event +from reflex.vars.base import Var + + +class Progress(TypedDict): + """Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds.""" + + played: float + playedSeconds: float + loaded: float + loadedSeconds: float class ReactPlayer(NoSSRComponent): @@ -12,7 +23,7 @@ class ReactPlayer(NoSSRComponent): reference: https://github.com/cookpete/react-player. """ - library = "react-player@2.12.0" + library = "react-player@2.16.0" tag = "ReactPlayer" @@ -46,49 +57,49 @@ class ReactPlayer(NoSSRComponent): height: Var[str] # Called when media is loaded and ready to play. If playing is set to true, media will play immediately. - on_ready: EventHandler[lambda: []] + on_ready: EventHandler[empty_event] # Called when media starts playing. - on_start: EventHandler[lambda: []] + on_start: EventHandler[empty_event] # Called when media starts or resumes playing after pausing or buffering. - on_play: EventHandler[lambda: []] + on_play: EventHandler[empty_event] # Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 } - on_progress: EventHandler[lambda progress: [progress]] + on_progress: EventHandler[identity_event(Progress)] # Callback containing duration of the media, in seconds. - on_duration: EventHandler[lambda seconds: [seconds]] + on_duration: EventHandler[identity_event(float)] # Called when media is paused. - on_pause: EventHandler[lambda: []] + on_pause: EventHandler[empty_event] # Called when media starts buffering. - on_buffer: EventHandler[lambda: []] + on_buffer: EventHandler[empty_event] # Called when media has finished buffering. Works for files, YouTube and Facebook. - on_buffer_end: EventHandler[lambda: []] + on_buffer_end: EventHandler[empty_event] # Called when media seeks with seconds parameter. - on_seek: EventHandler[lambda seconds: [seconds]] + on_seek: EventHandler[identity_event(float)] # Called when playback rate of the player changed. Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths. - on_playback_rate_change: EventHandler[lambda e0: []] + on_playback_rate_change: EventHandler[empty_event] # Called when playback quality of the player changed. Only supported by YouTube (if enabled). - on_playback_quality_change: EventHandler[lambda e0: []] + on_playback_quality_change: EventHandler[empty_event] # Called when media finishes playing. Does not fire when loop is set to true. - on_ended: EventHandler[lambda: []] + on_ended: EventHandler[empty_event] # Called when an error occurs whilst attempting to play media. - on_error: EventHandler[lambda: []] + on_error: EventHandler[empty_event] # Called when user clicks the light mode preview. - on_click_preview: EventHandler[lambda: []] + on_click_preview: EventHandler[empty_event] # Called when picture-in-picture mode is enabled. - on_enable_pip: EventHandler[lambda: []] + on_enable_pip: EventHandler[empty_event] # Called when picture-in-picture mode is disabled. - on_disable_pip: EventHandler[lambda: []] + on_disable_pip: EventHandler[empty_event] diff --git a/reflex/components/react_player/react_player.pyi b/reflex/components/react_player/react_player.pyi index c9e8ba569..e4027cf40 100644 --- a/reflex/components/react_player/react_player.pyi +++ b/reflex/components/react_player/react_player.pyi @@ -3,12 +3,20 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload + +from typing_extensions import TypedDict from reflex.components.component import NoSSRComponent -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var + +class Progress(TypedDict): + played: float + playedSeconds: float + loaded: float + loadedSeconds: float class ReactPlayer(NoSSRComponent): @overload @@ -31,73 +39,37 @@ class ReactPlayer(NoSSRComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_buffer: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_buffer_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click_preview: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_disable_pip: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_duration: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_enable_pip: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_ended: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pause: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_play: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_playback_quality_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_playback_rate_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_progress: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_ready: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_seek: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_start: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_buffer: Optional[EventType[[]]] = None, + on_buffer_end: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_click_preview: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_disable_pip: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_duration: Optional[EventType[float]] = None, + on_enable_pip: Optional[EventType[[]]] = None, + on_ended: Optional[EventType[[]]] = None, + on_error: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_pause: Optional[EventType[[]]] = None, + on_play: Optional[EventType[[]]] = None, + on_playback_quality_change: Optional[EventType[[]]] = None, + on_playback_rate_change: Optional[EventType[[]]] = None, + on_progress: Optional[EventType[Progress]] = None, + on_ready: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_seek: Optional[EventType[float]] = None, + on_start: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ReactPlayer": """Create the component. diff --git a/reflex/components/react_player/video.pyi b/reflex/components/react_player/video.pyi index 7f7c1fda1..a05e3747b 100644 --- a/reflex/components/react_player/video.pyi +++ b/reflex/components/react_player/video.pyi @@ -3,12 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from typing import Any, Dict, Optional, Union, overload +import reflex from reflex.components.react_player.react_player import ReactPlayer -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Video(ReactPlayer): pass @@ -33,73 +34,39 @@ class Video(ReactPlayer): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_buffer: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_buffer_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click_preview: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_disable_pip: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_duration: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_enable_pip: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_ended: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_pause: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_play: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_playback_quality_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_playback_rate_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_buffer: Optional[EventType[[]]] = None, + on_buffer_end: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_click_preview: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_disable_pip: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_duration: Optional[EventType[float]] = None, + on_enable_pip: Optional[EventType[[]]] = None, + on_ended: Optional[EventType[[]]] = None, + on_error: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_pause: Optional[EventType[[]]] = None, + on_play: Optional[EventType[[]]] = None, + on_playback_quality_change: Optional[EventType[[]]] = None, + on_playback_rate_change: Optional[EventType[[]]] = None, on_progress: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_ready: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_seek: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_start: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] + EventType[reflex.components.react_player.react_player.Progress] ] = None, + on_ready: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_seek: Optional[EventType[float]] = None, + on_start: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Video": """Create the component. diff --git a/reflex/components/recharts/cartesian.py b/reflex/components/recharts/cartesian.py index 4c76e82ea..865b50a32 100644 --- a/reflex/components/recharts/cartesian.py +++ b/reflex/components/recharts/cartesian.py @@ -6,9 +6,8 @@ from typing import Any, Dict, List, Union from reflex.constants import EventTriggers from reflex.constants.colors import Color -from reflex.event import EventHandler -from reflex.ivars.base import LiteralVar -from reflex.vars import Var +from reflex.event import EventHandler, empty_event +from reflex.vars.base import LiteralVar, Var from .recharts import ( LiteralAnimationEasing, @@ -16,6 +15,7 @@ from .recharts import ( LiteralDirection, LiteralIfOverflow, LiteralInterval, + LiteralIntervalAxis, LiteralLayout, LiteralLegendType, LiteralLineType, @@ -25,6 +25,7 @@ from .recharts import ( LiteralPolarRadiusType, LiteralScale, LiteralShape, + LiteralTextAnchor, Recharts, ) @@ -35,7 +36,7 @@ class Axis(Recharts): # The key of data displayed in the axis. data_key: Var[Union[str, int]] - # If set true, the axis do not display in the chart. + # If set true, the axis do not display in the chart. Default: False hide: Var[bool] # The width of axis which is usually calculated internally. @@ -47,28 +48,34 @@ class Axis(Recharts): # The type of axis 'number' | 'category' type_: Var[LiteralPolarRadiusType] - # Allow the ticks of XAxis to be decimals or not. + # If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. Default: "preserveEnd" + interval: Var[Union[LiteralIntervalAxis, int]] + + # Allow the ticks of Axis to be decimals or not. Default: True allow_decimals: Var[bool] - # When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. + # When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. Default: False allow_data_overflow: Var[bool] - # Allow the axis has duplicated categorys or not when the type of axis is "category". + # Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True allow_duplicated_category: Var[bool] - # If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. + # The range of the axis. Work best in conjuction with allow_data_overflow. Default: [0, "auto"] + domain: Var[List] + + # If set false, no axis line will be drawn. Default: True axis_line: Var[bool] - # If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. + # If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. Default: False mirror: Var[bool] - # Reverse the ticks or not. + # Reverse the ticks or not. Default: False reversed: Var[bool] # The label of axis, which appears next to the axis. label: Var[Union[str, int, Dict[str, Any]]] - # If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function + # If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold'. Default: "auto" scale: Var[LiteralScale] # The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. @@ -83,44 +90,44 @@ class Axis(Recharts): # If set false, no ticks will be drawn. tick: Var[bool] - # The count of axis ticks. + # The count of axis ticks. Not used if 'type' is 'category'. Default: 5 tick_count: Var[int] - # If set false, no axis tick lines will be drawn. - tick_line: Var[bool] = LiteralVar.create(False) + # If set false, no axis tick lines will be drawn. Default: True + tick_line: Var[bool] - # The length of tick line. + # The length of tick line. Default: 6 tick_size: Var[int] - # The minimum gap between two adjacent labels + # The minimum gap between two adjacent labels. Default: 5 min_tick_gap: Var[int] - # The stroke color of axis + # The stroke color of axis. Default: rx.color("gray", 9) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 9)) - # The text anchor of axis - text_anchor: Var[str] # 'start', 'middle', 'end' + # The text anchor of axis. Default: "middle" + text_anchor: Var[LiteralTextAnchor] # The customized event handler of click on the ticks of this axis - on_click: EventHandler[lambda: []] + on_click: EventHandler[empty_event] # The customized event handler of mousedown on the ticks of this axis - on_mouse_down: EventHandler[lambda: []] + on_mouse_down: EventHandler[empty_event] # The customized event handler of mouseup on the ticks of this axis - on_mouse_up: EventHandler[lambda: []] + on_mouse_up: EventHandler[empty_event] # The customized event handler of mousemove on the ticks of this axis - on_mouse_move: EventHandler[lambda: []] + on_mouse_move: EventHandler[empty_event] # The customized event handler of mouseout on the ticks of this axis - on_mouse_out: EventHandler[lambda: []] + on_mouse_out: EventHandler[empty_event] # The customized event handler of mouseenter on the ticks of this axis - on_mouse_enter: EventHandler[lambda: []] + on_mouse_enter: EventHandler[empty_event] # The customized event handler of mouseleave on the ticks of this axis - on_mouse_leave: EventHandler[lambda: []] + on_mouse_leave: EventHandler[empty_event] class XAxis(Axis): @@ -130,20 +137,20 @@ class XAxis(Axis): alias = "RechartsXAxis" - # The orientation of axis 'top' | 'bottom' + # The orientation of axis 'top' | 'bottom'. Default: "bottom" orientation: Var[LiteralOrientationTopBottom] - # The id of x-axis which is corresponding to the data. + # The id of x-axis which is corresponding to the data. Default: 0 x_axis_id: Var[Union[str, int]] - # Ensures that all datapoints within a chart contribute to its domain calculation, even when they are hidden - include_hidden: Var[bool] = LiteralVar.create(False) + # Ensures that all datapoints within a chart contribute to its domain calculation, even when they are hidden. Default: False + include_hidden: Var[bool] - # The range of the axis. Work best in conjuction with allow_data_overflow. - domain: Var[List] + # The angle of axis ticks. Default: 0 + angle: Var[int] - # The range of the axis. Work best in conjuction with allow_data_overflow. - domain: Var[List] + # Specify the padding of x-axis. Default: {"left": 0, "right": 0} + padding: Var[Dict[str, int]] class YAxis(Axis): @@ -153,14 +160,14 @@ class YAxis(Axis): alias = "RechartsYAxis" - # The orientation of axis 'left' | 'right' + # The orientation of axis 'left' | 'right'. Default: "left" orientation: Var[LiteralOrientationLeftRight] - # The id of y-axis which is corresponding to the data. + # The id of y-axis which is corresponding to the data. Default: 0 y_axis_id: Var[Union[str, int]] - # The range of the axis. Work best in conjuction with allow_data_overflow. - domain: Var[List] + # Specify the padding of y-axis. Default: {"top": 0, "bottom": 0} + padding: Var[Dict[str, int]] class ZAxis(Recharts): @@ -168,12 +175,15 @@ class ZAxis(Recharts): tag = "ZAxis" - alias = "RechartszAxis" + alias = "RechartsZAxis" # The key of data displayed in the axis. data_key: Var[Union[str, int]] - # The range of axis. + # The unique id of z-axis. Default: 0 + z_axis_id: Var[Union[str, int]] + + # The range of axis. Default: [10, 10] range: Var[List[int]] # The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. @@ -182,7 +192,7 @@ class ZAxis(Recharts): # The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. name: Var[Union[str, int]] - # If 'auto' set, the scale function is decided by the type of chart, and the props type. + # If 'auto' set, the scale function is decided by the type of chart, and the props type. Default: "auto" scale: Var[LiteralScale] @@ -193,40 +203,40 @@ class Brush(Recharts): alias = "RechartsBrush" - # Stroke color + # Stroke color. Default: rx.color("gray", 9) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 9)) - # The fill color of brush. + # The fill color of brush. Default: rx.color("gray", 2) fill: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 2)) # The key of data displayed in the axis. data_key: Var[Union[str, int]] - # The x-coordinate of brush. + # The x-coordinate of brush. Default: 0 x: Var[int] - # The y-coordinate of brush. + # The y-coordinate of brush. Default: 0 y: Var[int] - # The width of brush. + # The width of brush. Default: 0 width: Var[int] - # The height of brush. + # The height of brush. Default: 40 height: Var[int] - # The data domain of brush, [min, max]. + # The original data of a LineChart, a BarChart or an AreaChart. data: Var[List[Any]] - # The width of each traveller. + # The width of each traveller. Default: 5 traveller_width: Var[int] - # The data with gap of refreshing chart. If the option is not set, the chart will be refreshed every time + # The data with gap of refreshing chart. If the option is not set, the chart will be refreshed every time. Default: 1 gap: Var[int] - # The default start index of brush. If the option is not set, the start index will be 0. + # The default start index of brush. If the option is not set, the start index will be 0. Default: 0 start_index: Var[int] - # The default end index of brush. If the option is not set, the end index will be 1. + # The default end index of brush. If the option is not set, the end index will be calculated by the length of data. end_index: Var[int] # The fill color of brush @@ -242,7 +252,7 @@ class Brush(Recharts): A dict mapping the event trigger to the var that is passed to the handler. """ return { - EventTriggers.ON_CHANGE: lambda: [], + EventTriggers.ON_CHANGE: empty_event, } @@ -255,38 +265,62 @@ class Cartesian(Recharts): # The key of a group of data which should be unique in an area chart. data_key: Var[Union[str, int]] - # The id of x-axis which is corresponding to the data. + # The id of x-axis which is corresponding to the data. Default: 0 x_axis_id: Var[Union[str, int]] - # The id of y-axis which is corresponding to the data. + # The id of y-axis which is corresponding to the data. Default: 0 y_axis_id: Var[Union[str, int]] - # The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional + # The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional legend_type: Var[LiteralLegendType] + # If set false, animation of bar will be disabled. Default: True + is_animation_active: Var[bool] + + # Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_begin: Var[int] + + # Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_duration: Var[int] + + # The type of easing function. Default: "ease" + animation_easing: Var[LiteralAnimationEasing] + + # The unit of data. This option will be used in tooltip. + unit: Var[Union[str, int]] + + # The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively. + name: Var[Union[str, int]] + + # The customized event handler of animation start + on_animation_start: EventHandler[empty_event] + + # The customized event handler of animation end + on_animation_end: EventHandler[empty_event] + # The customized event handler of click on the component in this group - on_click: EventHandler[lambda: []] + on_click: EventHandler[empty_event] # The customized event handler of mousedown on the component in this group - on_mouse_down: EventHandler[lambda: []] + on_mouse_down: EventHandler[empty_event] # The customized event handler of mouseup on the component in this group - on_mouse_up: EventHandler[lambda: []] + on_mouse_up: EventHandler[empty_event] # The customized event handler of mousemove on the component in this group - on_mouse_move: EventHandler[lambda: []] + on_mouse_move: EventHandler[empty_event] # The customized event handler of mouseover on the component in this group - on_mouse_over: EventHandler[lambda: []] + on_mouse_over: EventHandler[empty_event] # The customized event handler of mouseout on the component in this group - on_mouse_out: EventHandler[lambda: []] + on_mouse_out: EventHandler[empty_event] # The customized event handler of mouseenter on the component in this group - on_mouse_enter: EventHandler[lambda: []] + on_mouse_enter: EventHandler[empty_event] # The customized event handler of mouseleave on the component in this group - on_mouse_leave: EventHandler[lambda: []] + on_mouse_leave: EventHandler[empty_event] class Area(Cartesian): @@ -296,22 +330,22 @@ class Area(Cartesian): alias = "RechartsArea" - # The color of the line stroke. + # The color of the line stroke. Default: rx.color("accent", 9) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9)) - # The width of the line stroke. - stroke_width: Var[int] = LiteralVar.create(1) + # The width of the line stroke. Default: 1 + stroke_width: Var[int] - # The color of the area fill. + # The color of the area fill. Default: rx.color("accent", 5) fill: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 5)) - # The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' | + # The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter'. Default: "monotone" type_: Var[LiteralAreaType] = LiteralVar.create("monotone") - # If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally. + # If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally. Default: False dot: Var[Union[bool, Dict[str, Any]]] - # The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. + # The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {stroke: rx.color("accent", 2), fill: rx.color("accent", 10)} active_dot: Var[Union[bool, Dict[str, Any]]] = LiteralVar.create( { "stroke": Color("accent", 2), @@ -319,17 +353,20 @@ class Area(Cartesian): } ) - # If set false, labels will not be drawn. If set true, labels will be drawn which have the props calculated internally. + # If set false, labels will not be drawn. If set true, labels will be drawn which have the props calculated internally. Default: False label: Var[bool] + # The value which can describle the line, usually calculated internally. + base_line: Var[Union[str, List[Dict[str, Any]]]] + + # The coordinates of all the points in the area, usually calculated internally. + points: Var[List[Dict[str, Any]]] + # The stack id of area, when two areas have the same value axis and same stack_id, then the two areas are stacked in order. stack_id: Var[Union[str, int]] - # The unit of data. This option will be used in tooltip. - unit: Var[Union[str, int]] - - # The name of data. This option will be used in tooltip and legend to represent a bar. If no value was set to this option, the value of dataKey will be used alternatively. - name: Var[Union[str, int]] + # Whether to connect a graph area across null points. Default: False + connect_nulls: Var[bool] # Valid children components _valid_children: List[str] = ["LabelList"] @@ -348,12 +385,13 @@ class Bar(Cartesian): # The width of the line stroke. stroke_width: Var[int] - # The width of the line stroke. + # The width of the line stroke. Default: Color("accent", 9) fill: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9)) - # If false set, background of bars will not be drawn. If true set, background of bars will be drawn which have the props calculated internally. + + # If false set, background of bars will not be drawn. If true set, background of bars will be drawn which have the props calculated internally. Default: False background: Var[bool] - # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. + # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False label: Var[bool] # The stack id of bar, when two bars have the same value axis and same stack_id, then the two bars are stacked in order. @@ -374,30 +412,15 @@ class Bar(Cartesian): # Max size of the bar max_bar_size: Var[int] + # If set a value, the option is the radius of all the rounded corners. If set a array, the option are in turn the radiuses of top-left corner, top-right corner, bottom-right corner, bottom-left corner. Default: 0 + radius: Var[Union[int, List[int]]] + # The active bar is shown when a user enters a bar chart and this chart has tooltip. If set to false, no active bar will be drawn. If set to true, active bar will be drawn with the props calculated internally. If passed an object, active bar will be drawn, and the internally calculated props will be merged with the key value pairs of the passed object. # active_bar: Var[Union[bool, Dict[str, Any]]] # Valid children components _valid_children: List[str] = ["Cell", "LabelList", "ErrorBar"] - # If set false, animation of bar will be disabled. - is_animation_active: Var[bool] - - # Specifies when the animation should begin, the unit of this option is ms, default 0. - animation_begin: Var[int] - - # Specifies the duration of animation, the unit of this option is ms, default 1500. - animation_duration: Var[int] - - # The type of easing function, default 'ease' - animation_easing: Var[LiteralAnimationEasing] - - # The customized event handler of animation start - on_animation_start: EventHandler[lambda: []] - - # The customized event handler of animation end - on_animation_end: EventHandler[lambda: []] - class Line(Cartesian): """A Line component in Recharts.""" @@ -409,13 +432,13 @@ class Line(Cartesian): # The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area. type_: Var[LiteralAreaType] - # The color of the line stroke. + # The color of the line stroke. Default: rx.color("accent", 9) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9)) - # The width of the line stroke. + # The width of the line stroke. Default: 1 stroke_width: Var[int] - # The dot is shown when mouse enter a line chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. + # The dot is shown when mouse enter a line chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {"stroke": rx.color("accent", 10), "fill": rx.color("accent", 4)} dot: Var[Union[bool, Dict[str, Any]]] = LiteralVar.create( { "stroke": Color("accent", 10), @@ -423,7 +446,7 @@ class Line(Cartesian): } ) - # The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. + # The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {"stroke": rx.color("accent", 2), "fill": rx.color("accent", 10)} active_dot: Var[Union[bool, Dict[str, Any]]] = LiteralVar.create( { "stroke": Color("accent", 2), @@ -431,10 +454,10 @@ class Line(Cartesian): } ) - # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. + # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False label: Var[bool] - # Hides the line when true, useful when toggling visibility state via legend. + # Hides the line when true, useful when toggling visibility state via legend. Default: False hide: Var[bool] # Whether to connect a graph line across null points. @@ -443,8 +466,11 @@ class Line(Cartesian): # The unit of data. This option will be used in tooltip. unit: Var[Union[str, int]] - # The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. - name: Var[Union[str, int]] + # The coordinates of all the points in the line, usually calculated internally. + points: Var[List[Dict[str, Any]]] + + # The pattern of dashes and gaps used to paint the line. + stroke_dasharray: Var[str] # Valid children components _valid_children: List[str] = ["LabelList", "ErrorBar"] @@ -460,71 +486,68 @@ class Scatter(Recharts): # The source data, in which each element is an object. data: Var[List[Dict[str, Any]]] - # The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none' + # The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none'. Default: "circle" legend_type: Var[LiteralLegendType] - # The id of x-axis which is corresponding to the data. + # The id of x-axis which is corresponding to the data. Default: 0 x_axis_id: Var[Union[str, int]] - # The id of y-axis which is corresponding to the data. + # The id of y-axis which is corresponding to the data. Default: 0 y_axis_id: Var[Union[str, int]] - # The id of z-axis which is corresponding to the data. - z_axis_id: Var[str] + # The id of z-axis which is corresponding to the data. Default: 0 + z_axis_id: Var[Union[str, int]] - # If false set, line will not be drawn. If true set, line will be drawn which have the props calculated internally. + # If false set, line will not be drawn. If true set, line will be drawn which have the props calculated internally. Default: False line: Var[bool] - # If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' + # If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'. Default: "circle" shape: Var[LiteralShape] - # If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting' + # If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting'. Default: "joint" line_type: Var[LiteralLineType] - # The fill + # The fill color of the scatter. Default: rx.color("accent", 9) fill: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9)) - # the name - name: Var[Union[str, int]] - # Valid children components. _valid_children: List[str] = ["LabelList", "ErrorBar"] - # If set false, animation of bar will be disabled. + # If set false, animation of bar will be disabled. Default: True in CSR, False in SSR is_animation_active: Var[bool] - # Specifies when the animation should begin, the unit of this option is ms, default 0. + # Specifies when the animation should begin, the unit of this option is ms. Default: 0 animation_begin: Var[int] - # Specifies the duration of animation, the unit of this option is ms, default 1500. + # Specifies the duration of animation, the unit of this option is ms. Default: 1500 animation_duration: Var[int] - # The type of easing function, default 'ease' + # The type of easing function. Default: "ease" animation_easing: Var[LiteralAnimationEasing] # The customized event handler of click on the component in this group - on_click: EventHandler[lambda: []] + on_click: EventHandler[empty_event] # The customized event handler of mousedown on the component in this group - on_mouse_down: EventHandler[lambda: []] + on_mouse_down: EventHandler[empty_event] # The customized event handler of mouseup on the component in this group - on_mouse_up: EventHandler[lambda: []] + on_mouse_up: EventHandler[empty_event] # The customized event handler of mousemove on the component in this group - on_mouse_move: EventHandler[lambda: []] + on_mouse_move: EventHandler[empty_event] # The customized event handler of mouseover on the component in this group - on_mouse_over: EventHandler[lambda: []] + on_mouse_over: EventHandler[empty_event] # The customized event handler of mouseout on the component in this group - on_mouse_out: EventHandler[lambda: []] + on_mouse_out: EventHandler[empty_event] # The customized event handler of mouseenter on the component in this group - on_mouse_enter: EventHandler[lambda: []] + on_mouse_enter: EventHandler[empty_event] # The customized event handler of mouseleave on the component in this group - on_mouse_leave: EventHandler[lambda: []] + on_mouse_leave: EventHandler[empty_event] class Funnel(Recharts): @@ -537,62 +560,65 @@ class Funnel(Recharts): # The source data, in which each element is an object. data: Var[List[Dict[str, Any]]] - # The key of a group of data which should be unique in an area chart. + # The key or getter of a group of data which should be unique in a FunnelChart. data_key: Var[Union[str, int]] - # The key or getter of a group of data which should be unique in a LineChart. + # The key of each sector's name. Default: "name" name_key: Var[str] - # The type of icon in legend. If set to 'none', no legend item will be rendered. + # The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "line" legend_type: Var[LiteralLegendType] - # If set false, animation of line will be disabled. + # If set false, animation of line will be disabled. Default: True is_animation_active: Var[bool] - # Specifies when the animation should begin, the unit of this option is ms. + # Specifies when the animation should begin, the unit of this option is ms. Default: 0 animation_begin: Var[int] - # Specifies the duration of animation, the unit of this option is ms. + # Specifies the duration of animation, the unit of this option is ms. Default: 1500 animation_duration: Var[int] - # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default "ease" animation_easing: Var[LiteralAnimationEasing] - # stroke color + # Stroke color. Default: rx.color("gray", 3) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 3)) + # The coordinates of all the trapezoids in the funnel, usually calculated internally. + trapezoids: Var[List[Dict[str, Any]]] + # Valid children components _valid_children: List[str] = ["LabelList", "Cell"] # The customized event handler of animation start - on_animation_start: EventHandler[lambda: []] + on_animation_start: EventHandler[empty_event] # The customized event handler of animation end - on_animation_end: EventHandler[lambda: []] + on_animation_end: EventHandler[empty_event] # The customized event handler of click on the component in this group - on_click: EventHandler[lambda: []] + on_click: EventHandler[empty_event] # The customized event handler of mousedown on the component in this group - on_mouse_down: EventHandler[lambda: []] + on_mouse_down: EventHandler[empty_event] # The customized event handler of mouseup on the component in this group - on_mouse_up: EventHandler[lambda: []] + on_mouse_up: EventHandler[empty_event] # The customized event handler of mousemove on the component in this group - on_mouse_move: EventHandler[lambda: []] + on_mouse_move: EventHandler[empty_event] # The customized event handler of mouseover on the component in this group - on_mouse_over: EventHandler[lambda: []] + on_mouse_over: EventHandler[empty_event] # The customized event handler of mouseout on the component in this group - on_mouse_out: EventHandler[lambda: []] + on_mouse_out: EventHandler[empty_event] # The customized event handler of mouseenter on the component in this group - on_mouse_enter: EventHandler[lambda: []] + on_mouse_enter: EventHandler[empty_event] # The customized event handler of mouseleave on the component in this group - on_mouse_leave: EventHandler[lambda: []] + on_mouse_leave: EventHandler[empty_event] class ErrorBar(Recharts): @@ -602,38 +628,38 @@ class ErrorBar(Recharts): alias = "RechartsErrorBar" - # The direction of error bar. 'x' | 'y' | 'both' + # Only used for ScatterChart with error bars in two directions. Only accepts a value of "x" or "y" and makes the error bars lie in that direction. direction: Var[LiteralDirection] # The key of a group of data which should be unique in an area chart. data_key: Var[Union[str, int]] - # The width of the error bar ends. + # The width of the error bar ends. Default: 5 width: Var[int] - # The stroke color of error bar. + # The stroke color of error bar. Default: rx.color("gray", 8) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 8)) - # The stroke width of error bar. - stroke_width: Var[int] + # The stroke width of error bar. Default: 1.5 + stroke_width: Var[Union[int, float]] class Reference(Recharts): """A base class for reference components in Reference.""" - # The id of x-axis which is corresponding to the data. + # The id of x-axis which is corresponding to the data. Default: 0 x_axis_id: Var[Union[str, int]] - # The id of y-axis which is corresponding to the data. + # The id of y-axis which is corresponding to the data. Default: 0 y_axis_id: Var[Union[str, int]] - # Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. + # Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. Default: "discard" if_overflow: Var[LiteralIfOverflow] # If set a string or a number, default label will be drawn, and the option is content. label: Var[Union[str, int]] - # If set true, the line will be rendered in front of bars in BarChart, etc. + # If set true, the line will be rendered in front of bars in BarChart, etc. Default: False is_front: Var[bool] @@ -653,7 +679,7 @@ class ReferenceLine(Reference): # The color of the reference line. stroke: Var[Union[str, Color]] - # The width of the stroke. + # The width of the stroke. Default: 1 stroke_width: Var[Union[str, int]] # Valid children components @@ -689,28 +715,28 @@ class ReferenceDot(Reference): _valid_children: List[str] = ["Label"] # The customized event handler of click on the component in this chart - on_click: EventHandler[lambda: []] + on_click: EventHandler[empty_event] # The customized event handler of mousedown on the component in this chart - on_mouse_down: EventHandler[lambda: []] + on_mouse_down: EventHandler[empty_event] # The customized event handler of mouseup on the component in this chart - on_mouse_up: EventHandler[lambda: []] + on_mouse_up: EventHandler[empty_event] # The customized event handler of mouseover on the component in this chart - on_mouse_over: EventHandler[lambda: []] + on_mouse_over: EventHandler[empty_event] # The customized event handler of mouseout on the component in this chart - on_mouse_out: EventHandler[lambda: []] + on_mouse_out: EventHandler[empty_event] # The customized event handler of mouseenter on the component in this chart - on_mouse_enter: EventHandler[lambda: []] + on_mouse_enter: EventHandler[empty_event] # The customized event handler of mousemove on the component in this chart - on_mouse_move: EventHandler[lambda: []] + on_mouse_move: EventHandler[empty_event] # The customized event handler of mouseleave on the component in this chart - on_mouse_leave: EventHandler[lambda: []] + on_mouse_leave: EventHandler[empty_event] class ReferenceArea(Recharts): @@ -747,10 +773,10 @@ class ReferenceArea(Recharts): # A boundary value of the area. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys. If one of y1 or y2 is invalidate, the area will cover along y-axis. y2: Var[Union[str, int]] - # Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. + # Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. Default: "discard" if_overflow: Var[LiteralIfOverflow] - # If set true, the line will be rendered in front of bars in BarChart, etc. + # If set true, the line will be rendered in front of bars in BarChart, etc. Default: False is_front: Var[bool] # Valid children components @@ -760,16 +786,16 @@ class ReferenceArea(Recharts): class Grid(Recharts): """A base class for grid components in Recharts.""" - # The x-coordinate of grid. + # The x-coordinate of grid. Default: 0 x: Var[int] - # The y-coordinate of grid. + # The y-coordinate of grid. Default: 0 y: Var[int] - # The width of grid. + # The width of grid. Default: 0 width: Var[int] - # The height of grid. + # The height of grid. Default: 0 height: Var[int] @@ -780,28 +806,28 @@ class CartesianGrid(Grid): alias = "RechartsCartesianGrid" - # The horizontal line configuration. + # The horizontal line configuration. Default: True horizontal: Var[bool] - # The vertical line configuration. + # The vertical line configuration. Default: True vertical: Var[bool] - # The x-coordinates in pixel values of all vertical lines. + # The x-coordinates in pixel values of all vertical lines. Default: [] vertical_points: Var[List[Union[str, int]]] - # The x-coordinates in pixel values of all vertical lines. + # The x-coordinates in pixel values of all vertical lines. Default: [] horizontal_points: Var[List[Union[str, int]]] # The background of grid. fill: Var[Union[str, Color]] - # The opacity of the background used to fill the space between grid lines + # The opacity of the background used to fill the space between grid lines. fill_opacity: Var[float] - # The pattern of dashes and gaps used to paint the lines of the grid + # The pattern of dashes and gaps used to paint the lines of the grid. stroke_dasharray: Var[str] - # the stroke color of grid + # the stroke color of grid. Default: rx.color("gray", 7) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 7)) @@ -812,28 +838,31 @@ class CartesianAxis(Grid): alias = "RechartsCartesianAxis" - # The orientation of axis 'top' | 'bottom' | 'left' | 'right' + # The orientation of axis 'top' | 'bottom' | 'left' | 'right'. Default: "bottom" orientation: Var[LiteralOrientationTopBottomLeftRight] - # If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. + # The box of viewing area. Default: {"x": 0, "y": 0, "width": 0, "height": 0} + view_box: Var[Dict[str, Any]] + + # If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. Default: True axis_line: Var[bool] - # If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. + # If set false, no ticks will be drawn. + tick: Var[bool] + + # If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. Default: True tick_line: Var[bool] - # The length of tick line. + # The length of tick line. Default: 6 tick_size: Var[int] - # If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. + # If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. Default: "preserveEnd" interval: Var[LiteralInterval] - # If set false, no ticks will be drawn. - ticks: Var[bool] - # If set a string or a number, default label will be drawn, and the option is content. - label: Var[str] + label: Var[Union[str, int]] - # If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. + # If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. Default: False mirror: Var[bool] # The margin between tick line and tick. diff --git a/reflex/components/recharts/cartesian.pyi b/reflex/components/recharts/cartesian.pyi index 0ffbd6c53..9772be792 100644 --- a/reflex/components/recharts/cartesian.pyi +++ b/reflex/components/recharts/cartesian.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.constants.colors import Color -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .recharts import ( Recharts, @@ -20,115 +20,123 @@ class Axis(Recharts): def create( # type: ignore cls, *children, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, hide: Optional[Union[Var[bool], bool]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, type_: Optional[ - Union[Var[Literal["number", "category"]], Literal["number", "category"]] + Union[Literal["category", "number"], Var[Literal["category", "number"]]] + ] = None, + interval: Optional[ + Union[ + Literal[ + "equidistantPreserveStart", + "preserveEnd", + "preserveStart", + "preserveStartEnd", + ], + Var[ + Union[ + Literal[ + "equidistantPreserveStart", + "preserveEnd", + "preserveStart", + "preserveStartEnd", + ], + int, + ] + ], + int, + ] ] = None, allow_decimals: Optional[Union[Var[bool], bool]] = None, allow_data_overflow: Optional[Union[Var[bool], bool]] = None, allow_duplicated_category: Optional[Union[Var[bool], bool]] = None, + domain: Optional[Union[List, Var[List]]] = None, axis_line: Optional[Union[Var[bool], bool]] = None, mirror: Optional[Union[Var[bool], bool]] = None, reversed: Optional[Union[Var[bool], bool]] = None, label: Optional[ - Union[Var[Union[Dict[str, Any], int, str]], str, int, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], int, str]], int, str] ] = None, scale: Optional[ Union[ + Literal[ + "auto", + "band", + "identity", + "linear", + "log", + "ordinal", + "point", + "pow", + "quantile", + "quantize", + "sequential", + "sqrt", + "threshold", + "time", + "utc", + ], Var[ Literal[ "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", "band", - "point", + "identity", + "linear", + "log", "ordinal", + "point", + "pow", "quantile", "quantize", - "utc", "sequential", + "sqrt", "threshold", + "time", + "utc", ] ], - Literal[ - "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", - "band", - "point", - "ordinal", - "quantile", - "quantize", - "utc", - "sequential", - "threshold", - ], ] ] = None, - unit: Optional[Union[Var[Union[int, str]], str, int]] = None, - name: Optional[Union[Var[Union[int, str]], str, int]] = None, + unit: Optional[Union[Var[Union[int, str]], int, str]] = None, + name: Optional[Union[Var[Union[int, str]], int, str]] = None, ticks: Optional[ - Union[Var[List[Union[int, str]]], List[Union[int, str]]] + Union[List[Union[int, str]], Var[List[Union[int, str]]]] ] = None, tick: Optional[Union[Var[bool], bool]] = None, tick_count: Optional[Union[Var[int], int]] = None, tick_line: Optional[Union[Var[bool], bool]] = None, tick_size: Optional[Union[Var[int], int]] = None, min_tick_gap: Optional[Union[Var[int], int]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - text_anchor: Optional[Union[Var[str], str]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + text_anchor: Optional[ + Union[ + Literal["end", "middle", "start"], + Var[Literal["end", "middle", "start"]], + ] + ] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Axis": """Create the component. @@ -136,28 +144,30 @@ class Axis(Recharts): Args: *children: The children of the component. data_key: The key of data displayed in the axis. - hide: If set true, the axis do not display in the chart. + hide: If set true, the axis do not display in the chart. Default: False width: The width of axis which is usually calculated internally. height: The height of axis, which can be setted by user. type_: The type of axis 'number' | 'category' - allow_decimals: Allow the ticks of XAxis to be decimals or not. - allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. - allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". - axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. - mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. - reversed: Reverse the ticks or not. + interval: If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. Default: "preserveEnd" + allow_decimals: Allow the ticks of Axis to be decimals or not. Default: True + allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. Default: False + allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True + domain: The range of the axis. Work best in conjuction with allow_data_overflow. Default: [0, "auto"] + axis_line: If set false, no axis line will be drawn. Default: True + mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. Default: False + reversed: Reverse the ticks or not. Default: False label: The label of axis, which appears next to the axis. - scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function + scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold'. Default: "auto" unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. ticks: Set the values of axis ticks manually. tick: If set false, no ticks will be drawn. - tick_count: The count of axis ticks. - tick_line: If set false, no axis tick lines will be drawn. - tick_size: The length of tick line. - min_tick_gap: The minimum gap between two adjacent labels - stroke: The stroke color of axis - text_anchor: The text anchor of axis + tick_count: The count of axis ticks. Not used if 'type' is 'category'. Default: 5 + tick_line: If set false, no axis tick lines will be drawn. Default: True + tick_size: The length of tick line. Default: 6 + min_tick_gap: The minimum gap between two adjacent labels. Default: 5 + stroke: The stroke color of axis. Default: rx.color("gray", 9) + text_anchor: The text anchor of axis. Default: "middle" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -178,153 +188,165 @@ class XAxis(Axis): cls, *children, orientation: Optional[ - Union[Var[Literal["top", "bottom"]], Literal["top", "bottom"]] + Union[Literal["bottom", "top"], Var[Literal["bottom", "top"]]] ] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, include_hidden: Optional[Union[Var[bool], bool]] = None, - domain: Optional[Union[Var[List], List]] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + angle: Optional[Union[Var[int], int]] = None, + padding: Optional[Union[Dict[str, int], Var[Dict[str, int]]]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, hide: Optional[Union[Var[bool], bool]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, type_: Optional[ - Union[Var[Literal["number", "category"]], Literal["number", "category"]] + Union[Literal["category", "number"], Var[Literal["category", "number"]]] + ] = None, + interval: Optional[ + Union[ + Literal[ + "equidistantPreserveStart", + "preserveEnd", + "preserveStart", + "preserveStartEnd", + ], + Var[ + Union[ + Literal[ + "equidistantPreserveStart", + "preserveEnd", + "preserveStart", + "preserveStartEnd", + ], + int, + ] + ], + int, + ] ] = None, allow_decimals: Optional[Union[Var[bool], bool]] = None, allow_data_overflow: Optional[Union[Var[bool], bool]] = None, allow_duplicated_category: Optional[Union[Var[bool], bool]] = None, + domain: Optional[Union[List, Var[List]]] = None, axis_line: Optional[Union[Var[bool], bool]] = None, mirror: Optional[Union[Var[bool], bool]] = None, reversed: Optional[Union[Var[bool], bool]] = None, label: Optional[ - Union[Var[Union[Dict[str, Any], int, str]], str, int, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], int, str]], int, str] ] = None, scale: Optional[ Union[ + Literal[ + "auto", + "band", + "identity", + "linear", + "log", + "ordinal", + "point", + "pow", + "quantile", + "quantize", + "sequential", + "sqrt", + "threshold", + "time", + "utc", + ], Var[ Literal[ "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", "band", - "point", + "identity", + "linear", + "log", "ordinal", + "point", + "pow", "quantile", "quantize", - "utc", "sequential", + "sqrt", "threshold", + "time", + "utc", ] ], - Literal[ - "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", - "band", - "point", - "ordinal", - "quantile", - "quantize", - "utc", - "sequential", - "threshold", - ], ] ] = None, - unit: Optional[Union[Var[Union[int, str]], str, int]] = None, - name: Optional[Union[Var[Union[int, str]], str, int]] = None, + unit: Optional[Union[Var[Union[int, str]], int, str]] = None, + name: Optional[Union[Var[Union[int, str]], int, str]] = None, ticks: Optional[ - Union[Var[List[Union[int, str]]], List[Union[int, str]]] + Union[List[Union[int, str]], Var[List[Union[int, str]]]] ] = None, tick: Optional[Union[Var[bool], bool]] = None, tick_count: Optional[Union[Var[int], int]] = None, tick_line: Optional[Union[Var[bool], bool]] = None, tick_size: Optional[Union[Var[int], int]] = None, min_tick_gap: Optional[Union[Var[int], int]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - text_anchor: Optional[Union[Var[str], str]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + text_anchor: Optional[ + Union[ + Literal["end", "middle", "start"], + Var[Literal["end", "middle", "start"]], + ] + ] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "XAxis": """Create the component. Args: *children: The children of the component. - orientation: The orientation of axis 'top' | 'bottom' - x_axis_id: The id of x-axis which is corresponding to the data. - include_hidden: Ensures that all datapoints within a chart contribute to its domain calculation, even when they are hidden - domain: The range of the axis. Work best in conjuction with allow_data_overflow. + orientation: The orientation of axis 'top' | 'bottom'. Default: "bottom" + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + include_hidden: Ensures that all datapoints within a chart contribute to its domain calculation, even when they are hidden. Default: False + angle: The angle of axis ticks. Default: 0 + padding: Specify the padding of x-axis. Default: {"left": 0, "right": 0} data_key: The key of data displayed in the axis. - hide: If set true, the axis do not display in the chart. + hide: If set true, the axis do not display in the chart. Default: False width: The width of axis which is usually calculated internally. height: The height of axis, which can be setted by user. type_: The type of axis 'number' | 'category' - allow_decimals: Allow the ticks of XAxis to be decimals or not. - allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. - allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". - axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. - mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. - reversed: Reverse the ticks or not. + interval: If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. Default: "preserveEnd" + allow_decimals: Allow the ticks of Axis to be decimals or not. Default: True + allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. Default: False + allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True + domain: The range of the axis. Work best in conjuction with allow_data_overflow. Default: [0, "auto"] + axis_line: If set false, no axis line will be drawn. Default: True + mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. Default: False + reversed: Reverse the ticks or not. Default: False label: The label of axis, which appears next to the axis. - scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function + scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold'. Default: "auto" unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. ticks: Set the values of axis ticks manually. tick: If set false, no ticks will be drawn. - tick_count: The count of axis ticks. - tick_line: If set false, no axis tick lines will be drawn. - tick_size: The length of tick line. - min_tick_gap: The minimum gap between two adjacent labels - stroke: The stroke color of axis - text_anchor: The text anchor of axis + tick_count: The count of axis ticks. Not used if 'type' is 'category'. Default: 5 + tick_line: If set false, no axis tick lines will be drawn. Default: True + tick_size: The length of tick line. Default: 6 + min_tick_gap: The minimum gap between two adjacent labels. Default: 5 + stroke: The stroke color of axis. Default: rx.color("gray", 9) + text_anchor: The text anchor of axis. Default: "middle" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -345,151 +367,161 @@ class YAxis(Axis): cls, *children, orientation: Optional[ - Union[Var[Literal["left", "right"]], Literal["left", "right"]] + Union[Literal["left", "right"], Var[Literal["left", "right"]]] ] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - domain: Optional[Union[Var[List], List]] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + padding: Optional[Union[Dict[str, int], Var[Dict[str, int]]]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, hide: Optional[Union[Var[bool], bool]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, type_: Optional[ - Union[Var[Literal["number", "category"]], Literal["number", "category"]] + Union[Literal["category", "number"], Var[Literal["category", "number"]]] + ] = None, + interval: Optional[ + Union[ + Literal[ + "equidistantPreserveStart", + "preserveEnd", + "preserveStart", + "preserveStartEnd", + ], + Var[ + Union[ + Literal[ + "equidistantPreserveStart", + "preserveEnd", + "preserveStart", + "preserveStartEnd", + ], + int, + ] + ], + int, + ] ] = None, allow_decimals: Optional[Union[Var[bool], bool]] = None, allow_data_overflow: Optional[Union[Var[bool], bool]] = None, allow_duplicated_category: Optional[Union[Var[bool], bool]] = None, + domain: Optional[Union[List, Var[List]]] = None, axis_line: Optional[Union[Var[bool], bool]] = None, mirror: Optional[Union[Var[bool], bool]] = None, reversed: Optional[Union[Var[bool], bool]] = None, label: Optional[ - Union[Var[Union[Dict[str, Any], int, str]], str, int, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], int, str]], int, str] ] = None, scale: Optional[ Union[ + Literal[ + "auto", + "band", + "identity", + "linear", + "log", + "ordinal", + "point", + "pow", + "quantile", + "quantize", + "sequential", + "sqrt", + "threshold", + "time", + "utc", + ], Var[ Literal[ "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", "band", - "point", + "identity", + "linear", + "log", "ordinal", + "point", + "pow", "quantile", "quantize", - "utc", "sequential", + "sqrt", "threshold", + "time", + "utc", ] ], - Literal[ - "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", - "band", - "point", - "ordinal", - "quantile", - "quantize", - "utc", - "sequential", - "threshold", - ], ] ] = None, - unit: Optional[Union[Var[Union[int, str]], str, int]] = None, - name: Optional[Union[Var[Union[int, str]], str, int]] = None, + unit: Optional[Union[Var[Union[int, str]], int, str]] = None, + name: Optional[Union[Var[Union[int, str]], int, str]] = None, ticks: Optional[ - Union[Var[List[Union[int, str]]], List[Union[int, str]]] + Union[List[Union[int, str]], Var[List[Union[int, str]]]] ] = None, tick: Optional[Union[Var[bool], bool]] = None, tick_count: Optional[Union[Var[int], int]] = None, tick_line: Optional[Union[Var[bool], bool]] = None, tick_size: Optional[Union[Var[int], int]] = None, min_tick_gap: Optional[Union[Var[int], int]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - text_anchor: Optional[Union[Var[str], str]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + text_anchor: Optional[ + Union[ + Literal["end", "middle", "start"], + Var[Literal["end", "middle", "start"]], + ] + ] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "YAxis": """Create the component. Args: *children: The children of the component. - orientation: The orientation of axis 'left' | 'right' - y_axis_id: The id of y-axis which is corresponding to the data. - domain: The range of the axis. Work best in conjuction with allow_data_overflow. + orientation: The orientation of axis 'left' | 'right'. Default: "left" + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + padding: Specify the padding of y-axis. Default: {"top": 0, "bottom": 0} data_key: The key of data displayed in the axis. - hide: If set true, the axis do not display in the chart. + hide: If set true, the axis do not display in the chart. Default: False width: The width of axis which is usually calculated internally. height: The height of axis, which can be setted by user. type_: The type of axis 'number' | 'category' - allow_decimals: Allow the ticks of XAxis to be decimals or not. - allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. - allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". - axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. - mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. - reversed: Reverse the ticks or not. + interval: If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. Default: "preserveEnd" + allow_decimals: Allow the ticks of Axis to be decimals or not. Default: True + allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. Default: False + allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True + domain: The range of the axis. Work best in conjuction with allow_data_overflow. Default: [0, "auto"] + axis_line: If set false, no axis line will be drawn. Default: True + mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. Default: False + reversed: Reverse the ticks or not. Default: False label: The label of axis, which appears next to the axis. - scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function + scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold'. Default: "auto" unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. ticks: Set the values of axis ticks manually. tick: If set false, no ticks will be drawn. - tick_count: The count of axis ticks. - tick_line: If set false, no axis tick lines will be drawn. - tick_size: The length of tick line. - min_tick_gap: The minimum gap between two adjacent labels - stroke: The stroke color of axis - text_anchor: The text anchor of axis + tick_count: The count of axis ticks. Not used if 'type' is 'category'. Default: 5 + tick_line: If set false, no axis tick lines will be drawn. Default: True + tick_size: The length of tick line. Default: 6 + min_tick_gap: The minimum gap between two adjacent labels. Default: 5 + stroke: The stroke color of axis. Default: rx.color("gray", 9) + text_anchor: The text anchor of axis. Default: "middle" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -509,48 +541,49 @@ class ZAxis(Recharts): def create( # type: ignore cls, *children, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, - range: Optional[Union[Var[List[int]], List[int]]] = None, - unit: Optional[Union[Var[Union[int, str]], str, int]] = None, - name: Optional[Union[Var[Union[int, str]], str, int]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, + z_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + range: Optional[Union[List[int], Var[List[int]]]] = None, + unit: Optional[Union[Var[Union[int, str]], int, str]] = None, + name: Optional[Union[Var[Union[int, str]], int, str]] = None, scale: Optional[ Union[ + Literal[ + "auto", + "band", + "identity", + "linear", + "log", + "ordinal", + "point", + "pow", + "quantile", + "quantize", + "sequential", + "sqrt", + "threshold", + "time", + "utc", + ], Var[ Literal[ "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", "band", - "point", + "identity", + "linear", + "log", "ordinal", + "point", + "pow", "quantile", "quantize", - "utc", "sequential", + "sqrt", "threshold", + "time", + "utc", ] ], - Literal[ - "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", - "band", - "point", - "ordinal", - "quantile", - "quantize", - "utc", - "sequential", - "threshold", - ], ] ] = None, style: Optional[Style] = None, @@ -559,41 +592,21 @@ class ZAxis(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ZAxis": """Create the component. @@ -601,10 +614,11 @@ class ZAxis(Recharts): Args: *children: The children of the component. data_key: The key of data displayed in the axis. - range: The range of axis. + z_axis_id: The unique id of z-axis. Default: 0 + range: The range of axis. Default: [10, 10] unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. - scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. + scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. Default: "auto" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -625,14 +639,14 @@ class Brush(Recharts): def create( # type: ignore cls, *children, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, x: Optional[Union[Var[int], int]] = None, y: Optional[Union[Var[int], int]] = None, width: Optional[Union[Var[int], int]] = None, height: Optional[Union[Var[int], int]] = None, - data: Optional[Union[Var[List[Any]], List[Any]]] = None, + data: Optional[Union[List[Any], Var[List[Any]]]] = None, traveller_width: Optional[Union[Var[int], int]] = None, gap: Optional[Union[Var[int], int]] = None, start_index: Optional[Union[Var[int], int]] = None, @@ -643,7 +657,7 @@ class Brush(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, + on_change: Optional[EventType[[]]] = None, **props, ) -> "Brush": """Create the component. @@ -653,15 +667,15 @@ class Brush(Recharts): stroke: The stroke color of brush fill: The fill color of brush data_key: The key of data displayed in the axis. - x: The x-coordinate of brush. - y: The y-coordinate of brush. - width: The width of brush. - height: The height of brush. - data: The data domain of brush, [min, max]. - traveller_width: The width of each traveller. - gap: The data with gap of refreshing chart. If the option is not set, the chart will be refreshed every time - start_index: The default start index of brush. If the option is not set, the start index will be 0. - end_index: The default end index of brush. If the option is not set, the end index will be 1. + x: The x-coordinate of brush. Default: 0 + y: The y-coordinate of brush. Default: 0 + width: The width of brush. Default: 0 + height: The height of brush. Default: 40 + data: The original data of a LineChart, a BarChart or an AreaChart. + traveller_width: The width of each traveller. Default: 5 + gap: The data with gap of refreshing chart. If the option is not set, the chart will be refreshed every time. Default: 1 + start_index: The default start index of brush. If the option is not set, the start index will be 0. Default: 0 + end_index: The default end index of brush. If the option is not set, the end index will be calculated by the length of data. style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -683,86 +697,79 @@ class Cartesian(Recharts): *children, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, legend_type: Optional[ Union[ - Var[ - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - "none", - ] - ], Literal[ - "line", - "plainline", - "square", - "rect", "circle", "cross", "diamond", + "line", + "none", + "plainline", + "rect", + "square", "star", "triangle", "wye", - "none", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] ], ] ] = None, + is_animation_active: Optional[Union[Var[bool], bool]] = None, + animation_begin: Optional[Union[Var[int], int]] = None, + animation_duration: Optional[Union[Var[int], int]] = None, + animation_easing: Optional[ + Union[ + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], + ] + ] = None, + unit: Optional[Union[Var[Union[int, str]], int, str]] = None, + name: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Cartesian": """Create the component. @@ -771,9 +778,15 @@ class Cartesian(Recharts): *children: The children of the component. layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical' data_key: The key of a group of data which should be unique in an area chart. - x_axis_id: The id of x-axis which is corresponding to the data. - y_axis_id: The id of y-axis which is corresponding to the data. - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional + is_animation_active: If set false, animation of bar will be disabled. Default: True + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. Default: "ease" + unit: The unit of data. This option will be used in tooltip. + name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively. style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -793,162 +806,165 @@ class Area(Cartesian): def create( # type: ignore cls, *children, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, stroke_width: Optional[Union[Var[int], int]] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, type_: Optional[ Union[ + Literal[ + "basis", + "basisClosed", + "basisOpen", + "bump", + "bumpX", + "bumpY", + "linear", + "linearClosed", + "monotone", + "monotoneX", + "monotoneY", + "natural", + "step", + "stepAfter", + "stepBefore", + ], Var[ Literal[ "basis", "basisClosed", "basisOpen", + "bump", "bumpX", "bumpY", - "bump", "linear", "linearClosed", - "natural", + "monotone", "monotoneX", "monotoneY", - "monotone", + "natural", "step", - "stepBefore", "stepAfter", + "stepBefore", ] ], - Literal[ - "basis", - "basisClosed", - "basisOpen", - "bumpX", - "bumpY", - "bump", - "linear", - "linearClosed", - "natural", - "monotoneX", - "monotoneY", - "monotone", - "step", - "stepBefore", - "stepAfter", - ], ] ] = None, dot: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, active_dot: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, label: Optional[Union[Var[bool], bool]] = None, - stack_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - unit: Optional[Union[Var[Union[int, str]], str, int]] = None, - name: Optional[Union[Var[Union[int, str]], str, int]] = None, + base_line: Optional[ + Union[List[Dict[str, Any]], Var[Union[List[Dict[str, Any]], str]], str] + ] = None, + points: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + stack_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + connect_nulls: Optional[Union[Var[bool], bool]] = None, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, legend_type: Optional[ Union[ - Var[ - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - "none", - ] - ], Literal[ - "line", - "plainline", - "square", - "rect", "circle", "cross", "diamond", + "line", + "none", + "plainline", + "rect", + "square", "star", "triangle", "wye", - "none", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] ], ] ] = None, + is_animation_active: Optional[Union[Var[bool], bool]] = None, + animation_begin: Optional[Union[Var[int], int]] = None, + animation_duration: Optional[Union[Var[int], int]] = None, + animation_easing: Optional[ + Union[ + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], + ] + ] = None, + unit: Optional[Union[Var[Union[int, str]], int, str]] = None, + name: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Area": """Create the component. Args: *children: The children of the component. - stroke: The color of the line stroke. - stroke_width: The width of the line stroke. - fill: The color of the area fill. - type_: The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' | - dot: If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally. - active_dot: The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. - label: If set false, labels will not be drawn. If set true, labels will be drawn which have the props calculated internally. + stroke: The color of the line stroke. Default: rx.color("accent", 9) + stroke_width: The width of the line stroke. Default: 1 + fill: The color of the area fill. Default: rx.color("accent", 5) + type_: The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter'. Default: "monotone" + dot: If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally. Default: False + active_dot: The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {stroke: rx.color("accent", 2), fill: rx.color("accent", 10)} + label: If set false, labels will not be drawn. If set true, labels will be drawn which have the props calculated internally. Default: False + base_line: The value which can describle the line, usually calculated internally. + points: The coordinates of all the points in the area, usually calculated internally. stack_id: The stack id of area, when two areas have the same value axis and same stack_id, then the two areas are stacked in order. - unit: The unit of data. This option will be used in tooltip. - name: The name of data. This option will be used in tooltip and legend to represent a bar. If no value was set to this option, the value of dataKey will be used alternatively. + connect_nulls: Whether to connect a graph area across null points. Default: False layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical' data_key: The key of a group of data which should be unique in an area chart. - x_axis_id: The id of x-axis which is corresponding to the data. - y_axis_id: The id of y-axis which is corresponding to the data. - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional + is_animation_active: If set false, animation of bar will be disabled. Default: True + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. Default: "ease" + unit: The unit of data. This option will be used in tooltip. + name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively. style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -968,65 +984,66 @@ class Bar(Cartesian): def create( # type: ignore cls, *children, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, stroke_width: Optional[Union[Var[int], int]] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, background: Optional[Union[Var[bool], bool]] = None, label: Optional[Union[Var[bool], bool]] = None, stack_id: Optional[Union[Var[str], str]] = None, - unit: Optional[Union[Var[Union[int, str]], str, int]] = None, + unit: Optional[Union[Var[Union[int, str]], int, str]] = None, min_point_size: Optional[Union[Var[int], int]] = None, - name: Optional[Union[Var[Union[int, str]], str, int]] = None, + name: Optional[Union[Var[Union[int, str]], int, str]] = None, bar_size: Optional[Union[Var[int], int]] = None, max_bar_size: Optional[Union[Var[int], int]] = None, + radius: Optional[Union[List[int], Var[Union[List[int], int]], int]] = None, + layout: Optional[ + Union[ + Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], + ] + ] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + legend_type: Optional[ + Union[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] + ], + ] + ] = None, is_animation_active: Optional[Union[Var[bool], bool]] = None, animation_begin: Optional[Union[Var[int], int]] = None, animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[ Union[ - Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], - Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"], - ] - ] = None, - layout: Optional[ - Union[ - Var[Literal["horizontal", "vertical"]], - Literal["horizontal", "vertical"], - ] - ] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - legend_type: Optional[ - Union[ - Var[ - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - "none", - ] - ], - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - "none", - ], + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], ] ] = None, style: Optional[Style] = None, @@ -1035,47 +1052,23 @@ class Bar(Cartesian): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_animation_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_animation_start: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Bar": """Create the component. @@ -1084,24 +1077,25 @@ class Bar(Cartesian): *children: The children of the component. stroke: The color of the line stroke. stroke_width: The width of the line stroke. - fill: The width of the line stroke. - background: If false set, background of bars will not be drawn. If true set, background of bars will be drawn which have the props calculated internally. - label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. + fill: The width of the line stroke. Default: Color("accent", 9) + background: If false set, background of bars will not be drawn. If true set, background of bars will be drawn which have the props calculated internally. Default: False + label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False stack_id: The stack id of bar, when two bars have the same value axis and same stack_id, then the two bars are stacked in order. unit: The unit of data. This option will be used in tooltip. min_point_size: The minimal height of a bar in a horizontal BarChart, or the minimal width of a bar in a vertical BarChart. By default, 0 values are not shown. To visualize a 0 (or close to zero) point, set the minimal point size to a pixel value like 3. In stacked bar charts, minPointSize might not be respected for tightly packed values. So we strongly recommend not using this prop in stacked BarCharts. - name: The name of data. This option will be used in tooltip and legend to represent a bar. If no value was set to this option, the value of dataKey will be used alternatively. + name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively. bar_size: Size of the bar (if one bar_size is set then a bar_size must be set for all bars) max_bar_size: Max size of the bar - is_animation_active: If set false, animation of bar will be disabled. - animation_begin: Specifies when the animation should begin, the unit of this option is ms, default 0. - animation_duration: Specifies the duration of animation, the unit of this option is ms, default 1500. - animation_easing: The type of easing function, default 'ease' + radius: If set a value, the option is the radius of all the rounded corners. If set a array, the option are in turn the radiuses of top-left corner, top-right corner, bottom-right corner, bottom-left corner. Default: 0 layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical' data_key: The key of a group of data which should be unique in an area chart. - x_axis_id: The id of x-axis which is corresponding to the data. - y_axis_id: The id of y-axis which is corresponding to the data. - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional + is_animation_active: If set false, animation of bar will be disabled. Default: True + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. Default: "ease" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -1123,139 +1117,132 @@ class Line(Cartesian): *children, type_: Optional[ Union[ + Literal[ + "basis", + "basisClosed", + "basisOpen", + "bump", + "bumpX", + "bumpY", + "linear", + "linearClosed", + "monotone", + "monotoneX", + "monotoneY", + "natural", + "step", + "stepAfter", + "stepBefore", + ], Var[ Literal[ "basis", "basisClosed", "basisOpen", + "bump", "bumpX", "bumpY", - "bump", "linear", "linearClosed", - "natural", + "monotone", "monotoneX", "monotoneY", - "monotone", + "natural", "step", - "stepBefore", "stepAfter", + "stepBefore", ] ], - Literal[ - "basis", - "basisClosed", - "basisOpen", - "bumpX", - "bumpY", - "bump", - "linear", - "linearClosed", - "natural", - "monotoneX", - "monotoneY", - "monotone", - "step", - "stepBefore", - "stepAfter", - ], ] ] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, stroke_width: Optional[Union[Var[int], int]] = None, dot: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, active_dot: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, label: Optional[Union[Var[bool], bool]] = None, hide: Optional[Union[Var[bool], bool]] = None, connect_nulls: Optional[Union[Var[bool], bool]] = None, - unit: Optional[Union[Var[Union[int, str]], str, int]] = None, - name: Optional[Union[Var[Union[int, str]], str, int]] = None, + unit: Optional[Union[Var[Union[int, str]], int, str]] = None, + points: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + stroke_dasharray: Optional[Union[Var[str], str]] = None, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, legend_type: Optional[ Union[ - Var[ - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - "none", - ] - ], Literal[ - "line", - "plainline", - "square", - "rect", "circle", "cross", "diamond", + "line", + "none", + "plainline", + "rect", + "square", "star", "triangle", "wye", - "none", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] ], ] ] = None, + is_animation_active: Optional[Union[Var[bool], bool]] = None, + animation_begin: Optional[Union[Var[int], int]] = None, + animation_duration: Optional[Union[Var[int], int]] = None, + animation_easing: Optional[ + Union[ + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], + ] + ] = None, + name: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Line": """Create the component. @@ -1263,20 +1250,26 @@ class Line(Cartesian): Args: *children: The children of the component. type_: The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area. - stroke: The color of the line stroke. - stroke_width: The width of the line stroke. - dot: The dot is shown when mouse enter a line chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. - active_dot: The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. - label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. - hide: Hides the line when true, useful when toggling visibility state via legend. + stroke: The color of the line stroke. Default: rx.color("accent", 9) + stroke_width: The width of the line stroke. Default: 1 + dot: The dot is shown when mouse enter a line chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {"stroke": rx.color("accent", 10), "fill": rx.color("accent", 4)} + active_dot: The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {"stroke": rx.color("accent", 2), "fill": rx.color("accent", 10)} + label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False + hide: Hides the line when true, useful when toggling visibility state via legend. Default: False connect_nulls: Whether to connect a graph line across null points. unit: The unit of data. This option will be used in tooltip. - name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. + points: The coordinates of all the points in the line, usually calculated internally. + stroke_dasharray: The pattern of dashes and gaps used to paint the line. layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical' data_key: The key of a group of data which should be unique in an area chart. - x_axis_id: The id of x-axis which is corresponding to the data. - y_axis_id: The id of y-axis which is corresponding to the data. - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional + is_animation_active: If set false, animation of bar will be disabled. Default: True + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. Default: "ease" + name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively. style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -1296,73 +1289,72 @@ class Scatter(Recharts): def create( # type: ignore cls, *children, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, legend_type: Optional[ Union[ - Var[ - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - "none", - ] - ], Literal[ - "line", - "plainline", - "square", - "rect", "circle", "cross", "diamond", + "line", + "none", + "plainline", + "rect", + "square", "star", "triangle", "wye", - "none", ], - ] - ] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - z_axis_id: Optional[Union[Var[str], str]] = None, - line: Optional[Union[Var[bool], bool]] = None, - shape: Optional[ - Union[ Var[ Literal[ - "square", "circle", "cross", "diamond", + "line", + "none", + "plainline", + "rect", + "square", "star", "triangle", "wye", ] ], + ] + ] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + z_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + line: Optional[Union[Var[bool], bool]] = None, + shape: Optional[ + Union[ Literal[ - "square", "circle", "cross", "diamond", "star", "triangle", "wye" + "circle", "cross", "diamond", "square", "star", "triangle", "wye" + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "square", + "star", + "triangle", + "wye", + ] ], ] ] = None, line_type: Optional[ - Union[Var[Literal["joint", "fitting"]], Literal["joint", "fitting"]] + Union[Literal["fitting", "joint"], Var[Literal["fitting", "joint"]]] ] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - name: Optional[Union[Var[Union[int, str]], str, int]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, is_animation_active: Optional[Union[Var[bool], bool]] = None, animation_begin: Optional[Union[Var[int], int]] = None, animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[ Union[ - Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], - Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"], + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], ] ] = None, style: Optional[Style] = None, @@ -1371,41 +1363,21 @@ class Scatter(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Scatter": """Create the component. @@ -1413,19 +1385,18 @@ class Scatter(Recharts): Args: *children: The children of the component. data: The source data, in which each element is an object. - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none' - x_axis_id: The id of x-axis which is corresponding to the data. - y_axis_id: The id of y-axis which is corresponding to the data. - z_axis_id: The id of z-axis which is corresponding to the data. - line: If false set, line will not be drawn. If true set, line will be drawn which have the props calculated internally. - shape: If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' - line_type: If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting' - fill: The fill - name: the name - is_animation_active: If set false, animation of bar will be disabled. - animation_begin: Specifies when the animation should begin, the unit of this option is ms, default 0. - animation_duration: Specifies the duration of animation, the unit of this option is ms, default 1500. - animation_easing: The type of easing function, default 'ease' + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none'. Default: "circle" + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + z_axis_id: The id of z-axis which is corresponding to the data. Default: 0 + line: If false set, line will not be drawn. If true set, line will be drawn which have the props calculated internally. Default: False + shape: If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'. Default: "circle" + line_type: If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting'. Default: "joint" + fill: The fill color of the scatter. Default: rx.color("accent", 9) + is_animation_active: If set false, animation of bar will be disabled. Default: True in CSR, False in SSR + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. Default: "ease" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -1445,38 +1416,38 @@ class Funnel(Recharts): def create( # type: ignore cls, *children, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, name_key: Optional[Union[Var[str], str]] = None, legend_type: Optional[ Union[ - Var[ - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - "none", - ] - ], Literal[ - "line", - "plainline", - "square", - "rect", "circle", "cross", "diamond", + "line", + "none", + "plainline", + "rect", + "square", "star", "triangle", "wye", - "none", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] ], ] ] = None, @@ -1485,58 +1456,37 @@ class Funnel(Recharts): animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[ Union[ - Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], - Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"], + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], ] ] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + trapezoids: Optional[ + Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]] + ] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_animation_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_animation_start: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Funnel": """Create the component. @@ -1544,14 +1494,15 @@ class Funnel(Recharts): Args: *children: The children of the component. data: The source data, in which each element is an object. - data_key: The key of a group of data which should be unique in an area chart. - name_key: The key or getter of a group of data which should be unique in a LineChart. - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. - is_animation_active: If set false, animation of line will be disabled. - animation_begin: Specifies when the animation should begin, the unit of this option is ms. - animation_duration: Specifies the duration of animation, the unit of this option is ms. - animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' - stroke: stroke color + data_key: The key or getter of a group of data which should be unique in a FunnelChart. + name_key: The key of each sector's name. Default: "name" + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "line" + is_animation_active: If set false, animation of line will be disabled. Default: True + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default "ease" + stroke: Stroke color. Default: rx.color("gray", 3) + trapezoids: The coordinates of all the trapezoids in the funnel, usually calculated internally. style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -1571,65 +1522,43 @@ class ErrorBar(Recharts): def create( # type: ignore cls, *children, - direction: Optional[ - Union[Var[Literal["x", "y", "both"]], Literal["x", "y", "both"]] - ] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + direction: Optional[Union[Literal["x", "y"], Var[Literal["x", "y"]]]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, width: Optional[Union[Var[int], int]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - stroke_width: Optional[Union[Var[int], int]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + stroke_width: Optional[Union[Var[Union[float, int]], float, int]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ErrorBar": """Create the component. Args: *children: The children of the component. - direction: The direction of error bar. 'x' | 'y' | 'both' + direction: Only used for ScatterChart with error bars in two directions. Only accepts a value of "x" or "y" and makes the error bars lie in that direction. data_key: The key of a group of data which should be unique in an area chart. - width: The width of the error bar ends. - stroke: The stroke color of error bar. - stroke_width: The stroke width of error bar. + width: The width of the error bar ends. Default: 5 + stroke: The stroke color of error bar. Default: rx.color("gray", 8) + stroke_width: The stroke width of error bar. Default: 1.5 style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -1649,15 +1578,15 @@ class Reference(Recharts): def create( # type: ignore cls, *children, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, if_overflow: Optional[ Union[ - Var[Literal["discard", "hidden", "visible", "extendDomain"]], - Literal["discard", "hidden", "visible", "extendDomain"], + Literal["discard", "extendDomain", "hidden", "visible"], + Var[Literal["discard", "extendDomain", "hidden", "visible"]], ] ] = None, - label: Optional[Union[Var[Union[int, str]], str, int]] = None, + label: Optional[Union[Var[Union[int, str]], int, str]] = None, is_front: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -1665,52 +1594,32 @@ class Reference(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Reference": """Create the component. Args: *children: The children of the component. - x_axis_id: The id of x-axis which is corresponding to the data. - y_axis_id: The id of y-axis which is corresponding to the data. - if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. Default: "discard" label: If set a string or a number, default label will be drawn, and the option is content. - is_front: If set true, the line will be rendered in front of bars in BarChart, etc. + is_front: If set true, the line will be rendered in front of bars in BarChart, etc. Default: False style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -1730,20 +1639,20 @@ class ReferenceLine(Reference): def create( # type: ignore cls, *children, - x: Optional[Union[Var[Union[int, str]], str, int]] = None, - y: Optional[Union[Var[Union[int, str]], str, int]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - stroke_width: Optional[Union[Var[Union[int, str]], str, int]] = None, + x: Optional[Union[Var[Union[int, str]], int, str]] = None, + y: Optional[Union[Var[Union[int, str]], int, str]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + stroke_width: Optional[Union[Var[Union[int, str]], int, str]] = None, segment: Optional[List[Any]] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, if_overflow: Optional[ Union[ - Var[Literal["discard", "hidden", "visible", "extendDomain"]], - Literal["discard", "hidden", "visible", "extendDomain"], + Literal["discard", "extendDomain", "hidden", "visible"], + Var[Literal["discard", "extendDomain", "hidden", "visible"]], ] ] = None, - label: Optional[Union[Var[Union[int, str]], str, int]] = None, + label: Optional[Union[Var[Union[int, str]], int, str]] = None, is_front: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -1751,41 +1660,21 @@ class ReferenceLine(Reference): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ReferenceLine": """Create the component. @@ -1795,13 +1684,13 @@ class ReferenceLine(Reference): x: If set a string or a number, a vertical line perpendicular to the x-axis specified by xAxisId will be drawn. If the specified x-axis is a number axis, the type of x must be Number. If the specified x-axis is a category axis, the value of x must be one of the categorys, otherwise no line will be drawn. y: If set a string or a number, a horizontal line perpendicular to the y-axis specified by yAxisId will be drawn. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys, otherwise no line will be drawn. stroke: The color of the reference line. - stroke_width: The width of the stroke. + stroke_width: The width of the stroke. Default: 1 segment: Array of endpoints in { x, y } format. These endpoints would be used to draw the ReferenceLine. - x_axis_id: The id of x-axis which is corresponding to the data. - y_axis_id: The id of y-axis which is corresponding to the data. - if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. Default: "discard" label: If set a string or a number, default label will be drawn, and the option is content. - is_front: If set true, the line will be rendered in front of bars in BarChart, etc. + is_front: If set true, the line will be rendered in front of bars in BarChart, etc. Default: False style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -1821,20 +1710,20 @@ class ReferenceDot(Reference): def create( # type: ignore cls, *children, - x: Optional[Union[Var[Union[int, str]], str, int]] = None, - y: Optional[Union[Var[Union[int, str]], str, int]] = None, + x: Optional[Union[Var[Union[int, str]], int, str]] = None, + y: Optional[Union[Var[Union[int, str]], int, str]] = None, r: Optional[Union[Var[int], int]] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, if_overflow: Optional[ Union[ - Var[Literal["discard", "hidden", "visible", "extendDomain"]], - Literal["discard", "hidden", "visible", "extendDomain"], + Literal["discard", "extendDomain", "hidden", "visible"], + Var[Literal["discard", "extendDomain", "hidden", "visible"]], ] ] = None, - label: Optional[Union[Var[Union[int, str]], str, int]] = None, + label: Optional[Union[Var[Union[int, str]], int, str]] = None, is_front: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -1842,41 +1731,21 @@ class ReferenceDot(Reference): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ReferenceDot": """Create the component. @@ -1888,11 +1757,11 @@ class ReferenceDot(Reference): r: The radius of dot. fill: The color of the area fill. stroke: The color of the line stroke. - x_axis_id: The id of x-axis which is corresponding to the data. - y_axis_id: The id of y-axis which is corresponding to the data. - if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. + x_axis_id: The id of x-axis which is corresponding to the data. Default: 0 + y_axis_id: The id of y-axis which is corresponding to the data. Default: 0 + if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. Default: "discard" label: If set a string or a number, default label will be drawn, and the option is content. - is_front: If set true, the line will be rendered in front of bars in BarChart, etc. + is_front: If set true, the line will be rendered in front of bars in BarChart, etc. Default: False style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -1912,19 +1781,19 @@ class ReferenceArea(Recharts): def create( # type: ignore cls, *children, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, fill_opacity: Optional[Union[Var[float], float]] = None, - x_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - y_axis_id: Optional[Union[Var[Union[int, str]], str, int]] = None, - x1: Optional[Union[Var[Union[int, str]], str, int]] = None, - x2: Optional[Union[Var[Union[int, str]], str, int]] = None, - y1: Optional[Union[Var[Union[int, str]], str, int]] = None, - y2: Optional[Union[Var[Union[int, str]], str, int]] = None, + x_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + y_axis_id: Optional[Union[Var[Union[int, str]], int, str]] = None, + x1: Optional[Union[Var[Union[int, str]], int, str]] = None, + x2: Optional[Union[Var[Union[int, str]], int, str]] = None, + y1: Optional[Union[Var[Union[int, str]], int, str]] = None, + y2: Optional[Union[Var[Union[int, str]], int, str]] = None, if_overflow: Optional[ Union[ - Var[Literal["discard", "hidden", "visible", "extendDomain"]], - Literal["discard", "hidden", "visible", "extendDomain"], + Literal["discard", "extendDomain", "hidden", "visible"], + Var[Literal["discard", "extendDomain", "hidden", "visible"]], ] ] = None, is_front: Optional[Union[Var[bool], bool]] = None, @@ -1934,41 +1803,21 @@ class ReferenceArea(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ReferenceArea": """Create the component. @@ -1984,8 +1833,8 @@ class ReferenceArea(Recharts): x2: A boundary value of the area. If the specified x-axis is a number axis, the type of x must be Number. If the specified x-axis is a category axis, the value of x must be one of the categorys. If one of x1 or x2 is invalidate, the area will cover along x-axis. y1: A boundary value of the area. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys. If one of y1 or y2 is invalidate, the area will cover along y-axis. y2: A boundary value of the area. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys. If one of y1 or y2 is invalidate, the area will cover along y-axis. - if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. - is_front: If set true, the line will be rendered in front of bars in BarChart, etc. + if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. Default: "discard" + is_front: If set true, the line will be rendered in front of bars in BarChart, etc. Default: False style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -2015,51 +1864,31 @@ class Grid(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Grid": """Create the component. Args: *children: The children of the component. - x: The x-coordinate of grid. - y: The y-coordinate of grid. - width: The width of grid. - height: The height of grid. + x: The x-coordinate of grid. Default: 0 + y: The y-coordinate of grid. Default: 0 + width: The width of grid. Default: 0 + height: The height of grid. Default: 0 style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -2082,15 +1911,15 @@ class CartesianGrid(Grid): horizontal: Optional[Union[Var[bool], bool]] = None, vertical: Optional[Union[Var[bool], bool]] = None, vertical_points: Optional[ - Union[Var[List[Union[int, str]]], List[Union[int, str]]] + Union[List[Union[int, str]], Var[List[Union[int, str]]]] ] = None, horizontal_points: Optional[ - Union[Var[List[Union[int, str]]], List[Union[int, str]]] + Union[List[Union[int, str]], Var[List[Union[int, str]]]] ] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, fill_opacity: Optional[Union[Var[float], float]] = None, stroke_dasharray: Optional[Union[Var[str], str]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, x: Optional[Union[Var[int], int]] = None, y: Optional[Union[Var[int], int]] = None, width: Optional[Union[Var[int], int]] = None, @@ -2101,59 +1930,39 @@ class CartesianGrid(Grid): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CartesianGrid": """Create the component. Args: *children: The children of the component. - horizontal: The horizontal line configuration. - vertical: The vertical line configuration. - vertical_points: The x-coordinates in pixel values of all vertical lines. - horizontal_points: The x-coordinates in pixel values of all vertical lines. + horizontal: The horizontal line configuration. Default: True + vertical: The vertical line configuration. Default: True + vertical_points: The x-coordinates in pixel values of all vertical lines. Default: [] + horizontal_points: The x-coordinates in pixel values of all vertical lines. Default: [] fill: The background of grid. - fill_opacity: The opacity of the background used to fill the space between grid lines - stroke_dasharray: The pattern of dashes and gaps used to paint the lines of the grid - stroke: the stroke color of grid - x: The x-coordinate of grid. - y: The y-coordinate of grid. - width: The width of grid. - height: The height of grid. + fill_opacity: The opacity of the background used to fill the space between grid lines. + stroke_dasharray: The pattern of dashes and gaps used to paint the lines of the grid. + stroke: the stroke color of grid. Default: rx.color("gray", 7) + x: The x-coordinate of grid. Default: 0 + y: The y-coordinate of grid. Default: 0 + width: The width of grid. Default: 0 + height: The height of grid. Default: 0 style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -2175,21 +1984,22 @@ class CartesianAxis(Grid): *children, orientation: Optional[ Union[ - Var[Literal["top", "bottom", "left", "right"]], - Literal["top", "bottom", "left", "right"], + Literal["bottom", "left", "right", "top"], + Var[Literal["bottom", "left", "right", "top"]], ] ] = None, + view_box: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, axis_line: Optional[Union[Var[bool], bool]] = None, + tick: Optional[Union[Var[bool], bool]] = None, tick_line: Optional[Union[Var[bool], bool]] = None, tick_size: Optional[Union[Var[int], int]] = None, interval: Optional[ Union[ - Var[Literal["preserveStart", "preserveEnd", "preserveStartEnd"]], - Literal["preserveStart", "preserveEnd", "preserveStartEnd"], + Literal["preserveEnd", "preserveStart", "preserveStartEnd"], + Var[Literal["preserveEnd", "preserveStart", "preserveStartEnd"]], ] ] = None, - ticks: Optional[Union[Var[bool], bool]] = None, - label: Optional[Union[Var[str], str]] = None, + label: Optional[Union[Var[Union[int, str]], int, str]] = None, mirror: Optional[Union[Var[bool], bool]] = None, tick_margin: Optional[Union[Var[int], int]] = None, x: Optional[Union[Var[int], int]] = None, @@ -2202,60 +2012,41 @@ class CartesianAxis(Grid): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CartesianAxis": """Create the component. Args: *children: The children of the component. - orientation: The orientation of axis 'top' | 'bottom' | 'left' | 'right' - axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. - tick_line: If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. - tick_size: The length of tick line. - interval: If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. - ticks: If set false, no ticks will be drawn. + orientation: The orientation of axis 'top' | 'bottom' | 'left' | 'right'. Default: "bottom" + view_box: The box of viewing area. Default: {"x": 0, "y": 0, "width": 0, "height": 0} + axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. Default: True + tick: If set false, no ticks will be drawn. + tick_line: If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. Default: True + tick_size: The length of tick line. Default: 6 + interval: If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. Default: "preserveEnd" label: If set a string or a number, default label will be drawn, and the option is content. - mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. + mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. Default: False tick_margin: The margin between tick line and tick. - x: The x-coordinate of grid. - y: The y-coordinate of grid. - width: The width of grid. - height: The height of grid. + x: The x-coordinate of grid. Default: 0 + y: The y-coordinate of grid. Default: 0 + width: The width of grid. Default: 0 + height: The height of grid. Default: 0 style: The style of the component. key: A unique key for the component. id: The id for the component. diff --git a/reflex/components/recharts/charts.py b/reflex/components/recharts/charts.py index 37b865b1d..d7e07b2d8 100644 --- a/reflex/components/recharts/charts.py +++ b/reflex/components/recharts/charts.py @@ -8,9 +8,8 @@ from reflex.components.component import Component from reflex.components.recharts.general import ResponsiveContainer from reflex.constants import EventTriggers from reflex.constants.colors import Color -from reflex.event import EventHandler -from reflex.ivars.base import LiteralVar -from reflex.vars import Var +from reflex.event import EventHandler, empty_event +from reflex.vars.base import Var from .recharts import ( LiteralAnimationEasing, @@ -32,16 +31,16 @@ class ChartBase(RechartsCharts): height: Var[Union[str, int]] = "100%" # type: ignore # The customized event handler of click on the component in this chart - on_click: EventHandler[lambda: []] + on_click: EventHandler[empty_event] # The customized event handler of mouseenter on the component in this chart - on_mouse_enter: EventHandler[lambda: []] + on_mouse_enter: EventHandler[empty_event] # The customized event handler of mousemove on the component in this chart - on_mouse_move: EventHandler[lambda: []] + on_mouse_move: EventHandler[empty_event] # The customized event handler of mouseleave on the component in this chart - on_mouse_leave: EventHandler[lambda: []] + on_mouse_leave: EventHandler[empty_event] @staticmethod def _ensure_valid_dimension(name: str, value: Any) -> None: @@ -113,10 +112,10 @@ class CategoricalChartBase(ChartBase): # If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. sync_id: Var[str] - # When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function + # When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function. Default: "index" sync_method: Var[LiteralSyncMethod] - # The layout of area in the chart. 'horizontal' | 'vertical' + # The layout of area in the chart. 'horizontal' | 'vertical'. Default: "horizontal" layout: Var[LiteralLayout] # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' @@ -130,7 +129,7 @@ class AreaChart(CategoricalChartBase): alias = "RechartsAreaChart" - # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' + # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'. Default: "auto" base_value: Var[Union[int, LiteralComposedChartBaseValue]] # Valid children components @@ -156,11 +155,11 @@ class BarChart(CategoricalChartBase): alias = "RechartsBarChart" - # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number - bar_category_gap: Var[Union[str, int]] = LiteralVar.create("10%") + # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number. Default: "10%" + bar_category_gap: Var[Union[str, int]] - # The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number - bar_gap: Var[Union[str, int]] = LiteralVar.create(4) # type: ignore + # The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number. Default: 4 + bar_gap: Var[Union[str, int]] # The width of all the bars in the chart. Number bar_size: Var[int] @@ -168,10 +167,10 @@ class BarChart(CategoricalChartBase): # The maximum width of all the bars in a horizontal BarChart, or maximum height in a vertical BarChart. max_bar_size: Var[int] - # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. + # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. Default: "none" stack_offset: Var[LiteralStackOffset] - # If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) + # If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) Default: False reverse_stack_order: Var[bool] # Valid children components @@ -218,19 +217,19 @@ class ComposedChart(CategoricalChartBase): alias = "RechartsComposedChart" - # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' + # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'. Default: "auto" base_value: Var[Union[int, LiteralComposedChartBaseValue]] - # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number - bar_category_gap: Var[Union[str, int]] # type: ignore + # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number. Default: "10%" + bar_category_gap: Var[Union[str, int]] - # The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number - bar_gap: Var[Union[str, int]] # type: ignore + # The gap between two bars in the same category. Default: 4 + bar_gap: Var[int] - # The width of all the bars in the chart. Number + # The width or height of each bar. If the barSize is not specified, the size of the bar will be calculated by the barCategoryGap, barGap and the quantity of bar groups. bar_size: Var[int] - # If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) + # If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position). Default: False reverse_stack_order: Var[bool] # Valid children components @@ -271,16 +270,16 @@ class PieChart(ChartBase): ] # The customized event handler of mousedown on the sectors in this group - on_mouse_down: EventHandler[lambda: []] + on_mouse_down: EventHandler[empty_event] # The customized event handler of mouseup on the sectors in this group - on_mouse_up: EventHandler[lambda: []] + on_mouse_up: EventHandler[empty_event] # The customized event handler of mouseover on the sectors in this group - on_mouse_over: EventHandler[lambda: []] + on_mouse_over: EventHandler[empty_event] # The customized event handler of mouseout on the sectors in this group - on_mouse_out: EventHandler[lambda: []] + on_mouse_out: EventHandler[empty_event] class RadarChart(ChartBase): @@ -293,25 +292,25 @@ class RadarChart(ChartBase): # The source data, in which each element is an object. data: Var[List[Dict[str, Any]]] - # The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. + # The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. Default: {"top": 0, "right": 0, "left": 0, "bottom": 0} margin: Var[Dict[str, Any]] - # The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage + # The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage. Default: "50%" cx: Var[Union[int, str]] - # The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage + # The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage. Default: "50%" cy: Var[Union[int, str]] - # The angle of first radial direction line. + # The angle of first radial direction line. Default: 90 start_angle: Var[int] - # The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. + # The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. Default: -270 end_angle: Var[int] - # The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + # The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: 0 inner_radius: Var[Union[int, str]] - # The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + # The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: "80%" outer_radius: Var[Union[int, str]] # Valid children components @@ -331,9 +330,9 @@ class RadarChart(ChartBase): A dict mapping the event trigger to the var that is passed to the handler. """ return { - EventTriggers.ON_CLICK: lambda: [], - EventTriggers.ON_MOUSE_ENTER: lambda: [], - EventTriggers.ON_MOUSE_LEAVE: lambda: [], + EventTriggers.ON_CLICK: empty_event, + EventTriggers.ON_MOUSE_ENTER: empty_event, + EventTriggers.ON_MOUSE_LEAVE: empty_event, } @@ -347,31 +346,31 @@ class RadialBarChart(ChartBase): # The source data which each element is an object. data: Var[List[Dict[str, Any]]] - # The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. + # The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "left": 5 "bottom": 5} margin: Var[Dict[str, Any]] - # The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage + # The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage. Default: "50%" cx: Var[Union[int, str]] - # The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage + # The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage. Default: "50%" cy: Var[Union[int, str]] - # The angle of first radial direction line. + # The angle of first radial direction line. Default: 0 start_angle: Var[int] - # The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. + # The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. Default: 360 end_angle: Var[int] - # The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + # The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: "30%" inner_radius: Var[Union[int, str]] - # The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + # The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: "100%" outer_radius: Var[Union[int, str]] - # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number + # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number. Default: "10%" bar_category_gap: Var[Union[int, str]] - # The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number + # The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number. Default: 4 bar_gap: Var[str] # The size of each bar. If the barSize is not specified, the size of bar will be calculated by the barCategoryGap, barGap and the quantity of bar groups. @@ -395,7 +394,7 @@ class ScatterChart(ChartBase): alias = "RechartsScatterChart" - # The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. + # The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "bottom": 5, "left": 5} margin: Var[Dict[str, Any]] # Valid children components @@ -420,14 +419,14 @@ class ScatterChart(ChartBase): A dict mapping the event trigger to the var that is passed to the handler. """ return { - EventTriggers.ON_CLICK: lambda: [], - EventTriggers.ON_MOUSE_DOWN: lambda: [], - EventTriggers.ON_MOUSE_UP: lambda: [], - EventTriggers.ON_MOUSE_MOVE: lambda: [], - EventTriggers.ON_MOUSE_OVER: lambda: [], - EventTriggers.ON_MOUSE_OUT: lambda: [], - EventTriggers.ON_MOUSE_ENTER: lambda: [], - EventTriggers.ON_MOUSE_LEAVE: lambda: [], + EventTriggers.ON_CLICK: empty_event, + EventTriggers.ON_MOUSE_DOWN: empty_event, + EventTriggers.ON_MOUSE_UP: empty_event, + EventTriggers.ON_MOUSE_MOVE: empty_event, + EventTriggers.ON_MOUSE_OVER: empty_event, + EventTriggers.ON_MOUSE_OUT: empty_event, + EventTriggers.ON_MOUSE_ENTER: empty_event, + EventTriggers.ON_MOUSE_LEAVE: empty_event, } @@ -438,10 +437,10 @@ class FunnelChart(ChartBase): alias = "RechartsFunnelChart" - # The layout of bars in the chart. centeric + # The layout of bars in the chart. Default: "centric" layout: Var[str] - # The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. + # The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "bottom": 5, "left": 5} margin: Var[Dict[str, Any]] # The stroke color of each bar. String | Object @@ -458,38 +457,41 @@ class Treemap(RechartsCharts): alias = "RechartsTreemap" - # The width of chart container. String or Integer + # The width of chart container. String or Integer. Default: "100%" width: Var[Union[str, int]] = "100%" # type: ignore - # The height of chart container. + # The height of chart container. String or Integer. Default: "100%" height: Var[Union[str, int]] = "100%" # type: ignore # data of treemap. Array data: Var[List[Dict[str, Any]]] - # The key of a group of data which should be unique in a treemap. String | Number | Function + # The key of a group of data which should be unique in a treemap. String | Number. Default: "value" data_key: Var[Union[str, int]] + # The key of each sector's name. String. Default: "name" + name_key: Var[str] + # The treemap will try to keep every single rectangle's aspect ratio near the aspectRatio given. Number aspect_ratio: Var[int] - # If set false, animation of area will be disabled. + # If set false, animation of area will be disabled. Default: True is_animation_active: Var[bool] - # Specifies when the animation should begin, the unit of this option is ms. + # Specifies when the animation should begin, the unit of this option is ms. Default: 0 animation_begin: Var[int] - # Specifies the duration of animation, the unit of this option is ms. + # Specifies the duration of animation, the unit of this option is ms. Default: 1500 animation_duration: Var[int] - # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease" animation_easing: Var[LiteralAnimationEasing] # The customized event handler of animation start - on_animation_start: EventHandler[lambda: []] + on_animation_start: EventHandler[empty_event] # The customized event handler of animation end - on_animation_end: EventHandler[lambda: []] + on_animation_end: EventHandler[empty_event] @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/recharts/charts.pyi b/reflex/components/recharts/charts.pyi index 48bde7483..f0b494ff8 100644 --- a/reflex/components/recharts/charts.pyi +++ b/reflex/components/recharts/charts.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.constants.colors import Color -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .recharts import ( RechartsCharts, @@ -20,49 +20,29 @@ class ChartBase(RechartsCharts): def create( # type: ignore cls, *children, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ChartBase": """Create a chart component. @@ -90,67 +70,47 @@ class CategoricalChartBase(ChartBase): def create( # type: ignore cls, *children, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, sync_id: Optional[Union[Var[str], str]] = None, sync_method: Optional[ - Union[Var[Literal["index", "value"]], Literal["index", "value"]] + Union[Literal["index", "value"], Var[Literal["index", "value"]]] ] = None, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, stack_offset: Optional[ Union[ - Var[Literal["expand", "none", "wiggle", "silhouette"]], - Literal["expand", "none", "wiggle", "silhouette"], + Literal["expand", "none", "silhouette", "wiggle"], + Var[Literal["expand", "none", "silhouette", "wiggle"]], ] ] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "CategoricalChartBase": """Create a chart component. @@ -160,8 +120,8 @@ class CategoricalChartBase(ChartBase): data: The source data, in which each element is an object. margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. sync_id: If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. - sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function - layout: The layout of area in the chart. 'horizontal' | 'vertical' + sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function. Default: "index" + layout: The layout of area in the chart. 'horizontal' | 'vertical'. Default: "horizontal" stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' width: The width of chart container. String or Integer height: The height of chart container. @@ -186,84 +146,64 @@ class AreaChart(CategoricalChartBase): *children, base_value: Optional[ Union[ - Var[Union[Literal["dataMin", "dataMax", "auto"], int]], + Literal["auto", "dataMax", "dataMin"], + Var[Union[Literal["auto", "dataMax", "dataMin"], int]], int, - Literal["dataMin", "dataMax", "auto"], ] ] = None, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, sync_id: Optional[Union[Var[str], str]] = None, sync_method: Optional[ - Union[Var[Literal["index", "value"]], Literal["index", "value"]] + Union[Literal["index", "value"], Var[Literal["index", "value"]]] ] = None, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, stack_offset: Optional[ Union[ - Var[Literal["expand", "none", "wiggle", "silhouette"]], - Literal["expand", "none", "wiggle", "silhouette"], + Literal["expand", "none", "silhouette", "wiggle"], + Var[Literal["expand", "none", "silhouette", "wiggle"]], ] ] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "AreaChart": """Create a chart component. Args: *children: The children of the chart component. - base_value: The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' + base_value: The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'. Default: "auto" data: The source data, in which each element is an object. margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. sync_id: If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. - sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function - layout: The layout of area in the chart. 'horizontal' | 'vertical' + sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function. Default: "index" + layout: The layout of area in the chart. 'horizontal' | 'vertical'. Default: "horizontal" stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' width: The width of chart container. String or Integer height: The height of chart container. @@ -286,89 +226,69 @@ class BarChart(CategoricalChartBase): def create( # type: ignore cls, *children, - bar_category_gap: Optional[Union[Var[Union[int, str]], str, int]] = None, - bar_gap: Optional[Union[Var[Union[int, str]], str, int]] = None, + bar_category_gap: Optional[Union[Var[Union[int, str]], int, str]] = None, + bar_gap: Optional[Union[Var[Union[int, str]], int, str]] = None, bar_size: Optional[Union[Var[int], int]] = None, max_bar_size: Optional[Union[Var[int], int]] = None, stack_offset: Optional[ Union[ - Var[Literal["expand", "none", "wiggle", "silhouette"]], - Literal["expand", "none", "wiggle", "silhouette"], + Literal["expand", "none", "silhouette", "wiggle"], + Var[Literal["expand", "none", "silhouette", "wiggle"]], ] ] = None, reverse_stack_order: Optional[Union[Var[bool], bool]] = None, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, sync_id: Optional[Union[Var[str], str]] = None, sync_method: Optional[ - Union[Var[Literal["index", "value"]], Literal["index", "value"]] + Union[Literal["index", "value"], Var[Literal["index", "value"]]] ] = None, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "BarChart": """Create a chart component. Args: *children: The children of the chart component. - bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number - bar_gap: The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number + bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number. Default: "10%" + bar_gap: The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number. Default: 4 bar_size: The width of all the bars in the chart. Number max_bar_size: The maximum width of all the bars in a horizontal BarChart, or maximum height in a vertical BarChart. stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' - reverse_stack_order: If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) + reverse_stack_order: If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) Default: False data: The source data, in which each element is an object. margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. sync_id: If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. - sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function - layout: The layout of area in the chart. 'horizontal' | 'vertical' + sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function. Default: "index" + layout: The layout of area in the chart. 'horizontal' | 'vertical'. Default: "horizontal" width: The width of chart container. String or Integer height: The height of chart container. style: The style of the component. @@ -390,67 +310,47 @@ class LineChart(CategoricalChartBase): def create( # type: ignore cls, *children, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, sync_id: Optional[Union[Var[str], str]] = None, sync_method: Optional[ - Union[Var[Literal["index", "value"]], Literal["index", "value"]] + Union[Literal["index", "value"], Var[Literal["index", "value"]]] ] = None, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, stack_offset: Optional[ Union[ - Var[Literal["expand", "none", "wiggle", "silhouette"]], - Literal["expand", "none", "wiggle", "silhouette"], + Literal["expand", "none", "silhouette", "wiggle"], + Var[Literal["expand", "none", "silhouette", "wiggle"]], ] ] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "LineChart": """Create a chart component. @@ -460,8 +360,8 @@ class LineChart(CategoricalChartBase): data: The source data, in which each element is an object. margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. sync_id: If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. - sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function - layout: The layout of area in the chart. 'horizontal' | 'vertical' + sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function. Default: "index" + layout: The layout of area in the chart. 'horizontal' | 'vertical'. Default: "horizontal" stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' width: The width of chart container. String or Integer height: The height of chart container. @@ -486,92 +386,72 @@ class ComposedChart(CategoricalChartBase): *children, base_value: Optional[ Union[ - Var[Union[Literal["dataMin", "dataMax", "auto"], int]], + Literal["auto", "dataMax", "dataMin"], + Var[Union[Literal["auto", "dataMax", "dataMin"], int]], int, - Literal["dataMin", "dataMax", "auto"], ] ] = None, - bar_category_gap: Optional[Union[Var[Union[int, str]], str, int]] = None, - bar_gap: Optional[Union[Var[Union[int, str]], str, int]] = None, + bar_category_gap: Optional[Union[Var[Union[int, str]], int, str]] = None, + bar_gap: Optional[Union[Var[int], int]] = None, bar_size: Optional[Union[Var[int], int]] = None, reverse_stack_order: Optional[Union[Var[bool], bool]] = None, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, sync_id: Optional[Union[Var[str], str]] = None, sync_method: Optional[ - Union[Var[Literal["index", "value"]], Literal["index", "value"]] + Union[Literal["index", "value"], Var[Literal["index", "value"]]] ] = None, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, stack_offset: Optional[ Union[ - Var[Literal["expand", "none", "wiggle", "silhouette"]], - Literal["expand", "none", "wiggle", "silhouette"], + Literal["expand", "none", "silhouette", "wiggle"], + Var[Literal["expand", "none", "silhouette", "wiggle"]], ] ] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ComposedChart": """Create a chart component. Args: *children: The children of the chart component. - base_value: The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' - bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number - bar_gap: The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number - bar_size: The width of all the bars in the chart. Number - reverse_stack_order: If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) + base_value: The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'. Default: "auto" + bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number. Default: "10%" + bar_gap: The gap between two bars in the same category. Default: 4 + bar_size: The width or height of each bar. If the barSize is not specified, the size of the bar will be calculated by the barCategoryGap, barGap and the quantity of bar groups. + reverse_stack_order: If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position). Default: False data: The source data, in which each element is an object. margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. sync_id: If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. - sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function - layout: The layout of area in the chart. 'horizontal' | 'vertical' + sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function. Default: "index" + layout: The layout of area in the chart. 'horizontal' | 'vertical'. Default: "horizontal" stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' width: The width of chart container. String or Integer height: The height of chart container. @@ -594,50 +474,30 @@ class PieChart(ChartBase): def create( # type: ignore cls, *children, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "PieChart": """Create a chart component. @@ -667,29 +527,25 @@ class RadarChart(ChartBase): def create( # type: ignore cls, *children, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, cx: Optional[Union[Var[Union[int, str]], int, str]] = None, cy: Optional[Union[Var[Union[int, str]], int, str]] = None, start_angle: Optional[Union[Var[int], int]] = None, end_angle: Optional[Union[Var[int], int]] = None, inner_radius: Optional[Union[Var[Union[int, str]], int, str]] = None, outer_radius: Optional[Union[Var[Union[int, str]], int, str]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_click: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, **props, ) -> "RadarChart": """Create a chart component. @@ -697,13 +553,13 @@ class RadarChart(ChartBase): Args: *children: The children of the chart component. data: The source data, in which each element is an object. - margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. - cx: The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage - cy: The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage - start_angle: The angle of first radial direction line. - end_angle: The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. - inner_radius: The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage - outer_radius: The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. Default: {"top": 0, "right": 0, "left": 0, "bottom": 0} + cx: The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage. Default: "50%" + cy: The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage. Default: "50%" + start_angle: The angle of first radial direction line. Default: 90 + end_angle: The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. Default: -270 + inner_radius: The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: 0 + outer_radius: The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: "80%" width: The width of chart container. String or Integer height: The height of chart container. style: The style of the component. @@ -725,8 +581,8 @@ class RadialBarChart(ChartBase): def create( # type: ignore cls, *children, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, cx: Optional[Union[Var[Union[int, str]], int, str]] = None, cy: Optional[Union[Var[Union[int, str]], int, str]] = None, start_angle: Optional[Union[Var[int], int]] = None, @@ -736,49 +592,29 @@ class RadialBarChart(ChartBase): bar_category_gap: Optional[Union[Var[Union[int, str]], int, str]] = None, bar_gap: Optional[Union[Var[str], str]] = None, bar_size: Optional[Union[Var[int], int]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RadialBarChart": """Create a chart component. @@ -786,15 +622,15 @@ class RadialBarChart(ChartBase): Args: *children: The children of the chart component. data: The source data which each element is an object. - margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. - cx: The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage - cy: The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage - start_angle: The angle of first radial direction line. - end_angle: The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. - inner_radius: The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage - outer_radius: The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage - bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number - bar_gap: The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number + margin: The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "left": 5 "bottom": 5} + cx: The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage. Default: "50%" + cy: The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage. Default: "50%" + start_angle: The angle of first radial direction line. Default: 0 + end_angle: The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. Default: 360 + inner_radius: The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: "30%" + outer_radius: The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: "100%" + bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number. Default: "10%" + bar_gap: The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number. Default: 4 bar_size: The size of each bar. If the barSize is not specified, the size of bar will be calculated by the barCategoryGap, barGap and the quantity of bar groups. width: The width of chart container. String or Integer height: The height of chart container. @@ -818,44 +654,30 @@ class ScatterChart(ChartBase): def create( # type: ignore cls, *children, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_click: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, **props, ) -> "ScatterChart": """Create a chart component. Args: *children: The children of the chart component. - margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. + margin: The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "bottom": 5, "left": 5} width: The width of chart container. String or Integer height: The height of chart container. style: The style of the component. @@ -878,59 +700,39 @@ class FunnelChart(ChartBase): cls, *children, layout: Optional[Union[Var[str], str]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "FunnelChart": """Create a chart component. Args: *children: The children of the chart component. - layout: The layout of bars in the chart. centeric - margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. + layout: The layout of bars in the chart. Default: "centric" + margin: The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "bottom": 5, "left": 5} stroke: The stroke color of each bar. String | Object width: The width of chart container. String or Integer height: The height of chart container. @@ -953,18 +755,19 @@ class Treemap(RechartsCharts): def create( # type: ignore cls, *children, - width: Optional[Union[Var[Union[int, str]], str, int]] = None, - height: Optional[Union[Var[Union[int, str]], str, int]] = None, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + width: Optional[Union[Var[Union[int, str]], int, str]] = None, + height: Optional[Union[Var[Union[int, str]], int, str]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, + name_key: Optional[Union[Var[str], str]] = None, aspect_ratio: Optional[Union[Var[int], int]] = None, is_animation_active: Optional[Union[Var[bool], bool]] = None, animation_begin: Optional[Union[Var[int], int]] = None, animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[ Union[ - Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], - Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"], + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], ] ] = None, style: Optional[Style] = None, @@ -973,62 +776,39 @@ class Treemap(RechartsCharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_animation_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_animation_start: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Treemap": """Create a chart component. Args: *children: The children of the chart component. - width: The width of chart container. String or Integer - height: The height of chart container. + width: The width of chart container. String or Integer. Default: "100%" + height: The height of chart container. String or Integer. Default: "100%" data: data of treemap. Array - data_key: The key of a group of data which should be unique in a treemap. String | Number | Function + data_key: The key of a group of data which should be unique in a treemap. String | Number. Default: "value" + name_key: The key of each sector's name. String. Default: "name" aspect_ratio: The treemap will try to keep every single rectangle's aspect ratio near the aspectRatio given. Number - is_animation_active: If set false, animation of area will be disabled. - animation_begin: Specifies when the animation should begin, the unit of this option is ms. - animation_duration: Specifies the duration of animation, the unit of this option is ms. - animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + is_animation_active: If set false, animation of area will be disabled. Default: True + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease" style: The style of the component. key: A unique key for the component. id: The id for the component. diff --git a/reflex/components/recharts/general.py b/reflex/components/recharts/general.py index 4f81ea833..641e1562a 100644 --- a/reflex/components/recharts/general.py +++ b/reflex/components/recharts/general.py @@ -6,9 +6,8 @@ from typing import Any, Dict, List, Union from reflex.components.component import MemoizationLeaf from reflex.constants.colors import Color -from reflex.event import EventHandler -from reflex.ivars.base import LiteralVar -from reflex.vars import Var +from reflex.event import EventHandler, empty_event +from reflex.vars.base import LiteralVar, Var from .recharts import ( LiteralAnimationEasing, @@ -31,21 +30,24 @@ class ResponsiveContainer(Recharts, MemoizationLeaf): # The aspect ratio of the container. The final aspect ratio of the SVG element will be (width / height) * aspect. Number aspect: Var[int] - # The width of chart container. Can be a number or string + # The width of chart container. Can be a number or string. Default: "100%" width: Var[Union[int, str]] - # The height of chart container. Number + # The height of chart container. Can be a number or string. Default: "100%" height: Var[Union[int, str]] - # The minimum width of chart container. + # The minimum width of chart container. Number min_width: Var[int] # The minimum height of chart container. Number min_height: Var[int] - # If specified a positive number, debounced function will be used to handle the resize event. + # If specified a positive number, debounced function will be used to handle the resize event. Default: 0 debounce: Var[int] + # If specified provides a callback providing the updated chart width and height values. + on_resize: EventHandler[empty_event] + # Valid children components _valid_children: List[str] = [ "AreaChart", @@ -74,21 +76,24 @@ class Legend(Recharts): # The height of legend container. Number height: Var[int] - # The layout of legend items. 'horizontal' | 'vertical' + # The layout of legend items. 'horizontal' | 'vertical'. Default: "horizontal" layout: Var[LiteralLayout] - # The alignment of legend items in 'horizontal' direction, which can be 'left', 'center', 'right'. + # The alignment of legend items in 'horizontal' direction, which can be 'left', 'center', 'right'. Default: "center" align: Var[LiteralLegendAlign] - # The alignment of legend items in 'vertical' direction, which can be 'top', 'middle', 'bottom'. + # The alignment of legend items in 'vertical' direction, which can be 'top', 'middle', 'bottom'. Default: "bottom" vertical_align: Var[LiteralVerticalAlign] - # The size of icon in each legend item. + # The size of icon in each legend item. Default: 14 icon_size: Var[int] # The type of icon in each legend item. 'line' | 'plainline' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' icon_type: Var[LiteralIconType] + # The source data of the content to be displayed in the legend, usually calculated internally. Default: [] + payload: Var[List[Dict[str, Any]]] + # The width of chart container, usually calculated internally. chart_width: Var[int] @@ -99,28 +104,28 @@ class Legend(Recharts): margin: Var[Dict[str, Any]] # The customized event handler of click on the items in this group - on_click: EventHandler[lambda: []] + on_click: EventHandler[empty_event] # The customized event handler of mousedown on the items in this group - on_mouse_down: EventHandler[lambda: []] + on_mouse_down: EventHandler[empty_event] # The customized event handler of mouseup on the items in this group - on_mouse_up: EventHandler[lambda: []] + on_mouse_up: EventHandler[empty_event] # The customized event handler of mousemove on the items in this group - on_mouse_move: EventHandler[lambda: []] + on_mouse_move: EventHandler[empty_event] # The customized event handler of mouseover on the items in this group - on_mouse_over: EventHandler[lambda: []] + on_mouse_over: EventHandler[empty_event] # The customized event handler of mouseout on the items in this group - on_mouse_out: EventHandler[lambda: []] + on_mouse_out: EventHandler[empty_event] # The customized event handler of mouseenter on the items in this group - on_mouse_enter: EventHandler[lambda: []] + on_mouse_enter: EventHandler[empty_event] # The customized event handler of mouseleave on the items in this group - on_mouse_leave: EventHandler[lambda: []] + on_mouse_leave: EventHandler[empty_event] class GraphingTooltip(Recharts): @@ -225,16 +230,16 @@ class LabelList(Recharts): # The key of a group of label values in data. data_key: Var[Union[str, int]] - # The position of each label relative to it view box。"Top" | "left" | "right" | "bottom" | "inside" | "outside" | "insideLeft" | "insideRight" | "insideTop" | "insideBottom" | "insideTopLeft" | "insideBottomLeft" | "insideTopRight" | "insideBottomRight" | "insideStart" | "insideEnd" | "end" | "center" + # The position of each label relative to it view box. "Top" | "left" | "right" | "bottom" | "inside" | "outside" | "insideLeft" | "insideRight" | "insideTop" | "insideBottom" | "insideTopLeft" | "insideBottomLeft" | "insideTopRight" | "insideBottomRight" | "insideStart" | "insideEnd" | "end" | "center" position: Var[LiteralPosition] - # The offset to the specified "position" + # The offset to the specified "position". Default: 5 offset: Var[int] - # The fill color of each label + # The fill color of each label. Default: rx.color("gray", 10) fill: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 10)) - # The stroke color of each label + # The stroke color of each label. Default: "none" stroke: Var[Union[str, Color]] = LiteralVar.create("none") diff --git a/reflex/components/recharts/general.pyi b/reflex/components/recharts/general.pyi index be6a0d42f..4a8f61c5e 100644 --- a/reflex/components/recharts/general.pyi +++ b/reflex/components/recharts/general.pyi @@ -3,13 +3,13 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.components.component import MemoizationLeaf from reflex.constants.colors import Color -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .recharts import ( Recharts, @@ -33,41 +33,22 @@ class ResponsiveContainer(Recharts, MemoizationLeaf): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_resize: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "ResponsiveContainer": """Create a new memoization leaf component. @@ -75,11 +56,11 @@ class ResponsiveContainer(Recharts, MemoizationLeaf): Args: *children: The children of the component. aspect: The aspect ratio of the container. The final aspect ratio of the SVG element will be (width / height) * aspect. Number - width: The width of chart container. Can be a number or string - height: The height of chart container. Number - min_width: The minimum width of chart container. + width: The width of chart container. Can be a number or string. Default: "100%" + height: The height of chart container. Can be a number or string. Default: "100%" + min_width: The minimum width of chart container. Number min_height: The minimum height of chart container. Number - debounce: If specified a positive number, debounced function will be used to handle the resize event. + debounce: If specified a positive number, debounced function will be used to handle the resize event. Default: 0 style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -103,97 +84,80 @@ class Legend(Recharts): height: Optional[Union[Var[int], int]] = None, layout: Optional[ Union[ - Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"], + Var[Literal["horizontal", "vertical"]], ] ] = None, align: Optional[ Union[ - Var[Literal["left", "center", "right"]], - Literal["left", "center", "right"], + Literal["center", "left", "right"], + Var[Literal["center", "left", "right"]], ] ] = None, vertical_align: Optional[ Union[ - Var[Literal["top", "middle", "bottom"]], - Literal["top", "middle", "bottom"], + Literal["bottom", "middle", "top"], + Var[Literal["bottom", "middle", "top"]], ] ] = None, icon_size: Optional[Union[Var[int], int]] = None, icon_type: Optional[ Union[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ], Var[ Literal[ - "line", - "plainline", - "square", - "rect", "circle", "cross", "diamond", + "line", + "plainline", + "rect", + "square", "star", "triangle", "wye", ] ], - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - ], ] ] = None, + payload: Optional[ + Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]] + ] = None, chart_width: Optional[Union[Var[int], int]] = None, chart_height: Optional[Union[Var[int], int]] = None, - margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + margin: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Legend": """Create the component. @@ -202,11 +166,12 @@ class Legend(Recharts): *children: The children of the component. width: The width of legend container. Number height: The height of legend container. Number - layout: The layout of legend items. 'horizontal' | 'vertical' - align: The alignment of legend items in 'horizontal' direction, which can be 'left', 'center', 'right'. - vertical_align: The alignment of legend items in 'vertical' direction, which can be 'top', 'middle', 'bottom'. - icon_size: The size of icon in each legend item. + layout: The layout of legend items. 'horizontal' | 'vertical'. Default: "horizontal" + align: The alignment of legend items in 'horizontal' direction, which can be 'left', 'center', 'right'. Default: "center" + vertical_align: The alignment of legend items in 'vertical' direction, which can be 'top', 'middle', 'bottom'. Default: "bottom" + icon_size: The size of icon in each legend item. Default: 14 icon_type: The type of icon in each legend item. 'line' | 'plainline' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' + payload: The source data of the content to be displayed in the legend, usually calculated internally. Default: [] chart_width: The width of chart container, usually calculated internally. chart_height: The height of chart container, usually calculated internally. margin: The margin of chart container, usually calculated internally. @@ -233,25 +198,25 @@ class GraphingTooltip(Recharts): offset: Optional[Union[Var[int], int]] = None, filter_null: Optional[Union[Var[bool], bool]] = None, cursor: Optional[ - Union[Var[Union[Dict[str, Any], bool]], Dict[str, Any], bool] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, - view_box: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, - item_style: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, - wrapper_style: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, - content_style: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, - label_style: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + view_box: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, + item_style: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, + wrapper_style: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, + content_style: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, + label_style: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, allow_escape_view_box: Optional[ - Union[Var[Dict[str, bool]], Dict[str, bool]] + Union[Dict[str, bool], Var[Dict[str, bool]]] ] = None, active: Optional[Union[Var[bool], bool]] = None, - position: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, - coordinate: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + position: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, + coordinate: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, is_animation_active: Optional[Union[Var[bool], bool]] = None, animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[ Union[ - Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], - Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"], + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], ] ] = None, style: Optional[Style] = None, @@ -260,41 +225,21 @@ class GraphingTooltip(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "GraphingTooltip": """Create the component. @@ -336,52 +281,52 @@ class Label(Recharts): def create( # type: ignore cls, *children, - view_box: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, + view_box: Optional[Union[Dict[str, Any], Var[Dict[str, Any]]]] = None, value: Optional[Union[Var[str], str]] = None, offset: Optional[Union[Var[int], int]] = None, position: Optional[ Union[ - Var[ - Literal[ - "top", - "left", - "right", - "bottom", - "inside", - "outside", - "insideLeft", - "insideRight", - "insideTop", - "insideBottom", - "insideTopLeft", - "insideBottomLeft", - "insideTopRight", - "insideBottomRight", - "insideStart", - "insideEnd", - "end", - "center", - ] - ], Literal[ - "top", - "left", - "right", "bottom", + "center", + "end", "inside", - "outside", + "insideBottom", + "insideBottomLeft", + "insideBottomRight", + "insideEnd", "insideLeft", "insideRight", - "insideTop", - "insideBottom", - "insideTopLeft", - "insideBottomLeft", - "insideTopRight", - "insideBottomRight", "insideStart", - "insideEnd", - "end", - "center", + "insideTop", + "insideTopLeft", + "insideTopRight", + "left", + "outside", + "right", + "top", + ], + Var[ + Literal[ + "bottom", + "center", + "end", + "inside", + "insideBottom", + "insideBottomLeft", + "insideBottomRight", + "insideEnd", + "insideLeft", + "insideRight", + "insideStart", + "insideTop", + "insideTopLeft", + "insideTopRight", + "left", + "outside", + "right", + "top", + ] ], ] ] = None, @@ -391,41 +336,21 @@ class Label(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Label": """Create the component. @@ -455,97 +380,77 @@ class LabelList(Recharts): def create( # type: ignore cls, *children, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, position: Optional[ Union[ - Var[ - Literal[ - "top", - "left", - "right", - "bottom", - "inside", - "outside", - "insideLeft", - "insideRight", - "insideTop", - "insideBottom", - "insideTopLeft", - "insideBottomLeft", - "insideTopRight", - "insideBottomRight", - "insideStart", - "insideEnd", - "end", - "center", - ] - ], Literal[ - "top", - "left", - "right", "bottom", + "center", + "end", "inside", - "outside", + "insideBottom", + "insideBottomLeft", + "insideBottomRight", + "insideEnd", "insideLeft", "insideRight", - "insideTop", - "insideBottom", - "insideTopLeft", - "insideBottomLeft", - "insideTopRight", - "insideBottomRight", "insideStart", - "insideEnd", - "end", - "center", + "insideTop", + "insideTopLeft", + "insideTopRight", + "left", + "outside", + "right", + "top", + ], + Var[ + Literal[ + "bottom", + "center", + "end", + "inside", + "insideBottom", + "insideBottomLeft", + "insideBottomRight", + "insideEnd", + "insideLeft", + "insideRight", + "insideStart", + "insideTop", + "insideTopLeft", + "insideTopRight", + "left", + "outside", + "right", + "top", + ] ], ] ] = None, offset: Optional[Union[Var[int], int]] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "LabelList": """Create the component. @@ -553,10 +458,10 @@ class LabelList(Recharts): Args: *children: The children of the component. data_key: The key of a group of label values in data. - position: The position of each label relative to it view box。"Top" | "left" | "right" | "bottom" | "inside" | "outside" | "insideLeft" | "insideRight" | "insideTop" | "insideBottom" | "insideTopLeft" | "insideBottomLeft" | "insideTopRight" | "insideBottomRight" | "insideStart" | "insideEnd" | "end" | "center" - offset: The offset to the specified "position" - fill: The fill color of each label - stroke: The stroke color of each label + position: The position of each label relative to it view box. "Top" | "left" | "right" | "bottom" | "inside" | "outside" | "insideLeft" | "insideRight" | "insideTop" | "insideBottom" | "insideTopLeft" | "insideBottomLeft" | "insideTopRight" | "insideBottomRight" | "insideStart" | "insideEnd" | "end" | "center" + offset: The offset to the specified "position". Default: 5 + fill: The fill color of each label. Default: rx.color("gray", 10) + stroke: The stroke color of each label. Default: "none" style: The style of the component. key: A unique key for the component. id: The id for the component. diff --git a/reflex/components/recharts/polar.py b/reflex/components/recharts/polar.py index 76347352b..ccb96f180 100644 --- a/reflex/components/recharts/polar.py +++ b/reflex/components/recharts/polar.py @@ -6,14 +6,14 @@ from typing import Any, Dict, List, Union from reflex.constants import EventTriggers from reflex.constants.colors import Color -from reflex.event import EventHandler -from reflex.ivars.base import LiteralVar -from reflex.vars import Var +from reflex.event import EventHandler, empty_event +from reflex.vars.base import LiteralVar, Var from .recharts import ( LiteralAnimationEasing, LiteralGridType, LiteralLegendType, + LiteralOrientationLeftRightMiddle, LiteralPolarRadiusType, LiteralScale, Recharts, @@ -27,57 +27,75 @@ class Pie(Recharts): alias = "RechartsPie" - # data + # The source data which each element is an object. data: Var[List[Dict[str, Any]]] # The key of each sector's value. data_key: Var[Union[str, int]] - # The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. + # The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. Default: "50%" cx: Var[Union[int, str]] - # The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height. + # The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height. Default: "50%" cy: Var[Union[int, str]] - # The inner radius of pie, which can be set to a percent value. + # The inner radius of pie, which can be set to a percent value. Default: 0 inner_radius: Var[Union[int, str]] - # The outer radius of pie, which can be set to a percent value. + # The outer radius of pie, which can be set to a percent value. Default: "80%" outer_radius: Var[Union[int, str]] - # The angle of first sector. + # The angle of first sector. Default: 0 start_angle: Var[int] - # The direction of sectors. 1 means clockwise and -1 means anticlockwise. + # The end angle of last sector, which should be unequal to start_angle. Default: 360 end_angle: Var[int] - # The minimum angle of each unzero data. + # The minimum angle of each unzero data. Default: 0 min_angle: Var[int] - # The angle between two sectors. + # The angle between two sectors. Default: 0 padding_angle: Var[int] - # The key of each sector's name. + # The key of each sector's name. Default: "name" name_key: Var[str] - # The type of icon in legend. If set to 'none', no legend item will be rendered. + # The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" legend_type: Var[LiteralLegendType] - # If false set, labels will not be drawn. + # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False label: Var[bool] = False # type: ignore - # If false set, label lines will not be drawn. + # If false set, label lines will not be drawn. If true set, label lines will be drawn which have the props calculated internally. Default: False label_line: Var[bool] + # The index of active sector in Pie, this option can be changed in mouse event handlers. + data: Var[List[Dict[str, Any]]] + # Valid children components _valid_children: List[str] = ["Cell", "LabelList"] - # Stoke color + # Stoke color. Default: rx.color("accent", 9) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9)) - # Fill color + # Fill color. Default: rx.color("accent", 3) fill: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 3)) + # If set false, animation of tooltip will be disabled. Default: true in CSR, and false in SSR + is_animation_active: Var[bool] + + # Specifies when the animation should begin, the unit of this option is ms. Default: 400 + animation_begin: Var[int] + + # Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_duration: Var[int] + + # The type of easing function. Default: "ease" + animation_easing: Var[LiteralAnimationEasing] + + # The tabindex of wrapper surrounding the cells. Default: 0 + root_tab_index: Var[int] + def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -85,12 +103,14 @@ class Pie(Recharts): A dict mapping the event trigger to the var that is passed to the handler. """ return { - EventTriggers.ON_CLICK: lambda: [], - EventTriggers.ON_MOUSE_MOVE: lambda: [], - EventTriggers.ON_MOUSE_OVER: lambda: [], - EventTriggers.ON_MOUSE_OUT: lambda: [], - EventTriggers.ON_MOUSE_ENTER: lambda: [], - EventTriggers.ON_MOUSE_LEAVE: lambda: [], + EventTriggers.ON_ANIMATION_START: empty_event, + EventTriggers.ON_ANIMATION_END: empty_event, + EventTriggers.ON_CLICK: empty_event, + EventTriggers.ON_MOUSE_MOVE: empty_event, + EventTriggers.ON_MOUSE_OVER: empty_event, + EventTriggers.ON_MOUSE_OUT: empty_event, + EventTriggers.ON_MOUSE_ENTER: empty_event, + EventTriggers.ON_MOUSE_LEAVE: empty_event, } @@ -107,36 +127,50 @@ class Radar(Recharts): # The coordinates of all the vertexes of the radar shape, like [{ x, y }]. points: Var[List[Dict[str, Any]]] - # If false set, dots will not be drawn + # If false set, dots will not be drawn. Default: True dot: Var[bool] - # Stoke color + # Stoke color. Default: rx.color("accent", 9) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9)) - # Fill color + # Fill color. Default: rx.color("accent", 3) fill: Var[str] = LiteralVar.create(Color("accent", 3)) - # opacity + # opacity. Default: 0.6 fill_opacity: Var[float] = LiteralVar.create(0.6) - # The type of icon in legend. If set to 'none', no legend item will be rendered. - legend_type: Var[str] + # The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" + legend_type: Var[LiteralLegendType] - # If false set, labels will not be drawn + # If false set, labels will not be drawn. Default: True label: Var[bool] - # Specifies when the animation should begin, the unit of this option is ms. + # If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR + is_animation_active: Var[bool] + + # Specifies when the animation should begin, the unit of this option is ms. Default: 0 animation_begin: Var[int] - # Specifies the duration of animation, the unit of this option is ms. + # Specifies the duration of animation, the unit of this option is ms. Default: 1500 animation_duration: Var[int] - # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease" animation_easing: Var[LiteralAnimationEasing] # Valid children components _valid_children: List[str] = ["LabelList"] + def get_event_triggers(self) -> dict[str, Union[Var, Any]]: + """Get the event triggers that pass the component's value to the handler. + + Returns: + A dict mapping the event trigger to the var that is passed to the handler. + """ + return { + EventTriggers.ON_ANIMATION_START: empty_event, + EventTriggers.ON_ANIMATION_END: empty_event, + } + class RadialBar(Recharts): """A RadialBar chart component in Recharts.""" @@ -145,31 +179,34 @@ class RadialBar(Recharts): alias = "RechartsRadialBar" + # The source data which each element is an object. + data: Var[List[Dict[str, Any]]] + # The key of a group of data which should be unique to show the meaning of angle axis. data_key: Var[Union[str, int]] - # Min angle of each bar. A positive value between 0 and 360. + # Min angle of each bar. A positive value between 0 and 360. Default: 0 min_angle: Var[int] - # Type of legend - legend_type: Var[str] + # The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" + legend_type: Var[LiteralLegendType] - # If false set, labels will not be drawn. + # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False label: Var[Union[bool, Dict[str, Any]]] - # If false set, background sector will not be drawn. + # If false set, background sector will not be drawn. Default: False background: Var[Union[bool, Dict[str, Any]]] - # If set false, animation of radial bars will be disabled. By default true in CSR, and false in SSR + # If set false, animation of radial bars will be disabled. Default: True is_animation_active: Var[bool] - # Specifies when the animation should begin, the unit of this option is ms. By default 0 + # Specifies when the animation should begin, the unit of this option is ms. Default: 0 animation_begin: Var[int] - # Specifies the duration of animation, the unit of this option is ms. By default 1500 + # Specifies the duration of animation, the unit of this option is ms. Default 1500 animation_duration: Var[int] - # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. By default 'ease' + # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease" animation_easing: Var[LiteralAnimationEasing] # Valid children components @@ -182,14 +219,14 @@ class RadialBar(Recharts): A dict mapping the event trigger to the var that is passed to the handler. """ return { - EventTriggers.ON_CLICK: lambda: [], - EventTriggers.ON_MOUSE_MOVE: lambda: [], - EventTriggers.ON_MOUSE_OVER: lambda: [], - EventTriggers.ON_MOUSE_OUT: lambda: [], - EventTriggers.ON_MOUSE_ENTER: lambda: [], - EventTriggers.ON_MOUSE_LEAVE: lambda: [], - EventTriggers.ON_ANIMATION_START: lambda: [], - EventTriggers.ON_ANIMATION_END: lambda: [], + EventTriggers.ON_CLICK: empty_event, + EventTriggers.ON_MOUSE_MOVE: empty_event, + EventTriggers.ON_MOUSE_OVER: empty_event, + EventTriggers.ON_MOUSE_OUT: empty_event, + EventTriggers.ON_MOUSE_ENTER: empty_event, + EventTriggers.ON_MOUSE_LEAVE: empty_event, + EventTriggers.ON_ANIMATION_START: empty_event, + EventTriggers.ON_ANIMATION_END: empty_event, } @@ -212,56 +249,56 @@ class PolarAngleAxis(Recharts): # The outer radius of circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. radius: Var[Union[int, str]] - # If false set, axis line will not be drawn. If true set, axis line will be drawn which have the props calculated internally. If object set, axis line will be drawn which have the props mergered by the internal calculated props and the option. + # If false set, axis line will not be drawn. If true set, axis line will be drawn which have the props calculated internally. If object set, axis line will be drawn which have the props mergered by the internal calculated props and the option. Default: True axis_line: Var[Union[bool, Dict[str, Any]]] - # The type of axis line. - axis_line_type: Var[str] + # The type of axis line. Default: "polygon" + axis_line_type: Var[LiteralGridType] - # If false set, tick lines will not be drawn. If true set, tick lines will be drawn which have the props calculated internally. If object set, tick lines will be drawn which have the props mergered by the internal calculated props and the option. + # If false set, tick lines will not be drawn. If true set, tick lines will be drawn which have the props calculated internally. If object set, tick lines will be drawn which have the props mergered by the internal calculated props and the option. Default: False tick_line: Var[Union[bool, Dict[str, Any]]] = LiteralVar.create(False) - # The width or height of tick. - tick: Var[Union[int, str]] + # If false set, ticks will not be drawn. If true set, ticks will be drawn which have the props calculated internally. If object set, ticks will be drawn which have the props mergered by the internal calculated props and the option. Default: True + tick: Var[Union[bool, Dict[str, Any]]] # The array of every tick's value and angle. ticks: Var[List[Dict[str, Any]]] - # The orientation of axis text. - orient: Var[str] + # The orientation of axis text. Default: "outer" + orientation: Var[str] - # The stroke color of axis + # The stroke color of axis. Default: rx.color("gray", 10) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 10)) - # Allow the axis has duplicated categorys or not when the type of axis is "category". + # Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True allow_duplicated_category: Var[bool] # Valid children components. _valid_children: List[str] = ["Label"] # The customized event handler of click on the ticks of this axis. - on_click: EventHandler[lambda: []] + on_click: EventHandler[empty_event] # The customized event handler of mousedown on the the ticks of this axis. - on_mouse_down: EventHandler[lambda: []] + on_mouse_down: EventHandler[empty_event] # The customized event handler of mouseup on the ticks of this axis. - on_mouse_up: EventHandler[lambda: []] + on_mouse_up: EventHandler[empty_event] # The customized event handler of mousemove on the ticks of this axis. - on_mouse_move: EventHandler[lambda: []] + on_mouse_move: EventHandler[empty_event] # The customized event handler of mouseover on the ticks of this axis. - on_mouse_over: EventHandler[lambda: []] + on_mouse_over: EventHandler[empty_event] # The customized event handler of mouseout on the ticks of this axis. - on_mouse_out: EventHandler[lambda: []] + on_mouse_out: EventHandler[empty_event] # The customized event handler of moustenter on the ticks of this axis. - on_mouse_enter: EventHandler[lambda: []] + on_mouse_enter: EventHandler[empty_event] # The customized event handler of mouseleave on the ticks of this axis. - on_mouse_leave: EventHandler[lambda: []] + on_mouse_leave: EventHandler[empty_event] class PolarGrid(Recharts): @@ -271,17 +308,17 @@ class PolarGrid(Recharts): alias = "RechartsPolarGrid" - # The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. - cx: Var[Union[int, str]] + # The x-coordinate of center. + cx: Var[int] - # The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height. - cy: Var[Union[int, str]] + # The y-coordinate of center. + cy: Var[int] # The radius of the inner polar grid. - inner_radius: Var[Union[int, str]] + inner_radius: Var[int] # The radius of the outer polar grid. - outer_radius: Var[Union[int, str]] + outer_radius: Var[int] # The array of every line grid's angle. polar_angles: Var[List[int]] @@ -289,10 +326,10 @@ class PolarGrid(Recharts): # The array of every line grid's radius. polar_radius: Var[List[int]] - # The type of polar grids. 'polygon' | 'circle' + # The type of polar grids. 'polygon' | 'circle'. Default: "polygon" grid_type: Var[LiteralGridType] - # The stroke color of grid + # The stroke color of grid. Default: rx.color("gray", 10) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 10)) # Valid children components @@ -306,46 +343,46 @@ class PolarRadiusAxis(Recharts): alias = "RechartsPolarRadiusAxis" - # The angle of radial direction line to display axis text. + # The angle of radial direction line to display axis text. Default: 0 angle: Var[int] - # The type of axis line. 'number' | 'category' + # The type of axis line. 'number' | 'category'. Default: "category" type_: Var[LiteralPolarRadiusType] - # Allow the axis has duplicated categorys or not when the type of axis is "category". + # Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True allow_duplicated_category: Var[bool] # The x-coordinate of center. - cx: Var[Union[int, str]] + cx: Var[int] # The y-coordinate of center. - cy: Var[Union[int, str]] + cy: Var[int] - # If set to true, the ticks of this axis are reversed. + # If set to true, the ticks of this axis are reversed. Default: False reversed: Var[bool] - # The orientation of axis text. - orientation: Var[str] + # The orientation of axis text. Default: "right" + orientation: Var[LiteralOrientationLeftRightMiddle] - # If false set, axis line will not be drawn. If true set, axis line will be drawn which have the props calculated internally. If object set, axis line will be drawn which have the props mergered by the internal calculated props and the option. + # If false set, axis line will not be drawn. If true set, axis line will be drawn which have the props calculated internally. If object set, axis line will be drawn which have the props mergered by the internal calculated props and the option. Default: True axis_line: Var[Union[bool, Dict[str, Any]]] - # The width or height of tick. - tick: Var[Union[int, str]] + # If false set, ticks will not be drawn. If true set, ticks will be drawn which have the props calculated internally. If object set, ticks will be drawn which have the props mergered by the internal calculated props and the option. Default: True + tick: Var[Union[bool, Dict[str, Any]]] - # The count of ticks. + # The count of axis ticks. Not used if 'type' is 'category'. Default: 5 tick_count: Var[int] - # If 'auto' set, the scale funtion is linear scale. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' + # If 'auto' set, the scale funtion is linear scale. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold'. Default: "auto" scale: Var[LiteralScale] # Valid children components _valid_children: List[str] = ["Label"] - # The domain of the polar radius axis, specifying the minimum and maximum values. - domain: Var[List[int]] = LiteralVar.create([0, 250]) + # The domain of the polar radius axis, specifying the minimum and maximum values. Default: [0, "auto"] + domain: Var[List[Union[int, str]]] - # The stroke color of axis + # The stroke color of axis. Default: rx.color("gray", 10) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("gray", 10)) def get_event_triggers(self) -> dict[str, Union[Var, Any]]: @@ -355,12 +392,12 @@ class PolarRadiusAxis(Recharts): A dict mapping the event trigger to the var that is passed to the handler. """ return { - EventTriggers.ON_CLICK: lambda: [], - EventTriggers.ON_MOUSE_MOVE: lambda: [], - EventTriggers.ON_MOUSE_OVER: lambda: [], - EventTriggers.ON_MOUSE_OUT: lambda: [], - EventTriggers.ON_MOUSE_ENTER: lambda: [], - EventTriggers.ON_MOUSE_LEAVE: lambda: [], + EventTriggers.ON_CLICK: empty_event, + EventTriggers.ON_MOUSE_MOVE: empty_event, + EventTriggers.ON_MOUSE_OVER: empty_event, + EventTriggers.ON_MOUSE_OUT: empty_event, + EventTriggers.ON_MOUSE_ENTER: empty_event, + EventTriggers.ON_MOUSE_LEAVE: empty_event, } diff --git a/reflex/components/recharts/polar.pyi b/reflex/components/recharts/polar.pyi index 81fb74b27..c02596006 100644 --- a/reflex/components/recharts/polar.pyi +++ b/reflex/components/recharts/polar.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.constants.colors import Color -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var from .recharts import ( Recharts, @@ -21,8 +21,8 @@ class Pie(Recharts): def create( # type: ignore cls, *children, - data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, cx: Optional[Union[Var[Union[int, str]], int, str]] = None, cy: Optional[Union[Var[Union[int, str]], int, str]] = None, inner_radius: Optional[Union[Var[Union[int, str]], int, str]] = None, @@ -34,84 +34,91 @@ class Pie(Recharts): name_key: Optional[Union[Var[str], str]] = None, legend_type: Optional[ Union[ - Var[ - Literal[ - "line", - "plainline", - "square", - "rect", - "circle", - "cross", - "diamond", - "star", - "triangle", - "wye", - "none", - ] - ], Literal[ - "line", - "plainline", - "square", - "rect", "circle", "cross", "diamond", + "line", + "none", + "plainline", + "rect", + "square", "star", "triangle", "wye", - "none", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] ], ] ] = None, label: Optional[Union[Var[bool], bool]] = None, label_line: Optional[Union[Var[bool], bool]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, - fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + fill: Optional[Union[Color, Var[Union[Color, str]], str]] = None, + is_animation_active: Optional[Union[Var[bool], bool]] = None, + animation_begin: Optional[Union[Var[int], int]] = None, + animation_duration: Optional[Union[Var[int], int]] = None, + animation_easing: Optional[ + Union[ + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], + ] + ] = None, + root_tab_index: Optional[Union[Var[int], int]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, **props, ) -> "Pie": """Create the component. Args: *children: The children of the component. - data: data + data: The index of active sector in Pie, this option can be changed in mouse event handlers. data_key: The key of each sector's value. - cx: The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. - cy: The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height. - inner_radius: The inner radius of pie, which can be set to a percent value. - outer_radius: The outer radius of pie, which can be set to a percent value. - start_angle: The angle of first sector. - end_angle: The direction of sectors. 1 means clockwise and -1 means anticlockwise. - min_angle: The minimum angle of each unzero data. - padding_angle: The angle between two sectors. - name_key: The key of each sector's name. - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. - label: If false set, labels will not be drawn. - label_line: If false set, label lines will not be drawn. - stroke: Stoke color - fill: Fill color + cx: The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. Default: "50%" + cy: The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height. Default: "50%" + inner_radius: The inner radius of pie, which can be set to a percent value. Default: 0 + outer_radius: The outer radius of pie, which can be set to a percent value. Default: "80%" + start_angle: The angle of first sector. Default: 0 + end_angle: The end angle of last sector, which should be unequal to start_angle. Default: 360 + min_angle: The minimum angle of each unzero data. Default: 0 + padding_angle: The angle between two sectors. Default: 0 + name_key: The key of each sector's name. Default: "name" + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" + label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False + label_line: If false set, label lines will not be drawn. If true set, label lines will be drawn which have the props calculated internally. Default: False + stroke: Stoke color. Default: rx.color("accent", 9) + fill: Fill color. Default: rx.color("accent", 3) + is_animation_active: If set false, animation of tooltip will be disabled. Default: true in CSR, and false in SSR + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 400 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. Default: "ease" + root_tab_index: The tabindex of wrapper surrounding the cells. Default: 0 style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -126,25 +133,58 @@ class Pie(Recharts): ... class Radar(Recharts): + def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ... @overload @classmethod def create( # type: ignore cls, *children, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, - points: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, + points: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, dot: Optional[Union[Var[bool], bool]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, fill: Optional[Union[Var[str], str]] = None, fill_opacity: Optional[Union[Var[float], float]] = None, - legend_type: Optional[Union[Var[str], str]] = None, + legend_type: Optional[ + Union[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] + ], + ] + ] = None, label: Optional[Union[Var[bool], bool]] = None, + is_animation_active: Optional[Union[Var[bool], bool]] = None, animation_begin: Optional[Union[Var[int], int]] = None, animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[ Union[ - Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], - Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"], + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], ] ] = None, style: Optional[Style] = None, @@ -153,41 +193,8 @@ class Radar(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, **props, ) -> "Radar": """Create the component. @@ -196,15 +203,16 @@ class Radar(Recharts): *children: The children of the component. data_key: The key of a group of data which should be unique in a radar chart. points: The coordinates of all the vertexes of the radar shape, like [{ x, y }]. - dot: If false set, dots will not be drawn - stroke: Stoke color - fill: Fill color - fill_opacity: opacity - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. - label: If false set, labels will not be drawn - animation_begin: Specifies when the animation should begin, the unit of this option is ms. - animation_duration: Specifies the duration of animation, the unit of this option is ms. - animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + dot: If false set, dots will not be drawn. Default: True + stroke: Stoke color. Default: rx.color("accent", 9) + fill: Fill color. Default: rx.color("accent", 3) + fill_opacity: opacity. Default: 0.6 + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" + label: If false set, labels will not be drawn. Default: True + is_animation_active: If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500 + animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -225,22 +233,54 @@ class RadialBar(Recharts): def create( # type: ignore cls, *children, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + data: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, min_angle: Optional[Union[Var[int], int]] = None, - legend_type: Optional[Union[Var[str], str]] = None, + legend_type: Optional[ + Union[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] + ], + ] + ] = None, label: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, background: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, is_animation_active: Optional[Union[Var[bool], bool]] = None, animation_begin: Optional[Union[Var[int], int]] = None, animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[ Union[ - Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], - Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"], + Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"], + Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]], ] ] = None, style: Optional[Style] = None, @@ -249,43 +289,30 @@ class RadialBar(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_animation_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_animation_start: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_animation_end: Optional[EventType[[]]] = None, + on_animation_start: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, **props, ) -> "RadialBar": """Create the component. Args: *children: The children of the component. + data: The source data which each element is an object. data_key: The key of a group of data which should be unique to show the meaning of angle axis. - min_angle: Min angle of each bar. A positive value between 0 and 360. - legend_type: Type of legend - label: If false set, labels will not be drawn. - background: If false set, background sector will not be drawn. - is_animation_active: If set false, animation of radial bars will be disabled. By default true in CSR, and false in SSR - animation_begin: Specifies when the animation should begin, the unit of this option is ms. By default 0 - animation_duration: Specifies the duration of animation, the unit of this option is ms. By default 1500 - animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. By default 'ease' + min_angle: Min angle of each bar. A positive value between 0 and 360. Default: 0 + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" + label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False + background: If false set, background sector will not be drawn. Default: False + is_animation_active: If set false, animation of radial bars will be disabled. Default: True + animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0 + animation_duration: Specifies the duration of animation, the unit of this option is ms. Default 1500 + animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -305,21 +332,25 @@ class PolarAngleAxis(Recharts): def create( # type: ignore cls, *children, - data_key: Optional[Union[Var[Union[int, str]], str, int]] = None, + data_key: Optional[Union[Var[Union[int, str]], int, str]] = None, cx: Optional[Union[Var[Union[int, str]], int, str]] = None, cy: Optional[Union[Var[Union[int, str]], int, str]] = None, radius: Optional[Union[Var[Union[int, str]], int, str]] = None, axis_line: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] + ] = None, + axis_line_type: Optional[ + Union[Literal["circle", "polygon"], Var[Literal["circle", "polygon"]]] ] = None, - axis_line_type: Optional[Union[Var[str], str]] = None, tick_line: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, - tick: Optional[Union[Var[Union[int, str]], int, str]] = None, - ticks: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, - orient: Optional[Union[Var[str], str]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + tick: Optional[ + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] + ] = None, + ticks: Optional[Union[List[Dict[str, Any]], Var[List[Dict[str, Any]]]]] = None, + orientation: Optional[Union[Var[str], str]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, allow_duplicated_category: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -327,41 +358,21 @@ class PolarAngleAxis(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "PolarAngleAxis": """Create the component. @@ -372,14 +383,14 @@ class PolarAngleAxis(Recharts): cx: The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. cy: The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height. radius: The outer radius of circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. - axis_line: If false set, axis line will not be drawn. If true set, axis line will be drawn which have the props calculated internally. If object set, axis line will be drawn which have the props mergered by the internal calculated props and the option. - axis_line_type: The type of axis line. - tick_line: If false set, tick lines will not be drawn. If true set, tick lines will be drawn which have the props calculated internally. If object set, tick lines will be drawn which have the props mergered by the internal calculated props and the option. - tick: The width or height of tick. + axis_line: If false set, axis line will not be drawn. If true set, axis line will be drawn which have the props calculated internally. If object set, axis line will be drawn which have the props mergered by the internal calculated props and the option. Default: True + axis_line_type: The type of axis line. Default: "polygon" + tick_line: If false set, tick lines will not be drawn. If true set, tick lines will be drawn which have the props calculated internally. If object set, tick lines will be drawn which have the props mergered by the internal calculated props and the option. Default: False + tick: If false set, ticks will not be drawn. If true set, ticks will be drawn which have the props calculated internally. If object set, ticks will be drawn which have the props mergered by the internal calculated props and the option. Default: True ticks: The array of every tick's value and angle. - orient: The orientation of axis text. - stroke: The stroke color of axis - allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". + orientation: The orientation of axis text. Default: "outer" + stroke: The stroke color of axis. Default: rx.color("gray", 10) + allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -399,71 +410,51 @@ class PolarGrid(Recharts): def create( # type: ignore cls, *children, - cx: Optional[Union[Var[Union[int, str]], int, str]] = None, - cy: Optional[Union[Var[Union[int, str]], int, str]] = None, - inner_radius: Optional[Union[Var[Union[int, str]], int, str]] = None, - outer_radius: Optional[Union[Var[Union[int, str]], int, str]] = None, - polar_angles: Optional[Union[Var[List[int]], List[int]]] = None, - polar_radius: Optional[Union[Var[List[int]], List[int]]] = None, + cx: Optional[Union[Var[int], int]] = None, + cy: Optional[Union[Var[int], int]] = None, + inner_radius: Optional[Union[Var[int], int]] = None, + outer_radius: Optional[Union[Var[int], int]] = None, + polar_angles: Optional[Union[List[int], Var[List[int]]]] = None, + polar_radius: Optional[Union[List[int], Var[List[int]]]] = None, grid_type: Optional[ - Union[Var[Literal["polygon", "circle"]], Literal["polygon", "circle"]] + Union[Literal["circle", "polygon"], Var[Literal["circle", "polygon"]]] ] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "PolarGrid": """Create the component. Args: *children: The children of the component. - cx: The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. - cy: The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height. + cx: The x-coordinate of center. + cy: The y-coordinate of center. inner_radius: The radius of the inner polar grid. outer_radius: The radius of the outer polar grid. polar_angles: The array of every line grid's angle. polar_radius: The array of every line grid's radius. - grid_type: The type of polar grids. 'polygon' | 'circle' - stroke: The stroke color of grid + grid_type: The type of polar grids. 'polygon' | 'circle'. Default: "polygon" + stroke: The stroke color of grid. Default: rx.color("gray", 10) style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -486,101 +477,100 @@ class PolarRadiusAxis(Recharts): *children, angle: Optional[Union[Var[int], int]] = None, type_: Optional[ - Union[Var[Literal["number", "category"]], Literal["number", "category"]] + Union[Literal["category", "number"], Var[Literal["category", "number"]]] ] = None, allow_duplicated_category: Optional[Union[Var[bool], bool]] = None, - cx: Optional[Union[Var[Union[int, str]], int, str]] = None, - cy: Optional[Union[Var[Union[int, str]], int, str]] = None, + cx: Optional[Union[Var[int], int]] = None, + cy: Optional[Union[Var[int], int]] = None, reversed: Optional[Union[Var[bool], bool]] = None, - orientation: Optional[Union[Var[str], str]] = None, - axis_line: Optional[ - Union[Var[Union[Dict[str, Any], bool]], bool, Dict[str, Any]] + orientation: Optional[ + Union[ + Literal["left", "middle", "right"], + Var[Literal["left", "middle", "right"]], + ] + ] = None, + axis_line: Optional[ + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] + ] = None, + tick: Optional[ + Union[Dict[str, Any], Var[Union[Dict[str, Any], bool]], bool] ] = None, - tick: Optional[Union[Var[Union[int, str]], int, str]] = None, tick_count: Optional[Union[Var[int], int]] = None, scale: Optional[ Union[ + Literal[ + "auto", + "band", + "identity", + "linear", + "log", + "ordinal", + "point", + "pow", + "quantile", + "quantize", + "sequential", + "sqrt", + "threshold", + "time", + "utc", + ], Var[ Literal[ "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", "band", - "point", + "identity", + "linear", + "log", "ordinal", + "point", + "pow", "quantile", "quantize", - "utc", "sequential", + "sqrt", "threshold", + "time", + "utc", ] ], - Literal[ - "auto", - "linear", - "pow", - "sqrt", - "log", - "identity", - "time", - "band", - "point", - "ordinal", - "quantile", - "quantize", - "utc", - "sequential", - "threshold", - ], ] ] = None, - domain: Optional[Union[Var[List[int]], List[int]]] = None, - stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + domain: Optional[ + Union[List[Union[int, str]], Var[List[Union[int, str]]]] + ] = None, + stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_click: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, **props, ) -> "PolarRadiusAxis": """Create the component. Args: *children: The children of the component. - angle: The angle of radial direction line to display axis text. - type_: The type of axis line. 'number' | 'category' - allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". + angle: The angle of radial direction line to display axis text. Default: 0 + type_: The type of axis line. 'number' | 'category'. Default: "category" + allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True cx: The x-coordinate of center. cy: The y-coordinate of center. - reversed: If set to true, the ticks of this axis are reversed. - orientation: The orientation of axis text. - axis_line: If false set, axis line will not be drawn. If true set, axis line will be drawn which have the props calculated internally. If object set, axis line will be drawn which have the props mergered by the internal calculated props and the option. - tick: The width or height of tick. - tick_count: The count of ticks. - scale: If 'auto' set, the scale funtion is linear scale. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' - domain: The domain of the polar radius axis, specifying the minimum and maximum values. - stroke: The stroke color of axis + reversed: If set to true, the ticks of this axis are reversed. Default: False + orientation: The orientation of axis text. Default: "right" + axis_line: If false set, axis line will not be drawn. If true set, axis line will be drawn which have the props calculated internally. If object set, axis line will be drawn which have the props mergered by the internal calculated props and the option. Default: True + tick: If false set, ticks will not be drawn. If true set, ticks will be drawn which have the props calculated internally. If object set, ticks will be drawn which have the props mergered by the internal calculated props and the option. Default: True + tick_count: The count of axis ticks. Not used if 'type' is 'category'. Default: 5 + scale: If 'auto' set, the scale funtion is linear scale. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold'. Default: "auto" + domain: The domain of the polar radius axis, specifying the minimum and maximum values. Default: [0, "auto"] + stroke: The stroke color of axis. Default: rx.color("gray", 10) style: The style of the component. key: A unique key for the component. id: The id for the component. diff --git a/reflex/components/recharts/recharts.py b/reflex/components/recharts/recharts.py index adb7bfdf9..a0d683f72 100644 --- a/reflex/components/recharts/recharts.py +++ b/reflex/components/recharts/recharts.py @@ -9,7 +9,7 @@ from reflex.utils import console class Recharts(Component): """A component that wraps a recharts lib.""" - library = "recharts@2.12.7" + library = "recharts@2.13.0" def render(self) -> Dict: """Render the tag. @@ -29,7 +29,7 @@ class Recharts(Component): class RechartsCharts(NoSSRComponent, MemoizationLeaf): """A component that wraps a recharts lib.""" - library = "recharts@2.12.7" + library = "recharts@2.13.0" LiteralAnimationEasing = Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"] @@ -60,6 +60,7 @@ LiteralScale = Literal[ "sequential", "threshold", ] +LiteralTextAnchor = Literal["start", "middle", "end"] LiteralLayout = Literal["horizontal", "vertical"] LiteralPolarRadiusType = Literal["number", "category"] LiteralGridType = Literal["polygon", "circle"] @@ -131,6 +132,9 @@ LiteralAreaType = Literal[ "stepBefore", "stepAfter", ] -LiteralDirection = Literal["x", "y", "both"] +LiteralDirection = Literal["x", "y"] LiteralInterval = Literal["preserveStart", "preserveEnd", "preserveStartEnd"] +LiteralIntervalAxis = Literal[ + "preserveStart", "preserveEnd", "preserveStartEnd", "equidistantPreserveStart" +] LiteralSyncMethod = Literal["index", "value"] diff --git a/reflex/components/recharts/recharts.pyi b/reflex/components/recharts/recharts.pyi index 695ecab48..c13519f05 100644 --- a/reflex/components/recharts/recharts.pyi +++ b/reflex/components/recharts/recharts.pyi @@ -3,12 +3,12 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Recharts(Component): def render(self) -> Dict: ... @@ -23,41 +23,21 @@ class Recharts(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Recharts": """Create the component. @@ -89,41 +69,21 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "RechartsCharts": """Create a new memoization leaf component. @@ -171,6 +131,7 @@ LiteralScale = Literal[ "sequential", "threshold", ] +LiteralTextAnchor = Literal["start", "middle", "end"] LiteralLayout = Literal["horizontal", "vertical"] LiteralPolarRadiusType = Literal["number", "category"] LiteralGridType = Literal["polygon", "circle"] @@ -242,6 +203,9 @@ LiteralAreaType = Literal[ "stepBefore", "stepAfter", ] -LiteralDirection = Literal["x", "y", "both"] +LiteralDirection = Literal["x", "y"] LiteralInterval = Literal["preserveStart", "preserveEnd", "preserveStartEnd"] +LiteralIntervalAxis = Literal[ + "preserveStart", "preserveEnd", "preserveStartEnd", "equidistantPreserveStart" +] LiteralSyncMethod = Literal["index", "value"] diff --git a/reflex/components/sonner/toast.py b/reflex/components/sonner/toast.py index c7ec5ca60..02c320ac6 100644 --- a/reflex/components/sonner/toast.py +++ b/reflex/components/sonner/toast.py @@ -14,12 +14,12 @@ from reflex.event import ( EventSpec, call_script, ) -from reflex.ivars.base import LiteralVar from reflex.style import Style, resolved_color_mode from reflex.utils import format from reflex.utils.imports import ImportVar -from reflex.utils.serializers import serialize, serializer -from reflex.vars import Var, VarData +from reflex.utils.serializers import serializer +from reflex.vars import VarData +from reflex.vars.base import LiteralVar, Var LiteralPosition = Literal[ "top-left", @@ -30,7 +30,7 @@ LiteralPosition = Literal[ "bottom-right", ] -toast_ref = Var.create_safe("refs['__toast']", _var_is_string=False) +toast_ref = Var(_js_expr="refs['__toast']") class ToastAction(Base): @@ -66,9 +66,8 @@ def _toast_callback_signature(toast: Var) -> list[Var]: A function call stripping non-serializable members of the toast object. """ return [ - Var.create_safe( - f"(() => {{let {{action, cancel, onDismiss, onAutoClose, ...rest}} = {toast}; return rest}})()", - _var_is_string=False, + Var( + _js_expr=f"(() => {{let {{action, cancel, onDismiss, onAutoClose, ...rest}} = {str(toast)}; return rest}})()" ) ] @@ -172,12 +171,12 @@ class ToastProps(PropsBase): d["cancel"] = self.cancel if isinstance(self.cancel, dict): d["cancel"] = ToastAction(**self.cancel) - if "on_dismiss" in d: - d["on_dismiss"] = format.format_queue_events( + if "onDismiss" in d: + d["onDismiss"] = format.format_queue_events( self.on_dismiss, _toast_callback_signature ) - if "on_auto_close" in d: - d["on_auto_close"] = format.format_queue_events( + if "onAutoClose" in d: + d["onAutoClose"] = format.format_queue_events( self.on_auto_close, _toast_callback_signature ) return d @@ -193,7 +192,7 @@ class ToastProps(PropsBase): class Toaster(Component): """A Toaster Component for displaying toast notifications.""" - library: str = "sonner@1.4.41" + library: str = "sonner@1.5.0" tag = "Toaster" @@ -248,10 +247,8 @@ class Toaster(Component): Returns: The hooks for the toaster component. """ - hook = Var.create_safe( - f"{toast_ref} = toast", - _var_is_local=True, - _var_is_string=False, + hook = Var( + _js_expr=f"{toast_ref} = toast", _var_data=VarData( imports={ "/utils/state": [ImportVar(tag="refs")], @@ -284,12 +281,12 @@ class Toaster(Component): if message == "" and ("title" not in props or "description" not in props): raise ValueError("Toast message or title or description must be provided.") if props: - args = serialize(ToastProps(**props)) # type: ignore - toast = f"{toast_command}(`{message}`, {args})" + args = LiteralVar.create(ToastProps(**props)) + toast = f"{toast_command}(`{message}`, {str(args)})" else: toast = f"{toast_command}(`{message}`)" - toast_action = Var.create_safe(toast, _var_is_string=False, _var_is_local=True) + toast_action = Var(_js_expr=toast) return call_script(toast_action) @staticmethod @@ -357,17 +354,14 @@ class Toaster(Component): dismiss_var_data = None if isinstance(id, Var): - dismiss = f"{toast_ref}.dismiss({id._var_name_unwrapped})" + dismiss = f"{toast_ref}.dismiss({str(id)})" dismiss_var_data = id._get_all_var_data() elif isinstance(id, str): dismiss = f"{toast_ref}.dismiss('{id}')" else: dismiss = f"{toast_ref}.dismiss()" - dismiss_action = Var.create_safe( - dismiss, - _var_is_string=False, - _var_is_local=True, - _var_data=VarData.merge(dismiss_var_data), + dismiss_action = Var( + _js_expr=dismiss, _var_data=VarData.merge(dismiss_var_data) ) return call_script(dismiss_action) diff --git a/reflex/components/sonner/toast.pyi b/reflex/components/sonner/toast.pyi index bb7191eb8..976f9f310 100644 --- a/reflex/components/sonner/toast.pyi +++ b/reflex/components/sonner/toast.pyi @@ -3,16 +3,16 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, ClassVar, Dict, Literal, Optional, Union, overload +from typing import Any, ClassVar, Dict, Literal, Optional, Union, overload from reflex.base import Base from reflex.components.component import Component, ComponentNamespace from reflex.components.lucide.icon import Icon from reflex.components.props import PropsBase -from reflex.event import EventHandler, EventSpec +from reflex.event import EventSpec, EventType from reflex.style import Style from reflex.utils.serializers import serializer -from reflex.vars import Var +from reflex.vars.base import Var LiteralPosition = Literal[ "top-left", @@ -22,7 +22,7 @@ LiteralPosition = Literal[ "bottom-center", "bottom-right", ] -toast_ref = Var.create_safe("refs['__toast']", _var_is_string=False) +toast_ref = Var(_js_expr="refs['__toast']") class ToastAction(Base): label: str @@ -86,24 +86,24 @@ class Toaster(Component): visible_toasts: Optional[Union[Var[int], int]] = None, position: Optional[ Union[ + Literal[ + "bottom-center", + "bottom-left", + "bottom-right", + "top-center", + "top-left", + "top-right", + ], Var[ Literal[ - "top-left", - "top-center", - "top-right", - "bottom-left", "bottom-center", + "bottom-left", "bottom-right", + "top-center", + "top-left", + "top-right", ] ], - Literal[ - "top-left", - "top-center", - "top-right", - "bottom-left", - "bottom-center", - "bottom-right", - ], ] ] = None, close_button: Optional[Union[Var[bool], bool]] = None, @@ -111,9 +111,9 @@ class Toaster(Component): dir: Optional[Union[Var[str], str]] = None, hotkey: Optional[Union[Var[str], str]] = None, invert: Optional[Union[Var[bool], bool]] = None, - toast_options: Optional[Union[Var[ToastProps], ToastProps]] = None, + toast_options: Optional[Union[ToastProps, Var[ToastProps]]] = None, gap: Optional[Union[Var[int], int]] = None, - loading_icon: Optional[Union[Var[Icon], Icon]] = None, + loading_icon: Optional[Union[Icon, Var[Icon]]] = None, pause_when_page_is_hidden: Optional[Union[Var[bool], bool]] = None, style: Optional[Style] = None, key: Optional[Any] = None, @@ -121,41 +121,21 @@ class Toaster(Component): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Toaster": """Create a toaster component. diff --git a/reflex/components/suneditor/editor.py b/reflex/components/suneditor/editor.py index 6e28b396a..3bca8a3f6 100644 --- a/reflex/components/suneditor/editor.py +++ b/reflex/components/suneditor/editor.py @@ -3,14 +3,14 @@ from __future__ import annotations import enum -from typing import Dict, List, Literal, Optional, Union +from typing import Dict, List, Literal, Optional, Tuple, Union from reflex.base import Base from reflex.components.component import Component, NoSSRComponent -from reflex.event import EventHandler +from reflex.event import EventHandler, empty_event, identity_event from reflex.utils.format import to_camel_case from reflex.utils.imports import ImportDict, ImportVar -from reflex.vars import Var +from reflex.vars.base import Var class EditorButtonList(list, enum.Enum): @@ -68,6 +68,35 @@ class EditorOptions(Base): button_list: Optional[List[Union[List[str], str]]] +def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]: + """A helper function to specify the on_blur event handler. + + Args: + e: The event. + content: The content of the editor. + + Returns: + A tuple containing the content of the editor. + """ + return (content,) + + +def on_paste_spec( + e: Var, clean_data: Var[str], max_char_count: Var[bool] +) -> Tuple[Var[str], Var[bool]]: + """A helper function to specify the on_paste event handler. + + Args: + e: The event. + clean_data: The clean data. + max_char_count: The maximum character count. + + Returns: + A tuple containing the clean data and the maximum character count. + """ + return (clean_data, max_char_count) + + class Editor(NoSSRComponent): """A Rich Text Editor component based on SunEditor. Not every JS prop is listed here (some are not easily usable from python), @@ -178,36 +207,31 @@ class Editor(NoSSRComponent): disable_toolbar: Var[bool] # Fired when the editor content changes. - on_change: EventHandler[lambda content: [content]] + on_change: EventHandler[identity_event(str)] # Fired when the something is inputted in the editor. - on_input: EventHandler[lambda e: [e]] + on_input: EventHandler[empty_event] # Fired when the editor loses focus. - on_blur: EventHandler[lambda e, content: [content]] + on_blur: EventHandler[on_blur_spec] # Fired when the editor is loaded. - on_load: EventHandler[lambda reload: [reload]] - - # Fired when the editor is resized. - on_resize_editor: EventHandler[lambda height, prev_height: [height, prev_height]] + on_load: EventHandler[identity_event(bool)] # Fired when the editor content is copied. - on_copy: EventHandler[lambda e, clipboard_data: [clipboard_data]] + on_copy: EventHandler[empty_event] # Fired when the editor content is cut. - on_cut: EventHandler[lambda e, clipboard_data: [clipboard_data]] + on_cut: EventHandler[empty_event] # Fired when the editor content is pasted. - on_paste: EventHandler[ - lambda e, clean_data, max_char_count: [clean_data, max_char_count] - ] + on_paste: EventHandler[on_paste_spec] # Fired when the code view is toggled. - toggle_code_view: EventHandler[lambda is_code_view: [is_code_view]] + toggle_code_view: EventHandler[identity_event(bool)] # Fired when the full screen mode is toggled. - toggle_full_screen: EventHandler[lambda is_full_screen: [is_full_screen]] + toggle_full_screen: EventHandler[identity_event(bool)] def add_imports(self) -> ImportDict: """Add imports for the Editor component. diff --git a/reflex/components/suneditor/editor.pyi b/reflex/components/suneditor/editor.pyi index b1bc8a830..73dd38fdc 100644 --- a/reflex/components/suneditor/editor.pyi +++ b/reflex/components/suneditor/editor.pyi @@ -4,14 +4,14 @@ # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ import enum -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload from reflex.base import Base from reflex.components.component import NoSSRComponent -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.style import Style from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var class EditorButtonList(list, enum.Enum): BASIC = [["font", "fontSize"], ["fontColor"], ["horizontalRule"], ["link", "image"]] @@ -44,6 +44,11 @@ class EditorOptions(Base): rtl: Optional[bool] button_list: Optional[List[Union[List[str], str]]] +def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]: ... +def on_paste_spec( + e: Var, clean_data: Var[str], max_char_count: Var[bool] +) -> Tuple[Var[str], Var[bool]]: ... + class Editor(NoSSRComponent): def add_imports(self) -> ImportDict: ... @overload @@ -53,51 +58,51 @@ class Editor(NoSSRComponent): *children, lang: Optional[ Union[ + Literal[ + "ckb", + "da", + "de", + "en", + "es", + "fr", + "he", + "it", + "ja", + "ko", + "lv", + "pl", + "pt_br", + "ro", + "ru", + "se", + "ua", + "zh_cn", + ], Var[ Union[ Literal[ - "en", + "ckb", "da", "de", + "en", "es", "fr", - "ja", - "ko", - "pt_br", - "ru", - "zh_cn", - "ro", - "pl", - "ckb", - "lv", - "se", - "ua", "he", "it", + "ja", + "ko", + "lv", + "pl", + "pt_br", + "ro", + "ru", + "se", + "ua", + "zh_cn", ], dict, ] ], - Literal[ - "en", - "da", - "de", - "es", - "fr", - "ja", - "ko", - "pt_br", - "ru", - "zh_cn", - "ro", - "pl", - "ckb", - "lv", - "se", - "ua", - "he", - "it", - ], dict, ] ] = None, @@ -107,7 +112,7 @@ class Editor(NoSSRComponent): height: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, auto_focus: Optional[Union[Var[bool], bool]] = None, - set_options: Optional[Union[Var[Dict], Dict]] = None, + set_options: Optional[Union[Dict, Var[Dict]]] = None, set_all_plugins: Optional[Union[Var[bool], bool]] = None, set_contents: Optional[Union[Var[str], str]] = None, append_contents: Optional[Union[Var[str], str]] = None, @@ -122,56 +127,29 @@ class Editor(NoSSRComponent): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_copy: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_cut: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_input: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_load: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_paste: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_resize_editor: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - toggle_code_view: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - toggle_full_screen: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[str]] = None, + on_change: Optional[EventType[str]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_copy: Optional[EventType[[]]] = None, + on_cut: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_input: Optional[EventType[[]]] = None, + on_load: Optional[EventType[bool]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_paste: Optional[EventType[str, bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, + toggle_code_view: Optional[EventType[bool]] = None, + toggle_full_screen: Optional[EventType[bool]] = None, **props, ) -> "Editor": """Create an instance of Editor. No children allowed. diff --git a/reflex/components/tags/cond_tag.py b/reflex/components/tags/cond_tag.py index 3143890c4..b4d0fe469 100644 --- a/reflex/components/tags/cond_tag.py +++ b/reflex/components/tags/cond_tag.py @@ -1,19 +1,21 @@ """Tag to conditionally render components.""" +import dataclasses from typing import Any, Dict, Optional from reflex.components.tags.tag import Tag -from reflex.vars import Var +from reflex.vars.base import Var +@dataclasses.dataclass() class CondTag(Tag): """A conditional tag.""" # The condition to determine which component to render. - cond: Var[Any] + cond: Var[Any] = dataclasses.field(default_factory=lambda: Var.create(True)) # The code to render if the condition is true. - true_value: Dict + true_value: Dict = dataclasses.field(default_factory=dict) # The code to render if the condition is false. - false_value: Optional[Dict] + false_value: Optional[Dict] = None diff --git a/reflex/components/tags/iter_tag.py b/reflex/components/tags/iter_tag.py index 0828f8b10..fec27f3d9 100644 --- a/reflex/components/tags/iter_tag.py +++ b/reflex/components/tags/iter_tag.py @@ -2,31 +2,43 @@ from __future__ import annotations +import dataclasses import inspect -from typing import TYPE_CHECKING, Any, Callable, List, Tuple, Type, Union, get_args +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Iterable, + Tuple, + Type, + Union, + get_args, +) from reflex.components.tags.tag import Tag -from reflex.ivars.base import ImmutableVar -from reflex.vars import Var +from reflex.vars import LiteralArrayVar, Var, get_unique_variable_name if TYPE_CHECKING: from reflex.components.component import Component +@dataclasses.dataclass() class IterTag(Tag): """An iterator tag.""" # The var to iterate over. - iterable: Var[List] + iterable: Var[Iterable] = dataclasses.field( + default_factory=lambda: LiteralArrayVar.create([]) + ) # The component render function for each item in the iterable. - render_fn: Callable + render_fn: Callable = dataclasses.field(default_factory=lambda: lambda x: x) # The name of the arg var. - arg_var_name: str + arg_var_name: str = dataclasses.field(default_factory=get_unique_variable_name) # The name of the index var. - index_var_name: str + index_var_name: str = dataclasses.field(default_factory=get_unique_variable_name) def get_iterable_var_type(self) -> Type: """Get the type of the iterable var. @@ -34,15 +46,16 @@ class IterTag(Tag): Returns: The type of the iterable var. """ + iterable = self.iterable try: - if self.iterable._var_type.mro()[0] == dict: + if iterable._var_type.mro()[0] is dict: # Arg is a tuple of (key, value). - return Tuple[get_args(self.iterable._var_type)] # type: ignore - elif self.iterable._var_type.mro()[0] == tuple: + return Tuple[get_args(iterable._var_type)] # type: ignore + elif iterable._var_type.mro()[0] is tuple: # Arg is a union of any possible values in the tuple. - return Union[get_args(self.iterable._var_type)] # type: ignore + return Union[get_args(iterable._var_type)] # type: ignore else: - return get_args(self.iterable._var_type)[0] + return get_args(iterable._var_type)[0] except Exception: return Any @@ -54,8 +67,8 @@ class IterTag(Tag): Returns: The index var. """ - return ImmutableVar( - _var_name=self.index_var_name, + return Var( + _js_expr=self.index_var_name, _var_type=int, ).guess_type() @@ -67,8 +80,8 @@ class IterTag(Tag): Returns: The arg var. """ - return ImmutableVar( - _var_name=self.arg_var_name, + return Var( + _js_expr=self.arg_var_name, _var_type=self.get_iterable_var_type(), ).guess_type() @@ -80,8 +93,8 @@ class IterTag(Tag): Returns: The index var. """ - return ImmutableVar( - _var_name=self.index_var_name, + return Var( + _js_expr=self.index_var_name, _var_type=int, ).guess_type() @@ -93,14 +106,17 @@ class IterTag(Tag): Returns: The arg var. """ - return ImmutableVar( - _var_name=self.arg_var_name, + return Var( + _js_expr=self.arg_var_name, _var_type=self.get_iterable_var_type(), ).guess_type() def render_component(self) -> Component: """Render the component. + Raises: + ValueError: If the render function takes more than 2 arguments. + Returns: The rendered component. """ @@ -119,7 +135,8 @@ class IterTag(Tag): component = self.render_fn(arg) else: # If the render function takes the index as an argument. - assert len(args) == 2 + if len(args) != 2: + raise ValueError("The render function must take 2 arguments.") component = self.render_fn(arg, index) # Nested foreach components or cond must be wrapped in fragments. diff --git a/reflex/components/tags/match_tag.py b/reflex/components/tags/match_tag.py index c2f6649d5..01eedb296 100644 --- a/reflex/components/tags/match_tag.py +++ b/reflex/components/tags/match_tag.py @@ -1,19 +1,21 @@ """Tag to conditionally match cases.""" +import dataclasses from typing import Any, List from reflex.components.tags.tag import Tag -from reflex.vars import Var +from reflex.vars.base import Var +@dataclasses.dataclass() class MatchTag(Tag): """A match tag.""" # The condition to determine which case to match. - cond: Var[Any] + cond: Var[Any] = dataclasses.field(default_factory=lambda: Var.create(True)) # The list of match cases to be matched. - match_cases: List[Any] + match_cases: List[Any] = dataclasses.field(default_factory=list) # The catchall case to match. - default: Any + default: Any = dataclasses.field(default=Var.create(None)) diff --git a/reflex/components/tags/tag.py b/reflex/components/tags/tag.py index 9a8cca11f..d577abc6e 100644 --- a/reflex/components/tags/tag.py +++ b/reflex/components/tags/tag.py @@ -2,23 +2,23 @@ from __future__ import annotations -from typing import Any, Dict, List, Optional, Set, Tuple, Union +import dataclasses +from typing import Any, Dict, List, Optional, Tuple, Union -from reflex.base import Base from reflex.event import EventChain -from reflex.ivars.base import LiteralVar from reflex.utils import format, types -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var -class Tag(Base): +@dataclasses.dataclass() +class Tag: """A React tag.""" # The name of the tag. name: str = "" # The props of the tag. - props: Dict[str, Any] = {} + props: Dict[str, Any] = dataclasses.field(default_factory=dict) # The inner contents of the tag. contents: str = "" @@ -27,25 +27,18 @@ class Tag(Base): args: Optional[Tuple[str, ...]] = None # Special props that aren't key value pairs. - special_props: Set[Var] = set() + special_props: List[Var] = dataclasses.field(default_factory=list) # The children components. - children: List[Any] = [] + children: List[Any] = dataclasses.field(default_factory=list) - def __init__(self, *args, **kwargs): - """Initialize the tag. - - Args: - *args: Args to initialize the tag. - **kwargs: Kwargs to initialize the tag. - """ - # Convert any props to vars. - if "props" in kwargs: - kwargs["props"] = { - name: LiteralVar.create(value) - for name, value in kwargs["props"].items() - } - super().__init__(*args, **kwargs) + def __post_init__(self): + """Post initialize the tag.""" + object.__setattr__( + self, + "props", + {name: LiteralVar.create(value) for name, value in self.props.items()}, + ) def format_props(self) -> List: """Format the tag's props. @@ -55,6 +48,29 @@ class Tag(Base): """ return format.format_props(*self.special_props, **self.props) + def set(self, **kwargs: Any): + """Set the tag's fields. + + Args: + kwargs: The fields to set. + + Returns: + The tag with the fields + """ + for name, value in kwargs.items(): + setattr(self, name, value) + + return self + + def __iter__(self): + """Iterate over the tag's fields. + + Yields: + Tuple[str, Any]: The field name and value. + """ + for field in dataclasses.fields(self): + yield field.name, getattr(self, field.name) + def add_props(self, **kwargs: Optional[Any]) -> Tag: """Add props to the tag. diff --git a/reflex/config.py b/reflex/config.py index 06d8c2193..eb319c5dd 100644 --- a/reflex/config.py +++ b/reflex/config.py @@ -2,11 +2,18 @@ from __future__ import annotations +import dataclasses import importlib import os import sys import urllib.parse -from typing import Any, Dict, List, Optional, Set +from pathlib import Path +from typing import Any, Dict, List, Optional, Set, Union + +from typing_extensions import get_type_hints + +from reflex.utils.exceptions import ConfigError, EnvironmentVarValueError +from reflex.utils.types import value_inside_optional try: import pydantic.v1 as pydantic @@ -128,6 +135,198 @@ class DBConfig(Base): return f"{self.engine}://{path}/{self.database}" +def get_default_value_for_field(field: dataclasses.Field) -> Any: + """Get the default value for a field. + + Args: + field: The field. + + Returns: + The default value. + + Raises: + ValueError: If no default value is found. + """ + if field.default != dataclasses.MISSING: + return field.default + elif field.default_factory != dataclasses.MISSING: + return field.default_factory() + else: + raise ValueError( + f"Missing value for environment variable {field.name} and no default value found" + ) + + +def interpret_boolean_env(value: str) -> bool: + """Interpret a boolean environment variable value. + + Args: + value: The environment variable value. + + Returns: + The interpreted value. + + Raises: + EnvironmentVarValueError: If the value is invalid. + """ + true_values = ["true", "1", "yes", "y"] + false_values = ["false", "0", "no", "n"] + + if value.lower() in true_values: + return True + elif value.lower() in false_values: + return False + raise EnvironmentVarValueError(f"Invalid boolean value: {value}") + + +def interpret_int_env(value: str) -> int: + """Interpret an integer environment variable value. + + Args: + value: The environment variable value. + + Returns: + The interpreted value. + + Raises: + EnvironmentVarValueError: If the value is invalid. + """ + try: + return int(value) + except ValueError as ve: + raise EnvironmentVarValueError(f"Invalid integer value: {value}") from ve + + +def interpret_path_env(value: str) -> Path: + """Interpret a path environment variable value. + + Args: + value: The environment variable value. + + Returns: + The interpreted value. + + Raises: + EnvironmentVarValueError: If the path does not exist. + """ + path = Path(value) + if not path.exists(): + raise EnvironmentVarValueError(f"Path does not exist: {path}") + return path + + +def interpret_env_var_value(value: str, field: dataclasses.Field) -> Any: + """Interpret an environment variable value based on the field type. + + Args: + value: The environment variable value. + field: The field. + + Returns: + The interpreted value. + + Raises: + ValueError: If the value is invalid. + """ + field_type = value_inside_optional(field.type) + + if field_type is bool: + return interpret_boolean_env(value) + elif field_type is str: + return value + elif field_type is int: + return interpret_int_env(value) + elif field_type is Path: + return interpret_path_env(value) + + else: + raise ValueError( + f"Invalid type for environment variable {field.name}: {field_type}. This is probably an issue in Reflex." + ) + + +@dataclasses.dataclass(init=False) +class EnvironmentVariables: + """Environment variables class to instantiate environment variables.""" + + # Whether to use npm over bun to install frontend packages. + REFLEX_USE_NPM: bool = False + + # The npm registry to use. + NPM_CONFIG_REGISTRY: Optional[str] = None + + # Whether to use Granian for the backend. Otherwise, use Uvicorn. + REFLEX_USE_GRANIAN: bool = False + + # The username to use for authentication on python package repository. Username and password must both be provided. + TWINE_USERNAME: Optional[str] = None + + # The password to use for authentication on python package repository. Username and password must both be provided. + TWINE_PASSWORD: Optional[str] = None + + # Whether to use the system installed bun. If set to false, bun will be bundled with the app. + REFLEX_USE_SYSTEM_BUN: bool = False + + # Whether to use the system installed node and npm. If set to false, node and npm will be bundled with the app. + REFLEX_USE_SYSTEM_NODE: bool = False + + # The working directory for the next.js commands. + REFLEX_WEB_WORKDIR: Path = Path(constants.Dirs.WEB) + + # Path to the alembic config file + ALEMBIC_CONFIG: Path = Path(constants.ALEMBIC_CONFIG) + + # Disable SSL verification for HTTPX requests. + SSL_NO_VERIFY: bool = False + + # The directory to store uploaded files. + REFLEX_UPLOADED_FILES_DIR: Path = Path(constants.Dirs.UPLOADED_FILES) + + # Whether to use seperate processes to compile the frontend and how many. If not set, defaults to thread executor. + REFLEX_COMPILE_PROCESSES: Optional[int] = None + + # Whether to use seperate threads to compile the frontend and how many. Defaults to `min(32, os.cpu_count() + 4)`. + REFLEX_COMPILE_THREADS: Optional[int] = None + + # The directory to store reflex dependencies. + REFLEX_DIR: Path = Path(constants.Reflex.DIR) + + # Whether to print the SQL queries if the log level is INFO or lower. + SQLALCHEMY_ECHO: bool = False + + # Whether to ignore the redis config error. Some redis servers only allow out-of-band configuration. + REFLEX_IGNORE_REDIS_CONFIG_ERROR: bool = False + + # Whether to skip purging the web directory in dev mode. + REFLEX_PERSIST_WEB_DIR: bool = False + + # The reflex.build frontend host. + REFLEX_BUILD_FRONTEND: str = constants.Templates.REFLEX_BUILD_FRONTEND + + # The reflex.build backend host. + REFLEX_BUILD_BACKEND: str = constants.Templates.REFLEX_BUILD_BACKEND + + def __init__(self): + """Initialize the environment variables.""" + type_hints = get_type_hints(type(self)) + + for field in dataclasses.fields(self): + raw_value = os.getenv(field.name, None) + + field.type = type_hints.get(field.name) or field.type + + value = ( + interpret_env_var_value(raw_value, field) + if raw_value is not None + else get_default_value_for_field(field) + ) + + setattr(self, field.name, value) + + +environment = EnvironmentVariables() + + class Config(Base): """The config defines runtime settings for the app. @@ -158,7 +357,7 @@ class Config(Base): app_name: str # The log level to use. - loglevel: constants.LogLevel = constants.LogLevel.INFO + loglevel: constants.LogLevel = constants.LogLevel.DEFAULT # The port to run the frontend on. NOTE: When running in dev mode, the next available port will be used if this is taken. frontend_port: int = constants.DefaultPorts.FRONTEND_PORT @@ -188,13 +387,13 @@ class Config(Base): telemetry_enabled: bool = True # The bun path - bun_path: str = constants.Bun.DEFAULT_PATH + bun_path: Union[str, Path] = constants.Bun.DEFAULT_PATH # List of origins that are allowed to connect to the backend API. cors_allowed_origins: List[str] = ["*"] # Tailwind config. - tailwind: Optional[Dict[str, Any]] = {} + tailwind: Optional[Dict[str, Any]] = {"plugins": ["@tailwindcss/typography"]} # Timeout when launching the gunicorn server. TODO(rename this to backend_timeout?) timeout: int = 120 @@ -219,6 +418,15 @@ class Config(Base): # Number of gunicorn workers from user gunicorn_workers: Optional[int] = None + # Number of requests before a worker is restarted + gunicorn_max_requests: int = 100 + + # Variance limit for max requests; gunicorn only + gunicorn_max_requests_jitter: int = 25 + + # Indicate which type of state manager to use + state_manager_mode: constants.StateManagerMode = constants.StateManagerMode.DISK + # Maximum expiration lock time for redis state manager redis_lock_expiration: int = constants.Expiration.LOCK @@ -228,12 +436,18 @@ class Config(Base): # Attributes that were explicitly set by the user. _non_default_attributes: Set[str] = pydantic.PrivateAttr(set()) + # Path to file containing key-values pairs to override in the environment; Dotenv format. + env_file: Optional[str] = None + def __init__(self, *args, **kwargs): """Initialize the config values. Args: *args: The args to pass to the Pydantic init method. **kwargs: The kwargs to pass to the Pydantic init method. + + Raises: + ConfigError: If some values in the config are invalid. """ super().__init__(*args, **kwargs) @@ -247,6 +461,14 @@ class Config(Base): self._non_default_attributes.update(kwargs) self._replace_defaults(**kwargs) + if ( + self.state_manager_mode == constants.StateManagerMode.REDIS + and not self.redis_url + ): + raise ConfigError( + "REDIS_URL is required when using the redis state manager." + ) + @property def module(self) -> str: """Get the module name of the app. @@ -258,6 +480,7 @@ class Config(Base): def update_from_env(self) -> dict[str, Any]: """Update the config values based on set environment variables. + If there is a set env_file, it is loaded first. Returns: The updated config values. @@ -267,6 +490,12 @@ class Config(Base): """ from reflex.utils.exceptions import EnvVarValueError + if self.env_file: + from dotenv import load_dotenv + + # load env file if exists + load_dotenv(self.env_file, override=True) + updated_values = {} # Iterate over the fields. for key, field in self.__fields__.items(): diff --git a/reflex/constants/__init__.py b/reflex/constants/__init__.py index e974ab915..a540805b5 100644 --- a/reflex/constants/__init__.py +++ b/reflex/constants/__init__.py @@ -2,6 +2,8 @@ from .base import ( COOKIES, + ENV_BACKEND_ONLY_ENV_VAR, + ENV_FRONTEND_ONLY_ENV_VAR, ENV_MODE_ENV_VAR, IS_WINDOWS, LOCAL_STORAGE, @@ -63,6 +65,7 @@ from .route import ( RouteRegex, RouteVar, ) +from .state import StateManagerMode from .style import Tailwind __ALL__ = [ @@ -115,6 +118,7 @@ __ALL__ = [ SETTER_PREFIX, SKIP_COMPILE_ENV_VAR, SocketEvent, + StateManagerMode, Tailwind, Templates, CompileVars, diff --git a/reflex/constants/base.py b/reflex/constants/base.py index d5407902e..bba53d625 100644 --- a/reflex/constants/base.py +++ b/reflex/constants/base.py @@ -2,14 +2,16 @@ from __future__ import annotations -import os import platform from enum import Enum from importlib import metadata +from pathlib import Path from types import SimpleNamespace from platformdirs import PlatformDirs +from .utils import classproperty + IS_WINDOWS = platform.system() == "Windows" @@ -19,6 +21,8 @@ class Dirs(SimpleNamespace): # The frontend directories in a project. # The web folder where the NextJS app is compiled to. WEB = ".web" + # The directory where uploaded files are stored. + UPLOADED_FILES = "uploaded_files" # The name of the assets directory. APP_ASSETS = "assets" # The name of the assets directory for external ressource (a subfolder of APP_ASSETS). @@ -63,21 +67,14 @@ class Reflex(SimpleNamespace): # Files and directories used to init a new project. # The directory to store reflex dependencies. - # Get directory value from enviroment variables if it exists. - _dir = os.environ.get("REFLEX_DIR", "") + # on windows, we use C:/Users//AppData/Local/reflex. + # on macOS, we use ~/Library/Application Support/reflex. + # on linux, we use ~/.local/share/reflex. + # If user sets REFLEX_DIR envroment variable use that instead. + DIR = PlatformDirs(MODULE_NAME, False).user_data_path - DIR = _dir or ( - # on windows, we use C:/Users//AppData/Local/reflex. - # on macOS, we use ~/Library/Application Support/reflex. - # on linux, we use ~/.local/share/reflex. - # If user sets REFLEX_DIR envroment variable use that instead. - PlatformDirs(MODULE_NAME, False).user_data_dir - ) # The root directory of the reflex library. - - ROOT_DIR = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - ) + ROOT_DIR = Path(__file__).parents[2] RELEASES_URL = f"https://api.github.com/repos/reflex-dev/templates/releases" @@ -99,35 +96,61 @@ class Templates(SimpleNamespace): DEFAULT = "blank" # The reflex.build frontend host - REFLEX_BUILD_FRONTEND = os.environ.get( - "REFLEX_BUILD_FRONTEND", "https://flexgen.reflex.run" - ) + REFLEX_BUILD_FRONTEND = "https://flexgen.reflex.run" # The reflex.build backend host - REFLEX_BUILD_BACKEND = os.environ.get( - "REFLEX_BUILD_BACKEND", "https://flexgen-prod-flexgen.fly.dev" - ) + REFLEX_BUILD_BACKEND = "https://flexgen-prod-flexgen.fly.dev" - # The URL to redirect to reflex.build - REFLEX_BUILD_URL = ( - REFLEX_BUILD_FRONTEND + "/gen?reflex_init_token={reflex_init_token}" - ) + @classproperty + @classmethod + def REFLEX_BUILD_URL(cls): + """The URL to redirect to reflex.build. - # The URL to poll waiting for the user to select a generation. - REFLEX_BUILD_POLL_URL = REFLEX_BUILD_BACKEND + "/api/init/{reflex_init_token}" + Returns: + The URL to redirect to reflex.build. + """ + from reflex.config import environment - # The URL to fetch the generation's reflex code - REFLEX_BUILD_CODE_URL = REFLEX_BUILD_BACKEND + "/api/gen/{generation_hash}" + return ( + environment.REFLEX_BUILD_FRONTEND + + "/gen?reflex_init_token={reflex_init_token}" + ) + + @classproperty + @classmethod + def REFLEX_BUILD_POLL_URL(cls): + """The URL to poll waiting for the user to select a generation. + + Returns: + The URL to poll waiting for the user to select a generation. + """ + from reflex.config import environment + + return environment.REFLEX_BUILD_BACKEND + "/api/init/{reflex_init_token}" + + @classproperty + @classmethod + def REFLEX_BUILD_CODE_URL(cls): + """The URL to fetch the generation's reflex code. + + Returns: + The URL to fetch the generation's reflex code. + """ + from reflex.config import environment + + return ( + environment.REFLEX_BUILD_BACKEND + "/api/gen/{generation_hash}/refactored" + ) class Dirs(SimpleNamespace): """Folders used by the template system of Reflex.""" # The template directory used during reflex init. - BASE = os.path.join(Reflex.ROOT_DIR, Reflex.MODULE_NAME, ".templates") + BASE = Reflex.ROOT_DIR / Reflex.MODULE_NAME / ".templates" # The web subdirectory of the template directory. - WEB_TEMPLATE = os.path.join(BASE, "web") + WEB_TEMPLATE = BASE / "web" # The jinja template directory. - JINJA_TEMPLATE = os.path.join(BASE, "jinja") + JINJA_TEMPLATE = BASE / "jinja" # Where the code for the templates is stored. CODE = "code" @@ -171,6 +194,7 @@ class LogLevel(str, Enum): """The log levels.""" DEBUG = "debug" + DEFAULT = "default" INFO = "info" WARNING = "warning" ERROR = "error" @@ -188,6 +212,14 @@ class LogLevel(str, Enum): levels = list(LogLevel) return levels.index(self) <= levels.index(other) + def subprocess_level(self): + """Return the log level for the subprocess. + + Returns: + The log level for the subprocess + """ + return self if self != LogLevel.DEFAULT else LogLevel.WARNING + # Server socket configuration variables POLLING_MAX_HTTP_BUFFER_SIZE = 1000 * 1000 @@ -213,6 +245,9 @@ SKIP_COMPILE_ENV_VAR = "__REFLEX_SKIP_COMPILE" # This env var stores the execution mode of the app ENV_MODE_ENV_VAR = "REFLEX_ENV_MODE" +ENV_BACKEND_ONLY_ENV_VAR = "REFLEX_BACKEND_ONLY" +ENV_FRONTEND_ONLY_ENV_VAR = "REFLEX_FRONTEND_ONLY" + # Testing variables. # Testing os env set by pytest when running a test case. PYTEST_CURRENT_TEST = "PYTEST_CURRENT_TEST" diff --git a/reflex/constants/compiler.py b/reflex/constants/compiler.py index 1de3fc263..318a93783 100644 --- a/reflex/constants/compiler.py +++ b/reflex/constants/compiler.py @@ -132,16 +132,6 @@ class Hooks(SimpleNamespace): } })""" - FRONTEND_ERRORS = f""" - const logFrontendError = (error, info) => {{ - if (process.env.NODE_ENV === "production") {{ - addEvents([Event("{CompileVars.FRONTEND_EXCEPTION_STATE_FULL}.handle_frontend_exception", {{ - stack: error.stack, - }})]) - }} - }} - """ - class MemoizationDisposition(enum.Enum): """The conditions under which a component should be memoized.""" @@ -160,3 +150,28 @@ class MemoizationMode(Base): # Whether children of this component should be memoized first. recursive: bool = True + + +class SpecialAttributes(enum.Enum): + """Special attributes for components. + + These are placed in custom_attrs and rendered as-is rather than converting + to a style prop. + """ + + DATA_UNDERSCORE = "data_" + DATA_DASH = "data-" + ARIA_UNDERSCORE = "aria_" + ARIA_DASH = "aria-" + + @classmethod + def is_special(cls, attr: str) -> bool: + """Check if the attribute is special. + + Args: + attr: the attribute to check + + Returns: + True if the attribute is special. + """ + return any(attr.startswith(value.value) for value in cls) diff --git a/reflex/constants/config.py b/reflex/constants/config.py index 966727426..970e67844 100644 --- a/reflex/constants/config.py +++ b/reflex/constants/config.py @@ -1,6 +1,6 @@ """Config constants.""" -import os +from pathlib import Path from types import SimpleNamespace from reflex.constants.base import Dirs, Reflex @@ -8,7 +8,7 @@ from reflex.constants.base import Dirs, Reflex from .compiler import Ext # Alembic migrations -ALEMBIC_CONFIG = os.environ.get("ALEMBIC_CONFIG", "alembic.ini") +ALEMBIC_CONFIG = "alembic.ini" class Config(SimpleNamespace): @@ -17,9 +17,7 @@ class Config(SimpleNamespace): # The name of the reflex config module. MODULE = "rxconfig" # The python config file. - FILE = f"{MODULE}{Ext.PY}" - # The previous config file. - PREVIOUS_FILE = f"pcconfig{Ext.PY}" + FILE = Path(f"{MODULE}{Ext.PY}") class Expiration(SimpleNamespace): @@ -37,7 +35,7 @@ class GitIgnore(SimpleNamespace): """Gitignore constants.""" # The gitignore file. - FILE = ".gitignore" + FILE = Path(".gitignore") # Files to gitignore. DEFAULTS = {Dirs.WEB, "*.db", "__pycache__/", "*.py[cod]", "assets/external/"} diff --git a/reflex/constants/custom_components.py b/reflex/constants/custom_components.py index 3ea9cf6ed..d879a01f2 100644 --- a/reflex/constants/custom_components.py +++ b/reflex/constants/custom_components.py @@ -2,6 +2,7 @@ from __future__ import annotations +from pathlib import Path from types import SimpleNamespace @@ -11,9 +12,9 @@ class CustomComponents(SimpleNamespace): # The name of the custom components source directory. SRC_DIR = "custom_components" # The name of the custom components pyproject.toml file. - PYPROJECT_TOML = "pyproject.toml" + PYPROJECT_TOML = Path("pyproject.toml") # The name of the custom components package README file. - PACKAGE_README = "README.md" + PACKAGE_README = Path("README.md") # The name of the custom components package .gitignore file. PACKAGE_GITIGNORE = ".gitignore" # The name of the distribution directory as result of a build. @@ -29,6 +30,6 @@ class CustomComponents(SimpleNamespace): "testpypi": "https://test.pypi.org/legacy/", } # The .gitignore file for the custom component project. - FILE = ".gitignore" + FILE = Path(".gitignore") # Files to gitignore. DEFAULTS = {"__pycache__/", "*.py[cod]", "*.egg-info/", "dist/"} diff --git a/reflex/constants/installer.py b/reflex/constants/installer.py index 4a7027ee8..766dcf5be 100644 --- a/reflex/constants/installer.py +++ b/reflex/constants/installer.py @@ -2,11 +2,12 @@ from __future__ import annotations -import os import platform +from pathlib import Path from types import SimpleNamespace -from .base import IS_WINDOWS, Reflex +from .base import IS_WINDOWS +from .utils import classproperty def get_fnm_name() -> str | None: @@ -36,24 +37,44 @@ class Bun(SimpleNamespace): """Bun constants.""" # The Bun version. - VERSION = "1.1.10" + VERSION = "1.1.29" + # Min Bun Version MIN_VERSION = "0.7.0" - # The directory to store the bun. - ROOT_PATH = os.path.join(Reflex.DIR, "bun") - # Default bun path. - DEFAULT_PATH = os.path.join( - ROOT_PATH, "bin", "bun" if not IS_WINDOWS else "bun.exe" - ) + # URL to bun install script. - INSTALL_URL = "https://bun.sh/install" + INSTALL_URL = "https://raw.githubusercontent.com/reflex-dev/reflex/main/scripts/bun_install.sh" + # URL to windows install script. WINDOWS_INSTALL_URL = ( "https://raw.githubusercontent.com/reflex-dev/reflex/main/scripts/install.ps1" ) + # Path of the bunfig file CONFIG_PATH = "bunfig.toml" + @classproperty + @classmethod + def ROOT_PATH(cls): + """The directory to store the bun. + + Returns: + The directory to store the bun. + """ + from reflex.config import environment + + return environment.REFLEX_DIR / "bun" + + @classproperty + @classmethod + def DEFAULT_PATH(cls): + """Default bun path. + + Returns: + The default bun path. + """ + return cls.ROOT_PATH / "bin" / ("bun" if not IS_WINDOWS else "bun.exe") + # FNM config. class Fnm(SimpleNamespace): @@ -61,40 +82,81 @@ class Fnm(SimpleNamespace): # The FNM version. VERSION = "1.35.1" - # The directory to store fnm. - DIR = os.path.join(Reflex.DIR, "fnm") + FILENAME = get_fnm_name() - # The fnm executable binary. - EXE = os.path.join(DIR, "fnm.exe" if IS_WINDOWS else "fnm") # The URL to the fnm release binary INSTALL_URL = ( f"https://github.com/Schniz/fnm/releases/download/v{VERSION}/{FILENAME}.zip" ) + @classproperty + @classmethod + def DIR(cls) -> Path: + """The directory to store fnm. + + Returns: + The directory to store fnm. + """ + from reflex.config import environment + + return environment.REFLEX_DIR / "fnm" + + @classproperty + @classmethod + def EXE(cls): + """The fnm executable binary. + + Returns: + The fnm executable binary. + """ + return cls.DIR / ("fnm.exe" if IS_WINDOWS else "fnm") + # Node / NPM config class Node(SimpleNamespace): """Node/ NPM constants.""" # The Node version. - VERSION = "18.17.0" + VERSION = "22.10.0" # The minimum required node version. MIN_VERSION = "18.17.0" - # The node bin path. - BIN_PATH = os.path.join( - Fnm.DIR, - "node-versions", - f"v{VERSION}", - "installation", - "bin" if not IS_WINDOWS else "", - ) - # The default path where node is installed. - PATH = os.path.join(BIN_PATH, "node.exe" if IS_WINDOWS else "node") + @classproperty + @classmethod + def BIN_PATH(cls): + """The node bin path. - # The default path where npm is installed. - NPM_PATH = os.path.join(BIN_PATH, "npm") + Returns: + The node bin path. + """ + return ( + Fnm.DIR + / "node-versions" + / f"v{cls.VERSION}" + / "installation" + / ("bin" if not IS_WINDOWS else "") + ) + + @classproperty + @classmethod + def PATH(cls): + """The default path where node is installed. + + Returns: + The default path where node is installed. + """ + return cls.BIN_PATH / ("node.exe" if IS_WINDOWS else "node") + + @classproperty + @classmethod + def NPM_PATH(cls): + """The default path where npm is installed. + + Returns: + The default path where npm is installed. + """ + return cls.BIN_PATH / "npm" class PackageJson(SimpleNamespace): @@ -111,20 +173,21 @@ class PackageJson(SimpleNamespace): PATH = "package.json" DEPENDENCIES = { - "@emotion/react": "11.11.1", - "axios": "1.6.0", + "@babel/standalone": "7.25.8", + "@emotion/react": "11.13.3", + "axios": "1.7.7", "json5": "2.2.3", - "next": "14.0.1", - "next-sitemap": "4.1.8", - "next-themes": "0.2.1", - "react": "18.2.0", - "react-dom": "18.2.0", - "react-focus-lock": "2.11.3", - "socket.io-client": "4.6.1", - "universal-cookie": "4.0.4", + "next": "14.2.15", + "next-sitemap": "4.2.3", + "next-themes": "0.3.0", + "react": "18.3.1", + "react-dom": "18.3.1", + "react-focus-lock": "2.13.2", + "socket.io-client": "4.8.0", + "universal-cookie": "7.2.1", } DEV_DEPENDENCIES = { - "autoprefixer": "10.4.14", - "postcss": "8.4.31", + "autoprefixer": "10.4.20", + "postcss": "8.4.47", "postcss-import": "16.1.0", } diff --git a/reflex/constants/state.py b/reflex/constants/state.py new file mode 100644 index 000000000..aa0e2f97f --- /dev/null +++ b/reflex/constants/state.py @@ -0,0 +1,11 @@ +"""State-related constants.""" + +from enum import Enum + + +class StateManagerMode(str, Enum): + """State manager constants.""" + + DISK = "disk" + MEMORY = "memory" + REDIS = "redis" diff --git a/reflex/constants/style.py b/reflex/constants/style.py index 2130ab4e0..403acd4ba 100644 --- a/reflex/constants/style.py +++ b/reflex/constants/style.py @@ -7,7 +7,7 @@ class Tailwind(SimpleNamespace): """Tailwind constants.""" # The Tailwindcss version - VERSION = "tailwindcss@3.3.2" + VERSION = "tailwindcss@3.4.14" # The Tailwind config. CONFIG = "tailwind.config.js" # Default Tailwind content paths diff --git a/reflex/constants/utils.py b/reflex/constants/utils.py new file mode 100644 index 000000000..48797afbf --- /dev/null +++ b/reflex/constants/utils.py @@ -0,0 +1,32 @@ +"""Utility functions for constants.""" + +from typing import Any, Callable, Generic, Type + +from typing_extensions import TypeVar + +T = TypeVar("T") +V = TypeVar("V") + + +class classproperty(Generic[T, V]): + """A class property decorator.""" + + def __init__(self, getter: Callable[[Type[T]], V]) -> None: + """Initialize the class property. + + Args: + getter: The getter function. + """ + self.getter = getattr(getter, "__func__", getter) + + def __get__(self, instance: Any, owner: Type[T]) -> V: + """Get the value of the class property. + + Args: + instance: The instance of the class. + owner: The class itself. + + Returns: + The value of the class property. + """ + return self.getter(owner) diff --git a/reflex/custom_components/custom_components.py b/reflex/custom_components/custom_components.py index a47de6feb..ddda3de56 100644 --- a/reflex/custom_components/custom_components.py +++ b/reflex/custom_components/custom_components.py @@ -17,7 +17,7 @@ import typer from tomlkit.exceptions import TOMLKitError from reflex import constants -from reflex.config import get_config +from reflex.config import environment, get_config from reflex.constants import CustomComponents from reflex.utils import console @@ -36,7 +36,7 @@ POST_CUSTOM_COMPONENTS_GALLERY_TIMEOUT = 15 @contextmanager -def set_directory(working_directory: str): +def set_directory(working_directory: str | Path): """Context manager that sets the working directory. Args: @@ -45,7 +45,8 @@ def set_directory(working_directory: str): Yields: Yield to the caller to perform operations in the working directory. """ - current_directory = os.getcwd() + current_directory = Path.cwd() + working_directory = Path(working_directory) try: os.chdir(working_directory) yield @@ -62,12 +63,14 @@ def _create_package_config(module_name: str, package_name: str): """ from reflex.compiler import templates - with open(CustomComponents.PYPROJECT_TOML, "w") as f: - f.write( - templates.CUSTOM_COMPONENTS_PYPROJECT_TOML.render( - module_name=module_name, package_name=package_name - ) + pyproject = Path(CustomComponents.PYPROJECT_TOML) + pyproject.write_text( + templates.CUSTOM_COMPONENTS_PYPROJECT_TOML.render( + module_name=module_name, + package_name=package_name, + reflex_version=constants.Reflex.VERSION, ) + ) def _get_package_config(exit_on_fail: bool = True) -> dict: @@ -82,11 +85,11 @@ def _get_package_config(exit_on_fail: bool = True) -> dict: Raises: Exit: If the pyproject.toml file is not found. """ + pyproject = Path(CustomComponents.PYPROJECT_TOML) try: - with open(CustomComponents.PYPROJECT_TOML, "rb") as f: - return dict(tomlkit.load(f)) + return dict(tomlkit.loads(pyproject.read_bytes())) except (OSError, TOMLKitError) as ex: - console.error(f"Unable to read from pyproject.toml due to {ex}") + console.error(f"Unable to read from {pyproject} due to {ex}") if exit_on_fail: raise typer.Exit(code=1) from ex raise @@ -101,17 +104,17 @@ def _create_readme(module_name: str, package_name: str): """ from reflex.compiler import templates - with open(CustomComponents.PACKAGE_README, "w") as f: - f.write( - templates.CUSTOM_COMPONENTS_README.render( - module_name=module_name, - package_name=package_name, - ) + readme = Path(CustomComponents.PACKAGE_README) + readme.write_text( + templates.CUSTOM_COMPONENTS_README.render( + module_name=module_name, + package_name=package_name, ) + ) def _write_source_and_init_py( - custom_component_src_dir: str, + custom_component_src_dir: Path, component_class_name: str, module_name: str, ): @@ -124,27 +127,17 @@ def _write_source_and_init_py( """ from reflex.compiler import templates - with open( - os.path.join( - custom_component_src_dir, - f"{module_name}.py", - ), - "w", - ) as f: - f.write( - templates.CUSTOM_COMPONENTS_SOURCE.render( - component_class_name=component_class_name, module_name=module_name - ) + module_path = custom_component_src_dir / f"{module_name}.py" + module_path.write_text( + templates.CUSTOM_COMPONENTS_SOURCE.render( + component_class_name=component_class_name, module_name=module_name ) + ) - with open( - os.path.join( - custom_component_src_dir, - CustomComponents.INIT_FILE, - ), - "w", - ) as f: - f.write(templates.CUSTOM_COMPONENTS_INIT_FILE.render(module_name=module_name)) + init_path = custom_component_src_dir / CustomComponents.INIT_FILE + init_path.write_text( + templates.CUSTOM_COMPONENTS_INIT_FILE.render(module_name=module_name) + ) def _populate_demo_app(name_variants: NameVariants): @@ -190,7 +183,7 @@ def _get_default_library_name_parts() -> list[str]: Returns: The parts of default library name. """ - current_dir_name = os.getcwd().split(os.path.sep)[-1] + current_dir_name = Path.cwd().name cleaned_dir_name = re.sub("[^0-9a-zA-Z-_]+", "", current_dir_name).lower() parts = [part for part in re.split("-|_", cleaned_dir_name) if part] @@ -267,7 +260,7 @@ def _validate_library_name(library_name: str | None) -> NameVariants: # Module name is the snake case. module_name = "_".join(name_parts) - custom_component_module_dir = f"reflex_{module_name}" + custom_component_module_dir = Path(f"reflex_{module_name}") console.debug(f"Custom component source directory: {custom_component_module_dir}") # Use the same name for the directory and the app. @@ -343,7 +336,7 @@ def init( console.set_log_level(loglevel) - if os.path.exists(CustomComponents.PYPROJECT_TOML): + if CustomComponents.PYPROJECT_TOML.exists(): console.error(f"A {CustomComponents.PYPROJECT_TOML} already exists. Aborting.") typer.Exit(code=1) @@ -616,14 +609,14 @@ def publish( help="The API token to use for authentication on python package repository. If token is provided, no username/password should be provided at the same time", ), username: Optional[str] = typer.Option( - os.getenv("TWINE_USERNAME"), + environment.TWINE_USERNAME, "-u", "--username", show_default="TWINE_USERNAME environment variable value if set", help="The username to use for authentication on python package repository. Username and password must both be provided.", ), password: Optional[str] = typer.Option( - os.getenv("TWINE_PASSWORD"), + environment.TWINE_PASSWORD, "-p", "--password", show_default="TWINE_PASSWORD environment variable value if set", diff --git a/reflex/event.py b/reflex/event.py index b8fed5708..cfe40ef9a 100644 --- a/reflex/event.py +++ b/reflex/event.py @@ -2,30 +2,46 @@ from __future__ import annotations +import dataclasses import inspect +import sys import types import urllib.parse from base64 import b64encode +from functools import partial from typing import ( Any, Callable, Dict, + Generic, List, Optional, Tuple, + Type, + TypeVar, Union, get_type_hints, + overload, ) +from typing_extensions import ParamSpec, Protocol, get_args, get_origin + from reflex import constants -from reflex.base import Base -from reflex.ivars.base import ImmutableVar, LiteralVar -from reflex.ivars.function import FunctionStringVar, FunctionVar -from reflex.ivars.object import ObjectVar -from reflex.utils import format +from reflex.utils import console, format from reflex.utils.exceptions import EventFnArgMismatch, EventHandlerArgMismatch -from reflex.utils.types import ArgsSpec -from reflex.vars import ImmutableVarData, Var +from reflex.utils.types import ArgsSpec, GenericType +from reflex.vars import VarData +from reflex.vars.base import ( + LiteralVar, + Var, +) +from reflex.vars.function import ( + ArgsFunctionOperation, + FunctionStringVar, + FunctionVar, + VarOperationCall, +) +from reflex.vars.object import ObjectVar try: from typing import Annotated @@ -33,7 +49,11 @@ except ImportError: from typing_extensions import Annotated -class Event(Base): +@dataclasses.dataclass( + init=True, + frozen=True, +) +class Event: """An event that describes any state change in the app.""" # The token to specify the client that the event is for. @@ -43,10 +63,10 @@ class Event(Base): name: str # The routing data where event occurred - router_data: Dict[str, Any] = {} + router_data: Dict[str, Any] = dataclasses.field(default_factory=dict) # The event payload. - payload: Dict[str, Any] = {} + payload: Dict[str, Any] = dataclasses.field(default_factory=dict) @property def substate_token(self) -> str: @@ -81,11 +101,15 @@ def background(fn): return fn -class EventActionsMixin(Base): +@dataclasses.dataclass( + init=True, + frozen=True, +) +class EventActionsMixin: """Mixin for DOM event actions.""" # Whether to `preventDefault` or `stopPropagation` on the event. - event_actions: Dict[str, Union[bool, int]] = {} + event_actions: Dict[str, Union[bool, int]] = dataclasses.field(default_factory=dict) @property def stop_propagation(self): @@ -94,8 +118,9 @@ class EventActionsMixin(Base): Returns: New EventHandler-like with stopPropagation set to True. """ - return self.copy( - update={"event_actions": {"stopPropagation": True, **self.event_actions}}, + return dataclasses.replace( + self, + event_actions={"stopPropagation": True, **self.event_actions}, ) @property @@ -105,8 +130,9 @@ class EventActionsMixin(Base): Returns: New EventHandler-like with preventDefault set to True. """ - return self.copy( - update={"event_actions": {"preventDefault": True, **self.event_actions}}, + return dataclasses.replace( + self, + event_actions={"preventDefault": True, **self.event_actions}, ) def throttle(self, limit_ms: int): @@ -118,8 +144,9 @@ class EventActionsMixin(Base): Returns: New EventHandler-like with throttle set to limit_ms. """ - return self.copy( - update={"event_actions": {"throttle": limit_ms, **self.event_actions}}, + return dataclasses.replace( + self, + event_actions={"throttle": limit_ms, **self.event_actions}, ) def debounce(self, delay_ms: int): @@ -131,26 +158,25 @@ class EventActionsMixin(Base): Returns: New EventHandler-like with debounce set to delay_ms. """ - return self.copy( - update={"event_actions": {"debounce": delay_ms, **self.event_actions}}, + return dataclasses.replace( + self, + event_actions={"debounce": delay_ms, **self.event_actions}, ) +@dataclasses.dataclass( + init=True, + frozen=True, +) class EventHandler(EventActionsMixin): """An event handler responds to an event to update the state.""" # The function to call in response to the event. - fn: Any + fn: Any = dataclasses.field(default=None) # The full name of the state class this event handler is attached to. # Empty string means this event handler is a server side event. - state_full_name: str = "" - - class Config: - """The Pydantic config.""" - - # Needed to allow serialization of Callable. - frozen = True + state_full_name: str = dataclasses.field(default="") @classmethod def __class_getitem__(cls, args_spec: str) -> Annotated: @@ -191,7 +217,7 @@ class EventHandler(EventActionsMixin): # Get the function args. fn_args = inspect.getfullargspec(self.fn).args[1:] - fn_args = (ImmutableVar.create_safe(arg) for arg in fn_args) + fn_args = (Var(_js_expr=arg) for arg in fn_args) # Construct the payload. values = [] @@ -215,6 +241,10 @@ class EventHandler(EventActionsMixin): ) +@dataclasses.dataclass( + init=True, + frozen=True, +) class EventSpec(EventActionsMixin): """An event specification. @@ -223,19 +253,35 @@ class EventSpec(EventActionsMixin): """ # The event handler. - handler: EventHandler + handler: EventHandler = dataclasses.field(default=None) # type: ignore # The handler on the client to process event. - client_handler_name: str = "" + client_handler_name: str = dataclasses.field(default="") # The arguments to pass to the function. - args: Tuple[Tuple[Var, Var], ...] = () + args: Tuple[Tuple[Var, Var], ...] = dataclasses.field(default_factory=tuple) - class Config: - """The Pydantic config.""" + def __init__( + self, + handler: EventHandler, + event_actions: Dict[str, Union[bool, int]] | None = None, + client_handler_name: str = "", + args: Tuple[Tuple[Var, Var], ...] = tuple(), + ): + """Initialize an EventSpec. - # Required to allow tuple fields. - frozen = True + Args: + event_actions: The event actions. + handler: The event handler. + client_handler_name: The client handler name. + args: The arguments to pass to the function. + """ + if event_actions is None: + event_actions = {} + object.__setattr__(self, "event_actions", event_actions) + object.__setattr__(self, "handler", handler) + object.__setattr__(self, "client_handler_name", client_handler_name) + object.__setattr__(self, "args", args or tuple()) def with_args(self, args: Tuple[Tuple[Var, Var], ...]) -> EventSpec: """Copy the event spec, with updated args. @@ -269,7 +315,7 @@ class EventSpec(EventActionsMixin): # Get the remaining unfilled function args. fn_args = inspect.getfullargspec(self.handler.fn).args[1 + len(self.args) :] - fn_args = (ImmutableVar.create_safe(arg) for arg in fn_args) + fn_args = (Var(_js_expr=arg) for arg in fn_args) # Construct the payload. values = [] @@ -284,6 +330,9 @@ class EventSpec(EventActionsMixin): return self.with_args(self.args + new_payload) +@dataclasses.dataclass( + frozen=True, +) class CallableEventSpec(EventSpec): """Decorate an EventSpec-returning function to act as both a EventSpec and a function. @@ -303,10 +352,13 @@ class CallableEventSpec(EventSpec): if fn is not None: default_event_spec = fn() super().__init__( - fn=fn, # type: ignore - **default_event_spec.dict(), + event_actions=default_event_spec.event_actions, + client_handler_name=default_event_spec.client_handler_name, + args=default_event_spec.args, + handler=default_event_spec.handler, **kwargs, ) + object.__setattr__(self, "fn", fn) else: super().__init__(**kwargs) @@ -330,42 +382,196 @@ class CallableEventSpec(EventSpec): return self.fn(*args, **kwargs) +@dataclasses.dataclass( + init=True, + frozen=True, +) class EventChain(EventActionsMixin): """Container for a chain of events that will be executed in order.""" - events: List[EventSpec] + events: List[Union[EventSpec, EventVar]] = dataclasses.field(default_factory=list) - args_spec: Optional[Callable] + args_spec: Optional[Callable] = dataclasses.field(default=None) + + invocation: Optional[Var] = dataclasses.field(default=None) + + +@dataclasses.dataclass( + init=True, + frozen=True, +) +class JavascriptHTMLInputElement: + """Interface for a Javascript HTMLInputElement https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement.""" + + value: str = "" + + +@dataclasses.dataclass( + init=True, + frozen=True, +) +class JavascriptInputEvent: + """Interface for a Javascript InputEvent https://developer.mozilla.org/en-US/docs/Web/API/InputEvent.""" + + target: JavascriptHTMLInputElement = JavascriptHTMLInputElement() + + +@dataclasses.dataclass( + init=True, + frozen=True, +) +class JavasciptKeyboardEvent: + """Interface for a Javascript KeyboardEvent https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.""" + + key: str = "" + + +def input_event(e: Var[JavascriptInputEvent]) -> Tuple[Var[str]]: + """Get the value from an input event. + + Args: + e: The input event. + + Returns: + The value from the input event. + """ + return (e.target.value,) + + +def key_event(e: Var[JavasciptKeyboardEvent]) -> Tuple[Var[str]]: + """Get the key from a keyboard event. + + Args: + e: The keyboard event. + + Returns: + The key from the keyboard event. + """ + return (e.key,) + + +def empty_event() -> Tuple[()]: + """Empty event handler. + + Returns: + An empty tuple. + """ + return tuple() # type: ignore # These chains can be used for their side effects when no other events are desired. -stop_propagation = EventChain(events=[], args_spec=lambda: []).stop_propagation -prevent_default = EventChain(events=[], args_spec=lambda: []).prevent_default +stop_propagation = EventChain(events=[], args_spec=empty_event).stop_propagation +prevent_default = EventChain(events=[], args_spec=empty_event).prevent_default -class Target(Base): - """A Javascript event target.""" - - checked: bool = False - value: Any = None +T = TypeVar("T") +U = TypeVar("U") -class FrontendEvent(Base): - """A Javascript event.""" +# def identity_event(event_type: Type[T]) -> Callable[[Var[T]], Tuple[Var[T]]]: +# """A helper function that returns the input event as output. - target: Target = Target() - key: str = "" - value: Any = None +# Args: +# event_type: The type of the event. + +# Returns: +# A function that returns the input event as output. +# """ + +# def inner(ev: Var[T]) -> Tuple[Var[T]]: +# return (ev,) + +# inner.__signature__ = inspect.signature(inner).replace( # type: ignore +# parameters=[ +# inspect.Parameter( +# "ev", +# kind=inspect.Parameter.POSITIONAL_OR_KEYWORD, +# annotation=Var[event_type], +# ) +# ], +# return_annotation=Tuple[Var[event_type]], +# ) +# inner.__annotations__["ev"] = Var[event_type] +# inner.__annotations__["return"] = Tuple[Var[event_type]] + +# return inner -class FileUpload(Base): +class IdentityEventReturn(Generic[T], Protocol): + """Protocol for an identity event return.""" + + def __call__(self, *values: Var[T]) -> Tuple[Var[T], ...]: + """Return the input values. + + Args: + *values: The values to return. + + Returns: + The input values. + """ + return values + + +@overload +def identity_event(event_type: Type[T], /) -> Callable[[Var[T]], Tuple[Var[T]]]: ... # type: ignore + + +@overload +def identity_event( + event_type_1: Type[T], event_type2: Type[U], / +) -> Callable[[Var[T], Var[U]], Tuple[Var[T], Var[U]]]: ... + + +@overload +def identity_event(*event_types: Type[T]) -> IdentityEventReturn[T]: ... + + +def identity_event(*event_types: Type[T]) -> IdentityEventReturn[T]: # type: ignore + """A helper function that returns the input event as output. + + Args: + *event_types: The types of the events. + + Returns: + A function that returns the input event as output. + """ + + def inner(*values: Var[T]) -> Tuple[Var[T], ...]: + return values + + inner_type = tuple(Var[event_type] for event_type in event_types) + return_annotation = Tuple[inner_type] # type: ignore + + inner.__signature__ = inspect.signature(inner).replace( # type: ignore + parameters=[ + inspect.Parameter( + f"ev_{i}", + kind=inspect.Parameter.POSITIONAL_OR_KEYWORD, + annotation=Var[event_type], + ) + for i, event_type in enumerate(event_types) + ], + return_annotation=return_annotation, + ) + for i, event_type in enumerate(event_types): + inner.__annotations__[f"ev_{i}"] = Var[event_type] + inner.__annotations__["return"] = return_annotation + + return inner + + +@dataclasses.dataclass( + init=True, + frozen=True, +) +class FileUpload: """Class to represent a file upload.""" upload_id: Optional[str] = None on_upload_progress: Optional[Union[EventHandler, Callable]] = None @staticmethod - def on_upload_progress_args_spec(_prog: Dict[str, Union[int, float, bool]]): + def on_upload_progress_args_spec(_prog: Var[Dict[str, Union[int, float, bool]]]): """Args spec for on_upload_progress event handler. Returns: @@ -393,15 +599,15 @@ class FileUpload(Base): upload_id = self.upload_id or DEFAULT_UPLOAD_ID spec_args = [ ( - ImmutableVar.create_safe("files"), - ImmutableVar( - _var_name="filesById", + Var(_js_expr="files"), + Var( + _js_expr="filesById", _var_type=Dict[str, Any], - _var_data=ImmutableVarData.merge(upload_files_context_var_data), + _var_data=VarData.merge(upload_files_context_var_data), ).to(ObjectVar)[LiteralVar.create(upload_id)], ), ( - ImmutableVar.create_safe("upload_id"), + Var(_js_expr="upload_id"), LiteralVar.create(upload_id), ), ] @@ -424,13 +630,13 @@ class FileUpload(Base): if isinstance(events, Var): raise ValueError(f"{on_upload_progress} cannot return a var {events}.") on_upload_progress_chain = EventChain( - events=events, + events=[*events], args_spec=self.on_upload_progress_args_spec, ) formatted_chain = str(format.format_prop(on_upload_progress_chain)) spec_args.append( ( - ImmutableVar.create_safe("on_upload_progress"), + Var(_js_expr="on_upload_progress"), FunctionStringVar( formatted_chain.strip("{}"), ).to(FunctionVar, EventChain), @@ -470,7 +676,7 @@ def server_side(name: str, sig: inspect.Signature, **kwargs) -> EventSpec: handler=EventHandler(fn=fn), args=tuple( ( - ImmutableVar.create_safe(k), + Var(_js_expr=k), LiteralVar.create(v), ) for k, v in kwargs.items() @@ -717,14 +923,14 @@ def download( elif isinstance(data, Var): # Need to check on the frontend if the Var already looks like a data: URI. - is_data_url = (data._type() == "string") & ( + is_data_url = (data.js_type() == "string") & ( data.to(str).startswith("data:") ) # type: ignore # If it's a data: URI, use it as is, otherwise convert the Var to JSON in a data: URI. url = cond( # type: ignore is_data_url, - data, + data.to(str), "data:text/plain," + data.to_string(), # type: ignore ) elif isinstance(data, bytes): @@ -785,6 +991,16 @@ def call_script( ), ), } + if isinstance(javascript_code, str): + # When there is VarData, include it and eval the JS code inline on the client. + javascript_code, original_code = ( + LiteralVar.create(javascript_code), + javascript_code, + ) + if not javascript_code._get_all_var_data(): + # Without VarData, cast to string and eval the code in the event loop. + javascript_code = str(Var(_js_expr=original_code)) + return server_side( "_call_script", get_fn_signature(call_script), @@ -858,6 +1074,43 @@ def call_event_handler( ) +def unwrap_var_annotation(annotation: GenericType): + """Unwrap a Var annotation or return it as is if it's not Var[X]. + + Args: + annotation: The annotation to unwrap. + + Returns: + The unwrapped annotation. + """ + if get_origin(annotation) is Var and (args := get_args(annotation)): + return args[0] + return annotation + + +def resolve_annotation(annotations: dict[str, Any], arg_name: str): + """Resolve the annotation for the given argument name. + + Args: + annotations: The annotations. + arg_name: The argument name. + + Returns: + The resolved annotation. + """ + annotation = annotations.get(arg_name) + if annotation is None: + console.deprecate( + feature_name="Unannotated event handler arguments", + reason="Provide type annotations for event handler arguments.", + deprecation_version="0.6.3", + removal_version="0.7.0", + ) + # Allow arbitrary attribute access two levels deep until removed. + return Dict[str, dict] + return annotation + + def parse_args_spec(arg_spec: ArgsSpec): """Parse the args provided in the ArgsSpec of an event trigger. @@ -869,22 +1122,56 @@ def parse_args_spec(arg_spec: ArgsSpec): """ spec = inspect.getfullargspec(arg_spec) annotations = get_type_hints(arg_spec) - return arg_spec( - *[ - ImmutableVar(f"_{l_arg}").to( - ObjectVar, annotations.get(l_arg, FrontendEvent) - ) - for l_arg in spec.args - ] + + return list( + arg_spec( + *[ + Var(f"_{l_arg}").to( + unwrap_var_annotation(resolve_annotation(annotations, l_arg)) + ) + for l_arg in spec.args + ] + ) ) +def check_fn_match_arg_spec(fn: Callable, arg_spec: ArgsSpec) -> List[Var]: + """Ensures that the function signature matches the passed argument specification + or raises an EventFnArgMismatch if they do not. + + Args: + fn: The function to be validated. + arg_spec: The argument specification for the event trigger. + + Returns: + The parsed arguments from the argument specification. + + Raises: + EventFnArgMismatch: Raised if the number of mandatory arguments do not match + """ + fn_args = inspect.getfullargspec(fn).args + fn_defaults_args = inspect.getfullargspec(fn).defaults + n_fn_args = len(fn_args) + n_fn_defaults_args = len(fn_defaults_args) if fn_defaults_args else 0 + if isinstance(fn, types.MethodType): + n_fn_args -= 1 # subtract 1 for bound self arg + parsed_args = parse_args_spec(arg_spec) + if not (n_fn_args - n_fn_defaults_args <= len(parsed_args) <= n_fn_args): + raise EventFnArgMismatch( + "The number of mandatory arguments accepted by " + f"{fn} ({n_fn_args - n_fn_defaults_args}) " + "does not match the arguments passed by the event trigger: " + f"{[str(v) for v in parsed_args]}\n" + "See https://reflex.dev/docs/events/event-arguments/" + ) + return parsed_args + + def call_event_fn(fn: Callable, arg_spec: ArgsSpec) -> list[EventSpec] | Var: """Call a function to a list of event specs. The function should return a single EventSpec, a list of EventSpecs, or a - single Var. The function signature must match the passed arg_spec or - EventFnArgsMismatch will be raised. + single Var. Args: fn: The function to call. @@ -894,7 +1181,6 @@ def call_event_fn(fn: Callable, arg_spec: ArgsSpec) -> list[EventSpec] | Var: The event specs from calling the function or a Var. Raises: - EventFnArgMismatch: If the function signature doesn't match the arg spec. EventHandlerValueError: If the lambda returns an unusable value. """ # Import here to avoid circular imports. @@ -902,19 +1188,7 @@ def call_event_fn(fn: Callable, arg_spec: ArgsSpec) -> list[EventSpec] | Var: from reflex.utils.exceptions import EventHandlerValueError # Check that fn signature matches arg_spec - fn_args = inspect.getfullargspec(fn).args - n_fn_args = len(fn_args) - if isinstance(fn, types.MethodType): - n_fn_args -= 1 # subtract 1 for bound self arg - parsed_args = parse_args_spec(arg_spec) - if len(parsed_args) != n_fn_args: - raise EventFnArgMismatch( - "The number of arguments accepted by " - f"{fn} ({n_fn_args}) " - "does not match the arguments passed by the event trigger: " - f"{[str(v) for v in parsed_args]}\n" - "See https://reflex.dev/docs/events/event-arguments/" - ) + parsed_args = check_fn_match_arg_spec(fn, arg_spec) # Call the function with the parsed args. out = fn(*parsed_args) @@ -947,7 +1221,9 @@ def call_event_fn(fn: Callable, arg_spec: ArgsSpec) -> list[EventSpec] | Var: return events -def get_handler_args(event_spec: EventSpec) -> tuple[tuple[Var, Var], ...]: +def get_handler_args( + event_spec: EventSpec, +) -> tuple[tuple[Var, Var], ...]: """Get the handler args for the given event spec. Args: @@ -973,6 +1249,9 @@ def fix_events( token: The user token. router_data: The optional router data to set in the event. + Raises: + ValueError: If the event type is not what was expected. + Returns: The fixed events. """ @@ -996,9 +1275,10 @@ def fix_events( # Otherwise, create an event from the event spec. if isinstance(e, EventHandler): e = e() - assert isinstance(e, EventSpec), f"Unexpected event type, {type(e)}." + if not isinstance(e, EventSpec): + raise ValueError(f"Unexpected event type, {type(e)}.") name = format.format_event_handler(e.handler) - payload = {k._var_name: v._decode() for k, v in e.args} # type: ignore + payload = {k._js_expr: v._decode() for k, v in e.args} # type: ignore # Filter router_data to reduce payload size event_router_data = { @@ -1033,3 +1313,297 @@ def get_fn_signature(fn: Callable) -> inspect.Signature: "state", inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=Any ) return signature.replace(parameters=(new_param, *signature.parameters.values())) + + +class EventVar(ObjectVar, python_types=EventSpec): + """Base class for event vars.""" + + +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +class LiteralEventVar(VarOperationCall, LiteralVar, EventVar): + """A literal event var.""" + + _var_value: EventSpec = dataclasses.field(default=None) # type: ignore + + def __hash__(self) -> int: + """Get the hash of the var. + + Returns: + The hash of the var. + """ + return hash((self.__class__.__name__, self._js_expr)) + + @classmethod + def create( + cls, + value: EventSpec, + _var_data: VarData | None = None, + ) -> LiteralEventVar: + """Create a new LiteralEventVar instance. + + Args: + value: The value of the var. + _var_data: The data of the var. + + Returns: + The created LiteralEventVar instance. + """ + return cls( + _js_expr="", + _var_type=EventSpec, + _var_data=_var_data, + _var_value=value, + _func=FunctionStringVar("Event"), + _args=( + # event handler name + ".".join( + filter( + None, + format.get_event_handler_parts(value.handler), + ) + ), + # event handler args + {str(name): value for name, value in value.args}, + # event actions + value.event_actions, + # client handler name + *([value.client_handler_name] if value.client_handler_name else []), + ), + ) + + +class EventChainVar(FunctionVar, python_types=EventChain): + """Base class for event chain vars.""" + + +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +# Note: LiteralVar is second in the inheritance list allowing it act like a +# CachedVarOperation (ArgsFunctionOperation) and get the _js_expr from the +# _cached_var_name property. +class LiteralEventChainVar(ArgsFunctionOperation, LiteralVar, EventChainVar): + """A literal event chain var.""" + + _var_value: EventChain = dataclasses.field(default=None) # type: ignore + + def __hash__(self) -> int: + """Get the hash of the var. + + Returns: + The hash of the var. + """ + return hash((self.__class__.__name__, self._js_expr)) + + @classmethod + def create( + cls, + value: EventChain, + _var_data: VarData | None = None, + ) -> LiteralEventChainVar: + """Create a new LiteralEventChainVar instance. + + Args: + value: The value of the var. + _var_data: The data of the var. + + Returns: + The created LiteralEventChainVar instance. + """ + sig = inspect.signature(value.args_spec) # type: ignore + if sig.parameters: + arg_def = tuple((f"_{p}" for p in sig.parameters)) + arg_def_expr = LiteralVar.create([Var(_js_expr=arg) for arg in arg_def]) + else: + # add a default argument for addEvents if none were specified in value.args_spec + # used to trigger the preventDefault() on the event. + arg_def = ("...args",) + arg_def_expr = Var(_js_expr="args") + + if value.invocation is None: + invocation = FunctionStringVar.create("addEvents") + else: + invocation = value.invocation + + return cls( + _js_expr="", + _var_type=EventChain, + _var_data=_var_data, + _args_names=arg_def, + _return_expr=invocation.call( + LiteralVar.create([LiteralVar.create(event) for event in value.events]), + arg_def_expr, + value.event_actions, + ), + _var_value=value, + ) + + +G = ParamSpec("G") + +IndividualEventType = Union[EventSpec, EventHandler, Callable[G, Any], Var[Any]] + +EventType = Union[IndividualEventType[G], List[IndividualEventType[G]]] + +P = ParamSpec("P") +T = TypeVar("T") +V = TypeVar("V") +V2 = TypeVar("V2") +V3 = TypeVar("V3") +V4 = TypeVar("V4") +V5 = TypeVar("V5") + +if sys.version_info >= (3, 10): + from typing import Concatenate + + class EventCallback(Generic[P, T]): + """A descriptor that wraps a function to be used as an event.""" + + def __init__(self, func: Callable[Concatenate[Any, P], T]): + """Initialize the descriptor with the function to be wrapped. + + Args: + func: The function to be wrapped. + """ + self.func = func + + @overload + def __get__( + self: EventCallback[[V], T], instance: None, owner + ) -> Callable[[Union[Var[V], V]], EventSpec]: ... + + @overload + def __get__( + self: EventCallback[[V, V2], T], instance: None, owner + ) -> Callable[[Union[Var[V], V], Union[Var[V2], V2]], EventSpec]: ... + + @overload + def __get__( + self: EventCallback[[V, V2, V3], T], instance: None, owner + ) -> Callable[ + [Union[Var[V], V], Union[Var[V2], V2], Union[Var[V3], V3]], + EventSpec, + ]: ... + + @overload + def __get__( + self: EventCallback[[V, V2, V3, V4], T], instance: None, owner + ) -> Callable[ + [ + Union[Var[V], V], + Union[Var[V2], V2], + Union[Var[V3], V3], + Union[Var[V4], V4], + ], + EventSpec, + ]: ... + + @overload + def __get__( + self: EventCallback[[V, V2, V3, V4, V5], T], instance: None, owner + ) -> Callable[ + [ + Union[Var[V], V], + Union[Var[V2], V2], + Union[Var[V3], V3], + Union[Var[V4], V4], + Union[Var[V5], V5], + ], + EventSpec, + ]: ... + + @overload + def __get__(self, instance, owner) -> Callable[P, T]: ... + + def __get__(self, instance, owner) -> Callable: + """Get the function with the instance bound to it. + + Args: + instance: The instance to bind to the function. + owner: The owner of the function. + + Returns: + The function with the instance bound to it + """ + if instance is None: + return self.func # type: ignore + + return partial(self.func, instance) # type: ignore + + def event_handler(func: Callable[Concatenate[Any, P], T]) -> EventCallback[P, T]: + """Wrap a function to be used as an event. + + Args: + func: The function to wrap. + + Returns: + The wrapped function. + """ + return func # type: ignore +else: + + def event_handler(func: Callable[P, T]) -> Callable[P, T]: + """Wrap a function to be used as an event. + + Args: + func: The function to wrap. + + Returns: + The wrapped function. + """ + return func + + +class EventNamespace(types.SimpleNamespace): + """A namespace for event related classes.""" + + Event = Event + EventHandler = EventHandler + EventSpec = EventSpec + CallableEventSpec = CallableEventSpec + EventChain = EventChain + EventVar = EventVar + LiteralEventVar = LiteralEventVar + EventChainVar = EventChainVar + LiteralEventChainVar = LiteralEventChainVar + EventType = EventType + + __call__ = staticmethod(event_handler) + get_event = staticmethod(get_event) + get_hydrate_event = staticmethod(get_hydrate_event) + fix_events = staticmethod(fix_events) + call_event_handler = staticmethod(call_event_handler) + call_event_fn = staticmethod(call_event_fn) + get_handler_args = staticmethod(get_handler_args) + check_fn_match_arg_spec = staticmethod(check_fn_match_arg_spec) + resolve_annotation = staticmethod(resolve_annotation) + parse_args_spec = staticmethod(parse_args_spec) + identity_event = staticmethod(identity_event) + input_event = staticmethod(input_event) + key_event = staticmethod(key_event) + empty_event = staticmethod(empty_event) + server_side = staticmethod(server_side) + redirect = staticmethod(redirect) + console_log = staticmethod(console_log) + back = staticmethod(back) + window_alert = staticmethod(window_alert) + set_focus = staticmethod(set_focus) + scroll_to = staticmethod(scroll_to) + set_value = staticmethod(set_value) + remove_cookie = staticmethod(remove_cookie) + clear_local_storage = staticmethod(clear_local_storage) + remove_local_storage = staticmethod(remove_local_storage) + clear_session_storage = staticmethod(clear_session_storage) + remove_session_storage = staticmethod(remove_session_storage) + set_clipboard = staticmethod(set_clipboard) + download = staticmethod(download) + call_script = staticmethod(call_script) + + +event = EventNamespace() diff --git a/reflex/experimental/__init__.py b/reflex/experimental/__init__.py index 0c11deb85..164790fe5 100644 --- a/reflex/experimental/__init__.py +++ b/reflex/experimental/__init__.py @@ -2,6 +2,7 @@ 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 @@ -67,4 +68,5 @@ _x = ExperimentalNamespace( layout=layout, PropsBase=PropsBase, run_in_thread=run_in_thread, + code_block=code_block, ) diff --git a/reflex/experimental/assets.py b/reflex/experimental/assets.py index c18ac1e84..dcf386d8d 100644 --- a/reflex/experimental/assets.py +++ b/reflex/experimental/assets.py @@ -24,6 +24,7 @@ def asset(relative_filename: str, subfolder: Optional[str] = None) -> str: Raises: FileNotFoundError: If the file does not exist. + ValueError: If the module is None. Returns: The relative URL to the copied asset. @@ -31,7 +32,8 @@ def asset(relative_filename: str, subfolder: Optional[str] = None) -> str: # Determine the file by which the asset is exposed. calling_file = inspect.stack()[1].filename module = inspect.getmodule(inspect.stack()[1][0]) - assert module is not None + if module is None: + raise ValueError("Module is None") caller_module_path = module.__name__.replace(".", "/") subfolder = f"{caller_module_path}/{subfolder}" if subfolder else caller_module_path diff --git a/reflex/experimental/client_state.py b/reflex/experimental/client_state.py index af3056c4d..c7b2260a1 100644 --- a/reflex/experimental/client_state.py +++ b/reflex/experimental/client_state.py @@ -3,15 +3,19 @@ from __future__ import annotations import dataclasses +import re import sys -from typing import Any, Callable, Optional, Type, Union +from typing import Any, Callable, Union from reflex import constants from reflex.event import EventChain, EventHandler, EventSpec, call_script -from reflex.ivars.base import ImmutableVar, LiteralVar -from reflex.ivars.function import FunctionVar from reflex.utils.imports import ImportVar -from reflex.vars import ImmutableVarData, Var, VarData, get_unique_variable_name +from reflex.vars import ( + VarData, + get_unique_variable_name, +) +from reflex.vars.base import LiteralVar, Var +from reflex.vars.function import FunctionVar NoValue = object() @@ -35,36 +39,19 @@ def _client_state_ref(var_name: str) -> str: @dataclasses.dataclass( eq=False, + frozen=True, **{"slots": True} if sys.version_info >= (3, 10) else {}, ) class ClientStateVar(Var): """A Var that exists on the client via useState.""" - # The name of the var. - _var_name: str = dataclasses.field() - # Track the names of the getters and setters - _setter_name: str = dataclasses.field() - _getter_name: str = dataclasses.field() + _setter_name: str = dataclasses.field(default="") + _getter_name: str = dataclasses.field(default="") # Whether to add the var and setter to the global `refs` object for use in any Component. _global_ref: bool = dataclasses.field(default=True) - # The type of the var. - _var_type: Type = dataclasses.field(default=Any) - - # Whether this is a local javascript variable. - _var_is_local: bool = dataclasses.field(default=False) - - # Whether the var is a string literal. - _var_is_string: bool = dataclasses.field(default=False) - - # _var_full_name should be prefixed with _var_state - _var_full_name_needs_state_prefix: bool = dataclasses.field(default=False) - - # Extra metadata associated with the Var - _var_data: Optional[VarData] = dataclasses.field(default=None) - def __hash__(self) -> int: """Define a hash function for a var. @@ -72,7 +59,7 @@ class ClientStateVar(Var): The hash of the var. """ return hash( - (self._var_name, str(self._var_type), self._getter_name, self._setter_name) + (self._js_expr, str(self._var_type), self._getter_name, self._setter_name) ) @classmethod @@ -104,23 +91,25 @@ class ClientStateVar(Var): default: The default value of the variable. global_ref: Whether the state should be accessible in any Component and on the backend. + Raises: + ValueError: If the var_name is not a string. + Returns: ClientStateVar """ if var_name is None: var_name = get_unique_variable_name() - assert isinstance(var_name, str), "var_name must be a string." + if not isinstance(var_name, str): + raise ValueError("var_name must be a string.") if default is NoValue: - default_var = ImmutableVar.create_safe( - "", _var_is_local=False, _var_is_string=False - ) + default_var = Var(_js_expr="") elif not isinstance(default, Var): default_var = LiteralVar.create(default) else: default_var = default setter_name = f"set{var_name.capitalize()}" hooks = { - f"const [{var_name}, {setter_name}] = useState({default_var._var_name_unwrapped})": None, + f"const [{var_name}, {setter_name}] = useState({str(default_var)})": None, } imports = { "react": [ImportVar(tag="useState")], @@ -130,16 +119,14 @@ class ClientStateVar(Var): hooks[f"{_client_state_ref(setter_name)} = {setter_name}"] = None imports.update(_refs_import) return cls( - _var_name="", + _js_expr="", _setter_name=setter_name, _getter_name=var_name, _global_ref=global_ref, - _var_is_local=False, - _var_is_string=False, _var_type=default_var._var_type, _var_data=VarData.merge( default_var._var_data, - VarData( # type: ignore + VarData( hooks=hooks, imports=imports, ), @@ -158,10 +145,12 @@ class ClientStateVar(Var): an accessor for the client state variable. """ return ( - ImmutableVar.create_safe( - _client_state_ref(self._getter_name) - if self._global_ref - else self._getter_name + Var( + _js_expr=( + _client_state_ref(self._getter_name) + if self._global_ref + else self._getter_name + ) ) .to(self._var_type) ._replace( @@ -191,17 +180,17 @@ class ClientStateVar(Var): ) if value is not NoValue: # This is a hack to make it work like an EventSpec taking an arg - value = LiteralVar.create(value) - if not value._var_is_string and value._var_full_name.startswith("_"): - arg = value._var_name_unwrapped.partition(".")[0] + value_str = str(LiteralVar.create(value)) + + if value_str.startswith("_"): + # remove patterns of ["*"] from the value_str using regex + arg = re.sub(r"\[\".*\"\]", "", value_str) + setter = f"(({arg}) => {setter}({value_str}))" else: - arg = "" - setter = f"({arg}) => {setter}({value._var_name_unwrapped})" - return ImmutableVar( - _var_name=setter, - _var_data=ImmutableVarData( - imports=_refs_import if self._global_ref else {} - ), + setter = f"(() => {setter}({value_str}))" + return Var( + _js_expr=setter, + _var_data=VarData(imports=_refs_import if self._global_ref else {}), ).to(FunctionVar, EventChain) @property diff --git a/reflex/experimental/hooks.py b/reflex/experimental/hooks.py index 848ad7fb7..7d648225a 100644 --- a/reflex/experimental/hooks.py +++ b/reflex/experimental/hooks.py @@ -3,7 +3,8 @@ from __future__ import annotations from reflex.utils.imports import ImportVar -from reflex.vars import Var, VarData +from reflex.vars import VarData +from reflex.vars.base import Var def _compose_react_imports(tags: list[str]) -> dict[str, list[ImportVar]]: @@ -21,10 +22,8 @@ def const(name, value) -> Var: The constant Var. """ if isinstance(name, list): - return Var.create_safe( - f"const [{', '.join(name)}] = {value}", _var_is_string=False - ) - return Var.create_safe(f"const {name} = {value}", _var_is_string=False) + return Var(_js_expr=f"const [{', '.join(name)}] = {value}") + return Var(_js_expr=f"const {name} = {value}") def useCallback(func, deps) -> Var: @@ -37,9 +36,8 @@ def useCallback(func, deps) -> Var: Returns: The useCallback hook. """ - return Var.create_safe( - f"useCallback({func}, {deps})" if deps else f"useCallback({func})", - _var_is_string=False, + return Var( + _js_expr=f"useCallback({func}, {deps})" if deps else f"useCallback({func})", _var_data=VarData(imports=_compose_react_imports(["useCallback"])), ) @@ -53,9 +51,8 @@ def useContext(context) -> Var: Returns: The useContext hook. """ - return Var.create_safe( - f"useContext({context})", - _var_is_string=False, + return Var( + _js_expr=f"useContext({context})", _var_data=VarData(imports=_compose_react_imports(["useContext"])), ) @@ -69,9 +66,8 @@ def useRef(default) -> Var: Returns: The useRef hook. """ - return Var.create_safe( - f"useRef({default})", - _var_is_string=False, + return Var( + _js_expr=f"useRef({default})", _var_data=VarData(imports=_compose_react_imports(["useRef"])), ) @@ -88,9 +84,8 @@ def useState(var_name, default=None) -> Var: """ return const( [var_name, f"set{var_name.capitalize()}"], - Var.create_safe( - f"useState({default})", - _var_is_string=False, + Var( + _js_expr=f"useState({default})", _var_data=VarData(imports=_compose_react_imports(["useState"])), ), ) diff --git a/reflex/experimental/layout.py b/reflex/experimental/layout.py index cf39ccb6c..a3b76581a 100644 --- a/reflex/experimental/layout.py +++ b/reflex/experimental/layout.py @@ -16,7 +16,7 @@ from reflex.event import call_script from reflex.experimental import hooks from reflex.state import ComponentState from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Sidebar(Box, MemoizationLeaf): @@ -55,7 +55,7 @@ class Sidebar(Box, MemoizationLeaf): open = ( self.State.open # type: ignore if self.State - else Var.create_safe("open", _var_is_string=False) + else Var(_js_expr="open") ) sidebar.style["display"] = spacer.style["display"] = cond(open, "block", "none") @@ -172,8 +172,8 @@ class SidebarTrigger(Fragment): open, toggle = sidebar.State.open, sidebar.State.toggle # type: ignore else: open, toggle = ( - Var.create_safe("open", _var_is_string=False), - call_script(Var.create_safe("setOpen(!open)", _var_is_string=False)), + Var(_js_expr="open"), + call_script(Var(_js_expr="setOpen(!open)")), ) trigger_props["left"] = cond(open, f"calc({sidebar_width} - 32px)", "0") diff --git a/reflex/experimental/layout.pyi b/reflex/experimental/layout.pyi index 8799b4961..dcdac5b5d 100644 --- a/reflex/experimental/layout.pyi +++ b/reflex/experimental/layout.pyi @@ -3,17 +3,17 @@ # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex import color from reflex.components.base.fragment import Fragment from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf from reflex.components.radix.primitives.drawer import DrawerRoot from reflex.components.radix.themes.layout.box import Box -from reflex.event import EventHandler, EventSpec +from reflex.event import EventType from reflex.state import ComponentState from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import Var class Sidebar(Box, MemoizationLeaf): @overload @@ -21,71 +21,51 @@ class Sidebar(Box, MemoizationLeaf): def create( # type: ignore cls, *children, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Sidebar": """Create the sidebar component. @@ -124,8 +104,8 @@ class DrawerSidebar(DrawerRoot): modal: Optional[Union[Var[bool], bool]] = None, direction: Optional[ Union[ - Var[Literal["top", "bottom", "left", "right"]], - Literal["top", "bottom", "left", "right"], + Literal["bottom", "left", "right", "top"], + Var[Literal["bottom", "left", "right", "top"]], ] ] = None, preventScrollRestoration: Optional[Union[Var[bool], bool]] = None, @@ -136,44 +116,22 @@ class DrawerSidebar(DrawerRoot): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open_change: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_open_change: Optional[EventType[bool]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "DrawerSidebar": """Create the sidebar component. @@ -207,41 +165,21 @@ class SidebarTrigger(Fragment): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "SidebarTrigger": """Create the sidebar trigger component. @@ -262,71 +200,51 @@ class Layout(Box): cls, *children, sidebar: Optional[Component] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Layout": """Create the layout component. @@ -350,71 +268,51 @@ class LayoutNamespace(ComponentNamespace): def __call__( *children, sidebar: Optional[Component] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] + Union[Var[Union[bool, int, str]], bool, int, str] ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, + hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + on_blur: Optional[EventType[[]]] = None, + on_click: Optional[EventType[[]]] = None, + on_context_menu: Optional[EventType[[]]] = None, + on_double_click: Optional[EventType[[]]] = None, + on_focus: Optional[EventType[[]]] = None, + on_mount: Optional[EventType[[]]] = None, + on_mouse_down: Optional[EventType[[]]] = None, + on_mouse_enter: Optional[EventType[[]]] = None, + on_mouse_leave: Optional[EventType[[]]] = None, + on_mouse_move: Optional[EventType[[]]] = None, + on_mouse_out: Optional[EventType[[]]] = None, + on_mouse_over: Optional[EventType[[]]] = None, + on_mouse_up: Optional[EventType[[]]] = None, + on_scroll: Optional[EventType[[]]] = None, + on_unmount: Optional[EventType[[]]] = None, **props, ) -> "Layout": """Create the layout component. diff --git a/reflex/experimental/misc.py b/reflex/experimental/misc.py index 716d081b8..e3d237153 100644 --- a/reflex/experimental/misc.py +++ b/reflex/experimental/misc.py @@ -12,10 +12,12 @@ async def run_in_thread(func) -> Any: Args: func (callable): The non-async function to run. + Raises: + ValueError: If the function is an async function. + Returns: Any: The return value of the function. """ - assert not asyncio.coroutines.iscoroutinefunction( - func - ), "func must be a non-async function" + if asyncio.coroutines.iscoroutinefunction(func): + raise ValueError("func must be a non-async function") return await asyncio.get_event_loop().run_in_executor(None, func) diff --git a/reflex/istate/data.py b/reflex/istate/data.py new file mode 100644 index 000000000..9f6e3b3f4 --- /dev/null +++ b/reflex/istate/data.py @@ -0,0 +1,126 @@ +"""This module contains the dataclasses representing the router object.""" + +import dataclasses +from typing import Optional + +from reflex import constants +from reflex.utils import format + + +@dataclasses.dataclass(frozen=True) +class HeaderData: + """An object containing headers data.""" + + host: str = "" + origin: str = "" + upgrade: str = "" + connection: str = "" + cookie: str = "" + pragma: str = "" + cache_control: str = "" + user_agent: str = "" + sec_websocket_version: str = "" + sec_websocket_key: str = "" + sec_websocket_extensions: str = "" + accept_encoding: str = "" + accept_language: str = "" + + def __init__(self, router_data: Optional[dict] = None): + """Initalize the HeaderData object based on router_data. + + Args: + router_data: the router_data dict. + """ + if router_data: + for k, v in router_data.get(constants.RouteVar.HEADERS, {}).items(): + object.__setattr__(self, format.to_snake_case(k), v) + else: + for k in dataclasses.fields(self): + object.__setattr__(self, k.name, "") + + +@dataclasses.dataclass(frozen=True) +class PageData: + """An object containing page data.""" + + host: str = "" # repeated with self.headers.origin (remove or keep the duplicate?) + path: str = "" + raw_path: str = "" + full_path: str = "" + full_raw_path: str = "" + params: dict = dataclasses.field(default_factory=dict) + + def __init__(self, router_data: Optional[dict] = None): + """Initalize the PageData object based on router_data. + + Args: + router_data: the router_data dict. + """ + if router_data: + object.__setattr__( + self, + "host", + router_data.get(constants.RouteVar.HEADERS, {}).get("origin", ""), + ) + object.__setattr__( + self, "path", router_data.get(constants.RouteVar.PATH, "") + ) + object.__setattr__( + self, "raw_path", router_data.get(constants.RouteVar.ORIGIN, "") + ) + object.__setattr__(self, "full_path", f"{self.host}{self.path}") + object.__setattr__(self, "full_raw_path", f"{self.host}{self.raw_path}") + object.__setattr__( + self, "params", router_data.get(constants.RouteVar.QUERY, {}) + ) + else: + object.__setattr__(self, "host", "") + object.__setattr__(self, "path", "") + object.__setattr__(self, "raw_path", "") + object.__setattr__(self, "full_path", "") + object.__setattr__(self, "full_raw_path", "") + object.__setattr__(self, "params", {}) + + +@dataclasses.dataclass(frozen=True, init=False) +class SessionData: + """An object containing session data.""" + + client_token: str = "" + client_ip: str = "" + session_id: str = "" + + def __init__(self, router_data: Optional[dict] = None): + """Initalize the SessionData object based on router_data. + + Args: + router_data: the router_data dict. + """ + if router_data: + client_token = router_data.get(constants.RouteVar.CLIENT_TOKEN, "") + client_ip = router_data.get(constants.RouteVar.CLIENT_IP, "") + session_id = router_data.get(constants.RouteVar.SESSION_ID, "") + else: + client_token = client_ip = session_id = "" + object.__setattr__(self, "client_token", client_token) + object.__setattr__(self, "client_ip", client_ip) + object.__setattr__(self, "session_id", session_id) + + +@dataclasses.dataclass(frozen=True, init=False) +class RouterData: + """An object containing RouterData.""" + + session: SessionData = dataclasses.field(default_factory=SessionData) + headers: HeaderData = dataclasses.field(default_factory=HeaderData) + page: PageData = dataclasses.field(default_factory=PageData) + + def __init__(self, router_data: Optional[dict] = None): + """Initialize the RouterData object. + + Args: + router_data: the router_data dict. + """ + object.__setattr__(self, "session", SessionData(router_data)) + object.__setattr__(self, "headers", HeaderData(router_data)) + object.__setattr__(self, "page", PageData(router_data)) diff --git a/reflex/istate/dynamic.py b/reflex/istate/dynamic.py new file mode 100644 index 000000000..e5da36c26 --- /dev/null +++ b/reflex/istate/dynamic.py @@ -0,0 +1,3 @@ +"""A container for dynamically generated states.""" + +# This page intentionally left blank. diff --git a/reflex/istate/storage.py b/reflex/istate/storage.py new file mode 100644 index 000000000..85e21ffa7 --- /dev/null +++ b/reflex/istate/storage.py @@ -0,0 +1,144 @@ +"""Client-side storage classes for reflex state variables.""" + +from __future__ import annotations + +from typing import Any + +from reflex.utils import format + + +class ClientStorageBase: + """Base class for client-side storage.""" + + def options(self) -> dict[str, Any]: + """Get the options for the storage. + + Returns: + All set options for the storage (not None). + """ + return { + format.to_camel_case(k): v for k, v in vars(self).items() if v is not None + } + + +class Cookie(ClientStorageBase, str): + """Represents a state Var that is stored as a cookie in the browser.""" + + name: str | None + path: str + max_age: int | None + domain: str | None + secure: bool | None + same_site: str + + def __new__( + cls, + object: Any = "", + encoding: str | None = None, + errors: str | None = None, + /, + name: str | None = None, + path: str = "/", + max_age: int | None = None, + domain: str | None = None, + secure: bool | None = None, + same_site: str = "lax", + ): + """Create a client-side Cookie (str). + + Args: + object: The initial object. + encoding: The encoding to use. + errors: The error handling scheme to use. + name: The name of the cookie on the client side. + path: Cookie path. Use / as the path if the cookie should be accessible on all pages. + max_age: Relative max age of the cookie in seconds from when the client receives it. + domain: Domain for the cookie (sub.domain.com or .allsubdomains.com). + secure: Is the cookie only accessible through HTTPS? + same_site: Whether the cookie is sent with third party requests. + One of (true|false|none|lax|strict) + + Returns: + The client-side Cookie object. + + Note: expires (absolute Date) is not supported at this time. + """ + if encoding or errors: + inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict") + else: + inst = super().__new__(cls, object) + inst.name = name + inst.path = path + inst.max_age = max_age + inst.domain = domain + inst.secure = secure + inst.same_site = same_site + return inst + + +class LocalStorage(ClientStorageBase, str): + """Represents a state Var that is stored in localStorage in the browser.""" + + name: str | None + sync: bool = False + + def __new__( + cls, + object: Any = "", + encoding: str | None = None, + errors: str | None = None, + /, + name: str | None = None, + sync: bool = False, + ) -> "LocalStorage": + """Create a client-side localStorage (str). + + Args: + object: The initial object. + encoding: The encoding to use. + errors: The error handling scheme to use. + name: The name of the storage key on the client side. + sync: Whether changes should be propagated to other tabs. + + Returns: + The client-side localStorage object. + """ + if encoding or errors: + inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict") + else: + inst = super().__new__(cls, object) + inst.name = name + inst.sync = sync + return inst + + +class SessionStorage(ClientStorageBase, str): + """Represents a state Var that is stored in sessionStorage in the browser.""" + + name: str | None + + def __new__( + cls, + object: Any = "", + encoding: str | None = None, + errors: str | None = None, + /, + name: str | None = None, + ) -> "SessionStorage": + """Create a client-side sessionStorage (str). + + Args: + object: The initial object. + encoding: The encoding to use. + errors: The error handling scheme to use + name: The name of the storage on the client side + + Returns: + The client-side sessionStorage object. + """ + if encoding or errors: + inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict") + else: + inst = super().__new__(cls, object) + inst.name = name + return inst diff --git a/reflex/ivars/base.py b/reflex/ivars/base.py deleted file mode 100644 index 4cd3550dd..000000000 --- a/reflex/ivars/base.py +++ /dev/null @@ -1,1912 +0,0 @@ -"""Collection of base classes.""" - -from __future__ import annotations - -import contextlib -import dataclasses -import datetime -import dis -import functools -import inspect -import json -import sys -import warnings -from types import CodeType, FunctionType -from typing import ( - TYPE_CHECKING, - Any, - Callable, - Dict, - Generic, - List, - Literal, - NoReturn, - Optional, - Sequence, - Set, - Tuple, - Type, - TypeVar, - Union, - cast, - get_args, - overload, -) - -from typing_extensions import ParamSpec, get_type_hints, override - -from reflex import constants -from reflex.base import Base -from reflex.constants.colors import Color -from reflex.utils import console, imports, serializers, types -from reflex.utils.exceptions import VarDependencyError, VarTypeError, VarValueError -from reflex.utils.format import format_state_name -from reflex.utils.types import get_origin -from reflex.vars import ( - ComputedVar, - ImmutableVarData, - Var, - VarData, - _decode_var_immutable, - _extract_var_data, - _global_vars, -) - -if TYPE_CHECKING: - from reflex.state import BaseState - - from .function import FunctionVar, ToFunctionOperation - from .number import ( - BooleanVar, - NumberVar, - ToBooleanVarOperation, - ToNumberVarOperation, - ) - from .object import ObjectVar, ToObjectOperation - from .sequence import ArrayVar, StringVar, ToArrayOperation, ToStringOperation - - -VAR_TYPE = TypeVar("VAR_TYPE") - - -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ImmutableVar(Var, Generic[VAR_TYPE]): - """Base class for immutable vars.""" - - # The name of the var. - _var_name: str = dataclasses.field() - - # The type of the var. - _var_type: types.GenericType = dataclasses.field(default=Any) - - # Extra metadata associated with the Var - _var_data: Optional[ImmutableVarData] = dataclasses.field(default=None) - - def __str__(self) -> str: - """String representation of the var. Guaranteed to be a valid Javascript expression. - - Returns: - The name of the var. - """ - return self._var_name - - @property - def _var_is_local(self) -> bool: - """Whether this is a local javascript variable. - - Returns: - False - """ - return False - - @property - def _var_is_string(self) -> bool: - """Whether the var is a string literal. - - Returns: - False - """ - return False - - @property - def _var_full_name_needs_state_prefix(self) -> bool: - """Whether the full name of the var needs a _var_state prefix. - - Returns: - False - """ - return False - - def __post_init__(self): - """Post-initialize the var.""" - # Decode any inline Var markup and apply it to the instance - _var_data, _var_name = _decode_var_immutable(self._var_name) - - if _var_data or _var_name != self._var_name: - self.__init__( - _var_name=_var_name, - _var_type=self._var_type, - _var_data=ImmutableVarData.merge(self._var_data, _var_data), - ) - - def __hash__(self) -> int: - """Define a hash function for the var. - - Returns: - The hash of the var. - """ - return hash((self._var_name, self._var_type, self._var_data)) - - def _get_all_var_data(self) -> ImmutableVarData | None: - """Get all VarData associated with the Var. - - Returns: - The VarData of the components and all of its children. - """ - return self._var_data - - def _replace(self, merge_var_data=None, **kwargs: Any): - """Make a copy of this Var with updated fields. - - Args: - merge_var_data: VarData to merge into the existing VarData. - **kwargs: Var fields to update. - - Returns: - A new ImmutableVar with the updated fields overwriting the corresponding fields in this Var. - - Raises: - TypeError: If _var_is_local, _var_is_string, or _var_full_name_needs_state_prefix is not None. - """ - if kwargs.get("_var_is_local", False) is not False: - raise TypeError( - "The _var_is_local argument is not supported for ImmutableVar." - ) - - if kwargs.get("_var_is_string", False) is not False: - raise TypeError( - "The _var_is_string argument is not supported for ImmutableVar." - ) - - if kwargs.get("_var_full_name_needs_state_prefix", False) is not False: - raise TypeError( - "The _var_full_name_needs_state_prefix argument is not supported for ImmutableVar." - ) - - return dataclasses.replace( - self, - _var_data=ImmutableVarData.merge( - kwargs.get("_var_data", self._var_data), merge_var_data - ), - **kwargs, - ) - - @classmethod - def create( - cls, - value: Any, - _var_is_local: bool | None = None, - _var_is_string: bool | None = None, - _var_data: VarData | None = None, - ) -> ImmutableVar | Var | None: - """Create a var from a value. - - Args: - value: The value to create the var from. - _var_is_local: Whether the var is local. Deprecated. - _var_is_string: Whether the var is a string literal. Deprecated. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The var. - - Raises: - VarTypeError: If the value is JSON-unserializable. - TypeError: If _var_is_local or _var_is_string is not None. - """ - if _var_is_local is not None: - raise TypeError( - "The _var_is_local argument is not supported for ImmutableVar." - ) - - if _var_is_string is not None: - raise TypeError( - "The _var_is_string argument is not supported for ImmutableVar." - ) - - from reflex.utils import format - - # Check for none values. - if value is None: - return None - - # If the value is already a var, do nothing. - if isinstance(value, Var): - return value - - # Try to pull the imports and hooks from contained values. - if not isinstance(value, str): - _var_data = VarData.merge(*_extract_var_data(value), _var_data) - - # Try to serialize the value. - type_ = type(value) - if type_ in types.JSONType: - name = value - else: - name, _serialized_type = serializers.serialize(value, get_type=True) - if name is None: - raise VarTypeError( - f"No JSON serializer found for var {value} of type {type_}." - ) - name = name if isinstance(name, str) else format.json_dumps(name) - - return cls( - _var_name=name, - _var_type=type_, - _var_data=( - ImmutableVarData( - state=_var_data.state, - imports=_var_data.imports, - hooks=_var_data.hooks, - ) - if _var_data - else None - ), - ) - - @classmethod - def create_safe( - cls, - value: Any, - _var_is_local: bool | None = None, - _var_is_string: bool | None = None, - _var_data: VarData | None = None, - ) -> Var | ImmutableVar: - """Create a var from a value, asserting that it is not None. - - Args: - value: The value to create the var from. - _var_is_local: Whether the var is local. Deprecated. - _var_is_string: Whether the var is a string literal. Deprecated. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The var. - """ - var = cls.create( - value, - _var_is_local=_var_is_local, - _var_is_string=_var_is_string, - _var_data=_var_data, - ) - assert var is not None - return var - - def __format__(self, format_spec: str) -> str: - """Format the var into a Javascript equivalent to an f-string. - - Args: - format_spec: The format specifier (Ignored for now). - - Returns: - The formatted var. - """ - hashed_var = hash(self) - - _global_vars[hashed_var] = self - - # Encode the _var_data into the formatted output for tracking purposes. - return f"{constants.REFLEX_VAR_OPENING_TAG}{hashed_var}{constants.REFLEX_VAR_CLOSING_TAG}{self._var_name}" - - @overload - def to( - self, output: Type[NumberVar], var_type: type[int] | type[float] = float - ) -> ToNumberVarOperation: ... - - @overload - def to(self, output: Type[BooleanVar]) -> ToBooleanVarOperation: ... - - @overload - def to( - self, - output: Type[ArrayVar], - var_type: type[list] | type[tuple] | type[set] = list, - ) -> ToArrayOperation: ... - - @overload - def to(self, output: Type[StringVar]) -> ToStringOperation: ... - - @overload - def to( - self, output: Type[ObjectVar], var_type: types.GenericType = dict - ) -> ToObjectOperation: ... - - @overload - def to( - self, output: Type[FunctionVar], var_type: Type[Callable] = Callable - ) -> ToFunctionOperation: ... - - @overload - def to( - self, - output: Type[OUTPUT] | types.GenericType, - var_type: types.GenericType | None = None, - ) -> OUTPUT: ... - - def to( - self, - output: Type[OUTPUT] | types.GenericType, - var_type: types.GenericType | None = None, - ) -> Var: - """Convert the var to a different type. - - Args: - output: The output type. - var_type: The type of the var. - - Raises: - TypeError: If the var_type is not a supported type for the output. - - Returns: - The converted var. - """ - from .function import FunctionVar, ToFunctionOperation - from .number import ( - BooleanVar, - NumberVar, - ToBooleanVarOperation, - ToNumberVarOperation, - ) - from .object import ObjectVar, ToObjectOperation - from .sequence import ArrayVar, StringVar, ToArrayOperation, ToStringOperation - - base_type = var_type - if types.is_optional(base_type): - base_type = types.get_args(base_type)[0] - - fixed_type = get_origin(base_type) or base_type - - fixed_output_type = get_origin(output) or output - - # If the first argument is a python type, we map it to the corresponding Var type. - if fixed_output_type is dict: - return self.to(ObjectVar, output) - if fixed_output_type in (list, tuple, set): - return self.to(ArrayVar, output) - if fixed_output_type in (int, float): - return self.to(NumberVar, output) - if fixed_output_type is str: - return self.to(StringVar, output) - if fixed_output_type is bool: - return self.to(BooleanVar, output) - - if issubclass(output, NumberVar): - if fixed_type is not None: - if fixed_type is Union: - inner_types = get_args(base_type) - if not all(issubclass(t, (int, float)) for t in inner_types): - raise TypeError( - f"Unsupported type {var_type} for NumberVar. Must be int or float." - ) - - elif not issubclass(fixed_type, (int, float)): - raise TypeError( - f"Unsupported type {var_type} for NumberVar. Must be int or float." - ) - return ToNumberVarOperation.create(self, var_type or float) - - if issubclass(output, BooleanVar): - return ToBooleanVarOperation.create(self) - - if issubclass(output, ArrayVar): - if fixed_type is not None and not issubclass( - fixed_type, (list, tuple, set) - ): - raise TypeError( - f"Unsupported type {var_type} for ArrayVar. Must be list, tuple, or set." - ) - return ToArrayOperation.create(self, var_type or list) - - if issubclass(output, StringVar): - return ToStringOperation.create(self) - - if issubclass(output, (ObjectVar, Base)): - return ToObjectOperation.create(self, var_type or dict) - - if issubclass(output, FunctionVar): - # if fixed_type is not None and not issubclass(fixed_type, Callable): - # raise TypeError( - # f"Unsupported type {var_type} for FunctionVar. Must be Callable." - # ) - return ToFunctionOperation.create(self, var_type or Callable) - - # If we can't determine the first argument, we just replace the _var_type. - if not issubclass(output, Var) or var_type is None: - return dataclasses.replace( - self, - _var_type=output, - ) - - # We couldn't determine the output type to be any other Var type, so we replace the _var_type. - if var_type is not None: - return dataclasses.replace( - self, - _var_type=var_type, - ) - - return self - - def guess_type(self) -> ImmutableVar: - """Guesses the type of the variable based on its `_var_type` attribute. - - Returns: - ImmutableVar: The guessed type of the variable. - - Raises: - TypeError: If the type is not supported for guessing. - """ - from .number import BooleanVar, NumberVar - from .object import ObjectVar - from .sequence import ArrayVar, StringVar - - var_type = self._var_type - if types.is_optional(var_type): - var_type = types.get_args(var_type)[0] - - if var_type is Any: - return self - - fixed_type = get_origin(var_type) or var_type - - if fixed_type is Union: - inner_types = get_args(var_type) - if int in inner_types and float in inner_types: - return self.to(NumberVar, self._var_type) - return self - - if not inspect.isclass(fixed_type): - raise TypeError(f"Unsupported type {var_type} for guess_type.") - - if issubclass(fixed_type, bool): - return self.to(BooleanVar, self._var_type) - if issubclass(fixed_type, (int, float)): - return self.to(NumberVar, self._var_type) - if issubclass(fixed_type, dict): - return self.to(ObjectVar, self._var_type) - if issubclass(fixed_type, (list, tuple, set)): - return self.to(ArrayVar, self._var_type) - if issubclass(fixed_type, str): - return self.to(StringVar) - if issubclass(fixed_type, Base): - return self.to(ObjectVar, self._var_type) - return self - - def get_default_value(self) -> Any: - """Get the default value of the var. - - Returns: - The default value of the var. - - Raises: - ImportError: If the var is a dataframe and pandas is not installed. - """ - if types.is_optional(self._var_type): - return None - - type_ = ( - get_origin(self._var_type) - if types.is_generic_alias(self._var_type) - else self._var_type - ) - if type_ is Literal: - args = get_args(self._var_type) - return args[0] if args else None - if issubclass(type_, str): - return "" - if issubclass(type_, types.get_args(Union[int, float])): - return 0 - if issubclass(type_, bool): - return False - if issubclass(type_, list): - return [] - if issubclass(type_, dict): - return {} - if issubclass(type_, tuple): - return () - if types.is_dataframe(type_): - try: - import pandas as pd - - return pd.DataFrame() - except ImportError as e: - raise ImportError( - "Please install pandas to use dataframes in your app." - ) from e - return set() if issubclass(type_, set) else None - - def get_setter_name(self, include_state: bool = True) -> str: - """Get the name of the var's generated setter function. - - Args: - include_state: Whether to include the state name in the setter name. - - Returns: - The name of the setter function. - """ - var_name_parts = self._var_name.split(".") - setter = constants.SETTER_PREFIX + var_name_parts[-1] - if self._var_data is None: - return setter - if not include_state or self._var_data.state == "": - return setter - return ".".join((self._var_data.state, setter)) - - def get_setter(self) -> Callable[[BaseState, Any], None]: - """Get the var's setter function. - - Returns: - A function that that creates a setter for the var. - """ - actual_name = self._var_name.split(".")[-1] - - def setter(state: BaseState, value: Any): - """Get the setter for the var. - - Args: - state: The state within which we add the setter function. - value: The value to set. - """ - if self._var_type in [int, float]: - try: - value = self._var_type(value) - setattr(state, actual_name, value) - except ValueError: - console.debug( - f"{type(state).__name__}.{self._var_name}: Failed conversion of {value} to '{self._var_type.__name__}'. Value not set.", - ) - else: - setattr(state, actual_name, value) - - setter.__qualname__ = self.get_setter_name() - - return setter - - def __eq__(self, other: Var | Any) -> BooleanVar: - """Check if the current variable is equal to the given variable. - - Args: - other (Var | Any): The variable to compare with. - - Returns: - BooleanVar: A BooleanVar object representing the result of the equality check. - """ - from .number import equal_operation - - return equal_operation(self, other) - - def __ne__(self, other: Var | Any) -> BooleanVar: - """Check if the current object is not equal to the given object. - - Parameters: - other (Var | Any): The object to compare with. - - Returns: - BooleanVar: A BooleanVar object representing the result of the comparison. - """ - from .number import equal_operation - - return ~equal_operation(self, other) - - def __gt__(self, other: Var | Any) -> BooleanVar: - """Compare the current instance with another variable and return a BooleanVar representing the result of the greater than operation. - - Args: - other (Var | Any): The variable to compare with. - - Returns: - BooleanVar: A BooleanVar representing the result of the greater than operation. - """ - from .number import greater_than_operation - - return greater_than_operation(self, other) - - def __ge__(self, other: Var | Any) -> BooleanVar: - """Check if the value of this variable is greater than or equal to the value of another variable or object. - - Args: - other (Var | Any): The variable or object to compare with. - - Returns: - BooleanVar: A BooleanVar object representing the result of the comparison. - """ - from .number import greater_than_or_equal_operation - - return greater_than_or_equal_operation(self, other) - - def __lt__(self, other: Var | Any) -> BooleanVar: - """Compare the current instance with another variable using the less than (<) operator. - - Args: - other: The variable to compare with. - - Returns: - A `BooleanVar` object representing the result of the comparison. - """ - from .number import less_than_operation - - return less_than_operation(self, other) - - def __le__(self, other: Var | Any) -> BooleanVar: - """Compare if the current instance is less than or equal to the given value. - - Args: - other: The value to compare with. - - Returns: - A BooleanVar object representing the result of the comparison. - """ - from .number import less_than_or_equal_operation - - return less_than_or_equal_operation(self, other) - - def bool(self) -> BooleanVar: - """Convert the var to a boolean. - - Returns: - The boolean var. - """ - from .number import boolify - - return boolify(self) - - def __and__(self, other: Var | Any) -> ImmutableVar: - """Perform a logical AND operation on the current instance and another variable. - - Args: - other: The variable to perform the logical AND operation with. - - Returns: - A `BooleanVar` object representing the result of the logical AND operation. - """ - return and_operation(self, other) - - def __rand__(self, other: Var | Any) -> ImmutableVar: - """Perform a logical AND operation on the current instance and another variable. - - Args: - other: The variable to perform the logical AND operation with. - - Returns: - A `BooleanVar` object representing the result of the logical AND operation. - """ - return and_operation(other, self) - - def __or__(self, other: Var | Any) -> ImmutableVar: - """Perform a logical OR operation on the current instance and another variable. - - Args: - other: The variable to perform the logical OR operation with. - - Returns: - A `BooleanVar` object representing the result of the logical OR operation. - """ - return or_operation(self, other) - - def __ror__(self, other: Var | Any) -> ImmutableVar: - """Perform a logical OR operation on the current instance and another variable. - - Args: - other: The variable to perform the logical OR operation with. - - Returns: - A `BooleanVar` object representing the result of the logical OR operation. - """ - return or_operation(other, self) - - def __invert__(self) -> BooleanVar: - """Perform a logical NOT operation on the current instance. - - Returns: - A `BooleanVar` object representing the result of the logical NOT operation. - """ - return ~self.bool() - - def to_string(self) -> ImmutableVar: - """Convert the var to a string. - - Returns: - The string var. - """ - from .function import JSON_STRINGIFY - from .sequence import StringVar - - return JSON_STRINGIFY.call(self).to(StringVar) - - def as_ref(self) -> ImmutableVar: - """Get a reference to the var. - - Returns: - The reference to the var. - """ - from .object import ObjectVar - - refs = ImmutableVar( - _var_name="refs", - _var_data=ImmutableVarData( - imports={ - f"/{constants.Dirs.STATE_PATH}": [imports.ImportVar(tag="refs")] - } - ), - ).to(ObjectVar) - return refs[LiteralVar.create(str(self))] - - def _type(self) -> StringVar: - """Returns the type of the object. - - This method uses the `typeof` function from the `FunctionStringVar` class - to determine the type of the object. - - Returns: - StringVar: A string variable representing the type of the object. - """ - from .function import FunctionStringVar - from .sequence import StringVar - - type_of = FunctionStringVar("typeof") - return type_of.call(self).to(StringVar) - - -OUTPUT = TypeVar("OUTPUT", bound=ImmutableVar) - - -class LiteralVar(ImmutableVar): - """Base class for immutable literal vars.""" - - @classmethod - def create( - cls, - value: Any, - _var_data: VarData | None = None, - ) -> Var: - """Create a var from a value. - - Args: - value: The value to create the var from. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The var. - - Raises: - TypeError: If the value is not a supported type for LiteralVar. - """ - from .number import LiteralBooleanVar, LiteralNumberVar - from .object import LiteralObjectVar - from .sequence import LiteralArrayVar, LiteralStringVar - - if isinstance(value, Var): - if _var_data is None: - return value - return value._replace(merge_var_data=_var_data) - - if isinstance(value, str): - return LiteralStringVar.create(value, _var_data=_var_data) - - if isinstance(value, bool): - return LiteralBooleanVar.create(value, _var_data=_var_data) - - if isinstance(value, (int, float)): - return LiteralNumberVar.create(value, _var_data=_var_data) - - if isinstance(value, dict): - return LiteralObjectVar.create(value, _var_data=_var_data) - - if isinstance(value, Color): - return LiteralStringVar.create(f"{value}", _var_data=_var_data) - - if isinstance(value, (list, tuple, set)): - return LiteralArrayVar.create(value, _var_data=_var_data) - - if value is None: - return ImmutableVar.create_safe("null", _var_data=_var_data) - - from reflex.event import EventChain, EventSpec - from reflex.utils.format import get_event_handler_parts - - from .function import ArgsFunctionOperation, FunctionStringVar - from .object import LiteralObjectVar - - if isinstance(value, EventSpec): - event_name = LiteralVar.create( - ".".join(filter(None, get_event_handler_parts(value.handler))) - ) - event_args = LiteralVar.create( - {str(name): value for name, value in value.args} - ) - event_client_name = LiteralVar.create(value.client_handler_name) - return FunctionStringVar("Event").call( - event_name, - event_args, - *([event_client_name] if value.client_handler_name else []), - ) - - if isinstance(value, EventChain): - sig = inspect.signature(value.args_spec) # type: ignore - if sig.parameters: - arg_def = tuple((f"_{p}" for p in sig.parameters)) - arg_def_expr = LiteralVar.create( - [ImmutableVar.create_safe(arg) for arg in arg_def] - ) - else: - # add a default argument for addEvents if none were specified in value.args_spec - # used to trigger the preventDefault() on the event. - arg_def = ("...args",) - arg_def_expr = ImmutableVar.create_safe("args") - - return ArgsFunctionOperation.create( - arg_def, - FunctionStringVar.create("addEvents").call( - LiteralVar.create( - [LiteralVar.create(event) for event in value.events] - ), - arg_def_expr, - LiteralVar.create(value.event_actions), - ), - ) - - try: - from plotly.graph_objects import Figure, layout - from plotly.io import to_json - - if isinstance(value, Figure): - return LiteralObjectVar.create( - json.loads(str(to_json(value))), - _var_type=Figure, - _var_data=_var_data, - ) - - if isinstance(value, layout.Template): - return LiteralObjectVar.create( - { - "data": json.loads(str(to_json(value.data))), - "layout": json.loads(str(to_json(value.layout))), - }, - _var_type=layout.Template, - _var_data=_var_data, - ) - except ImportError: - pass - - try: - import base64 - import io - - from PIL.Image import MIME - from PIL.Image import Image as Img - - if isinstance(value, Img): - with io.BytesIO() as buffer: - image_format = getattr(value, "format", None) or "PNG" - value.save(buffer, format=image_format) - try: - # Newer method to get the mime type, but does not always work. - mimetype = value.get_format_mimetype() # type: ignore - except AttributeError: - try: - # Fallback method - mimetype = MIME[image_format] - except KeyError: - # Unknown mime_type: warn and return image/png and hope the browser can sort it out. - warnings.warn( # noqa: B028 - f"Unknown mime type for {value} {image_format}. Defaulting to image/png" - ) - mimetype = "image/png" - return LiteralStringVar.create( - f"data:{mimetype};base64,{base64.b64encode(buffer.getvalue()).decode()}", - _var_data=_var_data, - ) - except ImportError: - pass - - if isinstance(value, Base): - return LiteralObjectVar.create( - {k: (None if callable(v) else v) for k, v in value.dict().items()}, - _var_type=type(value), - _var_data=_var_data, - ) - - raise TypeError( - f"Unsupported type {type(value)} for LiteralVar. Tried to create a LiteralVar from {value}." - ) - - def __post_init__(self): - """Post-initialize the var.""" - - def json(self) -> str: - """Serialize the var to a JSON string. - - Raises: - NotImplementedError: If the method is not implemented. - """ - raise NotImplementedError( - "LiteralVar subclasses must implement the json method." - ) - - -P = ParamSpec("P") -T = TypeVar("T") - - -# NoReturn is used to match CustomVarOperationReturn with no type hint. -@overload -def var_operation( - func: Callable[P, CustomVarOperationReturn[NoReturn]], -) -> Callable[P, ImmutableVar]: ... - - -@overload -def var_operation( - func: Callable[P, CustomVarOperationReturn[bool]], -) -> Callable[P, BooleanVar]: ... - - -NUMBER_T = TypeVar("NUMBER_T", int, float, Union[int, float]) - - -@overload -def var_operation( - func: Callable[P, CustomVarOperationReturn[NUMBER_T]], -) -> Callable[P, NumberVar[NUMBER_T]]: ... - - -@overload -def var_operation( - func: Callable[P, CustomVarOperationReturn[str]], -) -> Callable[P, StringVar]: ... - - -LIST_T = TypeVar("LIST_T", bound=Union[List[Any], Tuple, Set]) - - -@overload -def var_operation( - func: Callable[P, CustomVarOperationReturn[LIST_T]], -) -> Callable[P, ArrayVar[LIST_T]]: ... - - -OBJECT_TYPE = TypeVar("OBJECT_TYPE", bound=Dict) - - -@overload -def var_operation( - func: Callable[P, CustomVarOperationReturn[OBJECT_TYPE]], -) -> Callable[P, ObjectVar[OBJECT_TYPE]]: ... - - -def var_operation( - func: Callable[P, CustomVarOperationReturn[T]], -) -> Callable[P, ImmutableVar[T]]: - """Decorator for creating a var operation. - - Example: - ```python - @var_operation - def add(a: NumberVar, b: NumberVar): - return custom_var_operation(f"{a} + {b}") - ``` - - Args: - func: The function to decorate. - - Returns: - The decorated function. - """ - - @functools.wraps(func) - def wrapper(*args: P.args, **kwargs: P.kwargs) -> ImmutableVar[T]: - func_args = list(inspect.signature(func).parameters) - args_vars = { - func_args[i]: (LiteralVar.create(arg) if not isinstance(arg, Var) else arg) - for i, arg in enumerate(args) - } - kwargs_vars = { - key: LiteralVar.create(value) if not isinstance(value, Var) else value - for key, value in kwargs.items() - } - - return CustomVarOperation.create( - args=tuple(list(args_vars.items()) + list(kwargs_vars.items())), - return_var=func(*args_vars.values(), **kwargs_vars), # type: ignore - ).guess_type() - - return wrapper - - -def unionize(*args: Type) -> Type: - """Unionize the types. - - Args: - args: The types to unionize. - - Returns: - The unionized types. - """ - if not args: - return Any - first, *rest = args - if not rest: - return first - return Union[first, unionize(*rest)] - - -def figure_out_type(value: Any) -> types.GenericType: - """Figure out the type of the value. - - Args: - value: The value to figure out the type of. - - Returns: - The type of the value. - """ - if isinstance(value, list): - return List[unionize(*(figure_out_type(v) for v in value))] - if isinstance(value, set): - return Set[unionize(*(figure_out_type(v) for v in value))] - if isinstance(value, tuple): - return Tuple[unionize(*(figure_out_type(v) for v in value)), ...] - if isinstance(value, dict): - return Dict[ - unionize(*(figure_out_type(k) for k in value)), - unionize(*(figure_out_type(v) for v in value.values())), - ] - if isinstance(value, Var): - return value._var_type - return type(value) - - -class cached_property_no_lock(functools.cached_property): - """A special version of functools.cached_property that does not use a lock.""" - - def __init__(self, func): - """Initialize the cached_property_no_lock. - - Args: - func: The function to cache. - """ - super().__init__(func) - self.lock = contextlib.nullcontext() - - -class CachedVarOperation: - """Base class for cached var operations to lower boilerplate code.""" - - def __post_init__(self): - """Post-initialize the CachedVarOperation.""" - object.__delattr__(self, "_var_name") - - def __getattr__(self, name: str) -> Any: - """Get an attribute of the var. - - Args: - name: The name of the attribute. - - Returns: - The attribute. - """ - if name == "_var_name": - return self._cached_var_name - - parent_classes = inspect.getmro(self.__class__) - - return parent_classes[parent_classes.index(CachedVarOperation) + 1].__getattr__( # type: ignore - self, name - ) - - def _get_all_var_data(self) -> ImmutableVarData | None: - """Get all VarData associated with the Var. - - Returns: - The VarData of the components and all of its children. - """ - return self._cached_get_all_var_data - - @cached_property_no_lock - def _cached_get_all_var_data(self) -> ImmutableVarData | None: - """Get the cached VarData. - - Returns: - The cached VarData. - """ - return ImmutableVarData.merge( - *map( - lambda value: ( - value._get_all_var_data() if isinstance(value, Var) else None - ), - map( - lambda field: getattr(self, field.name), - dataclasses.fields(self), # type: ignore - ), - ), - self._var_data, - ) - - def __hash__(self) -> int: - """Calculate the hash of the object. - - Returns: - The hash of the object. - """ - return hash( - ( - self.__class__.__name__, - *[ - getattr(self, field.name) - for field in dataclasses.fields(self) # type: ignore - if field.name not in ["_var_name", "_var_data", "_var_type"] - ], - ) - ) - - -def and_operation(a: Var | Any, b: Var | Any) -> ImmutableVar: - """Perform a logical AND operation on two variables. - - Args: - a: The first variable. - b: The second variable. - - Returns: - The result of the logical AND operation. - """ - return _and_operation(a, b) # type: ignore - - -@var_operation -def _and_operation(a: ImmutableVar, b: ImmutableVar): - """Perform a logical AND operation on two variables. - - Args: - a: The first variable. - b: The second variable. - - Returns: - The result of the logical AND operation. - """ - return var_operation_return( - js_expression=f"({a} && {b})", - var_type=unionize(a._var_type, b._var_type), - ) - - -def or_operation(a: Var | Any, b: Var | Any) -> ImmutableVar: - """Perform a logical OR operation on two variables. - - Args: - a: The first variable. - b: The second variable. - - Returns: - The result of the logical OR operation. - """ - return _or_operation(a, b) # type: ignore - - -@var_operation -def _or_operation(a: ImmutableVar, b: ImmutableVar): - """Perform a logical OR operation on two variables. - - Args: - a: The first variable. - b: The second variable. - - Returns: - The result of the logical OR operation. - """ - return var_operation_return( - js_expression=f"({a} || {b})", - var_type=unionize(a._var_type, b._var_type), - ) - - -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ImmutableCallableVar(ImmutableVar): - """Decorate a Var-returning function to act as both a Var and a function. - - This is used as a compatibility shim for replacing Var objects in the - API with functions that return a family of Var. - """ - - fn: Callable[..., Var] = dataclasses.field( - default_factory=lambda: lambda: ImmutableVar(_var_name="undefined") - ) - original_var: Var = dataclasses.field( - default_factory=lambda: ImmutableVar(_var_name="undefined") - ) - - def __init__(self, fn: Callable[..., Var]): - """Initialize a CallableVar. - - Args: - fn: The function to decorate (must return Var) - """ - original_var = fn() - super(ImmutableCallableVar, self).__init__( - _var_name=original_var._var_name, - _var_type=original_var._var_type, - _var_data=ImmutableVarData.merge(original_var._get_all_var_data()), - ) - object.__setattr__(self, "fn", fn) - object.__setattr__(self, "original_var", original_var) - - def __call__(self, *args, **kwargs) -> Var: - """Call the decorated function. - - Args: - *args: The args to pass to the function. - **kwargs: The kwargs to pass to the function. - - Returns: - The Var returned from calling the function. - """ - return self.fn(*args, **kwargs) - - def __hash__(self) -> int: - """Calculate the hash of the object. - - Returns: - The hash of the object. - """ - return hash((self.__class__.__name__, self.original_var)) - - -RETURN_TYPE = TypeVar("RETURN_TYPE") - -DICT_KEY = TypeVar("DICT_KEY") -DICT_VAL = TypeVar("DICT_VAL") - -LIST_INSIDE = TypeVar("LIST_INSIDE") - - -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ImmutableComputedVar(ImmutableVar[RETURN_TYPE]): - """A field with computed getters.""" - - # Whether to track dependencies and cache computed values - _cache: bool = dataclasses.field(default=False) - - # Whether the computed var is a backend var - _backend: bool = dataclasses.field(default=False) - - # The initial value of the computed var - _initial_value: RETURN_TYPE | types.Unset = dataclasses.field(default=types.Unset()) - - # Explicit var dependencies to track - _static_deps: set[str] = dataclasses.field(default_factory=set) - - # Whether var dependencies should be auto-determined - _auto_deps: bool = dataclasses.field(default=True) - - # Interval at which the computed var should be updated - _update_interval: Optional[datetime.timedelta] = dataclasses.field(default=None) - - _fget: Callable[[BaseState], RETURN_TYPE] = dataclasses.field( - default_factory=lambda: lambda _: None - ) # type: ignore - - def __init__( - self, - fget: Callable[[BASE_STATE], RETURN_TYPE], - initial_value: RETURN_TYPE | types.Unset = types.Unset(), - cache: bool = False, - deps: Optional[List[Union[str, Var]]] = None, - auto_deps: bool = True, - interval: Optional[Union[int, datetime.timedelta]] = None, - backend: bool | None = None, - **kwargs, - ): - """Initialize a ComputedVar. - - Args: - fget: The getter function. - initial_value: The initial value of the computed var. - cache: Whether to cache the computed value. - deps: Explicit var dependencies to track. - auto_deps: Whether var dependencies should be auto-determined. - interval: Interval at which the computed var should be updated. - backend: Whether the computed var is a backend var. - **kwargs: additional attributes to set on the instance - - Raises: - TypeError: If the computed var dependencies are not Var instances or var names. - """ - hints = get_type_hints(fget) - hint = hints.get("return", Any) - - kwargs["_var_name"] = kwargs.pop("_var_name", fget.__name__) - kwargs["_var_type"] = kwargs.pop("_var_type", hint) - - super(ImmutableComputedVar, self).__init__( - _var_name=kwargs.pop("_var_name"), - _var_type=kwargs.pop("_var_type"), - _var_data=ImmutableVarData.merge(kwargs.pop("_var_data", None)), - ) - - if backend is None: - backend = fget.__name__.startswith("_") - - object.__setattr__(self, "_backend", backend) - object.__setattr__(self, "_initial_value", initial_value) - object.__setattr__(self, "_cache", cache) - - if isinstance(interval, int): - interval = datetime.timedelta(seconds=interval) - - object.__setattr__(self, "_update_interval", interval) - - if deps is None: - deps = [] - else: - for dep in deps: - if isinstance(dep, Var): - continue - if isinstance(dep, str) and dep != "": - continue - raise TypeError( - "ComputedVar dependencies must be Var instances or var names (non-empty strings)." - ) - object.__setattr__( - self, - "_static_deps", - {dep._var_name if isinstance(dep, Var) else dep for dep in deps}, - ) - object.__setattr__(self, "_auto_deps", auto_deps) - - object.__setattr__(self, "_fget", fget) - - @override - def _replace(self, merge_var_data=None, **kwargs: Any) -> ImmutableComputedVar: - """Replace the attributes of the ComputedVar. - - Args: - merge_var_data: VarData to merge into the existing VarData. - **kwargs: Var fields to update. - - Returns: - The new ComputedVar instance. - - Raises: - TypeError: If kwargs contains keys that are not allowed. - """ - field_values = dict( - fget=kwargs.pop("fget", self._fget), - initial_value=kwargs.pop("initial_value", self._initial_value), - cache=kwargs.pop("cache", self._cache), - deps=kwargs.pop("deps", self._static_deps), - auto_deps=kwargs.pop("auto_deps", self._auto_deps), - interval=kwargs.pop("interval", self._update_interval), - backend=kwargs.pop("backend", self._backend), - _var_name=kwargs.pop("_var_name", self._var_name), - _var_type=kwargs.pop("_var_type", self._var_type), - _var_data=kwargs.pop( - "_var_data", VarData.merge(self._var_data, merge_var_data) - ), - ) - - if kwargs: - unexpected_kwargs = ", ".join(kwargs.keys()) - raise TypeError(f"Unexpected keyword arguments: {unexpected_kwargs}") - - return ImmutableComputedVar(**field_values) - - @property - def _cache_attr(self) -> str: - """Get the attribute used to cache the value on the instance. - - Returns: - An attribute name. - """ - return f"__cached_{self._var_name}" - - @property - def _last_updated_attr(self) -> str: - """Get the attribute used to store the last updated timestamp. - - Returns: - An attribute name. - """ - return f"__last_updated_{self._var_name}" - - def needs_update(self, instance: BaseState) -> bool: - """Check if the computed var needs to be updated. - - Args: - instance: The state instance that the computed var is attached to. - - Returns: - True if the computed var needs to be updated, False otherwise. - """ - if self._update_interval is None: - return False - last_updated = getattr(instance, self._last_updated_attr, None) - if last_updated is None: - return True - return datetime.datetime.now() - last_updated > self._update_interval - - @overload - def __get__( - self: ImmutableComputedVar[int] | ImmutableComputedVar[float], - instance: None, - owner: Type, - ) -> NumberVar: ... - - @overload - def __get__( - self: ImmutableComputedVar[str], - instance: None, - owner: Type, - ) -> StringVar: ... - - @overload - def __get__( - self: ImmutableComputedVar[dict[DICT_KEY, DICT_VAL]], - instance: None, - owner: Type, - ) -> ObjectVar[dict[DICT_KEY, DICT_VAL]]: ... - - @overload - def __get__( - self: ImmutableComputedVar[list[LIST_INSIDE]], - instance: None, - owner: Type, - ) -> ArrayVar[list[LIST_INSIDE]]: ... - - @overload - def __get__( - self: ImmutableComputedVar[set[LIST_INSIDE]], - instance: None, - owner: Type, - ) -> ArrayVar[set[LIST_INSIDE]]: ... - - @overload - def __get__( - self: ImmutableComputedVar[tuple[LIST_INSIDE, ...]], - instance: None, - owner: Type, - ) -> ArrayVar[tuple[LIST_INSIDE, ...]]: ... - - @overload - def __get__( - self, instance: None, owner: Type - ) -> ImmutableComputedVar[RETURN_TYPE]: ... - - @overload - def __get__(self, instance: BaseState, owner: Type) -> RETURN_TYPE: ... - - def __get__(self, instance: BaseState | None, owner): - """Get the ComputedVar value. - - If the value is already cached on the instance, return the cached value. - - Args: - instance: the instance of the class accessing this computed var. - owner: the class that this descriptor is attached to. - - Returns: - The value of the var for the given instance. - """ - if instance is None: - from reflex.state import BaseState - - path_to_function = self.fget.__qualname__.split(".") - class_name_where_defined = ( - path_to_function[-2] if len(path_to_function) > 1 else owner.__name__ - ) - - def contains_class_name(states: Sequence[Type]) -> bool: - return any(c.__name__ == class_name_where_defined for c in states) - - def is_not_mixin(state: Type[BaseState]) -> bool: - return not state._mixin - - def length_of_state(state: Type[BaseState]) -> int: - return len(inspect.getmro(state)) - - class_where_defined = cast( - Type[BaseState], - min( - filter( - lambda state: state.__module__ == self.fget.__module__, - filter( - is_not_mixin, - filter( - lambda state: contains_class_name( - inspect.getmro(state) - ), - inspect.getmro(owner), - ), - ), - ), - default=owner, - key=length_of_state, - ), - ) - - return self._replace( - _var_name=format_state_name(class_where_defined.get_full_name()) - + "." - + self._var_name, - merge_var_data=ImmutableVarData.from_state(class_where_defined), - ).guess_type() - - if not self._cache: - return self.fget(instance) - - # handle caching - if not hasattr(instance, self._cache_attr) or self.needs_update(instance): - # Set cache attr on state instance. - setattr(instance, self._cache_attr, self.fget(instance)) - # Ensure the computed var gets serialized to redis. - instance._was_touched = True - # Set the last updated timestamp on the state instance. - setattr(instance, self._last_updated_attr, datetime.datetime.now()) - return getattr(instance, self._cache_attr) - - def _deps( - self, - objclass: Type, - obj: FunctionType | CodeType | None = None, - self_name: Optional[str] = None, - ) -> set[str]: - """Determine var dependencies of this ComputedVar. - - Save references to attributes accessed on "self". Recursively called - when the function makes a method call on "self" or define comprehensions - or nested functions that may reference "self". - - Args: - objclass: the class obj this ComputedVar is attached to. - obj: the object to disassemble (defaults to the fget function). - self_name: if specified, look for this name in LOAD_FAST and LOAD_DEREF instructions. - - Returns: - A set of variable names accessed by the given obj. - - Raises: - VarValueError: if the function references the get_state, parent_state, or substates attributes - (cannot track deps in a related state, only implicitly via parent state). - """ - if not self._auto_deps: - return self._static_deps - d = self._static_deps.copy() - if obj is None: - fget = self._fget - if fget is not None: - obj = cast(FunctionType, fget) - else: - return set() - with contextlib.suppress(AttributeError): - # unbox functools.partial - obj = cast(FunctionType, obj.func) # type: ignore - with contextlib.suppress(AttributeError): - # unbox EventHandler - obj = cast(FunctionType, obj.fn) # type: ignore - - if self_name is None and isinstance(obj, FunctionType): - try: - # the first argument to the function is the name of "self" arg - self_name = obj.__code__.co_varnames[0] - except (AttributeError, IndexError): - self_name = None - if self_name is None: - # cannot reference attributes on self if method takes no args - return set() - - invalid_names = ["get_state", "parent_state", "substates", "get_substate"] - self_is_top_of_stack = False - for instruction in dis.get_instructions(obj): - if ( - instruction.opname in ("LOAD_FAST", "LOAD_DEREF") - and instruction.argval == self_name - ): - # bytecode loaded the class instance to the top of stack, next load instruction - # is referencing an attribute on self - self_is_top_of_stack = True - continue - if self_is_top_of_stack and instruction.opname in ( - "LOAD_ATTR", - "LOAD_METHOD", - ): - try: - ref_obj = getattr(objclass, instruction.argval) - except Exception: - ref_obj = None - if instruction.argval in invalid_names: - raise VarValueError( - f"Cached var {self._var_full_name} cannot access arbitrary state via `{instruction.argval}`." - ) - if callable(ref_obj): - # recurse into callable attributes - d.update( - self._deps( - objclass=objclass, - obj=ref_obj, - ) - ) - # recurse into property fget functions - elif isinstance(ref_obj, property) and not isinstance( - ref_obj, ImmutableComputedVar - ): - d.update( - self._deps( - objclass=objclass, - obj=ref_obj.fget, # type: ignore - ) - ) - elif ( - instruction.argval in objclass.backend_vars - or instruction.argval in objclass.vars - ): - # var access - d.add(instruction.argval) - elif instruction.opname == "LOAD_CONST" and isinstance( - instruction.argval, CodeType - ): - # recurse into nested functions / comprehensions, which can reference - # instance attributes from the outer scope - d.update( - self._deps( - objclass=objclass, - obj=instruction.argval, - self_name=self_name, - ) - ) - self_is_top_of_stack = False - return d - - def mark_dirty(self, instance) -> None: - """Mark this ComputedVar as dirty. - - Args: - instance: the state instance that needs to recompute the value. - """ - with contextlib.suppress(AttributeError): - delattr(instance, self._cache_attr) - - def _determine_var_type(self) -> Type: - """Get the type of the var. - - Returns: - The type of the var. - """ - hints = get_type_hints(self._fget) - if "return" in hints: - return hints["return"] - return Any - - @property - def __class__(self) -> Type: - """Get the class of the var. - - Returns: - The class of the var. - """ - return ComputedVar - - @property - def fget(self) -> Callable[[BaseState], RETURN_TYPE]: - """Get the getter function. - - Returns: - The getter function. - """ - return self._fget - - -if TYPE_CHECKING: - BASE_STATE = TypeVar("BASE_STATE", bound=BaseState) - - -@overload -def immutable_computed_var( - fget: None = None, - initial_value: Any | types.Unset = types.Unset(), - cache: bool = False, - deps: Optional[List[Union[str, Var]]] = None, - auto_deps: bool = True, - interval: Optional[Union[datetime.timedelta, int]] = None, - backend: bool | None = None, - **kwargs, -) -> Callable[ - [Callable[[BASE_STATE], RETURN_TYPE]], ImmutableComputedVar[RETURN_TYPE] -]: ... - - -@overload -def immutable_computed_var( - fget: Callable[[BASE_STATE], RETURN_TYPE], - initial_value: RETURN_TYPE | types.Unset = types.Unset(), - cache: bool = False, - deps: Optional[List[Union[str, Var]]] = None, - auto_deps: bool = True, - interval: Optional[Union[datetime.timedelta, int]] = None, - backend: bool | None = None, - **kwargs, -) -> ImmutableComputedVar[RETURN_TYPE]: ... - - -def immutable_computed_var( - fget: Callable[[BASE_STATE], Any] | None = None, - initial_value: Any | types.Unset = types.Unset(), - cache: bool = False, - deps: Optional[List[Union[str, Var]]] = None, - auto_deps: bool = True, - interval: Optional[Union[datetime.timedelta, int]] = None, - backend: bool | None = None, - **kwargs, -) -> ( - ImmutableComputedVar | Callable[[Callable[[BASE_STATE], Any]], ImmutableComputedVar] -): - """A ComputedVar decorator with or without kwargs. - - Args: - fget: The getter function. - initial_value: The initial value of the computed var. - cache: Whether to cache the computed value. - deps: Explicit var dependencies to track. - auto_deps: Whether var dependencies should be auto-determined. - interval: Interval at which the computed var should be updated. - backend: Whether the computed var is a backend var. - **kwargs: additional attributes to set on the instance - - Returns: - A ComputedVar instance. - - Raises: - ValueError: If caching is disabled and an update interval is set. - VarDependencyError: If user supplies dependencies without caching. - """ - if cache is False and interval is not None: - raise ValueError("Cannot set update interval without caching.") - - if cache is False and (deps is not None or auto_deps is False): - raise VarDependencyError("Cannot track dependencies without caching.") - - if fget is not None: - return ImmutableComputedVar(fget, cache=cache) - - def wrapper(fget: Callable[[BASE_STATE], Any]) -> ImmutableComputedVar: - return ImmutableComputedVar( - fget, - initial_value=initial_value, - cache=cache, - deps=deps, - auto_deps=auto_deps, - interval=interval, - backend=backend, - **kwargs, - ) - - return wrapper - - -RETURN = TypeVar("RETURN") - - -class CustomVarOperationReturn(ImmutableVar[RETURN]): - """Base class for custom var operations.""" - - @classmethod - def create( - cls, - js_expression: str, - _var_type: Type[RETURN] | None = None, - _var_data: VarData | None = None, - ) -> CustomVarOperationReturn[RETURN]: - """Create a CustomVarOperation. - - Args: - js_expression: The JavaScript expression to evaluate. - _var_type: The type of the var. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The CustomVarOperation. - """ - return CustomVarOperationReturn( - _var_name=js_expression, - _var_type=_var_type or Any, - _var_data=ImmutableVarData.merge(_var_data), - ) - - -def var_operation_return( - js_expression: str, - var_type: Type[RETURN] | None = None, -) -> CustomVarOperationReturn[RETURN]: - """Shortcut for creating a CustomVarOperationReturn. - - Args: - js_expression: The JavaScript expression to evaluate. - var_type: The type of the var. - - Returns: - The CustomVarOperationReturn. - """ - return CustomVarOperationReturn.create(js_expression, var_type) - - -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class CustomVarOperation(CachedVarOperation, ImmutableVar[T]): - """Base class for custom var operations.""" - - _args: Tuple[Tuple[str, Var], ...] = dataclasses.field(default_factory=tuple) - - _return: CustomVarOperationReturn[T] = dataclasses.field( - default_factory=lambda: CustomVarOperationReturn.create("") - ) - - @cached_property_no_lock - def _cached_var_name(self) -> str: - """Get the cached var name. - - Returns: - The cached var name. - """ - return str(self._return) - - @cached_property_no_lock - def _cached_get_all_var_data(self) -> ImmutableVarData | None: - """Get the cached VarData. - - Returns: - The cached VarData. - """ - return ImmutableVarData.merge( - *map( - lambda arg: arg[1]._get_all_var_data(), - self._args, - ), - self._return._get_all_var_data(), - self._var_data, - ) - - @classmethod - def create( - cls, - args: Tuple[Tuple[str, Var], ...], - return_var: CustomVarOperationReturn[T], - _var_data: VarData | None = None, - ) -> CustomVarOperation[T]: - """Create a CustomVarOperation. - - Args: - args: The arguments to the operation. - return_var: The return var. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The CustomVarOperation. - """ - return CustomVarOperation( - _var_name="", - _var_type=return_var._var_type, - _var_data=ImmutableVarData.merge(_var_data), - _args=args, - _return=return_var, - ) diff --git a/reflex/middleware/hydrate_middleware.py b/reflex/middleware/hydrate_middleware.py index b5694e22f..2198b82c2 100644 --- a/reflex/middleware/hydrate_middleware.py +++ b/reflex/middleware/hydrate_middleware.py @@ -2,18 +2,19 @@ from __future__ import annotations +import dataclasses from typing import TYPE_CHECKING, Optional from reflex import constants from reflex.event import Event, get_hydrate_event from reflex.middleware.middleware import Middleware from reflex.state import BaseState, StateUpdate -from reflex.utils import format if TYPE_CHECKING: from reflex.app import App +@dataclasses.dataclass(init=True) class HydrateMiddleware(Middleware): """Middleware to handle initial app hydration.""" @@ -41,7 +42,7 @@ class HydrateMiddleware(Middleware): setattr(state, constants.CompileVars.IS_HYDRATED, False) # Get the initial state. - delta = format.format_state(state.dict()) + delta = state.dict() # since a full dict was captured, clean any dirtiness state._clean() diff --git a/reflex/middleware/middleware.py b/reflex/middleware/middleware.py index 76cbcfe9a..ef9de0bde 100644 --- a/reflex/middleware/middleware.py +++ b/reflex/middleware/middleware.py @@ -2,10 +2,9 @@ from __future__ import annotations -from abc import ABC +from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Optional -from reflex.base import Base from reflex.event import Event from reflex.state import BaseState, StateUpdate @@ -13,9 +12,10 @@ if TYPE_CHECKING: from reflex.app import App -class Middleware(Base, ABC): +class Middleware(ABC): """Middleware to preprocess and postprocess requests.""" + @abstractmethod async def preprocess( self, app: App, state: BaseState, event: Event ) -> Optional[StateUpdate]: diff --git a/reflex/model.py b/reflex/model.py index fefb1f9e9..b269044c5 100644 --- a/reflex/model.py +++ b/reflex/model.py @@ -2,9 +2,7 @@ from __future__ import annotations -import os from collections import defaultdict -from pathlib import Path from typing import Any, ClassVar, Optional, Type, Union import alembic.autogenerate @@ -18,11 +16,10 @@ import sqlalchemy import sqlalchemy.exc import sqlalchemy.orm -from reflex import constants from reflex.base import Base -from reflex.config import get_config +from reflex.config import environment, get_config from reflex.utils import console -from reflex.utils.compat import sqlmodel +from reflex.utils.compat import sqlmodel, sqlmodel_field_has_primary_key def get_engine(url: str | None = None) -> sqlalchemy.engine.Engine: @@ -41,12 +38,12 @@ def get_engine(url: str | None = None) -> sqlalchemy.engine.Engine: url = url or conf.db_url if url is None: raise ValueError("No database url configured") - if not Path(constants.ALEMBIC_CONFIG).exists(): + if environment.ALEMBIC_CONFIG.exists(): console.warn( "Database is not initialized, run [bold]reflex db init[/bold] first." ) # Print the SQL queries if the log level is INFO or lower. - echo_db_query = os.environ.get("SQLALCHEMY_ECHO") == "True" + echo_db_query = environment.SQLALCHEMY_ECHO # Needed for the admin dash on sqlite. connect_args = {"check_same_thread": False} if url.startswith("sqlite") else {} return sqlmodel.create_engine(url, echo=echo_db_query, connect_args=connect_args) @@ -166,8 +163,7 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue non_default_primary_key_fields = [ field_name for field_name, field in cls.__fields__.items() - if field_name != "id" - and getattr(field.field_info, "primary_key", None) is True + if field_name != "id" and sqlmodel_field_has_primary_key(field) ] if non_default_primary_key_fields: cls.__fields__.pop("id", None) @@ -235,7 +231,7 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue Returns: tuple of (config, script_directory) """ - config = alembic.config.Config(constants.ALEMBIC_CONFIG) + config = alembic.config.Config(environment.ALEMBIC_CONFIG) return config, alembic.script.ScriptDirectory( config.get_main_option("script_location", default="version"), ) @@ -270,8 +266,8 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue def alembic_init(cls): """Initialize alembic for the project.""" alembic.command.init( - config=alembic.config.Config(constants.ALEMBIC_CONFIG), - directory=str(Path(constants.ALEMBIC_CONFIG).parent / "alembic"), + config=alembic.config.Config(environment.ALEMBIC_CONFIG), + directory=str(environment.ALEMBIC_CONFIG.parent / "alembic"), ) @classmethod @@ -291,7 +287,7 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue Returns: True when changes have been detected. """ - if not Path(constants.ALEMBIC_CONFIG).exists(): + if not environment.ALEMBIC_CONFIG.exists(): return False config, script_directory = cls._alembic_config() @@ -392,7 +388,7 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue True - indicating the process was successful. None - indicating the process was skipped. """ - if not Path(constants.ALEMBIC_CONFIG).exists(): + if not environment.ALEMBIC_CONFIG.exists(): return with cls.get_db_engine().connect() as connection: diff --git a/reflex/page.py b/reflex/page.py index 1e5e8603d..52f0c8efc 100644 --- a/reflex/page.py +++ b/reflex/page.py @@ -65,13 +65,20 @@ def page( return decorator -def get_decorated_pages() -> list[dict]: +def get_decorated_pages(omit_implicit_routes=True) -> list[dict[str, Any]]: """Get the decorated pages. + Args: + omit_implicit_routes: Whether to omit pages where the route will be implicitely guessed later. + Returns: The decorated pages. """ return sorted( - [page_data for _, page_data in DECORATED_PAGES[get_config().app_name]], - key=lambda x: x["route"], + [ + page_data + for _, page_data in DECORATED_PAGES[get_config().app_name] + if not omit_implicit_routes or "route" in page_data + ], + key=lambda x: x.get("route", ""), ) diff --git a/reflex/reflex.py b/reflex/reflex.py index 741873f4e..7bef8b7e5 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -4,7 +4,6 @@ from __future__ import annotations import atexit import os -import webbrowser from pathlib import Path from typing import List, Optional @@ -14,8 +13,9 @@ from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants -from reflex.config import get_config +from reflex.config import environment, get_config from reflex.custom_components.custom_components import custom_components_cli +from reflex.state import reset_disk_state_manager from reflex.utils import console, redir, telemetry # Disable typer+rich integration for help panels @@ -113,9 +113,6 @@ def _init( app_name, generation_hash=generation_hash ) - # Migrate Pynecone projects to Reflex. - prerequisites.migrate_to_reflex() - # Initialize the .gitignore. prerequisites.initialize_gitignore() @@ -180,6 +177,9 @@ def _run( if prerequisites.needs_reinit(frontend=frontend): _init(name=config.app_name, loglevel=loglevel) + # Delete the states folder if it exists. + reset_disk_state_manager() + # Find the next available open port if applicable. if frontend: frontend_port = processes.handle_port( @@ -225,7 +225,8 @@ def _run( exec.run_frontend_prod, exec.run_backend_prod, ) - assert setup_frontend and frontend_cmd and backend_cmd, "Invalid env" + if not setup_frontend or not frontend_cmd or not backend_cmd: + raise ValueError("Invalid env") # Post a telemetry event. telemetry.send(f"run-{env.value}") @@ -243,13 +244,23 @@ def _run( # In prod mode, run the backend on a separate thread. if backend and env == constants.Env.PROD: - commands.append((backend_cmd, backend_host, backend_port)) + commands.append( + ( + backend_cmd, + backend_host, + backend_port, + loglevel.subprocess_level(), + frontend, + ) + ) # Start the frontend and backend. with processes.run_concurrently_context(*commands): # In dev mode, run the backend on the main thread. if backend and env == constants.Env.DEV: - backend_cmd(backend_host, int(backend_port)) + backend_cmd( + backend_host, int(backend_port), loglevel.subprocess_level(), frontend + ) # The windows uvicorn bug workaround # https://github.com/reflex-dev/reflex/issues/2335 if constants.IS_WINDOWS and exec.frontend_process: @@ -263,9 +274,17 @@ def run( constants.Env.DEV, help="The environment to run the app in." ), frontend: bool = typer.Option( - False, "--frontend-only", help="Execute only frontend." + False, + "--frontend-only", + help="Execute only frontend.", + envvar=constants.ENV_FRONTEND_ONLY_ENV_VAR, + ), + backend: bool = typer.Option( + False, + "--backend-only", + help="Execute only backend.", + envvar=constants.ENV_BACKEND_ONLY_ENV_VAR, ), - backend: bool = typer.Option(False, "--backend-only", help="Execute only backend."), frontend_port: str = typer.Option( config.frontend_port, help="Specify a different frontend port." ), @@ -280,6 +299,12 @@ def run( ), ): """Run the app in the current directory.""" + if frontend and backend: + console.error("Cannot use both --frontend-only and --backend-only options.") + raise typer.Exit(1) + os.environ[constants.ENV_BACKEND_ONLY_ENV_VAR] = str(backend).lower() + os.environ[constants.ENV_FRONTEND_ONLY_ENV_VAR] = str(frontend).lower() + _run(env, frontend, backend, frontend_port, backend_port, backend_host, loglevel) @@ -321,7 +346,7 @@ def export( backend=backend, zip_dest_dir=zip_dest_dir, upload_db_file=upload_db_file, - loglevel=loglevel, + loglevel=loglevel.subprocess_level(), ) @@ -395,7 +420,7 @@ def db_init(): return # Check the alembic config. - if Path(constants.ALEMBIC_CONFIG).exists(): + if environment.ALEMBIC_CONFIG.exists(): console.error( "Database is already initialized. Use " "[bold]reflex db makemigrations[/bold] to create schema change " @@ -556,7 +581,7 @@ def deploy( frontend=frontend, backend=backend, zipping=zipping, - loglevel=loglevel, + loglevel=loglevel.subprocess_level(), upload_db_file=upload_db_file, ), key=key, @@ -570,22 +595,10 @@ def deploy( interactive=interactive, with_metrics=with_metrics, with_tracing=with_tracing, - loglevel=loglevel.value, + loglevel=loglevel.subprocess_level(), ) -@cli.command() -def demo( - frontend_port: str = typer.Option( - "3001", help="Specify a different frontend port." - ), - backend_port: str = typer.Option("8001", help="Specify a different backend port."), -): - """Run the demo app.""" - # Open the demo app in a terminal. - webbrowser.open("https://demo.reflex.run") - - cli.add_typer(db_cli, name="db", help="Subcommands for managing the database schema.") cli.add_typer(script_cli, name="script", help="Subcommands running helper scripts.") cli.add_typer( diff --git a/reflex/state.py b/reflex/state.py index c94adb39d..208c23a0f 100644 --- a/reflex/state.py +++ b/reflex/state.py @@ -5,18 +5,22 @@ from __future__ import annotations import asyncio import contextlib import copy +import dataclasses import functools import inspect -import os +import pickle +import sys import uuid from abc import ABC, abstractmethod from collections import defaultdict +from hashlib import md5 from pathlib import Path from types import FunctionType, MethodType from typing import ( TYPE_CHECKING, Any, AsyncIterator, + BinaryIO, Callable, ClassVar, Dict, @@ -26,15 +30,31 @@ from typing import ( Set, Tuple, Type, + TypeVar, Union, cast, + get_args, + get_type_hints, ) -import dill from sqlalchemy.orm import DeclarativeBase +from typing_extensions import Self +from reflex import event from reflex.config import get_config -from reflex.ivars.base import ImmutableComputedVar, ImmutableVar, immutable_computed_var +from reflex.istate.data import RouterData +from reflex.istate.storage import ( + ClientStorageBase, +) +from reflex.vars.base import ( + ComputedVar, + DynamicRouteVar, + Var, + computed_var, + dispatch, + get_unique_variable_name, + is_computed_var, +) try: import pydantic.v1 as pydantic @@ -45,8 +65,10 @@ import wrapt from redis.asyncio import Redis from redis.exceptions import ResponseError +import reflex.istate.dynamic from reflex import constants from reflex.base import Base +from reflex.config import environment from reflex.event import ( BACKGROUND_TASK_MARKER, Event, @@ -55,121 +77,35 @@ from reflex.event import ( fix_events, ) from reflex.utils import console, format, path_ops, prerequisites, types -from reflex.utils.exceptions import ImmutableStateError, LockExpiredError -from reflex.utils.exec import is_testing_env -from reflex.utils.serializers import SerializedType, serialize, serializer -from reflex.utils.types import override -from reflex.vars import ( - ComputedVar, - ImmutableVarData, - Var, +from reflex.utils.exceptions import ( + ComputedVarShadowsBaseVars, + ComputedVarShadowsStateVar, + DynamicComponentInvalidSignature, + DynamicRouteArgShadowsStateVar, + EventHandlerShadowsBuiltInStateMethod, + ImmutableStateError, + InvalidStateManagerMode, + LockExpiredError, + SetUndefinedStateVarError, + StateSchemaMismatchError, ) +from reflex.utils.exec import is_testing_env +from reflex.utils.serializers import serializer +from reflex.utils.types import get_origin, override +from reflex.vars import VarData if TYPE_CHECKING: from reflex.components.component import Component Delta = Dict[str, Any] -var = immutable_computed_var +var = computed_var # If the state is this large, it's considered a performance issue. TOO_LARGE_SERIALIZED_STATE = 100 * 1024 # 100kb -class HeaderData(Base): - """An object containing headers data.""" - - host: str = "" - origin: str = "" - upgrade: str = "" - connection: str = "" - pragma: str = "" - cache_control: str = "" - user_agent: str = "" - sec_websocket_version: str = "" - sec_websocket_key: str = "" - sec_websocket_extensions: str = "" - accept_encoding: str = "" - accept_language: str = "" - - def __init__(self, router_data: Optional[dict] = None): - """Initalize the HeaderData object based on router_data. - - Args: - router_data: the router_data dict. - """ - super().__init__() - if router_data: - for k, v in router_data.get(constants.RouteVar.HEADERS, {}).items(): - setattr(self, format.to_snake_case(k), v) - - -class PageData(Base): - """An object containing page data.""" - - host: str = "" # repeated with self.headers.origin (remove or keep the duplicate?) - path: str = "" - raw_path: str = "" - full_path: str = "" - full_raw_path: str = "" - params: dict = {} - - def __init__(self, router_data: Optional[dict] = None): - """Initalize the PageData object based on router_data. - - Args: - router_data: the router_data dict. - """ - super().__init__() - if router_data: - self.host = router_data.get(constants.RouteVar.HEADERS, {}).get("origin") - self.path = router_data.get(constants.RouteVar.PATH, "") - self.raw_path = router_data.get(constants.RouteVar.ORIGIN, "") - self.full_path = f"{self.host}{self.path}" - self.full_raw_path = f"{self.host}{self.raw_path}" - self.params = router_data.get(constants.RouteVar.QUERY, {}) - - -class SessionData(Base): - """An object containing session data.""" - - client_token: str = "" - client_ip: str = "" - session_id: str = "" - - def __init__(self, router_data: Optional[dict] = None): - """Initalize the SessionData object based on router_data. - - Args: - router_data: the router_data dict. - """ - super().__init__() - if router_data: - self.client_token = router_data.get(constants.RouteVar.CLIENT_TOKEN, "") - self.client_ip = router_data.get(constants.RouteVar.CLIENT_IP, "") - self.session_id = router_data.get(constants.RouteVar.SESSION_ID, "") - - -class RouterData(Base): - """An object containing RouterData.""" - - session: SessionData = SessionData() - headers: HeaderData = HeaderData() - page: PageData = PageData() - - def __init__(self, router_data: Optional[dict] = None): - """Initialize the RouterData object. - - Args: - router_data: the router_data dict. - """ - super().__init__() - self.session = SessionData(router_data) - self.headers = HeaderData(router_data) - self.page = PageData(router_data) - - def _no_chain_background_task( state_cls: Type["BaseState"], name: str, fn: Callable ) -> Callable: @@ -243,10 +179,11 @@ def _split_substate_key(substate_key: str) -> tuple[str, str]: return token, state_name +@dataclasses.dataclass(frozen=True, init=False) class EventHandlerSetVar(EventHandler): """A special event handler to wrap setvar functionality.""" - state_cls: Type[BaseState] + state_cls: Type[BaseState] = dataclasses.field(init=False) def __init__(self, state_cls: Type[BaseState]): """Initialize the EventHandlerSetVar. @@ -257,8 +194,8 @@ class EventHandlerSetVar(EventHandler): super().__init__( fn=type(self).setvar, state_full_name=state_cls.get_full_name(), - state_cls=state_cls, # type: ignore ) + object.__setattr__(self, "state_cls", state_cls) def setvar(self, var_name: str, value: Any): """Set the state variable to the value of the event. @@ -299,6 +236,33 @@ class EventHandlerSetVar(EventHandler): return super().__call__(*args) +if TYPE_CHECKING: + from pydantic.v1.fields import ModelField + + +def get_var_for_field(cls: Type[BaseState], f: ModelField): + """Get a Var instance for a Pydantic field. + + Args: + cls: The state class. + f: The Pydantic field. + + Returns: + The Var instance. + """ + from reflex.vars import Field + + field_name = format.format_state_name(cls.get_full_name()) + "." + f.name + + return dispatch( + field_name=field_name, + var_data=VarData.from_state(cls, f.name), + result_var_type=f.outer_type_ + if get_origin(f.outer_type_) is not Field + else get_args(f.outer_type_)[0], + ) + + class BaseState(Base, ABC, extra=pydantic.Extra.allow): """The state of the app.""" @@ -306,10 +270,10 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): vars: ClassVar[Dict[str, Var]] = {} # The base vars of the class. - base_vars: ClassVar[Dict[str, ImmutableVar]] = {} + base_vars: ClassVar[Dict[str, Var]] = {} # The computed vars of the class. - computed_vars: ClassVar[Dict[str, Union[ComputedVar, ImmutableComputedVar]]] = {} + computed_vars: ClassVar[Dict[str, ComputedVar]] = {} # Vars inherited by the parent state. inherited_vars: ClassVar[Dict[str, Var]] = {} @@ -422,7 +386,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): return f"{self.__class__.__name__}({self.dict()})" @classmethod - def _get_computed_vars(cls) -> list[Union[ComputedVar, ImmutableComputedVar]]: + def _get_computed_vars(cls) -> list[ComputedVar]: """Helper function to get all computed vars of a instance. Returns: @@ -431,8 +395,8 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): return [ v for mixin in cls._mixins() + [cls] - for v in mixin.__dict__.values() - if isinstance(v, (ComputedVar, ImmutableComputedVar)) + for name, v in mixin.__dict__.items() + if is_computed_var(v) and name not in cls.inherited_vars ] @classmethod @@ -469,6 +433,10 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): if mixin: return + # Handle locally-defined states for pickling. + if "" in cls.__qualname__: + cls._handle_local_def() + # Validate the module name. cls._validate_module_name() @@ -476,7 +444,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): cls._check_overridden_methods() # Computed vars should not shadow builtin state props. - cls._check_overriden_basevars() + cls._check_overridden_basevars() # Reset subclass tracking for this class. cls.class_subclasses = set() @@ -494,32 +462,32 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): if cls.get_name() in set( c.get_name() for c in parent_state.class_subclasses ): - if is_testing_env(): - # Clear existing subclass with same name when app is reloaded via - # utils.prerequisites.get_app(reload=True) - parent_state.class_subclasses = set( - c - for c in parent_state.class_subclasses - if c.get_name() != cls.get_name() - ) - else: - # During normal operation, subclasses cannot have the same name, even if they are - # defined in different modules. - raise StateValueError( - f"The substate class '{cls.get_name()}' has been defined multiple times. " - "Shadowing substate classes is not allowed." - ) + # This should not happen, since we have added module prefix to state names in #3214 + raise StateValueError( + f"The substate class '{cls.get_name()}' has been defined multiple times. " + "Shadowing substate classes is not allowed." + ) # Track this new subclass in the parent state's subclasses set. parent_state.class_subclasses.add(cls) # Get computed vars. computed_vars = cls._get_computed_vars() + cls._check_overridden_computed_vars() new_backend_vars = { name: value for name, value in cls.__dict__.items() if types.is_backend_base_variable(name, cls) } + # Add annotated backend vars that may not have a default value. + new_backend_vars.update( + { + name: cls._get_var_default(name, annotation_value) + for name, annotation_value in cls._get_type_hints().items() + if name not in new_backend_vars + and types.is_backend_base_variable(name, cls) + } + ) cls.backend_vars = { **cls.inherited_backend_vars, @@ -528,16 +496,12 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): # Set the base and computed vars. cls.base_vars = { - f.name: ImmutableVar( - _var_name=format.format_state_name(cls.get_full_name()) + "." + f.name, - _var_type=f.outer_type_, - _var_data=ImmutableVarData.from_state(cls), - ).guess_type() + f.name: get_var_for_field(cls, f) for f in cls.get_fields().values() if f.name not in cls.get_skip_vars() } cls.computed_vars = { - v._var_name: v._replace(merge_var_data=ImmutableVarData.from_state(cls)) + v._js_expr: v._replace(merge_var_data=VarData.from_state(cls)) for v in computed_vars } cls.vars = { @@ -560,15 +524,15 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): for mixin in cls._mixins(): for name, value in mixin.__dict__.items(): - if isinstance(value, (ComputedVar, ImmutableComputedVar)): + if name in cls.inherited_vars: + continue + if is_computed_var(value): fget = cls._copy_fn(value.fget) - newcv = value._replace( - fget=fget, _var_data=ImmutableVarData.from_state(cls) - ) + newcv = value._replace(fget=fget, _var_data=VarData.from_state(cls)) # cleanup refs to mixin cls in var_data setattr(cls, name, newcv) - cls.computed_vars[newcv._var_name] = newcv - cls.vars[newcv._var_name] = newcv + cls.computed_vars[newcv._js_expr] = newcv + cls.vars[newcv._js_expr] = newcv continue if types.is_backend_base_variable(name, mixin): cls.backend_vars[name] = copy.deepcopy(value) @@ -591,6 +555,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): cls.event_handlers[name] = handler setattr(cls, name, handler) + # Initialize per-class var dependency tracking. + cls._computed_var_dependencies = defaultdict(set) + cls._substate_var_dependencies = defaultdict(set) cls._init_var_dependency_dicts() @staticmethod @@ -633,6 +600,48 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): and hasattr(value, "__code__") ) + @classmethod + def _evaluate( + cls, f: Callable[[Self], Any], of_type: Union[type, None] = None + ) -> Var: + """Evaluate a function to a ComputedVar. Experimental. + + Args: + f: The function to evaluate. + of_type: The type of the ComputedVar. Defaults to Component. + + Returns: + The ComputedVar. + """ + console.warn( + "The _evaluate method is experimental and may be removed in future versions." + ) + from reflex.components.component import Component + + of_type = of_type or Component + + unique_var_name = get_unique_variable_name() + + @computed_var(_js_expr=unique_var_name, return_type=of_type) + def computed_var_func(state: Self): + result = f(state) + + if not isinstance(result, of_type): + console.warn( + f"Inline ComputedVar {f} expected type {of_type}, got {type(result)}. " + "You can specify expected type with `of_type` argument." + ) + + return result + + setattr(cls, unique_var_name, computed_var_func) + cls.computed_vars[unique_var_name] = computed_var_func + cls.vars[unique_var_name] = computed_var_func + cls._update_substate_inherited_vars({unique_var_name: computed_var_func}) + cls._always_dirty_computed_vars.add(unique_var_name) + + return getattr(cls, unique_var_name) + @classmethod def _mixins(cls) -> List[Type]: """Get the mixin classes of the state. @@ -650,6 +659,39 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): ) ] + @classmethod + def _handle_local_def(cls): + """Handle locally-defined states for pickling.""" + known_names = dir(reflex.istate.dynamic) + proposed_name = cls.__name__ + for ix in range(len(known_names)): + if proposed_name not in known_names: + break + proposed_name = f"{cls.__name__}_{ix}" + setattr(reflex.istate.dynamic, proposed_name, cls) + cls.__original_name__ = cls.__name__ + cls.__original_module__ = cls.__module__ + cls.__name__ = cls.__qualname__ = proposed_name + cls.__module__ = reflex.istate.dynamic.__name__ + + @classmethod + def _get_type_hints(cls) -> dict[str, Any]: + """Get the type hints for this class. + + If the class is dynamic, evaluate the type hints with the original + module in the local namespace. + + Returns: + The type hints dict. + """ + original_module = getattr(cls, "__original_module__", None) + if original_module is not None: + localns = sys.modules[original_module].__dict__ + else: + localns = None + + return get_type_hints(cls, localns=localns) + @classmethod def _init_var_dependency_dicts(cls): """Initialize the var dependency tracking dicts. @@ -660,10 +702,6 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): Additional updates tracking dicts for vars and substates that always need to be recomputed. """ - # Initialize per-class var dependency tracking. - cls._computed_var_dependencies = defaultdict(set) - cls._substate_var_dependencies = defaultdict(set) - inherited_vars = set(cls.inherited_vars).union( set(cls.inherited_backend_vars), ) @@ -704,12 +742,15 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): parent_state.get_parent_state(), ) + # Reset cached schema value + cls._to_schema.cache_clear() + @classmethod def _check_overridden_methods(cls): """Check for shadow methods and raise error if any. Raises: - NameError: When an event handler shadows an inbuilt state method. + EventHandlerShadowsBuiltInStateMethod: When an event handler shadows an inbuilt state method. """ overridden_methods = set() state_base_functions = cls._get_base_functions() @@ -723,21 +764,37 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): overridden_methods.add(method.__name__) for method_name in overridden_methods: - raise NameError( + raise EventHandlerShadowsBuiltInStateMethod( f"The event handler name `{method_name}` shadows a builtin State method; use a different name instead" ) @classmethod - def _check_overriden_basevars(cls): + def _check_overridden_basevars(cls): """Check for shadow base vars and raise error if any. Raises: - NameError: When a computed var shadows a base var. + ComputedVarShadowsBaseVars: When a computed var shadows a base var. """ for computed_var_ in cls._get_computed_vars(): - if computed_var_._var_name in cls.__annotations__: - raise NameError( - f"The computed var name `{computed_var_._var_name}` shadows a base var in {cls.__module__}.{cls.__name__}; use a different name instead" + if computed_var_._js_expr in cls.__annotations__: + raise ComputedVarShadowsBaseVars( + f"The computed var name `{computed_var_._js_expr}` shadows a base var in {cls.__module__}.{cls.__name__}; use a different name instead" + ) + + @classmethod + def _check_overridden_computed_vars(cls) -> None: + """Check for shadow computed vars and raise error if any. + + Raises: + ComputedVarShadowsStateVar: When a computed var shadows another. + """ + for name, cv in cls.__dict__.items(): + if not is_computed_var(cv): + continue + name = cv._js_expr + if name in cls.inherited_vars or name in cls.inherited_backend_vars: + raise ComputedVarShadowsStateVar( + f"The computed var name `{cv._js_expr}` shadows a var in {cls.__module__}.{cls.__name__}; use a different name instead" ) @classmethod @@ -764,6 +821,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): def get_parent_state(cls) -> Type[BaseState] | None: """Get the parent state. + Raises: + ValueError: If more than one parent state is found. + Returns: The parent state. """ @@ -772,9 +832,8 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): for base in cls.__bases__ if issubclass(base, BaseState) and base is not BaseState and not base._mixin ] - assert ( - len(parent_states) < 2 - ), f"Only one parent state is allowed {parent_states}." + if len(parent_states) >= 2: + raise ValueError(f"Only one parent state is allowed {parent_states}.") return parent_states[0] if len(parent_states) == 1 else None # type: ignore @classmethod @@ -859,7 +918,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): return getattr(substate, name) @classmethod - def _init_var(cls, prop: ImmutableVar): + def _init_var(cls, prop: Var): """Initialize a variable. Args: @@ -875,7 +934,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): "State vars must be primitive Python types, " "Plotly figures, Pandas dataframes, " "or subclasses of rx.Base. " - f'Found var "{prop._var_name}" with type {prop._var_type}.' + f'Found var "{prop._js_expr}" with type {prop._var_type}.' ) cls._set_var(prop) cls._create_setter(prop) @@ -902,10 +961,10 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): ) # create the variable based on name and type - var = ImmutableVar( - _var_name=format.format_state_name(cls.get_full_name()) + "." + name, + var = Var( + _js_expr=format.format_state_name(cls.get_full_name()) + "." + name, _var_type=type_, - _var_data=ImmutableVarData.from_state(cls), + _var_data=VarData.from_state(cls, name), ).guess_type() # add the pydantic field dynamically (must be done before _init_var) @@ -925,18 +984,13 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): cls._init_var_dependency_dicts() @classmethod - def _set_var(cls, prop: ImmutableVar): + def _set_var(cls, prop: Var): """Set the var as a class member. Args: prop: The var instance to set. """ - acutal_var_name = ( - prop._var_name - if "." not in prop._var_name - else prop._var_name.split(".")[-1] - ) - setattr(cls, acutal_var_name, prop) + setattr(cls, prop._var_field_name, prop) @classmethod def _create_event_handler(cls, fn): @@ -956,7 +1010,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): cls.setvar = cls.event_handlers["setvar"] = EventHandlerSetVar(state_cls=cls) @classmethod - def _create_setter(cls, prop: ImmutableVar): + def _create_setter(cls, prop: Var): """Create a setter for the var. Args: @@ -969,17 +1023,14 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): setattr(cls, setter_name, event_handler) @classmethod - def _set_default_value(cls, prop: ImmutableVar): + def _set_default_value(cls, prop: Var): """Set the default value for the var. Args: prop: The var to set the default value for. """ # Get the pydantic field for the var. - if "." in prop._var_name: - field = cls.get_fields()[prop._var_name.split(".")[-1]] - else: - field = cls.get_fields()[prop._var_name] + field = cls.get_fields()[prop._var_field_name] if field.required: default_value = prop.get_default_value() if default_value is not None: @@ -993,6 +1044,26 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): # Ensure frontend uses null coalescing when accessing. object.__setattr__(prop, "_var_type", Optional[prop._var_type]) + @classmethod + def _get_var_default(cls, name: str, annotation_value: Any) -> Any: + """Get the default value of a (backend) var. + + Args: + name: The name of the var. + annotation_value: The annotation value of the var. + + Returns: + The default value of the var or None. + """ + try: + return getattr(cls, name) + except AttributeError: + try: + return Var("", _var_type=annotation_value).get_default_value() + except TypeError: + pass + return None + @staticmethod def _get_base_functions() -> dict[str, FunctionType]: """Get all functions of the state class excluding dunder methods. @@ -1006,6 +1077,27 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): if not func[0].startswith("__") } + @classmethod + def _update_substate_inherited_vars(cls, vars_to_add: dict[str, Var]): + """Update the inherited vars of substates recursively when new vars are added. + + Also updates the var dependency tracking dicts after adding vars. + + Args: + vars_to_add: names to Var instances to add to substates + """ + for substate_class in cls.class_subclasses: + for name, var in vars_to_add.items(): + if types.is_backend_base_variable(name, cls): + substate_class.backend_vars.setdefault(name, var) + substate_class.inherited_backend_vars.setdefault(name, var) + else: + substate_class.vars.setdefault(name, var) + substate_class.inherited_vars.setdefault(name, var) + substate_class._update_substate_inherited_vars(vars_to_add) + # Reinitialize dependency tracking dicts. + cls._init_var_dependency_dicts() + @classmethod def setup_dynamic_args(cls, args: dict[str, str]): """Set up args for easy access in renderer. @@ -1013,21 +1105,24 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): Args: args: a dict of args """ + if not args: + return + + cls._check_overwritten_dynamic_args(list(args.keys())) def argsingle_factory(param): - @ComputedVar def inner_func(self) -> str: return self.router.page.params.get(param, "") return inner_func def arglist_factory(param): - @ComputedVar - def inner_func(self) -> List: + def inner_func(self) -> List[str]: return self.router.page.params.get(param, []) return inner_func + dynamic_vars = {} for param, value in args.items(): if value == constants.RouteArgType.SINGLE: func = argsingle_factory(param) @@ -1035,13 +1130,39 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): func = arglist_factory(param) else: continue - # to allow passing as a prop - func._var_name = param - cls.vars[param] = cls.computed_vars[param] = func._var_set_state(cls) # type: ignore - setattr(cls, param, func) + dynamic_vars[param] = DynamicRouteVar( + fget=func, + cache=True, + _js_expr=param, + _var_data=VarData.from_state(cls), + ) + setattr(cls, param, dynamic_vars[param]) - # Reinitialize dependency tracking dicts. - cls._init_var_dependency_dicts() + # Update tracking dicts. + cls.computed_vars.update(dynamic_vars) + cls.vars.update(dynamic_vars) + cls._update_substate_inherited_vars(dynamic_vars) + + @classmethod + def _check_overwritten_dynamic_args(cls, args: list[str]): + """Check if dynamic args are shadowing existing vars. Recursively checks all child states. + + Args: + args: a dict of args + + Raises: + DynamicRouteArgShadowsStateVar: If a dynamic arg is shadowing an existing var. + """ + for arg in args: + if ( + arg in cls.computed_vars + and not isinstance(cls.computed_vars[arg], DynamicRouteVar) + ) or arg in cls.base_vars: + raise DynamicRouteArgShadowsStateVar( + f"Dynamic route arg '{arg}' is shadowing an existing var in {cls.__module__}.{cls.__name__}" + ) + for substate in cls.get_substates(): + substate._check_overwritten_dynamic_args(args) def __getattribute__(self, name: str) -> Any: """Get the state var. @@ -1110,6 +1231,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): Args: name: The name of the attribute. value: The value of the attribute. + + Raises: + SetUndefinedStateVarError: If a value of a var is set without first defining it. """ if isinstance(value, MutableProxy): # unwrap proxy objects when assigning back to the state @@ -1127,6 +1251,19 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): self._mark_dirty() return + if ( + name not in self.vars + and name not in self.get_skip_vars() + and not name.startswith("__") + and not name.startswith( + f"_{getattr(type(self), '__original_name__', type(self).__name__)}__" + ) + ): + raise SetUndefinedStateVarError( + f"The state variable '{name}' has not been defined in '{type(self).__name__}'. " + f"All state variables must be declared before they can be set." + ) + # Set the attribute. super().__setattr__(name, value) @@ -1154,6 +1291,10 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): default = copy.deepcopy(field.default) setattr(self, prop_name, default) + # Reset the backend vars. + for prop_name, value in self.backend_vars.items(): + setattr(self, prop_name, copy.deepcopy(value)) + # Recursively reset the substates. for substate in self.substates.values(): substate.reset() @@ -1670,11 +1811,12 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): .union(self._always_dirty_computed_vars) ) - subdelta = { - prop: getattr(self, prop) + subdelta: Dict[str, Any] = { + prop: self.get_value(getattr(self, prop)) for prop in delta_vars if not types.is_backend_base_variable(prop, type(self)) } + if len(subdelta) > 0: delta[self.get_full_name()] = subdelta @@ -1683,9 +1825,6 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): for substate in self.dirty_substates.union(self._always_dirty_substates): delta.update(substates[substate].get_delta()) - # Format the delta. - delta = format.format_state(delta) - # Return the delta. return delta @@ -1792,12 +1931,12 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): prop_name: self.get_value(getattr(self, prop_name)) for prop_name in self.base_vars } - if initial: + if initial and include_computed: computed_vars = { # Include initial computed vars. prop_name: ( cv._initial_value - if isinstance(cv, (ComputedVar, ImmutableComputedVar)) + if is_computed_var(cv) and not isinstance(cv._initial_value, types.Unset) else self.get_value(getattr(self, prop_name)) ) @@ -1852,7 +1991,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): def __getstate__(self): """Get the state for redis serialization. - This method is called by cloudpickle to serialize the object. + This method is called by pickle to serialize the object. It explicitly removes parent_state and substates because those are serialized separately by the StateManagerRedis to allow for better horizontal scaling as state size increases. @@ -1861,15 +2000,94 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow): The state dict for serialization. """ state = super().__getstate__() - # Never serialize parent_state or substates state["__dict__"] = state["__dict__"].copy() + if state["__dict__"].get("parent_state") is not None: + # Do not serialize router data in substates (only the root state). + state["__dict__"].pop("router", None) + state["__dict__"].pop("router_data", None) + # Never serialize parent_state or substates. state["__dict__"]["parent_state"] = None state["__dict__"]["substates"] = {} state["__dict__"].pop("_was_touched", None) + # Remove all inherited vars. + for inherited_var_name in self.inherited_vars: + state["__dict__"].pop(inherited_var_name, None) return state + @classmethod + @functools.lru_cache() + def _to_schema(cls) -> str: + """Convert a state to a schema. -EventHandlerSetVar.update_forward_refs() + Returns: + The hash of the schema. + """ + + def _field_tuple( + field_name: str, + ) -> Tuple[str, str, Any, Union[bool, None], Any]: + model_field = cls.__fields__[field_name] + return ( + field_name, + model_field.name, + _serialize_type(model_field.type_), + ( + model_field.required + if isinstance(model_field.required, bool) + else None + ), + (model_field.default if is_serializable(model_field.default) else None), + ) + + return md5( + pickle.dumps( + list(sorted(_field_tuple(field_name) for field_name in cls.base_vars)) + ) + ).hexdigest() + + def _serialize(self) -> bytes: + """Serialize the state for redis. + + Returns: + The serialized state. + """ + try: + return pickle.dumps((self._to_schema(), self)) + except pickle.PicklingError: + console.warn( + f"Failed to serialize state {self.get_full_name()} due to unpicklable object. " + "This state will not be persisted." + ) + return b"" + + @classmethod + def _deserialize( + cls, data: bytes | None = None, fp: BinaryIO | None = None + ) -> BaseState: + """Deserialize the state from redis/disk. + + data and fp are mutually exclusive, but one must be provided. + + Args: + data: The serialized state data. + fp: The file pointer to the serialized state data. + + Returns: + The deserialized state. + + Raises: + ValueError: If both data and fp are provided, or neither are provided. + StateSchemaMismatchError: If the state schema does not match the expected schema. + """ + if data is not None and fp is None: + (substate_schema, state) = pickle.loads(data) + elif fp is not None and data is None: + (substate_schema, state) = pickle.load(fp) + else: + raise ValueError("Only one of `data` or `fp` must be provided") + if substate_schema != state._to_schema(): + raise StateSchemaMismatchError() + return state class State(BaseState): @@ -1879,10 +2097,56 @@ class State(BaseState): is_hydrated: bool = False +T = TypeVar("T", bound=BaseState) + + +def dynamic(func: Callable[[T], Component]): + """Create a dynamically generated components from a state class. + + Args: + func: The function to generate the component. + + Returns: + The dynamically generated component. + + Raises: + DynamicComponentInvalidSignature: If the function does not have exactly one parameter. + DynamicComponentInvalidSignature: If the function does not have a type hint for the state class. + """ + number_of_parameters = len(inspect.signature(func).parameters) + + func_signature = get_type_hints(func) + + if "return" in func_signature: + func_signature.pop("return") + + values = list(func_signature.values()) + + if number_of_parameters != 1: + raise DynamicComponentInvalidSignature( + "The function must have exactly one parameter, which is the state class." + ) + + if len(values) != 1: + raise DynamicComponentInvalidSignature( + "You must provide a type hint for the state class in the function." + ) + + state_class: Type[T] = values[0] + + def wrapper() -> Component: + from reflex.components.base.fragment import fragment + + return fragment(state_class._evaluate(lambda state: func(state))) + + return wrapper + + class FrontendEventExceptionState(State): """Substate for handling frontend exceptions.""" - def handle_frontend_exception(self, stack: str) -> None: + @event + def handle_frontend_exception(self, stack: str, component_stack: str) -> None: """Handle frontend exceptions. If a frontend exception handler is provided, it will be called. @@ -1890,6 +2154,7 @@ class FrontendEventExceptionState(State): Args: stack: The stack trace of the exception. + component_stack: The stack trace of the component where the exception occurred. """ app_instance = getattr(prerequisites.get_app(), constants.CompileVars.APP) @@ -2027,7 +2292,14 @@ class ComponentState(State, mixin=True): """ cls._per_component_state_instance_count += 1 state_cls_name = f"{cls.__name__}_n{cls._per_component_state_instance_count}" - component_state = type(state_cls_name, (cls, State), {}, mixin=False) + component_state = type( + state_cls_name, + (cls, State), + {"__module__": reflex.istate.dynamic.__name__}, + mixin=False, + ) + # Save a reference to the dynamic state for pickle/unpickle. + setattr(reflex.istate.dynamic, state_cls_name, component_state) component = component_state.get_component(*children, **props) component.State = component_state return component @@ -2303,18 +2575,29 @@ class StateProxy(wrapt.ObjectProxy): self._self_mutable = original_mutable -class StateUpdate(Base): +@dataclasses.dataclass( + frozen=True, +) +class StateUpdate: """A state update sent to the frontend.""" # The state delta. - delta: Delta = {} + delta: Delta = dataclasses.field(default_factory=dict) # Events to be added to the event queue. - events: List[Event] = [] + events: List[Event] = dataclasses.field(default_factory=list) # Whether this is the final state update for the event. final: bool = True + def json(self) -> str: + """Convert the state update to a JSON string. + + Returns: + The state update as a JSON string. + """ + return format.json_dumps(self) + class StateManager(Base, ABC): """A class to manage many client states.""" @@ -2329,20 +2612,32 @@ class StateManager(Base, ABC): Args: state: The state class to use. + Raises: + InvalidStateManagerMode: If the state manager mode is invalid. + Returns: - The state manager (either memory or redis). + The state manager (either disk, memory or redis). """ - redis = prerequisites.get_redis() - if redis is not None: - # make sure expiration values are obtained only from the config object on creation - config = get_config() - return StateManagerRedis( - state=state, - redis=redis, - token_expiration=config.redis_token_expiration, - lock_expiration=config.redis_lock_expiration, - ) - return StateManagerDisk(state=state) + config = get_config() + if prerequisites.parse_redis_url() is not None: + config.state_manager_mode = constants.StateManagerMode.REDIS + if config.state_manager_mode == constants.StateManagerMode.MEMORY: + return StateManagerMemory(state=state) + if config.state_manager_mode == constants.StateManagerMode.DISK: + return StateManagerDisk(state=state) + if config.state_manager_mode == constants.StateManagerMode.REDIS: + redis = prerequisites.get_redis() + if redis is not None: + # make sure expiration values are obtained only from the config object on creation + return StateManagerRedis( + state=state, + redis=redis, + token_expiration=config.redis_token_expiration, + lock_expiration=config.redis_lock_expiration, + ) + raise InvalidStateManagerMode( + f"Expected one of: DISK, MEMORY, REDIS, got {config.state_manager_mode}" + ) @abstractmethod async def get_state(self, token: str) -> BaseState: @@ -2472,39 +2767,27 @@ def _serialize_type(type_: Any) -> str: return f"{type_.__module__}.{type_.__qualname__}" -def state_to_schema( - state: BaseState, -) -> List[ - Tuple[ - str, - str, - Any, - Union[bool, None], - ] -]: - """Convert a state to a schema. +def is_serializable(value: Any) -> bool: + """Check if a value is serializable. Args: - state: The state to convert to a schema. + value: The value to check. Returns: - The schema. + Whether the value is serializable. """ - return list( - sorted( - ( - field_name, - model_field.name, - _serialize_type(model_field.type_), - ( - model_field.required - if isinstance(model_field.required, bool) - else None - ), - ) - for field_name, model_field in state.__fields__.items() - ) - ) + try: + return bool(pickle.dumps(value)) + except Exception: + return False + + +def reset_disk_state_manager(): + """Reset the disk state manager.""" + states_directory = prerequisites.get_web_dir() / constants.Dirs.STATES + if states_directory.exists(): + for path in states_directory.iterdir(): + path.unlink() class StateManagerDisk(StateManager): @@ -2577,37 +2860,28 @@ class StateManagerDisk(StateManager): Returns: The path for the token. """ - return (self.states_directory / f"{token}.pkl").absolute() + return ( + self.states_directory / f"{md5(token.encode()).hexdigest()}.pkl" + ).absolute() - async def load_state(self, token: str, root_state: BaseState) -> BaseState: + async def load_state(self, token: str) -> BaseState | None: """Load a state object based on the provided token. Args: token: The token used to identify the state object. - root_state: The root state object. Returns: - The loaded state object. + The loaded state object or None. """ - if token in self.states: - return self.states[token] - - client_token, substate_address = _split_substate_key(token) - token_path = self.token_path(token) if token_path.exists(): try: with token_path.open(mode="rb") as file: - (substate_schema, substate) = dill.load(file) - if substate_schema == state_to_schema(substate): - await self.populate_substates(client_token, substate, root_state) - return substate + return BaseState._deserialize(fp=file) except Exception: pass - return root_state.get_substate(substate_address.split(".")[1:]) - async def populate_substates( self, client_token: str, state: BaseState, root_state: BaseState ): @@ -2621,10 +2895,13 @@ class StateManagerDisk(StateManager): for substate in state.get_substates(): substate_token = _substate_key(client_token, substate) - substate = await self.load_state(substate_token, root_state) + instance = await self.load_state(substate_token) + if instance is None: + instance = await root_state.get_state(substate) + state.substates[substate.get_name()] = instance + instance.parent_state = state - state.substates[substate.get_name()] = substate - substate.parent_state = state + await self.populate_substates(client_token, instance, root_state) @override async def get_state( @@ -2639,13 +2916,24 @@ class StateManagerDisk(StateManager): Returns: The state for the token. """ - client_token, substate_address = _split_substate_key(token) + client_token = _split_substate_key(token)[0] + root_state = self.states.get(client_token) + if root_state is not None: + # Retrieved state from memory. + return root_state - root_state_token = _substate_key(client_token, substate_address.split(".")[0]) - - return await self.load_state( - root_state_token, self.state(_reflex_internal_init=True) - ) + # Deserialize root state from disk. + root_state = await self.load_state(_substate_key(client_token, self.state)) + # Create a new root state tree with all substates instantiated. + fresh_root_state = self.state(_reflex_internal_init=True) + if root_state is None: + root_state = fresh_root_state + else: + # Ensure all substates exist, even if they were not serialized previously. + root_state.substates = fresh_root_state.substates + self.states[client_token] = root_state + await self.populate_substates(client_token, root_state, root_state) + return root_state async def set_state_for_substate(self, client_token: str, substate: BaseState): """Set the state for a substate. @@ -2656,12 +2944,13 @@ class StateManagerDisk(StateManager): """ substate_token = _substate_key(client_token, substate) - self.states[substate_token] = substate - - state_dilled = dill.dumps((state_to_schema(substate), substate)) - if not self.states_directory.exists(): - self.states_directory.mkdir(parents=True, exist_ok=True) - self.token_path(substate_token).write_bytes(state_dilled) + if substate._get_was_touched(): + substate._was_touched = False # Reset the touched flag after serializing. + pickle_state = substate._serialize() + if pickle_state: + if not self.states_directory.exists(): + self.states_directory.mkdir(parents=True, exist_ok=True) + self.token_path(substate_token).write_bytes(pickle_state) for substate_substate in substate.substates.values(): await self.set_state_for_substate(client_token, substate_substate) @@ -2701,25 +2990,6 @@ class StateManagerDisk(StateManager): await self.set_state(token, state) -# Workaround https://github.com/cloudpipe/cloudpickle/issues/408 for dynamic pydantic classes -if not isinstance(State.validate.__func__, FunctionType): - cython_function_or_method = type(State.validate.__func__) - - @dill.register(cython_function_or_method) - def _dill_reduce_cython_function_or_method(pickler, obj): - # Ignore cython function when pickling. - pass - - -@dill.register(type(State)) -def _dill_reduce_state(pickler, obj): - if obj is not State and issubclass(obj, State): - # Avoid serializing subclasses of State, instead get them by reference from the State class. - pickler.save_reduce(State.get_class_substate, (obj.get_full_name(),), obj=obj) - else: - dill.Pickler.dispatch[type](pickler, obj) - - def _default_lock_expiration() -> int: """Get the default lock expiration time. @@ -2760,11 +3030,14 @@ class StateManagerRedis(StateManager): # Only warn about each state class size once. _warned_about_state_size: ClassVar[Set[str]] = set() - async def _get_parent_state(self, token: str) -> BaseState | None: + async def _get_parent_state( + self, token: str, state: BaseState | None = None + ) -> BaseState | None: """Get the parent state for the state requested in the token. Args: token: The token to get the state for (_substate_key). + state: The state instance to get parent state for. Returns: The parent state for the state requested by the token or None if there is no such parent. @@ -2773,11 +3046,15 @@ class StateManagerRedis(StateManager): client_token, state_path = _split_substate_key(token) parent_state_name = state_path.rpartition(".")[0] if parent_state_name: + cached_substates = None + if state is not None: + cached_substates = [state] # Retrieve the parent state to populate event handlers onto this substate. parent_state = await self.get_state( token=_substate_key(client_token, parent_state_name), top_level=False, get_substates=False, + cached_substates=cached_substates, ) return parent_state @@ -2809,6 +3086,8 @@ class StateManagerRedis(StateManager): tasks = {} # Retrieve the necessary substates from redis. for substate_cls in fetch_substates: + if substate_cls.get_name() in state.substates: + continue substate_name = substate_cls.get_name() tasks[substate_name] = asyncio.create_task( self.get_state( @@ -2829,6 +3108,7 @@ class StateManagerRedis(StateManager): top_level: bool = True, get_substates: bool = True, parent_state: BaseState | None = None, + cached_substates: list[BaseState] | None = None, ) -> BaseState: """Get the state for a token. @@ -2837,6 +3117,7 @@ class StateManagerRedis(StateManager): top_level: If true, return an instance of the top-level state (self.state). get_substates: If true, also retrieve substates. parent_state: If provided, use this parent_state instead of getting it from redis. + cached_substates: If provided, attach these substates to the state. Returns: The state for the token. @@ -2854,45 +3135,38 @@ class StateManagerRedis(StateManager): "StateManagerRedis requires token to be specified in the form of {token}_{state_full_name}" ) + # The deserialized or newly created (sub)state instance. + state = None + # Fetch the serialized substate from redis. redis_state = await self.redis.get(token) if redis_state is not None: # Deserialize the substate. - state = dill.loads(redis_state) - - # Populate parent state if missing and requested. - if parent_state is None: - parent_state = await self._get_parent_state(token) - # Set up Bidirectional linkage between this state and its parent. - if parent_state is not None: - parent_state.substates[state.get_name()] = state - state.parent_state = parent_state - # Populate substates if requested. - await self._populate_substates(token, state, all_substates=get_substates) - - # To retain compatibility with previous implementation, by default, we return - # the top-level state by chasing `parent_state` pointers up the tree. - if top_level: - return state._get_root_state() - return state - - # TODO: dedupe the following logic with the above block - # Key didn't exist so we have to create a new instance for this token. + with contextlib.suppress(StateSchemaMismatchError): + state = BaseState._deserialize(data=redis_state) + if state is None: + # Key didn't exist or schema mismatch so create a new instance for this token. + state = state_cls( + init_substates=False, + _reflex_internal_init=True, + ) + # Populate parent state if missing and requested. if parent_state is None: - parent_state = await self._get_parent_state(token) - # Instantiate the new state class (but don't persist it yet). - state = state_cls( - parent_state=parent_state, - init_substates=False, - _reflex_internal_init=True, - ) + parent_state = await self._get_parent_state(token, state) # Set up Bidirectional linkage between this state and its parent. if parent_state is not None: parent_state.substates[state.get_name()] = state state.parent_state = parent_state - # Populate substates for the newly created state. + # Avoid fetching substates multiple times. + if cached_substates: + for substate in cached_substates: + state.substates[substate.get_name()] = substate + if substate.parent_state is None: + substate.parent_state = state + # Populate substates if requested. await self._populate_substates(token, state, all_substates=get_substates) + # To retain compatibility with previous implementation, by default, we return # the top-level state by chasing `parent_state` pointers up the tree. if top_level: @@ -2971,13 +3245,14 @@ class StateManagerRedis(StateManager): ) # Persist only the given state (parents or substates are excluded by BaseState.__getstate__). if state._get_was_touched(): - pickle_state = dill.dumps(state, byref=True) + pickle_state = state._serialize() self._warn_if_too_large(state, len(pickle_state)) - await self.redis.set( - _substate_key(client_token, state), - pickle_state, - ex=self.token_expiration, - ) + if pickle_state: + await self.redis.set( + _substate_key(client_token, state), + pickle_state, + ex=self.token_expiration, + ) # Wait for substates to be persisted. for t in tasks: @@ -3052,11 +3327,7 @@ class StateManagerRedis(StateManager): ) except ResponseError: # Some redis servers only allow out-of-band configuration, so ignore errors here. - ignore_config_error = os.environ.get( - "REFLEX_IGNORE_REDIS_CONFIG_ERROR", - None, - ) - if not ignore_config_error: + if not environment.REFLEX_IGNORE_REDIS_CONFIG_ERROR: raise async with self.redis.pubsub() as pubsub: await pubsub.psubscribe(lock_key_channel) @@ -3128,143 +3399,6 @@ def get_state_manager() -> StateManager: return app.state_manager -class ClientStorageBase: - """Base class for client-side storage.""" - - def options(self) -> dict[str, Any]: - """Get the options for the storage. - - Returns: - All set options for the storage (not None). - """ - return { - format.to_camel_case(k): v for k, v in vars(self).items() if v is not None - } - - -class Cookie(ClientStorageBase, str): - """Represents a state Var that is stored as a cookie in the browser.""" - - name: str | None - path: str - max_age: int | None - domain: str | None - secure: bool | None - same_site: str - - def __new__( - cls, - object: Any = "", - encoding: str | None = None, - errors: str | None = None, - /, - name: str | None = None, - path: str = "/", - max_age: int | None = None, - domain: str | None = None, - secure: bool | None = None, - same_site: str = "lax", - ): - """Create a client-side Cookie (str). - - Args: - object: The initial object. - encoding: The encoding to use. - errors: The error handling scheme to use. - name: The name of the cookie on the client side. - path: Cookie path. Use / as the path if the cookie should be accessible on all pages. - max_age: Relative max age of the cookie in seconds from when the client receives it. - domain: Domain for the cookie (sub.domain.com or .allsubdomains.com). - secure: Is the cookie only accessible through HTTPS? - same_site: Whether the cookie is sent with third party requests. - One of (true|false|none|lax|strict) - - Returns: - The client-side Cookie object. - - Note: expires (absolute Date) is not supported at this time. - """ - if encoding or errors: - inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict") - else: - inst = super().__new__(cls, object) - inst.name = name - inst.path = path - inst.max_age = max_age - inst.domain = domain - inst.secure = secure - inst.same_site = same_site - return inst - - -class LocalStorage(ClientStorageBase, str): - """Represents a state Var that is stored in localStorage in the browser.""" - - name: str | None - sync: bool = False - - def __new__( - cls, - object: Any = "", - encoding: str | None = None, - errors: str | None = None, - /, - name: str | None = None, - sync: bool = False, - ) -> "LocalStorage": - """Create a client-side localStorage (str). - - Args: - object: The initial object. - encoding: The encoding to use. - errors: The error handling scheme to use. - name: The name of the storage key on the client side. - sync: Whether changes should be propagated to other tabs. - - Returns: - The client-side localStorage object. - """ - if encoding or errors: - inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict") - else: - inst = super().__new__(cls, object) - inst.name = name - inst.sync = sync - return inst - - -class SessionStorage(ClientStorageBase, str): - """Represents a state Var that is stored in sessionStorage in the browser.""" - - name: str | None - - def __new__( - cls, - object: Any = "", - encoding: str | None = None, - errors: str | None = None, - /, - name: str | None = None, - ) -> "SessionStorage": - """Create a client-side sessionStorage (str). - - Args: - object: The initial object. - encoding: The encoding to use. - errors: The error handling scheme to use - name: The name of the storage on the client side - - Returns: - The client-side sessionStorage object. - """ - if encoding or errors: - inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict") - else: - inst = super().__new__(cls, object) - inst.name = name - return inst - - class MutableProxy(wrapt.ObjectProxy): """A proxy for a mutable object that tracks changes.""" @@ -3521,22 +3655,16 @@ class MutableProxy(wrapt.ObjectProxy): @serializer -def serialize_mutable_proxy(mp: MutableProxy) -> SerializedType: - """Serialize the wrapped value of a MutableProxy. +def serialize_mutable_proxy(mp: MutableProxy): + """Return the wrapped value of a MutableProxy. Args: mp: The MutableProxy to serialize. Returns: - The serialized wrapped object. - - Raises: - ValueError: when the wrapped object is not serializable. + The wrapped object. """ - value = serialize(mp.__wrapped__) - if value is None: - raise ValueError(f"Cannot serialize {type(mp.__wrapped__)}") - return value + return mp.__wrapped__ class ImmutableMutableProxy(MutableProxy): @@ -3607,5 +3735,7 @@ def reload_state_module( if subclass.__module__ == module and module is not None: state.class_subclasses.remove(subclass) state._always_dirty_substates.discard(subclass.get_name()) - state._init_var_dependency_dicts() + state._computed_var_dependencies = defaultdict(set) + state._substate_var_dependencies = defaultdict(set) + state._init_var_dependency_dicts() state.get_class_substate.cache_clear() diff --git a/reflex/style.py b/reflex/style.py index a2083f634..8e24e9b6b 100644 --- a/reflex/style.py +++ b/reflex/style.py @@ -6,14 +6,15 @@ from typing import Any, Literal, Tuple, Type from reflex import constants from reflex.components.core.breakpoints import Breakpoints, breakpoints_values -from reflex.event import EventChain -from reflex.ivars.base import ImmutableCallableVar, ImmutableVar, LiteralVar -from reflex.ivars.function import FunctionVar +from reflex.event import EventChain, EventHandler from reflex.utils import format +from reflex.utils.exceptions import ReflexError from reflex.utils.imports import ImportVar -from reflex.vars import ImmutableVarData, Var, VarData - -VarData.update_forward_refs() # Ensure all type definitions are resolved +from reflex.utils.types import get_origin +from reflex.vars import VarData +from reflex.vars.base import CallableVar, LiteralVar, Var +from reflex.vars.function import FunctionVar +from reflex.vars.object import ObjectVar SYSTEM_COLOR_MODE: str = "system" LIGHT_COLOR_MODE: str = "light" @@ -27,27 +28,27 @@ color_mode_imports = { } -def _color_mode_var(_var_name: str, _var_type: Type = str) -> ImmutableVar: - """Create a Var that destructs the _var_name from ColorModeContext. +def _color_mode_var(_js_expr: str, _var_type: Type = str) -> Var: + """Create a Var that destructs the _js_expr from ColorModeContext. Args: - _var_name: The name of the variable to get from ColorModeContext. + _js_expr: The name of the variable to get from ColorModeContext. _var_type: The type of the Var. Returns: The Var that resolves to the color mode. """ - return ImmutableVar( - _var_name=_var_name, + return Var( + _js_expr=_js_expr, _var_type=_var_type, - _var_data=ImmutableVarData( + _var_data=VarData( imports=color_mode_imports, - hooks={f"const {{ {_var_name} }} = useContext(ColorModeContext)": None}, + hooks={f"const {{ {_js_expr} }} = useContext(ColorModeContext)": None}, ), ).guess_type() -@ImmutableCallableVar +@CallableVar def set_color_mode( new_color_mode: LiteralColorMode | Var[LiteralColorMode] | None = None, ) -> Var[EventChain]: @@ -63,7 +64,7 @@ def set_color_mode( The EventChain Var that can be passed to an event trigger. """ base_setter = _color_mode_var( - _var_name=constants.ColorMode.SET, + _js_expr=constants.ColorMode.SET, _var_type=EventChain, ) if new_color_mode is None: @@ -72,21 +73,21 @@ def set_color_mode( if not isinstance(new_color_mode, Var): new_color_mode = LiteralVar.create(new_color_mode) - return ImmutableVar( + return Var( f"() => {str(base_setter)}({str(new_color_mode)})", - _var_data=ImmutableVarData.merge( + _var_data=VarData.merge( base_setter._get_all_var_data(), new_color_mode._get_all_var_data() ), - ).to(FunctionVar, EventChain) + ).to(FunctionVar, EventChain) # type: ignore # Var resolves to the current color mode for the app ("light", "dark" or "system") -color_mode = _color_mode_var(_var_name=constants.ColorMode.NAME) +color_mode = _color_mode_var(_js_expr=constants.ColorMode.NAME) # Var resolves to the resolved color mode for the app ("light" or "dark") -resolved_color_mode = _color_mode_var(_var_name=constants.ColorMode.RESOLVED_NAME) +resolved_color_mode = _color_mode_var(_js_expr=constants.ColorMode.RESOLVED_NAME) # Var resolves to a function invocation that toggles the color mode toggle_color_mode = _color_mode_var( - _var_name=constants.ColorMode.TOGGLE, + _js_expr=constants.ColorMode.TOGGLE, _var_type=EventChain, ) @@ -116,7 +117,7 @@ def media_query(breakpoint_expr: str): def convert_item( style_item: int | str | Var, -) -> tuple[str | Var, VarData | ImmutableVarData | None]: +) -> tuple[str | Var, VarData | None]: """Format a single value in a style dictionary. Args: @@ -124,7 +125,16 @@ def convert_item( Returns: The formatted style item and any associated VarData. + + Raises: + ReflexError: If an EventHandler is used as a style value """ + if isinstance(style_item, EventHandler): + raise ReflexError( + "EventHandlers cannot be used as style values. " + "Please use a Var or a literal value." + ) + if isinstance(style_item, Var): return style_item, style_item._get_all_var_data() @@ -180,7 +190,20 @@ def convert( out[k] = return_value for key, value in style_dict.items(): - keys = format_style_key(key) + keys = ( + format_style_key(key) + if not isinstance(value, (dict, ObjectVar)) + or ( + isinstance(value, Breakpoints) + and all(not isinstance(v, dict) for v in value.values()) + ) + or ( + isinstance(value, ObjectVar) + and not issubclass(get_origin(value._var_type) or value._var_type, dict) + ) + else (key,) + ) + if isinstance(value, Var): return_val = value new_var_data = value._get_all_var_data() @@ -275,14 +298,13 @@ def _format_emotion_style_pseudo_selector(key: str) -> str: """Format a pseudo selector for emotion CSS-in-JS. Args: - key: Underscore-prefixed or colon-prefixed pseudo selector key (_hover). + key: Underscore-prefixed or colon-prefixed pseudo selector key (_hover/:hover). Returns: A self-referential pseudo selector key (&:hover). """ prefix = None if key.startswith("_"): - # Handle pseudo selectors in chakra style format. prefix = "&:" key = key[1:] if key.startswith(":"): diff --git a/reflex/testing.py b/reflex/testing.py index 503db6c2f..6a45c51eb 100644 --- a/reflex/testing.py +++ b/reflex/testing.py @@ -292,8 +292,6 @@ class AppHarness: if isinstance(self.app_instance._state_manager, StateManagerRedis): # Create our own redis connection for testing. self.state_manager = StateManagerRedis.create(self.app_instance.state) - elif isinstance(self.app_instance._state_manager, StateManagerDisk): - self.state_manager = StateManagerDisk.create(self.app_instance.state) else: self.state_manager = self.app_instance._state_manager @@ -340,6 +338,9 @@ class AppHarness: This is necessary when the backend is restarted and the state manager is a StateManagerRedis instance. + + Raises: + RuntimeError: when the state manager cannot be reset """ if ( self.app_instance is not None @@ -354,7 +355,8 @@ class AppHarness: self.app_instance._state_manager = StateManagerRedis.create( state=self.app_instance.state, ) - assert isinstance(self.app_instance.state_manager, StateManagerRedis) + if not isinstance(self.app_instance.state_manager, StateManagerRedis): + raise RuntimeError("Failed to reset state manager.") def _start_frontend(self): # Set up the frontend. @@ -392,9 +394,14 @@ class AppHarness: def consume_frontend_output(): while True: - line = ( - self.frontend_process.stdout.readline() # pyright: ignore [reportOptionalMemberAccess] - ) + try: + line = ( + self.frontend_process.stdout.readline() # pyright: ignore [reportOptionalMemberAccess] + ) + # catch I/O operation on closed file. + except ValueError as e: + print(e) + break if not line: break print(line) @@ -787,13 +794,13 @@ class AppHarness: Raises: RuntimeError: when the app hasn't started running TimeoutError: when the timeout expires before any states are seen + ValueError: when the state_manager is not a memory state manager """ if self.app_instance is None: raise RuntimeError("App is not running.") state_manager = self.app_instance.state_manager - assert isinstance( - state_manager, (StateManagerMemory, StateManagerDisk) - ), "Only works with memory state manager" + if not isinstance(state_manager, (StateManagerMemory, StateManagerDisk)): + raise ValueError("Only works with memory or disk state manager") if not self._poll_for( target=lambda: state_manager.states, timeout=timeout, diff --git a/reflex/utils/build.py b/reflex/utils/build.py index 7a67ec32e..14709d99c 100644 --- a/reflex/utils/build.py +++ b/reflex/utils/build.py @@ -23,18 +23,6 @@ def set_env_json(): ) -def set_os_env(**kwargs): - """Set os environment variables. - - Args: - kwargs: env key word args. - """ - for key, value in kwargs.items(): - if not value: - continue - os.environ[key.upper()] = value - - def generate_sitemap_config(deploy_url: str, export=False): """Generate the sitemap config file. @@ -61,8 +49,8 @@ def generate_sitemap_config(deploy_url: str, export=False): def _zip( component_name: constants.ComponentName, - target: str, - root_dir: str, + target: str | Path, + root_dir: str | Path, exclude_venv_dirs: bool, upload_db_file: bool = False, dirs_to_exclude: set[str] | None = None, @@ -82,22 +70,22 @@ def _zip( top_level_dirs_to_exclude: The top level directory names immediately under root_dir to exclude. Do not exclude folders by these names further in the sub-directories. """ + target = Path(target) + root_dir = Path(root_dir) dirs_to_exclude = dirs_to_exclude or set() files_to_exclude = files_to_exclude or set() files_to_zip: list[str] = [] # Traverse the root directory in a top-down manner. In this traversal order, # we can modify the dirs list in-place to remove directories we don't want to include. for root, dirs, files in os.walk(root_dir, topdown=True): + root = Path(root) # Modify the dirs in-place so excluded and hidden directories are skipped in next traversal. dirs[:] = [ d for d in dirs - if (basename := os.path.basename(os.path.normpath(d))) - not in dirs_to_exclude + if (basename := Path(d).resolve().name) not in dirs_to_exclude and not basename.startswith(".") - and ( - not exclude_venv_dirs or not _looks_like_venv_dir(os.path.join(root, d)) - ) + and (not exclude_venv_dirs or not _looks_like_venv_dir(root / d)) ] # If we are at the top level with root_dir, exclude the top level dirs. if top_level_dirs_to_exclude and root == root_dir: @@ -109,7 +97,7 @@ def _zip( if not f.startswith(".") and (upload_db_file or not f.endswith(".db")) ] files_to_zip += [ - os.path.join(root, file) for file in files if file not in files_to_exclude + str(root / file) for file in files if file not in files_to_exclude ] # Create a progress bar for zipping the component. @@ -126,13 +114,13 @@ def _zip( for file in files_to_zip: console.debug(f"{target}: {file}", progress=progress) progress.advance(task) - zipf.write(file, os.path.relpath(file, root_dir)) + zipf.write(file, Path(file).relative_to(root_dir)) def zip_app( frontend: bool = True, backend: bool = True, - zip_dest_dir: str = os.getcwd(), + zip_dest_dir: str | Path = Path.cwd(), upload_db_file: bool = False, ): """Zip up the app. @@ -143,6 +131,7 @@ def zip_app( zip_dest_dir: The directory to export the zip file to. upload_db_file: Whether to upload the database file. """ + zip_dest_dir = Path(zip_dest_dir) files_to_exclude = { constants.ComponentName.FRONTEND.zip(), constants.ComponentName.BACKEND.zip(), @@ -151,8 +140,8 @@ def zip_app( if frontend: _zip( component_name=constants.ComponentName.FRONTEND, - target=os.path.join(zip_dest_dir, constants.ComponentName.FRONTEND.zip()), - root_dir=str(prerequisites.get_web_dir() / constants.Dirs.STATIC), + target=zip_dest_dir / constants.ComponentName.FRONTEND.zip(), + root_dir=prerequisites.get_web_dir() / constants.Dirs.STATIC, files_to_exclude=files_to_exclude, exclude_venv_dirs=False, ) @@ -160,8 +149,8 @@ def zip_app( if backend: _zip( component_name=constants.ComponentName.BACKEND, - target=os.path.join(zip_dest_dir, constants.ComponentName.BACKEND.zip()), - root_dir=".", + target=zip_dest_dir / constants.ComponentName.BACKEND.zip(), + root_dir=Path("."), dirs_to_exclude={"__pycache__"}, files_to_exclude=files_to_exclude, top_level_dirs_to_exclude={"assets"}, @@ -236,6 +225,9 @@ def setup_frontend( # Set the environment variables in client (env.json). set_env_json() + # update the last reflex run time. + prerequisites.set_last_reflex_run_time() + # Disable the Next telemetry. if disable_telemetry: processes.new_process( @@ -266,5 +258,6 @@ def setup_frontend_prod( build(deploy_url=get_config().deploy_url) -def _looks_like_venv_dir(dir_to_check: str) -> bool: - return os.path.exists(os.path.join(dir_to_check, "pyvenv.cfg")) +def _looks_like_venv_dir(dir_to_check: str | Path) -> bool: + dir_to_check = Path(dir_to_check) + return (dir_to_check / "pyvenv.cfg").exists() diff --git a/reflex/utils/compat.py b/reflex/utils/compat.py index ef5fcd3e1..e63492a6b 100644 --- a/reflex/utils/compat.py +++ b/reflex/utils/compat.py @@ -19,10 +19,13 @@ async def windows_hot_reload_lifespan_hack(): import asyncio import sys - while True: - sys.stderr.write("\0") - sys.stderr.flush() - await asyncio.sleep(0.5) + try: + while True: + sys.stderr.write("\0") + sys.stderr.flush() + await asyncio.sleep(0.5) + except asyncio.CancelledError: + pass @contextlib.contextmanager @@ -69,3 +72,19 @@ def pydantic_v1_patch(): with pydantic_v1_patch(): import sqlmodel as sqlmodel + + +def sqlmodel_field_has_primary_key(field) -> bool: + """Determines if a field is a priamary. + + Args: + field: a rx.model field + + Returns: + If field is a primary key (Bool) + """ + if getattr(field.field_info, "primary_key", None) is True: + return True + if getattr(field.field_info, "sa_column", None) is None: + return False + return bool(getattr(field.field_info.sa_column, "primary_key", None)) diff --git a/reflex/utils/console.py b/reflex/utils/console.py index 69500b32f..20c699e20 100644 --- a/reflex/utils/console.py +++ b/reflex/utils/console.py @@ -58,7 +58,7 @@ def debug(msg: str, **kwargs): kwargs: Keyword arguments to pass to the print function. """ if is_debug(): - msg_ = f"[blue]Debug: {msg}[/blue]" + msg_ = f"[purple]Debug: {msg}[/purple]" if progress := kwargs.pop("progress", None): progress.console.print(msg_, **kwargs) else: diff --git a/reflex/utils/exceptions.py b/reflex/utils/exceptions.py index 8c1a1f07f..f16338513 100644 --- a/reflex/utils/exceptions.py +++ b/reflex/utils/exceptions.py @@ -5,6 +5,14 @@ class ReflexError(Exception): """Base exception for all Reflex exceptions.""" +class ConfigError(ReflexError): + """Custom exception for config related errors.""" + + +class InvalidStateManagerMode(ReflexError, ValueError): + """Raised when an invalid state manager mode is provided.""" + + class ReflexRuntimeError(ReflexError, RuntimeError): """Custom RuntimeError for Reflex.""" @@ -87,3 +95,51 @@ class EventHandlerArgMismatch(ReflexError, TypeError): class EventFnArgMismatch(ReflexError, TypeError): """Raised when the number of args accepted by a lambda differs from that provided by the event trigger.""" + + +class DynamicRouteArgShadowsStateVar(ReflexError, NameError): + """Raised when a dynamic route arg shadows a state var.""" + + +class ComputedVarShadowsStateVar(ReflexError, NameError): + """Raised when a computed var shadows a state var.""" + + +class ComputedVarShadowsBaseVars(ReflexError, NameError): + """Raised when a computed var shadows a base var.""" + + +class EventHandlerShadowsBuiltInStateMethod(ReflexError, NameError): + """Raised when an event handler shadows a built-in state method.""" + + +class GeneratedCodeHasNoFunctionDefs(ReflexError): + """Raised when refactored code generated with flexgen has no functions defined.""" + + +class PrimitiveUnserializableToJSON(ReflexError, ValueError): + """Raised when a primitive type is unserializable to JSON. Usually with NaN and Infinity.""" + + +class InvalidLifespanTaskType(ReflexError, TypeError): + """Raised when an invalid task type is registered as a lifespan task.""" + + +class DynamicComponentMissingLibrary(ReflexError, ValueError): + """Raised when a dynamic component is missing a library.""" + + +class SetUndefinedStateVarError(ReflexError, AttributeError): + """Raised when setting the value of a var without first declaring it.""" + + +class StateSchemaMismatchError(ReflexError, TypeError): + """Raised when the serialized schema of a state class does not match the current schema.""" + + +class EnvironmentVarValueError(ReflexError, ValueError): + """Raised when an environment variable is set to an invalid value.""" + + +class DynamicComponentInvalidSignature(ReflexError, TypeError): + """Raised when a dynamic component has an invalid signature.""" diff --git a/reflex/utils/exec.py b/reflex/utils/exec.py index 417d6fbe7..bdc9be4ae 100644 --- a/reflex/utils/exec.py +++ b/reflex/utils/exec.py @@ -15,7 +15,8 @@ from urllib.parse import urljoin import psutil from reflex import constants -from reflex.config import get_config +from reflex.config import environment, get_config +from reflex.constants.base import LogLevel from reflex.utils import console, path_ops from reflex.utils.prerequisites import get_web_dir @@ -60,6 +61,13 @@ def kill(proc_pid: int): process.kill() +def notify_backend(): + """Output a string notifying where the backend is running.""" + console.print( + f"Backend running at: [bold green]http://0.0.0.0:{get_config().backend_port}[/bold green]" + ) + + # run_process_and_launch_url is assumed to be used # only to launch the frontend # If this is not the case, might have to change the logic @@ -103,9 +111,7 @@ def run_process_and_launch_url(run_command: list[str], backend_present=True): f"App running at: [bold green]{url}[/bold green]{' (Frontend-only mode)' if not backend_present else ''}" ) if backend_present: - console.print( - f"Backend running at: [bold green]http://0.0.0.0:{get_config().backend_port}[/bold green]" - ) + notify_backend() first_run = False else: console.print("New packages detected: Updating app...") @@ -172,13 +178,69 @@ def run_frontend_prod(root: Path, port: str, backend_present=True): ) +def should_use_granian(): + """Whether to use Granian for backend. + + Returns: + True if Granian should be used. + """ + return environment.REFLEX_USE_GRANIAN + + +def get_app_module(): + """Get the app module for the backend. + + Returns: + The app module for the backend. + """ + return f"reflex.app_module_for_backend:{constants.CompileVars.APP}" + + +def get_granian_target(): + """Get the Granian target for the backend. + + Returns: + The Granian target for the backend. + """ + import reflex + + app_module_path = Path(reflex.__file__).parent / "app_module_for_backend.py" + + return f"{str(app_module_path)}:{constants.CompileVars.APP}.{constants.CompileVars.API}" + + def run_backend( host: str, port: int, loglevel: constants.LogLevel = constants.LogLevel.ERROR, + frontend_present: bool = False, ): """Run the backend. + Args: + host: The app host + port: The app port + loglevel: The log level. + frontend_present: Whether the frontend is present. + """ + web_dir = get_web_dir() + # Create a .nocompile file to skip compile for backend. + if web_dir.exists(): + (web_dir / constants.NOCOMPILE_FILE).touch() + + if not frontend_present: + notify_backend() + + # Run the backend in development mode. + if should_use_granian(): + run_granian_backend(host, port, loglevel) + else: + run_uvicorn_backend(host, port, loglevel) + + +def run_uvicorn_backend(host, port, loglevel: LogLevel): + """Run the backend in development mode using Uvicorn. + Args: host: The app host port: The app port @@ -186,22 +248,55 @@ def run_backend( """ import uvicorn - config = get_config() - app_module = f"reflex.app_module_for_backend:{constants.CompileVars.APP}" - - web_dir = get_web_dir() - # Create a .nocompile file to skip compile for backend. - if web_dir.exists(): - (web_dir / constants.NOCOMPILE_FILE).touch() - - # Run the backend in development mode. uvicorn.run( - app=f"{app_module}.{constants.CompileVars.API}", + app=f"{get_app_module()}.{constants.CompileVars.API}", host=host, port=port, log_level=loglevel.value, reload=True, - reload_dirs=[config.app_name], + reload_dirs=[get_config().app_name], + ) + + +def run_granian_backend(host, port, loglevel: LogLevel): + """Run the backend in development mode using Granian. + + Args: + host: The app host + port: The app port + loglevel: The log level. + """ + console.debug("Using Granian for backend") + try: + from granian import Granian # type: ignore + from granian.constants import Interfaces # type: ignore + from granian.log import LogLevels # type: ignore + + Granian( + target=get_granian_target(), + address=host, + port=port, + interface=Interfaces.ASGI, + log_level=LogLevels(loglevel.value), + reload=True, + reload_paths=[Path(get_config().app_name)], + reload_ignore_dirs=[".web"], + ).serve() + except ImportError: + console.error( + 'InstallError: REFLEX_USE_GRANIAN is set but `granian` is not installed. (run `pip install "granian[reload]>=1.6.0"`)' + ) + os._exit(1) + + +def _get_backend_workers(): + from reflex.utils import processes + + config = get_config() + return ( + processes.get_num_workers() + if not config.gunicorn_workers + else config.gunicorn_workers ) @@ -209,9 +304,28 @@ def run_backend_prod( host: str, port: int, loglevel: constants.LogLevel = constants.LogLevel.ERROR, + frontend_present: bool = False, ): """Run the backend. + Args: + host: The app host + port: The app port + loglevel: The log level. + frontend_present: Whether the frontend is present. + """ + if not frontend_present: + notify_backend() + + if should_use_granian(): + run_granian_backend_prod(host, port, loglevel) + else: + run_uvicorn_backend_prod(host, port, loglevel) + + +def run_uvicorn_backend_prod(host, port, loglevel): + """Run the backend in production mode using Uvicorn. + Args: host: The app host port: The app port @@ -220,14 +334,11 @@ def run_backend_prod( from reflex.utils import processes config = get_config() - num_workers = ( - processes.get_num_workers() - if not config.gunicorn_workers - else config.gunicorn_workers - ) - RUN_BACKEND_PROD = f"gunicorn --worker-class {config.gunicorn_worker_class} --preload --timeout {config.timeout} --log-level critical".split() - RUN_BACKEND_PROD_WINDOWS = f"uvicorn --timeout-keep-alive {config.timeout}".split() - app_module = f"reflex.app_module_for_backend:{constants.CompileVars.APP}" + + app_module = get_app_module() + + RUN_BACKEND_PROD = f"gunicorn --worker-class {config.gunicorn_worker_class} --max-requests {config.gunicorn_max_requests} --max-requests-jitter {config.gunicorn_max_requests_jitter} --preload --timeout {config.timeout} --log-level critical".split() + RUN_BACKEND_PROD_WINDOWS = f"uvicorn --limit-max-requests {config.gunicorn_max_requests} --timeout-keep-alive {config.timeout}".split() command = ( [ *RUN_BACKEND_PROD_WINDOWS, @@ -243,7 +354,7 @@ def run_backend_prod( "--bind", f"{host}:{port}", "--threads", - str(num_workers), + str(_get_backend_workers()), f"{app_module}()", ] ) @@ -252,7 +363,7 @@ def run_backend_prod( "--log-level", loglevel.value, "--workers", - str(num_workers), + str(_get_backend_workers()), ] processes.new_process( command, @@ -262,6 +373,47 @@ def run_backend_prod( ) +def run_granian_backend_prod(host, port, loglevel): + """Run the backend in production mode using Granian. + + Args: + host: The app host + port: The app port + loglevel: The log level. + """ + from reflex.utils import processes + + try: + from granian.constants import Interfaces # type: ignore + + command = [ + "granian", + "--workers", + str(_get_backend_workers()), + "--log-level", + "critical", + "--host", + host, + "--port", + str(port), + "--interface", + str(Interfaces.ASGI), + get_granian_target(), + ] + processes.new_process( + command, + run=True, + show_logs=True, + env={ + constants.SKIP_COMPILE_ENV_VAR: "yes" + }, # skip compile for prod backend + ) + except ImportError: + console.error( + 'InstallError: REFLEX_USE_GRANIAN is set but `granian` is not installed. (run `pip install "granian[reload]>=1.6.0"`)' + ) + + def output_system_info(): """Show system information if the loglevel is in DEBUG.""" if console._LOG_LEVEL > constants.LogLevel.DEBUG: @@ -344,6 +496,24 @@ def is_prod_mode() -> bool: return current_mode == constants.Env.PROD.value +def is_frontend_only() -> bool: + """Check if the app is running in frontend-only mode. + + Returns: + True if the app is running in frontend-only mode. + """ + return os.environ.get(constants.ENV_FRONTEND_ONLY_ENV_VAR, "").lower() == "true" + + +def is_backend_only() -> bool: + """Check if the app is running in backend-only mode. + + Returns: + True if the app is running in backend-only mode. + """ + return os.environ.get(constants.ENV_BACKEND_ONLY_ENV_VAR, "").lower() == "true" + + def should_skip_compile() -> bool: """Whether the app should skip compile. diff --git a/reflex/utils/format.py b/reflex/utils/format.py index e7d85a93e..65c0f049b 100644 --- a/reflex/utils/format.py +++ b/reflex/utils/format.py @@ -9,8 +9,8 @@ import re from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union from reflex import constants -from reflex.utils import exceptions, types -from reflex.vars import BaseVar, Var +from reflex.utils import exceptions +from reflex.utils.console import deprecate if TYPE_CHECKING: from reflex.components.component import ComponentStyle @@ -263,34 +263,6 @@ def format_string(string: str) -> str: return _wrap_js_string(_escape_js_string(string)) -def format_f_string_prop(prop: BaseVar) -> str: - """Format the string in a given prop as an f-string. - - Args: - prop: The prop to format. - - Returns: - The formatted string. - """ - from reflex.ivars.base import VarData - - s = prop._var_full_name - var_data = VarData.merge(prop._get_all_var_data()) - interps = var_data.interpolations if var_data else [] - parts: List[str] = [] - - if interps: - for i, (start, end) in enumerate(interps): - prev_end = interps[i - 1][1] if i > 0 else 0 - parts.append(_escape_js_string(s[prev_end:start])) - parts.append(s[start:end]) - parts.append(_escape_js_string(s[interps[-1][1] :])) - else: - parts.append(_escape_js_string(s)) - - return _wrap_js_string("".join(parts)) - - def format_var(var: Var) -> str: """Format the given Var as a javascript value. @@ -300,13 +272,7 @@ def format_var(var: Var) -> str: Returns: The formatted Var. """ - if not var._var_is_local or var._var_is_string: - return str(var) - if types._issubclass(var._var_type, str): - return format_string(var._var_full_name) - if is_wrapped(var._var_full_name, "{"): - return var._var_full_name - return json_dumps(var._var_full_name) + return str(var) def format_route(route: str, format_case=True) -> str: @@ -331,46 +297,11 @@ def format_route(route: str, format_case=True) -> str: return route -def format_cond( +def format_match( cond: str | Var, - true_value: str | Var, - false_value: str | Var = '""', - is_prop=False, + match_cases: List[List[Var]], + default: Var, ) -> str: - """Format a conditional expression. - - Args: - cond: The cond. - true_value: The value to return if the cond is true. - false_value: The value to return if the cond is false. - is_prop: Whether the cond is a prop - - Returns: - The formatted conditional expression. - """ - # Use Python truthiness. - cond = f"isTrue({cond})" - - def create_var(cond_part): - return Var.create_safe(cond_part, _var_is_string=isinstance(cond_part, str)) - - # Format prop conds. - if is_prop: - true_value = create_var(true_value) - prop1 = true_value._replace( - _var_is_local=True, - ) - - false_value = create_var(false_value) - prop2 = false_value._replace(_var_is_local=True) - # unwrap '{}' to avoid f-string semantics for Var - return f"{cond} ? {prop1._var_name_unwrapped} : {prop2._var_name_unwrapped}" - - # Format component conds. - return wrap(f"{cond} ? {true_value} : {false_value}", "{") - - -def format_match(cond: str | Var, match_cases: List[BaseVar], default: Var) -> str: """Format a match expression whose return type is a Var. Args: @@ -389,17 +320,12 @@ def format_match(cond: str | Var, match_cases: List[BaseVar], default: Var) -> s return_value = case[-1] case_conditions = " ".join( - [ - f"case JSON.stringify({condition._var_name_unwrapped}):" - for condition in conditions - ] - ) - case_code = ( - f"{case_conditions} return ({return_value._var_name_unwrapped}); break;" + [f"case JSON.stringify({str(condition)}):" for condition in conditions] ) + case_code = f"{case_conditions} return ({str(return_value)}); break;" switch_code += case_code - switch_code += f"default: return ({default._var_name_unwrapped}); break;" + switch_code += f"default: return ({str(default)}); break;" switch_code += "};})()" return switch_code @@ -419,39 +345,21 @@ def format_prop( Raises: exceptions.InvalidStylePropError: If the style prop value is not a valid type. TypeError: If the prop is not valid. + ValueError: If the prop is not a string. """ # import here to avoid circular import. from reflex.event import EventChain from reflex.utils import serializers - from reflex.vars import VarData + from reflex.vars import Var try: # Handle var props. if isinstance(prop, Var): - if not prop._var_is_local or prop._var_is_string: - return str(prop) - if isinstance(prop, BaseVar) and types._issubclass(prop._var_type, str): - var_data = VarData.merge(prop._get_all_var_data()) - if var_data and var_data.interpolations: - return format_f_string_prop(prop) - return format_string(prop._var_full_name) - prop = prop._var_full_name + return str(prop) # Handle event props. - elif isinstance(prop, EventChain): - sig = inspect.signature(prop.args_spec) # type: ignore - if sig.parameters: - arg_def = ",".join(f"_{p}" for p in sig.parameters) - arg_def_expr = f"[{arg_def}]" - else: - # add a default argument for addEvents if none were specified in prop.args_spec - # used to trigger the preventDefault() on the event. - arg_def = "...args" - arg_def_expr = "args" - - chain = ",".join([format_event(event) for event in prop.events]) - event = f"addEvents([{chain}], {arg_def_expr}, {json_dumps(prop.event_actions)})" - prop = f"({arg_def}) => {event}" + if isinstance(prop, EventChain): + return str(Var.create(prop)) # Handle other types. elif isinstance(prop, str): @@ -472,7 +380,8 @@ def format_prop( raise TypeError(f"Could not format prop: {prop} of type {type(prop)}") from e # Wrap the variable in braces. - assert isinstance(prop, str), "The prop must be a string." + if not isinstance(prop, str): + raise ValueError(f"Invalid prop: {prop}. Expected a string.") return wrap(prop, "{", check_first=False) @@ -487,26 +396,15 @@ def format_props(*single_props, **key_value_props) -> list[str]: The formatted props list. """ # Format all the props. - from reflex.ivars.base import ImmutableVar, LiteralVar + from reflex.vars.base import LiteralVar, Var return [ ( - f"{name}={format_prop(prop)}" - if isinstance(prop, Var) and not isinstance(prop, ImmutableVar) - else ( - f"{name}={{{format_prop(prop if isinstance(prop, Var) else LiteralVar.create(prop))}}}" - ) + f"{name}={{{format_prop(prop if isinstance(prop, Var) else LiteralVar.create(prop))}}}" ) for name, prop in sorted(key_value_props.items()) if prop is not None - ] + [ - ( - str(prop) - if isinstance(prop, Var) and not isinstance(prop, ImmutableVar) - else f"{{{str(LiteralVar.create(prop))}}}" - ) - for prop in single_props - ] + ] + [(f"{str(LiteralVar.create(prop))}") for prop in single_props] def get_event_handler_parts(handler: EventHandler) -> tuple[str, str]: @@ -567,14 +465,14 @@ def format_event(event_spec: EventSpec) -> str: [ ":".join( ( - name._var_name, + name._js_expr, ( wrap( - json.dumps(val._var_name).strip('"').replace("`", "\\`"), + json.dumps(val._js_expr).strip('"').replace("`", "\\`"), "`", ) if val._var_is_string - else val._var_full_name + else str(val) ), ) ) @@ -591,45 +489,40 @@ def format_event(event_spec: EventSpec) -> str: return f"Event({', '.join(event_args)})" +if TYPE_CHECKING: + from reflex.vars import Var + + def format_event_chain( event_chain: EventChain | Var[EventChain], event_arg: Var | None = None, ) -> str: - """Format an event chain as a javascript invocation. + """DEPRECATED: format an event chain as a javascript invocation. + + Use str(rx.Var.create(event_chain)) instead. Args: - event_chain: The event chain to queue on the frontend. - event_arg: The browser-native event (only used to preventDefault). + event_chain: The event chain to format. + event_arg: this argument is ignored. Returns: Compiled javascript code to queue the given event chain on the frontend. - - Raises: - ValueError: When the given event chain is not a valid event chain. """ - if isinstance(event_chain, Var): - from reflex.event import EventChain - - if event_chain._var_type is not EventChain: - raise ValueError(f"Invalid event chain: {event_chain}") - return "".join( - [ - "(() => {", - format_var(event_chain), - f"; preventDefault({format_var(event_arg)})" if event_arg else "", - "})()", - ] - ) - - chain = ",".join([format_event(event) for event in event_chain.events]) - return "".join( - [ - f"addEvents([{chain}]", - f", {format_var(event_arg)}" if event_arg else "", - ")", - ] + deprecate( + feature_name="format_event_chain", + reason="Use str(rx.Var.create(event_chain)) instead", + deprecation_version="0.6.0", + removal_version="0.7.0", ) + from reflex.vars import Var + from reflex.vars.function import ArgsFunctionOperation + + result = Var.create(event_chain) + if isinstance(result, ArgsFunctionOperation): + result = result._return_expr + return str(result) + def format_queue_events( events: ( @@ -666,10 +559,10 @@ def format_queue_events( call_event_fn, call_event_handler, ) - from reflex.ivars import FunctionVar, ImmutableVar + from reflex.vars import FunctionVar, Var if not events: - return ImmutableVar("(() => null)").to(FunctionVar, EventChain) + return Var("(() => null)").to(FunctionVar, EventChain) # type: ignore # If no spec is provided, the function will take no arguments. def _default_args_spec(): @@ -702,10 +595,10 @@ def format_queue_events( # Return the final code snippet, expecting queueEvents, processEvent, and socket to be in scope. # Typically this snippet will _only_ run from within an rx.call_script eval context. - return ImmutableVar( + return Var( f"{arg_def} => {{queueEvents([{','.join(payloads)}], {constants.CompileVars.SOCKET}); " f"processEvent({constants.CompileVars.SOCKET})}}", - ).to(FunctionVar, EventChain) + ).to(FunctionVar, EventChain) # type: ignore def format_query_params(router_data: dict[str, Any]) -> dict[str, str]: @@ -721,48 +614,6 @@ def format_query_params(router_data: dict[str, Any]) -> dict[str, str]: return {k.replace("-", "_"): v for k, v in params.items()} -def format_state(value: Any, key: Optional[str] = None) -> Any: - """Recursively format values in the given state. - - Args: - value: The state to format. - key: The key associated with the value (optional). - - Returns: - The formatted state. - - Raises: - TypeError: If the given value is not a valid state. - """ - from reflex.utils import serializers - - # Handle dicts. - if isinstance(value, dict): - return {k: format_state(v, k) for k, v in value.items()} - - # Handle lists, sets, typles. - if isinstance(value, types.StateIterBases): - return [format_state(v) for v in value] - - # Return state vars as is. - if isinstance(value, types.StateBases): - return value - - # Serialize the value. - serialized = serializers.serialize(value) - if serialized is not None: - return serialized - - if key is None: - raise TypeError( - f"No JSON serializer found for var {value} of type {type(value)}." - ) - else: - raise TypeError( - f"No JSON serializer found for State Var '{key}' of value {value} of type {type(value)}." - ) - - def format_state_name(state_name: str) -> str: """Format a state name, replacing dots with double underscore. @@ -792,41 +643,6 @@ def format_ref(ref: str) -> str: return f"ref_{clean_ref}" -def format_array_ref(refs: str, idx: Var | None) -> str: - """Format a ref accessed by array. - - Args: - refs : The ref array to access. - idx : The index of the ref in the array. - - Returns: - The formatted ref. - """ - clean_ref = re.sub(r"[^\w]+", "_", refs) - if idx is not None: - # idx._var_is_local = True - return f"refs_{clean_ref}[{str(idx)}]" - return f"refs_{clean_ref}" - - -def format_breadcrumbs(route: str) -> list[tuple[str, str]]: - """Take a route and return a list of tuple for use in breadcrumb. - - Args: - route: The route to transform. - - Returns: - list[tuple[str, str]]: the list of tuples for the breadcrumb. - """ - route_parts = route.lstrip("/").split("/") - - # create and return breadcrumbs - return [ - (part, "/".join(["", *route_parts[: i + 1]])) - for i, part in enumerate(route_parts) - ] - - def format_library_name(library_fullname: str): """Format the name of a library. @@ -836,6 +652,8 @@ def format_library_name(library_fullname: str): Returns: The name without the @version if it was part of the name """ + if library_fullname.startswith("https://"): + return library_fullname lib, at, version = library_fullname.rpartition("@") if not lib: lib = at + version @@ -857,42 +675,6 @@ def json_dumps(obj: Any) -> str: return json.dumps(obj, ensure_ascii=False, default=serializers.serialize) -def unwrap_vars(value: str) -> str: - """Unwrap var values from a JSON string. - - For example, "{var}" will be unwrapped to "var". - - Args: - value: The JSON string to unwrap. - - Returns: - The unwrapped JSON string. - """ - - def unescape_double_quotes_in_var(m: re.Match) -> str: - prefix = m.group(1) or "" - # Since the outer quotes are removed, the inner escaped quotes must be unescaped. - return prefix + re.sub('\\\\"', '"', m.group(2)) - - # This substitution is necessary to unwrap var values. - return ( - re.sub( - pattern=r""" - (?.*?)? # Optional encoded VarData (non-greedy) - {(.*?)} # extract the value between curly braces (non-greedy) - " # match must end with an unescaped double quote - """, - repl=unescape_double_quotes_in_var, - string=value, - flags=re.VERBOSE, - ) - .replace('"`', "`") - .replace('`"', "`") - ) - - def collect_form_dict_names(form_dict: dict[str, Any]) -> dict[str, Any]: """Collapse keys with consecutive suffixes into a single list value. @@ -915,6 +697,23 @@ def collect_form_dict_names(form_dict: dict[str, Any]) -> dict[str, Any]: return collapsed +def format_array_ref(refs: str, idx: Var | None) -> str: + """Format a ref accessed by array. + + Args: + refs : The ref array to access. + idx : The index of the ref in the array. + + Returns: + The formatted ref. + """ + clean_ref = re.sub(r"[^\w]+", "_", refs) + if idx is not None: + # idx._var_is_local = True + return f"refs_{clean_ref}[{str(idx)}]" + return f"refs_{clean_ref}" + + def format_data_editor_column(col: str | dict): """Format a given column into the proper format. @@ -927,6 +726,8 @@ def format_data_editor_column(col: str | dict): Returns: The formatted column. """ + from reflex.vars import Var + if isinstance(col, str): return {"title": col, "id": col.lower(), "type": "str"} @@ -939,7 +740,7 @@ def format_data_editor_column(col: str | dict): col["overlayIcon"] = None return col - if isinstance(col, BaseVar): + if isinstance(col, Var): return col raise ValueError( @@ -956,9 +757,9 @@ def format_data_editor_cell(cell: Any): Returns: The formatted cell. """ - from reflex.ivars.base import ImmutableVar + from reflex.vars.base import Var return { - "kind": ImmutableVar.create("GridCellKind.Text"), + "kind": Var(_js_expr="GridCellKind.Text"), "data": cell, } diff --git a/reflex/utils/imports.py b/reflex/utils/imports.py index d58c2bf3f..8f53ed07a 100644 --- a/reflex/utils/imports.py +++ b/reflex/utils/imports.py @@ -2,10 +2,9 @@ from __future__ import annotations +import dataclasses from collections import defaultdict -from typing import Dict, List, Optional, Tuple, Union - -from reflex.base import Base +from typing import DefaultDict, Dict, List, Optional, Tuple, Union def merge_imports( @@ -19,12 +18,22 @@ def merge_imports( Returns: The merged import dicts. """ - all_imports = defaultdict(list) + all_imports: DefaultDict[str, List[ImportVar]] = defaultdict(list) for import_dict in imports: for lib, fields in ( import_dict if isinstance(import_dict, tuple) else import_dict.items() ): - all_imports[lib].extend(fields) + if isinstance(fields, (list, tuple, set)): + all_imports[lib].extend( + ( + ImportVar(field) if isinstance(field, str) else field + for field in fields + ) + ) + else: + all_imports[lib].append( + ImportVar(fields) if isinstance(fields, str) else fields + ) return all_imports @@ -75,7 +84,8 @@ def collapse_imports( } -class ImportVar(Base): +@dataclasses.dataclass(order=True, frozen=True) +class ImportVar: """An import var.""" # The name of the import tag. @@ -111,73 +121,6 @@ class ImportVar(Base): else: return self.tag or "" - def __lt__(self, other: ImportVar) -> bool: - """Compare two ImportVar objects. - - Args: - other: The other ImportVar object to compare. - - Returns: - Whether this ImportVar object is less than the other. - """ - return ( - self.tag, - self.is_default, - self.alias, - self.install, - self.render, - self.transpile, - ) < ( - other.tag, - other.is_default, - other.alias, - other.install, - other.render, - other.transpile, - ) - - def __eq__(self, other: ImportVar) -> bool: - """Check if two ImportVar objects are equal. - - Args: - other: The other ImportVar object to compare. - - Returns: - Whether the two ImportVar objects are equal. - """ - return ( - self.tag, - self.is_default, - self.alias, - self.install, - self.render, - self.transpile, - ) == ( - other.tag, - other.is_default, - other.alias, - other.install, - other.render, - other.transpile, - ) - - def __hash__(self) -> int: - """Hash the ImportVar object. - - Returns: - The hash of the ImportVar object. - """ - return hash( - ( - self.tag, - self.is_default, - self.alias, - self.install, - self.render, - self.transpile, - ) - ) - ImportTypes = Union[str, ImportVar, List[Union[str, ImportVar]], List[ImportVar]] ImportDict = Dict[str, ImportTypes] diff --git a/reflex/utils/net.py b/reflex/utils/net.py index 83e25559c..2c6f22764 100644 --- a/reflex/utils/net.py +++ b/reflex/utils/net.py @@ -1,9 +1,8 @@ """Helpers for downloading files from the network.""" -import os - import httpx +from ..config import environment from . import console @@ -13,8 +12,7 @@ def _httpx_verify_kwarg() -> bool: Returns: True if SSL verification is enabled, False otherwise """ - ssl_no_verify = os.environ.get("SSL_NO_VERIFY", "").lower() in ["true", "1", "yes"] - return not ssl_no_verify + return not environment.SSL_NO_VERIFY def get(url: str, **kwargs) -> httpx.Response: diff --git a/reflex/utils/path_ops.py b/reflex/utils/path_ops.py index 21065db99..ee93b24cf 100644 --- a/reflex/utils/path_ops.py +++ b/reflex/utils/path_ops.py @@ -9,6 +9,7 @@ import shutil from pathlib import Path from reflex import constants +from reflex.config import environment # Shorthand for join. join = os.linesep.join @@ -129,7 +130,25 @@ def which(program: str | Path) -> str | Path | None: return shutil.which(str(program)) -def get_node_bin_path() -> str | None: +def use_system_node() -> bool: + """Check if the system node should be used. + + Returns: + Whether the system node should be used. + """ + return environment.REFLEX_USE_SYSTEM_NODE + + +def use_system_bun() -> bool: + """Check if the system bun should be used. + + Returns: + Whether the system bun should be used. + """ + return environment.REFLEX_USE_SYSTEM_BUN + + +def get_node_bin_path() -> Path | None: """Get the node binary dir path. Returns: @@ -138,8 +157,8 @@ def get_node_bin_path() -> str | None: bin_path = Path(constants.Node.BIN_PATH) if not bin_path.exists(): str_path = which("node") - return str(Path(str_path).parent.resolve()) if str_path else str_path - return str(bin_path.resolve()) + return Path(str_path).parent.resolve() if str_path else None + return bin_path.resolve() def get_node_path() -> str | None: @@ -149,8 +168,9 @@ def get_node_path() -> str | None: The path to the node binary file. """ node_path = Path(constants.Node.PATH) - if not node_path.exists(): - return str(which("node")) + if use_system_node() or not node_path.exists(): + system_node_path = which("node") + return str(system_node_path) if system_node_path else None return str(node_path) @@ -161,8 +181,9 @@ def get_npm_path() -> str | None: The path to the npm binary file. """ npm_path = Path(constants.Node.NPM_PATH) - if not npm_path.exists(): - return str(which("npm")) + if use_system_node() or not npm_path.exists(): + system_npm_path = which("npm") + return str(system_npm_path) if system_npm_path else None return str(npm_path) @@ -183,7 +204,7 @@ def update_json_file(file_path: str | Path, update_dict: dict[str, int | str]): # Read the existing json object from the file. json_object = {} - if fp.stat().st_size == 0: + if fp.stat().st_size: with open(fp) as f: json_object = json.load(f) diff --git a/reflex/utils/prerequisites.py b/reflex/utils/prerequisites.py index e061207f4..33165af0e 100644 --- a/reflex/utils/prerequisites.py +++ b/reflex/utils/prerequisites.py @@ -2,8 +2,9 @@ from __future__ import annotations +import contextlib +import dataclasses import functools -import glob import importlib import importlib.metadata import json @@ -15,10 +16,9 @@ import shutil import stat import sys import tempfile -import textwrap +import time import zipfile from datetime import datetime -from fileinput import FileInput from pathlib import Path from types import ModuleType from typing import Callable, List, Optional @@ -32,17 +32,18 @@ from redis import exceptions from redis.asyncio import Redis from reflex import constants, model -from reflex.base import Base from reflex.compiler import templates -from reflex.config import Config, get_config +from reflex.config import Config, environment, get_config from reflex.utils import console, net, path_ops, processes +from reflex.utils.exceptions import GeneratedCodeHasNoFunctionDefs from reflex.utils.format import format_library_name -from reflex.utils.registry import _get_best_registry +from reflex.utils.registry import _get_npm_registry CURRENTLY_INSTALLING_NODE = False -class Template(Base): +@dataclasses.dataclass(frozen=True) +class Template: """A template for a Reflex app.""" name: str @@ -51,7 +52,8 @@ class Template(Base): demo_url: str -class CpuInfo(Base): +@dataclasses.dataclass(frozen=True) +class CpuInfo: """Model to save cpu info.""" manufacturer_id: Optional[str] @@ -67,8 +69,19 @@ def get_web_dir() -> Path: Returns: The working directory. """ - workdir = Path(os.getenv("REFLEX_WEB_WORKDIR", constants.Dirs.WEB)) - return workdir + return environment.REFLEX_WEB_WORKDIR + + +def _python_version_check(): + """Emit deprecation warning for deprecated python versions.""" + # Check for end-of-life python versions. + if sys.version_info < (3, 10): + console.deprecate( + feature_name="Support for Python 3.9 and older", + reason="please upgrade to Python 3.10 or newer", + deprecation_version="0.6.0", + removal_version="0.7.0", + ) def check_latest_package_version(package_name: str): @@ -83,15 +96,16 @@ def check_latest_package_version(package_name: str): url = f"https://pypi.org/pypi/{package_name}/json" response = net.get(url) latest_version = response.json()["info"]["version"] - if ( - version.parse(current_version) < version.parse(latest_version) - and not get_or_set_last_reflex_version_check_datetime() - ): - # only show a warning when the host version is outdated and - # the last_version_check_datetime is not set in reflex.json + if get_or_set_last_reflex_version_check_datetime(): + # Versions were already checked and saved in reflex.json, no need to warn again + return + if version.parse(current_version) < version.parse(latest_version): + # Show a warning when the host version is older than PyPI version console.warn( f"Your version ({current_version}) of {package_name} is out of date. Upgrade to {latest_version} with 'pip install {package_name} --upgrade'" ) + # Check for depreacted python versions + _python_version_check() except Exception: pass @@ -116,6 +130,14 @@ def get_or_set_last_reflex_version_check_datetime(): return last_version_check_datetime +def set_last_reflex_run_time(): + """Set the last Reflex run time.""" + path_ops.update_json_file( + get_web_dir() / constants.Reflex.JSON, + {"last_reflex_run_datetime": str(datetime.now())}, + ) + + def check_node_version() -> bool: """Check the version of Node.js. @@ -123,14 +145,9 @@ def check_node_version() -> bool: Whether the version of Node.js is valid. """ current_version = get_node_version() - if current_version: - # Compare the version numbers - return ( - current_version >= version.parse(constants.Node.MIN_VERSION) - if constants.IS_WINDOWS - else current_version == version.parse(constants.Node.VERSION) - ) - return False + return current_version is not None and current_version >= version.parse( + constants.Node.MIN_VERSION + ) def get_node_version() -> version.Version | None: @@ -176,7 +193,7 @@ def get_bun_version() -> version.Version | None: """ try: # Run the bun -v command and capture the output - result = processes.new_process([get_config().bun_path, "-v"], run=True) + result = processes.new_process([str(get_config().bun_path), "-v"], run=True) return version.parse(result.stdout) # type: ignore except FileNotFoundError: return None @@ -201,7 +218,7 @@ def get_install_package_manager() -> str | None: or windows_npm_escape_hatch() ): return get_package_manager() - return get_config().bun_path + return str(get_config().bun_path) def get_package_manager() -> str | None: @@ -232,7 +249,7 @@ def windows_npm_escape_hatch() -> bool: Returns: If the user has set REFLEX_USE_NPM. """ - return os.environ.get("REFLEX_USE_NPM", "").lower() in ["true", "1", "yes"] + return environment.REFLEX_USE_NPM def get_app(reload: bool = False) -> ModuleType: @@ -288,7 +305,7 @@ def get_compiled_app(reload: bool = False, export: bool = False) -> ModuleType: """ app_module = get_app(reload=reload) app = getattr(app_module, constants.CompileVars.APP) - # For py3.8 and py3.9 compatibility when redis is used, we MUST add any decorator pages + # For py3.9 compatibility when redis is used, we MUST add any decorator pages # before compiling the app in a thread to avoid event loop error (REF-2172). app._apply_decorated_pages() app._compile(export=export) @@ -378,9 +395,7 @@ def validate_app_name(app_name: str | None = None) -> str: Raises: Exit: if the app directory name is reflex or if the name is not standard for a python package name. """ - app_name = ( - app_name if app_name else os.getcwd().split(os.path.sep)[-1].replace("-", "_") - ) + app_name = app_name if app_name else Path.cwd().name.replace("-", "_") # Make sure the app is not named "reflex". if app_name.lower() == constants.Reflex.MODULE_NAME: console.error( @@ -414,7 +429,7 @@ def create_config(app_name: str): def initialize_gitignore( - gitignore_file: str = constants.GitIgnore.FILE, + gitignore_file: Path = constants.GitIgnore.FILE, files_to_ignore: set[str] = constants.GitIgnore.DEFAULTS, ): """Initialize the template .gitignore file. @@ -425,9 +440,10 @@ def initialize_gitignore( """ # Combine with the current ignored files. current_ignore: set[str] = set() - if os.path.exists(gitignore_file): - with open(gitignore_file, "r") as f: - current_ignore |= set([line.strip() for line in f.readlines()]) + if gitignore_file.exists(): + current_ignore |= set( + line.strip() for line in gitignore_file.read_text().splitlines() + ) if files_to_ignore == current_ignore: console.debug(f"{gitignore_file} already up to date.") @@ -435,9 +451,11 @@ def initialize_gitignore( files_to_ignore |= current_ignore # Write files to the .gitignore file. - with open(gitignore_file, "w", newline="\n") as f: - console.debug(f"Creating {gitignore_file}") - f.write(f"{(path_ops.join(sorted(files_to_ignore))).lstrip()}\n") + gitignore_file.touch(exist_ok=True) + console.debug(f"Creating {gitignore_file}") + gitignore_file.write_text( + "\n".join(sorted(files_to_ignore)) + "\n", + ) def initialize_requirements_txt(): @@ -530,8 +548,8 @@ def initialize_app_directory( # Rename the template app to the app name. path_ops.mv(template_code_dir_name, app_name) path_ops.mv( - os.path.join(app_name, template_name + constants.Ext.PY), - os.path.join(app_name, app_name + constants.Ext.PY), + Path(app_name) / (template_name + constants.Ext.PY), + Path(app_name) / (app_name + constants.Ext.PY), ) # Fix up the imports. @@ -596,7 +614,7 @@ def initialize_package_json(): code = _compile_package_json() output_path.write_text(code) - best_registry = _get_best_registry() + best_registry = _get_npm_registry() bun_config_path = get_web_dir() / constants.Bun.CONFIG_PATH bun_config_path.write_text( f""" @@ -675,7 +693,7 @@ def _update_next_config( def remove_existing_bun_installation(): """Remove existing bun installation.""" console.debug("Removing existing bun installation.") - if os.path.exists(get_config().bun_path): + if Path(get_config().bun_path).exists(): path_ops.rm(constants.Bun.ROOT_PATH) @@ -715,7 +733,7 @@ def download_and_extract_fnm_zip(): # Download the zip file url = constants.Fnm.INSTALL_URL console.debug(f"Downloading {url}") - fnm_zip_file = os.path.join(constants.Fnm.DIR, f"{constants.Fnm.FILENAME}.zip") + fnm_zip_file = constants.Fnm.DIR / f"{constants.Fnm.FILENAME}.zip" # Function to download and extract the FNM zip release. try: # Download the FNM zip release. @@ -754,7 +772,7 @@ def install_node(): return path_ops.mkdir(constants.Fnm.DIR) - if not os.path.exists(constants.Fnm.EXE): + if not constants.Fnm.EXE.exists(): download_and_extract_fnm_zip() if constants.IS_WINDOWS: @@ -811,7 +829,7 @@ def install_bun(): ) # Skip if bun is already installed. - if os.path.exists(get_config().bun_path) and get_bun_version() == version.parse( + if Path(get_config().bun_path).exists() and get_bun_version() == version.parse( constants.Bun.VERSION ): console.debug("Skipping bun installation as it is already installed.") @@ -826,7 +844,7 @@ def install_bun(): f"irm {constants.Bun.WINDOWS_INSTALL_URL}|iex", ], env={ - "BUN_INSTALL": constants.Bun.ROOT_PATH, + "BUN_INSTALL": str(constants.Bun.ROOT_PATH), "BUN_VERSION": constants.Bun.VERSION, }, shell=True, @@ -842,25 +860,26 @@ def install_bun(): download_and_run( constants.Bun.INSTALL_URL, f"bun-v{constants.Bun.VERSION}", - BUN_INSTALL=constants.Bun.ROOT_PATH, + BUN_INSTALL=str(constants.Bun.ROOT_PATH), ) -def _write_cached_procedure_file(payload: str, cache_file: str): - with open(cache_file, "w") as f: - f.write(payload) +def _write_cached_procedure_file(payload: str, cache_file: str | Path): + cache_file = Path(cache_file) + cache_file.write_text(payload) -def _read_cached_procedure_file(cache_file: str) -> str | None: - if os.path.exists(cache_file): - with open(cache_file, "r") as f: - return f.read() +def _read_cached_procedure_file(cache_file: str | Path) -> str | None: + cache_file = Path(cache_file) + if cache_file.exists(): + return cache_file.read_text() return None -def _clear_cached_procedure_file(cache_file: str): - if os.path.exists(cache_file): - os.remove(cache_file) +def _clear_cached_procedure_file(cache_file: str | Path): + cache_file = Path(cache_file) + if cache_file.exists(): + cache_file.unlink() def cached_procedure(cache_file: str, payload_fn: Callable[..., str]): @@ -961,7 +980,7 @@ def needs_reinit(frontend: bool = True) -> bool: Raises: Exit: If the app is not initialized. """ - if not os.path.exists(constants.Config.FILE): + if not constants.Config.FILE.exists(): console.error( f"[cyan]{constants.Config.FILE}[/cyan] not found. Move to the root folder of your project, or run [bold]{constants.Reflex.MODULE_NAME} init[/bold] to start a new project." ) @@ -972,7 +991,7 @@ def needs_reinit(frontend: bool = True) -> bool: return False # Make sure the .reflex directory exists. - if not os.path.exists(constants.Reflex.DIR): + if not environment.REFLEX_DIR.exists(): return True # Make sure the .web directory exists in frontend mode. @@ -1018,6 +1037,8 @@ def validate_bun(): # if a custom bun path is provided, make sure its valid # This is specific to non-FHS OS bun_path = get_config().bun_path + if path_ops.use_system_bun(): + bun_path = path_ops.which("bun") if bun_path != constants.Bun.DEFAULT_PATH: console.info(f"Using custom Bun path: {bun_path}") bun_version = get_bun_version() @@ -1075,25 +1096,21 @@ def ensure_reflex_installation_id() -> Optional[int]: """ try: initialize_reflex_user_directory() - installation_id_file = os.path.join(constants.Reflex.DIR, "installation_id") + installation_id_file = environment.REFLEX_DIR / "installation_id" installation_id = None - if os.path.exists(installation_id_file): - try: - with open(installation_id_file, "r") as f: - installation_id = int(f.read()) - except Exception: + if installation_id_file.exists(): + with contextlib.suppress(Exception): + installation_id = int(installation_id_file.read_text()) # If anything goes wrong at all... just regenerate. # Like what? Examples: # - file not exists # - file not readable # - content not parseable as an int - pass if installation_id is None: installation_id = random.getrandbits(128) - with open(installation_id_file, "w") as f: - f.write(str(installation_id)) + installation_id_file.write_text(str(installation_id)) # If we get here, installation_id is definitely set return installation_id except Exception as e: @@ -1104,7 +1121,7 @@ def ensure_reflex_installation_id() -> Optional[int]: def initialize_reflex_user_directory(): """Initialize the reflex user directory.""" # Create the reflex directory. - path_ops.mkdir(constants.Reflex.DIR) + path_ops.mkdir(environment.REFLEX_DIR) def initialize_frontend_dependencies(): @@ -1127,7 +1144,7 @@ def check_db_initialized() -> bool: Returns: True if alembic is initialized (or if database is not used). """ - if get_config().db_url is not None and not Path(constants.ALEMBIC_CONFIG).exists(): + if get_config().db_url is not None and not environment.ALEMBIC_CONFIG.exists(): console.error( "Database is not initialized. Run [bold]reflex db init[/bold] first." ) @@ -1137,7 +1154,7 @@ def check_db_initialized() -> bool: def check_schema_up_to_date(): """Check if the sqlmodel metadata matches the current database schema.""" - if get_config().db_url is None or not Path(constants.ALEMBIC_CONFIG).exists(): + if get_config().db_url is None or not environment.ALEMBIC_CONFIG.exists(): return with model.Model.get_db_engine().connect() as connection: try: @@ -1187,50 +1204,6 @@ def prompt_for_template(templates: list[Template]) -> str: return templates[int(template)].name -def migrate_to_reflex(): - """Migration from Pynecone to Reflex.""" - # Check if the old config file exists. - if not os.path.exists(constants.Config.PREVIOUS_FILE): - return - - # Ask the user if they want to migrate. - action = console.ask( - "Pynecone project detected. Automatically upgrade to Reflex?", - choices=["y", "n"], - ) - if action == "n": - return - - # Rename pcconfig to rxconfig. - console.log( - f"[bold]Renaming {constants.Config.PREVIOUS_FILE} to {constants.Config.FILE}" - ) - os.rename(constants.Config.PREVIOUS_FILE, constants.Config.FILE) - - # Find all python files in the app directory. - file_pattern = os.path.join(get_config().app_name, "**/*.py") - file_list = glob.glob(file_pattern, recursive=True) - - # Add the config file to the list of files to be migrated. - file_list.append(constants.Config.FILE) - - # Migrate all files. - updates = { - "Pynecone": "Reflex", - "pynecone as pc": "reflex as rx", - "pynecone.io": "reflex.dev", - "pynecone": "reflex", - "pc.": "rx.", - "pcconfig": "rxconfig", - } - for file_path in file_list: - with FileInput(file_path, inplace=True) as file: - for line in file: - for old, new in updates.items(): - line = line.replace(old, new) - print(line, end="") - - def fetch_app_templates(version: str) -> dict[str, Template]: """Fetch a dict of templates from the templates repo using github API. @@ -1277,11 +1250,16 @@ def fetch_app_templates(version: str) -> dict[str, Template]: ), None, ) - return { - tp["name"]: Template.parse_obj(tp) - for tp in templates_data - if not tp["hidden"] and tp["code_url"] is not None - } + + filtered_templates = {} + for tp in templates_data: + if tp["hidden"] or tp["code_url"] is None: + continue + known_fields = set(f.name for f in dataclasses.fields(Template)) + filtered_templates[tp["name"]] = Template( + **{k: v for k, v in tp.items() if k in known_fields} + ) + return filtered_templates def create_config_init_app_from_remote_template(app_name: str, template_url: str): @@ -1378,7 +1356,7 @@ def initialize_app(app_name: str, template: str | None = None): from reflex.utils import telemetry # Check if the app is already initialized. - if os.path.exists(constants.Config.FILE): + if constants.Config.FILE.exists(): telemetry.send("reinit") return @@ -1435,19 +1413,37 @@ def initialize_main_module_index_from_generation(app_name: str, generation_hash: Args: app_name: The name of the app. generation_hash: The generation hash from reflex.build. + + Raises: + GeneratedCodeHasNoFunctionDefs: If the fetched code has no function definitions + (the refactored reflex code is expected to have at least one root function defined). """ # Download the reflex code for the generation. - resp = net.get( - constants.Templates.REFLEX_BUILD_CODE_URL.format( - generation_hash=generation_hash + url = constants.Templates.REFLEX_BUILD_CODE_URL.format( + generation_hash=generation_hash + ) + resp = net.get(url) + while resp.status_code == httpx.codes.SERVICE_UNAVAILABLE: + console.debug("Waiting for the code to be generated...") + time.sleep(1) + resp = net.get(url) + resp.raise_for_status() + + # Determine the name of the last function, which renders the generated code. + defined_funcs = re.findall(r"def ([a-zA-Z_]+)\(", resp.text) + if not defined_funcs: + raise GeneratedCodeHasNoFunctionDefs( + f"No function definitions found in generated code from {url!r}." ) - ).raise_for_status() + render_func_name = defined_funcs[-1] def replace_content(_match): return "\n".join( [ - "def index() -> rx.Component:", - textwrap.indent("return " + resp.text, " "), + resp.text, + "", + "" "def index() -> rx.Component:", + f" return {render_func_name}()", "", "", ], @@ -1455,13 +1451,20 @@ def initialize_main_module_index_from_generation(app_name: str, generation_hash: main_module_path = Path(app_name, app_name + constants.Ext.PY) main_module_code = main_module_path.read_text() - main_module_path.write_text( - re.sub( - r"def index\(\).*:\n([^\n]\s+.*\n+)+", - replace_content, - main_module_code, - ) + + main_module_code = re.sub( + r"def index\(\).*:\n([^\n]\s+.*\n+)+", + replace_content, + main_module_code, ) + # Make the app use light mode until flexgen enforces the conversion of + # tailwind colors to radix colors. + main_module_code = re.sub( + r"app\s*=\s*rx\.App\(\s*\)", + 'app = rx.App(theme=rx.theme(color_mode="light"))', + main_module_code, + ) + main_module_path.write_text(main_module_code) def format_address_width(address_width) -> int | None: diff --git a/reflex/utils/processes.py b/reflex/utils/processes.py index c435af7d0..a45676c01 100644 --- a/reflex/utils/processes.py +++ b/reflex/utils/processes.py @@ -156,7 +156,7 @@ def new_process(args, run: bool = False, show_logs: bool = False, **kwargs): Raises: Exit: When attempting to run a command with a None value. """ - node_bin_path = path_ops.get_node_bin_path() + node_bin_path = str(path_ops.get_node_bin_path()) if not node_bin_path and not prerequisites.CURRENTLY_INSTALLING_NODE: console.warn( "The path to the Node binary could not be found. Please ensure that Node is properly " @@ -167,7 +167,7 @@ def new_process(args, run: bool = False, show_logs: bool = False, **kwargs): console.error(f"Invalid command: {args}") raise typer.Exit(1) # Add the node bin path to the PATH environment variable. - env = { + env: dict[str, str] = { **os.environ, "PATH": os.pathsep.join( [node_bin_path if node_bin_path else "", os.environ["PATH"]] diff --git a/reflex/utils/pyi_generator.py b/reflex/utils/pyi_generator.py index f96a4c046..1fc17341b 100644 --- a/reflex/utils/pyi_generator.py +++ b/reflex/utils/pyi_generator.py @@ -16,11 +16,11 @@ from itertools import chain from multiprocessing import Pool, cpu_count from pathlib import Path from types import ModuleType, SimpleNamespace -from typing import Any, Callable, Iterable, Type, get_args +from typing import Any, Callable, Iterable, Type, get_args, get_origin from reflex.components.component import Component from reflex.utils import types as rx_types -from reflex.vars import Var +from reflex.vars.base import Var logger = logging.getLogger("pyi_generator") @@ -69,10 +69,10 @@ DEFAULT_TYPING_IMPORTS = { # TODO: fix import ordering and unused imports with ruff later DEFAULT_IMPORTS = { "typing": sorted(DEFAULT_TYPING_IMPORTS), - "reflex.vars": ["Var", "BaseVar", "ComputedVar"], "reflex.components.core.breakpoints": ["Breakpoints"], - "reflex.event": ["EventChain", "EventHandler", "EventSpec"], + "reflex.event": ["EventChain", "EventHandler", "EventSpec", "EventType"], "reflex.style": ["Style"], + "reflex.vars.base": ["Var"], } @@ -150,7 +150,7 @@ def _get_type_hint(value, type_hint_globals, is_optional=True) -> str: if args: inner_container_type_args = ( - [repr(arg) for arg in args] + sorted((repr(arg) for arg in args)) if rx_types.is_literal(value) else [ _get_type_hint(arg, type_hint_globals, is_optional=False) @@ -184,7 +184,7 @@ def _get_type_hint(value, type_hint_globals, is_optional=True) -> str: if arg is not type(None) ] if len(types) > 1: - res = ", ".join(types) + res = ", ".join(sorted(types)) res = f"Union[{res}]" elif isinstance(value, str): ev = eval(value, type_hint_globals) @@ -214,7 +214,9 @@ def _get_type_hint(value, type_hint_globals, is_optional=True) -> str: return res -def _generate_imports(typing_imports: Iterable[str]) -> list[ast.ImportFrom]: +def _generate_imports( + typing_imports: Iterable[str], +) -> list[ast.ImportFrom | ast.Import]: """Generate the import statements for the stub file. Args: @@ -228,6 +230,7 @@ def _generate_imports(typing_imports: Iterable[str]) -> list[ast.ImportFrom]: ast.ImportFrom(module=name, names=[ast.alias(name=val) for val in values]) for name, values in DEFAULT_IMPORTS.items() ], + ast.Import([ast.alias("reflex")]), ] @@ -372,6 +375,64 @@ def _extract_class_props_as_ast_nodes( return kwargs +def type_to_ast(typ, cls: type) -> ast.AST: + """Converts any type annotation into its AST representation. + Handles nested generic types, unions, etc. + + Args: + typ: The type annotation to convert. + cls: The class where the type annotation is used. + + Returns: + The AST representation of the type annotation. + """ + if typ is type(None): + return ast.Name(id="None") + + origin = get_origin(typ) + + # Handle plain types (int, str, custom classes, etc.) + if origin is None: + if hasattr(typ, "__name__"): + if typ.__module__.startswith("reflex."): + typ_parts = typ.__module__.split(".") + cls_parts = cls.__module__.split(".") + + zipped = list(zip(typ_parts, cls_parts, strict=False)) + + if all(a == b for a, b in zipped) and len(typ_parts) == len(cls_parts): + return ast.Name(id=typ.__name__) + + return ast.Name(id=typ.__module__ + "." + typ.__name__) + return ast.Name(id=typ.__name__) + elif hasattr(typ, "_name"): + return ast.Name(id=typ._name) + return ast.Name(id=str(typ)) + + # Get the base type name (List, Dict, Optional, etc.) + base_name = origin._name if hasattr(origin, "_name") else origin.__name__ + + # Get type arguments + args = get_args(typ) + + # Handle empty type arguments + if not args: + return ast.Name(id=base_name) + + # Convert all type arguments recursively + arg_nodes = [type_to_ast(arg, cls) for arg in args] + + # Special case for single-argument types (like List[T] or Optional[T]) + if len(arg_nodes) == 1: + slice_value = arg_nodes[0] + else: + slice_value = ast.Tuple(elts=arg_nodes, ctx=ast.Load()) + + return ast.Subscript( + value=ast.Name(id=base_name), slice=ast.Index(value=slice_value), ctx=ast.Load() + ) + + def _get_parent_imports(func): _imports = {"reflex.vars": ["Var"]} for type_hint in inspect.get_annotations(func).values(): @@ -427,18 +488,85 @@ def _generate_component_create_functiondef( all_props = [arg[0].arg for arg in prop_kwargs] kwargs.extend(prop_kwargs) + def figure_out_return_type(annotation: Any): + if inspect.isclass(annotation) and issubclass(annotation, inspect._empty): + return ast.Name(id="Optional[EventType]") + + if not isinstance(annotation, str) and get_origin(annotation) is tuple: + arguments = get_args(annotation) + + arguments_without_var = [ + get_args(argument)[0] if get_origin(argument) == Var else argument + for argument in arguments + ] + + # Convert each argument type to its AST representation + type_args = [type_to_ast(arg, cls=clz) for arg in arguments_without_var] + + # Join the type arguments with commas for EventType + args_str = ", ".join(ast.unparse(arg) for arg in type_args) + + # Create EventType using the joined string + event_type = ast.Name(id=f"EventType[{args_str}]") + + # Wrap in Optional + optional_type = ast.Subscript( + value=ast.Name(id="Optional"), + slice=ast.Index(value=event_type), + ctx=ast.Load(), + ) + + return ast.Name(id=ast.unparse(optional_type)) + + if isinstance(annotation, str) and annotation.startswith("Tuple["): + inside_of_tuple = annotation.removeprefix("Tuple[").removesuffix("]") + + if inside_of_tuple == "()": + return ast.Name(id="Optional[EventType[[]]]") + + arguments = [""] + + bracket_count = 0 + + for char in inside_of_tuple: + if char == "[": + bracket_count += 1 + elif char == "]": + bracket_count -= 1 + + if char == "," and bracket_count == 0: + arguments.append("") + else: + arguments[-1] += char + + arguments = [argument.strip() for argument in arguments] + + arguments_without_var = [ + argument.removeprefix("Var[").removesuffix("]") + if argument.startswith("Var[") + else argument + for argument in arguments + ] + + return ast.Name( + id=f"Optional[EventType[{', '.join(arguments_without_var)}]]" + ) + return ast.Name(id="Optional[EventType]") + + event_triggers = clz().get_event_triggers() + # event handler kwargs kwargs.extend( ( ast.arg( arg=trigger, - annotation=ast.Name( - id="Optional[Union[EventHandler, EventSpec, list, Callable, Var]]" + annotation=figure_out_return_type( + inspect.signature(event_triggers[trigger]).return_annotation ), ), ast.Constant(value=None), ) - for trigger in sorted(clz().get_event_triggers()) + for trigger in sorted(event_triggers) ) logger.debug(f"Generated {clz.__name__}.create method with {len(kwargs)} kwargs") create_args = ast.arguments( @@ -902,7 +1030,13 @@ class PyiGenerator: # construct the import statement and handle special cases for aliases sub_mod_attrs_imports = [ f"from .{path} import {mod if not isinstance(mod, tuple) else mod[0]} as {mod if not isinstance(mod, tuple) else mod[1]}" - + (" # type: ignore" if mod in pyright_ignore_imports else "") + + ( + " # type: ignore" + if mod in pyright_ignore_imports + else " # noqa" # ignore ruff formatting here for cases like rx.list. + if isinstance(mod, tuple) + else "" + ) for mod, path in sub_mod_attrs.items() ] sub_mod_attrs_imports.append("") diff --git a/reflex/utils/registry.py b/reflex/utils/registry.py index 551292f2d..77c3d31cd 100644 --- a/reflex/utils/registry.py +++ b/reflex/utils/registry.py @@ -2,7 +2,8 @@ import httpx -from reflex.utils import console +from reflex.config import environment +from reflex.utils import console, net def latency(registry: str) -> int: @@ -15,7 +16,7 @@ def latency(registry: str) -> int: int: The latency of the registry in microseconds. """ try: - return httpx.get(registry).elapsed.microseconds + return net.get(registry).elapsed.microseconds except httpx.HTTPError: console.info(f"Failed to connect to {registry}.") return 10_000_000 @@ -34,7 +35,7 @@ def average_latency(registry, attempts: int = 3) -> int: return sum(latency(registry) for _ in range(attempts)) // attempts -def _get_best_registry() -> str: +def get_best_registry() -> str: """Get the best registry based on latency. Returns: @@ -46,3 +47,12 @@ def _get_best_registry() -> str: ] return min(registries, key=average_latency) + + +def _get_npm_registry() -> str: + """Get npm registry. If environment variable is set, use it first. + + Returns: + str: + """ + return environment.NPM_CONFIG_REGISTRY or get_best_registry() diff --git a/reflex/utils/serializers.py b/reflex/utils/serializers.py index 6c36647cc..614257181 100644 --- a/reflex/utils/serializers.py +++ b/reflex/utils/serializers.py @@ -2,9 +2,9 @@ from __future__ import annotations +import dataclasses import functools import json -import types as builtin_types import warnings from datetime import date, datetime, time, timedelta from enum import Enum @@ -12,7 +12,6 @@ from pathlib import Path from typing import ( Any, Callable, - Dict, List, Literal, Optional, @@ -26,11 +25,11 @@ from typing import ( from reflex.base import Base from reflex.constants.colors import Color, format_color -from reflex.utils import exceptions, types +from reflex.utils import types # Mapping from type to a serializer. # The serializer should convert the type to a JSON object. -SerializedType = Union[str, bool, int, float, list, dict] +SerializedType = Union[str, bool, int, float, list, dict, None] Serializer = Callable[[Type], SerializedType] @@ -125,6 +124,9 @@ def serialize( # If there is no serializer, return None. if serializer is None: + if dataclasses.is_dataclass(value) and not isinstance(value, type): + return {k.name: getattr(value, k.name) for k in dataclasses.fields(value)} + if get_type: return None, None return None @@ -213,35 +215,7 @@ def serialize_type(value: type) -> str: @serializer -def serialize_str(value: str) -> str: - """Serialize a string. - - Args: - value: The string to serialize. - - Returns: - The serialized string. - """ - return value - - -@serializer -def serialize_primitive(value: Union[bool, int, float, None]) -> str: - """Serialize a primitive type. - - Args: - value: The number/bool/None to serialize. - - Returns: - The serialized number/bool/None. - """ - from reflex.utils import format - - return format.json_dumps(value) - - -@serializer -def serialize_base(value: Base) -> str: +def serialize_base(value: Base) -> dict: """Serialize a Base instance. Args: @@ -250,61 +224,20 @@ def serialize_base(value: Base) -> str: Returns: The serialized Base. """ - return value.json() + return {k: v for k, v in value.dict().items() if not callable(v)} @serializer -def serialize_list(value: Union[List, Tuple, Set]) -> str: - """Serialize a list to a JSON string. +def serialize_set(value: Set) -> list: + """Serialize a set to a JSON serializable list. Args: - value: The list to serialize. + value: The set to serialize. Returns: The serialized list. """ - from reflex.utils import format - - # Dump the list to a string. - fprop = format.json_dumps(list(value)) - - # Unwrap var values. - return format.unwrap_vars(fprop) - - -@serializer -def serialize_dict(prop: Dict[str, Any]) -> str: - """Serialize a dictionary to a JSON string. - - Args: - prop: The dictionary to serialize. - - Returns: - The serialized dictionary. - - Raises: - InvalidStylePropError: If the style prop is invalid. - """ - # Import here to avoid circular imports. - from reflex.event import EventHandler - from reflex.utils import format - - prop_dict = {} - - for key, value in prop.items(): - if types._issubclass(type(value), Callable): - raise exceptions.InvalidStylePropError( - f"The style prop `{format.to_snake_case(key)}` cannot have " # type: ignore - f"`{value.fn.__qualname__ if isinstance(value, EventHandler) else value.__qualname__ if isinstance(value, builtin_types.FunctionType) else value}`, " - f"an event handler or callable as its value" - ) - prop_dict[key] = value - - # Dump the dict to a string. - fprop = format.json_dumps(prop_dict) - - # Unwrap var values. - return format.unwrap_vars(fprop) + return list(value) @serializer(to=str) diff --git a/reflex/utils/telemetry.py b/reflex/utils/telemetry.py index e027ed81a..9ae165ea2 100644 --- a/reflex/utils/telemetry.py +++ b/reflex/utils/telemetry.py @@ -3,6 +3,7 @@ from __future__ import annotations import asyncio +import dataclasses import multiprocessing import platform import warnings @@ -93,9 +94,7 @@ def _raise_on_missing_project_hash() -> bool: False when compilation should be skipped (i.e. no .web directory is required). Otherwise return True. """ - if should_skip_compile(): - return False - return True + return not should_skip_compile() def _prepare_event(event: str, **kwargs) -> dict: @@ -120,7 +119,7 @@ def _prepare_event(event: str, **kwargs) -> dict: return {} if UTC is None: - # for python 3.8, 3.9 & 3.10 + # for python 3.9 & 3.10 stamp = datetime.utcnow().isoformat() else: # for python 3.11 & 3.12 @@ -144,7 +143,7 @@ def _prepare_event(event: str, **kwargs) -> dict: "python_version": get_python_version(), "cpu_count": get_cpu_count(), "memory": get_memory(), - "cpu_info": dict(cpuinfo) if cpuinfo else {}, + "cpu_info": dataclasses.asdict(cpuinfo) if cpuinfo else {}, **additional_fields, }, "timestamp": stamp, diff --git a/reflex/utils/types.py b/reflex/utils/types.py index 6c21aa679..3d7992011 100644 --- a/reflex/utils/types.py +++ b/reflex/utils/types.py @@ -3,11 +3,13 @@ from __future__ import annotations import contextlib +import dataclasses import inspect import sys import types from functools import cached_property, lru_cache, wraps from typing import ( + TYPE_CHECKING, Any, Callable, ClassVar, @@ -16,6 +18,7 @@ from typing import ( List, Literal, Optional, + Sequence, Tuple, Type, Union, @@ -95,8 +98,22 @@ PrimitiveType = Union[int, float, bool, str, list, dict, set, tuple] StateVar = Union[PrimitiveType, Base, None] StateIterVar = Union[list, set, tuple] -# ArgsSpec = Callable[[Var], list[Var]] -ArgsSpec = Callable +if TYPE_CHECKING: + from reflex.vars.base import Var + + # ArgsSpec = Callable[[Var], list[Var]] + ArgsSpec = ( + Callable[[], Sequence[Var]] + | Callable[[Var], Sequence[Var]] + | Callable[[Var, Var], Sequence[Var]] + | Callable[[Var, Var, Var], Sequence[Var]] + | Callable[[Var, Var, Var, Var], Sequence[Var]] + | Callable[[Var, Var, Var, Var, Var], Sequence[Var]] + | Callable[[Var, Var, Var, Var, Var, Var], Sequence[Var]] + | Callable[[Var, Var, Var, Var, Var, Var, Var], Sequence[Var]] + ) +else: + ArgsSpec = Callable[..., List[Any]] PrimitiveToAnnotation = { @@ -111,6 +128,11 @@ RESERVED_BACKEND_VAR_NAMES = { "_was_touched", } +if sys.version_info >= (3, 11): + from typing import Self as Self +else: + from typing_extensions import Self as Self + class Unset: """A class to represent an unset value. @@ -161,6 +183,26 @@ def is_generic_alias(cls: GenericType) -> bool: return isinstance(cls, GenericAliasTypes) +def unionize(*args: GenericType) -> Type: + """Unionize the types. + + Args: + args: The types to unionize. + + Returns: + The unionized types. + """ + if not args: + return Any + if len(args) == 1: + return args[0] + # We are bisecting the args list here to avoid hitting the recursion limit + # In Python versions >= 3.11, we can simply do `return Union[*args]` + midpoint = len(args) // 2 + first_half, second_half = args[:midpoint], args[midpoint:] + return Union[unionize(*first_half), unionize(*second_half)] + + def is_none(cls: GenericType) -> bool: """Check if a class is None. @@ -199,6 +241,27 @@ def is_literal(cls: GenericType) -> bool: return get_origin(cls) is Literal +def has_args(cls) -> bool: + """Check if the class has generic parameters. + + Args: + cls: The class to check. + + Returns: + Whether the class has generic + """ + if get_args(cls): + return True + + # Check if the class inherits from a generic class (using __orig_bases__) + if hasattr(cls, "__orig_bases__"): + for base in cls.__orig_bases__: + if get_args(base): + return True + + return False + + def is_optional(cls: GenericType) -> bool: """Check if a class is an Optional. @@ -211,6 +274,20 @@ def is_optional(cls: GenericType) -> bool: return is_union(cls) and type(None) in get_args(cls) +def value_inside_optional(cls: GenericType) -> GenericType: + """Get the value inside an Optional type or the original type. + + Args: + cls: The class to check. + + Returns: + The value inside the Optional type or the original type. + """ + if is_union(cls) and len(args := get_args(cls)) >= 2 and type(None) in args: + return unionize(*[arg for arg in args if arg is not type(None)]) + return cls + + def get_property_hint(attr: Any | None) -> GenericType | None: """Check if an attribute is a property and return its type hint. @@ -316,11 +393,9 @@ def get_attribute_access_type(cls: GenericType, name: str) -> GenericType | None return type_ elif is_union(cls): # Check in each arg of the annotation. - for arg in get_args(cls): - type_ = get_attribute_access_type(arg, name) - if type_ is not None: - # Return the first attribute type that is accessible. - return type_ + return unionize( + *(get_attribute_access_type(arg, name) for arg in get_args(cls)) + ) elif isinstance(cls, type): # Bare class if sys.version_info >= (3, 10): @@ -353,7 +428,7 @@ def get_base_class(cls: GenericType) -> Type: if is_literal(cls): # only literals of the same type are supported. arg_type = type(get_args(cls)[0]) - if not all(type(arg) == arg_type for arg in get_args(cls)): + if not all(type(arg) is arg_type for arg in get_args(cls)): raise TypeError("only literals of the same type are supported") return type(get_args(cls)[0]) @@ -475,7 +550,11 @@ def is_valid_var_type(type_: Type) -> bool: if is_union(type_): return all((is_valid_var_type(arg) for arg in get_args(type_))) - return _issubclass(type_, StateVar) or serializers.has_serializer(type_) + return ( + _issubclass(type_, StateVar) + or serializers.has_serializer(type_) + or dataclasses.is_dataclass(type_) + ) def is_backend_base_variable(name: str, cls: Type) -> bool: @@ -500,7 +579,11 @@ def is_backend_base_variable(name: str, cls: Type) -> bool: if name.startswith(f"_{cls.__name__}__"): return False - hints = get_type_hints(cls) + # Extract the namespace of the original module if defined (dynamic substates). + if callable(getattr(cls, "_get_type_hints", None)): + hints = cls._get_type_hints() + else: + hints = get_type_hints(cls) if name in hints: hint = get_origin(hints[name]) if hint == ClassVar: @@ -509,14 +592,14 @@ def is_backend_base_variable(name: str, cls: Type) -> bool: if name in cls.inherited_backend_vars: return False + from reflex.vars.base import is_computed_var + if name in cls.__dict__: value = cls.__dict__[name] - if type(value) == classmethod: + if type(value) is classmethod: return False if callable(value): return False - from reflex.ivars.base import ImmutableComputedVar - from reflex.vars import ComputedVar if isinstance( value, @@ -524,10 +607,8 @@ def is_backend_base_variable(name: str, cls: Type) -> bool: types.FunctionType, property, cached_property, - ComputedVar, - ImmutableComputedVar, ), - ): + ) or is_computed_var(value): return False return True diff --git a/reflex/vars.py b/reflex/vars.py deleted file mode 100644 index 13481b962..000000000 --- a/reflex/vars.py +++ /dev/null @@ -1,2633 +0,0 @@ -"""Define a state var.""" - -from __future__ import annotations - -import contextlib -import dataclasses -import datetime -import dis -import inspect -import json -import random -import re -import string -import sys -from types import CodeType, FunctionType -from typing import ( - TYPE_CHECKING, - Any, - Callable, - Dict, - Iterable, - List, - Literal, - Optional, - Tuple, - Type, - Union, - _GenericAlias, # type: ignore - cast, - get_args, - get_type_hints, -) - -from reflex import constants -from reflex.base import Base -from reflex.utils import console, imports, serializers, types -from reflex.utils.exceptions import ( - VarAttributeError, - VarDependencyError, - VarTypeError, - VarValueError, -) - -# This module used to export ImportVar itself, so we still import it for export here -from reflex.utils.imports import ( - ImmutableParsedImportDict, - ImportDict, - ImportVar, - ParsedImportDict, - parse_imports, -) -from reflex.utils.types import get_origin, override - -if TYPE_CHECKING: - from reflex.state import BaseState - - -# Set of unique variable names. -USED_VARIABLES = set() - -# Supported operators for all types. -ALL_OPS = ["==", "!=", "!==", "===", "&&", "||"] -# Delimiters used between function args or operands. -DELIMITERS = [","] -# Mapping of valid operations for different type combinations. -OPERATION_MAPPING = { - (int, int): { - "+", - "-", - "/", - "//", - "*", - "%", - "**", - ">", - "<", - "<=", - ">=", - "|", - "&", - }, - (int, str): {"*"}, - (int, list): {"*"}, - (str, str): {"+", ">", "<", "<=", ">="}, - (float, float): {"+", "-", "/", "//", "*", "%", "**", ">", "<", "<=", ">="}, - (float, int): {"+", "-", "/", "//", "*", "%", "**", ">", "<", "<=", ">="}, - (list, list): {"+", ">", "<", "<=", ">="}, -} - -# These names were changed in reflex 0.3.0 -REPLACED_NAMES = { - "full_name": "_var_full_name", - "name": "_var_name", - "state": "_var_data.state", - "type_": "_var_type", - "is_local": "_var_is_local", - "is_string": "_var_is_string", - "set_state": "_var_set_state", - "deps": "_deps", -} - -PYTHON_JS_TYPE_MAP = { - (int, float): "number", - (str,): "string", - (bool,): "boolean", - (list, tuple): "Array", - (dict,): "Object", - (None,): "null", -} - - -def get_unique_variable_name() -> str: - """Get a unique variable name. - - Returns: - The unique variable name. - """ - name = "".join([random.choice(string.ascii_lowercase) for _ in range(8)]) - if name not in USED_VARIABLES: - USED_VARIABLES.add(name) - return name - return get_unique_variable_name() - - -class VarData(Base): - """Metadata associated with a Var.""" - - # The name of the enclosing state. - state: str = "" - - # Imports needed to render this var - imports: ParsedImportDict = {} - - # Hooks that need to be present in the component to render this var - hooks: Dict[str, None] = {} - - # Positions of interpolated strings. This is used by the decoder to figure - # out where the interpolations are and only escape the non-interpolated - # segments. - interpolations: List[Tuple[int, int]] = [] - - def __init__( - self, imports: Union[ImportDict, ParsedImportDict] | None = None, **kwargs: Any - ): - """Initialize the var data. - - Args: - imports: The imports needed to render this var. - **kwargs: The var data fields. - """ - if imports: - kwargs["imports"] = parse_imports(imports) - super().__init__(**kwargs) - - @classmethod - def merge(cls, *others: ImmutableVarData | VarData | None) -> VarData | None: - """Merge multiple var data objects. - - Args: - *others: The var data objects to merge. - - Returns: - The merged var data object. - """ - state = "" - _imports = {} - hooks = {} - interpolations = [] - for var_data in others: - if var_data is None: - continue - state = state or var_data.state - _imports = imports.merge_imports(_imports, var_data.imports) - hooks.update( - var_data.hooks - if isinstance(var_data.hooks, dict) - else {k: None for k in var_data.hooks} - ) - interpolations += ( - var_data.interpolations if isinstance(var_data, VarData) else [] - ) - - if state or _imports or hooks or interpolations: - return cls( - state=state, - imports=_imports, - hooks=hooks, - interpolations=interpolations, - ) - return None - - def __bool__(self) -> bool: - """Check if the var data is non-empty. - - Returns: - True if any field is set to a non-default value. - """ - return bool(self.state or self.imports or self.hooks or self.interpolations) - - def __eq__(self, other: Any) -> bool: - """Check if two var data objects are equal. - - Args: - other: The other var data object to compare. - - Returns: - True if all fields are equal and collapsed imports are equal. - """ - if not isinstance(other, VarData): - return False - - # Don't compare interpolations - that's added in by the decoder, and - # not part of the vardata itself. - return ( - self.state == other.state - and self.hooks.keys() == other.hooks.keys() - and imports.collapse_imports(self.imports) - == imports.collapse_imports(other.imports) - ) - - def dict(self) -> dict: - """Convert the var data to a dictionary. - - Returns: - The var data dictionary. - """ - return { - "state": self.state, - "interpolations": list(self.interpolations), - "imports": { - lib: [import_var.dict() for import_var in import_vars] - for lib, import_vars in self.imports.items() - }, - "hooks": self.hooks, - } - - -@dataclasses.dataclass( - eq=True, - frozen=True, -) -class ImmutableVarData: - """Metadata associated with a Var.""" - - # The name of the enclosing state. - state: str = dataclasses.field(default="") - - # Imports needed to render this var - imports: ImmutableParsedImportDict = dataclasses.field(default_factory=tuple) - - # Hooks that need to be present in the component to render this var - hooks: Tuple[str, ...] = dataclasses.field(default_factory=tuple) - - def __init__( - self, - state: str = "", - imports: ImportDict | ParsedImportDict | None = None, - hooks: dict[str, None] | None = None, - ): - """Initialize the var data. - - Args: - state: The name of the enclosing state. - imports: Imports needed to render this var. - hooks: Hooks that need to be present in the component to render this var. - """ - immutable_imports: ImmutableParsedImportDict = tuple( - sorted( - ((k, tuple(sorted(v))) for k, v in parse_imports(imports or {}).items()) - ) - ) - object.__setattr__(self, "state", state) - object.__setattr__(self, "imports", immutable_imports) - object.__setattr__(self, "hooks", tuple(hooks or {})) - - @classmethod - def merge( - cls, *others: ImmutableVarData | VarData | None - ) -> ImmutableVarData | None: - """Merge multiple var data objects. - - Args: - *others: The var data objects to merge. - - Returns: - The merged var data object. - """ - state = "" - _imports = {} - hooks = {} - for var_data in others: - if var_data is None: - continue - state = state or var_data.state - _imports = imports.merge_imports(_imports, var_data.imports) - hooks.update( - var_data.hooks - if isinstance(var_data.hooks, dict) - else {k: None for k in var_data.hooks} - ) - - if state or _imports or hooks: - return ImmutableVarData( - state=state, - imports=_imports, - hooks=hooks, - ) - return None - - def __bool__(self) -> bool: - """Check if the var data is non-empty. - - Returns: - True if any field is set to a non-default value. - """ - return bool(self.state or self.imports or self.hooks) - - def __eq__(self, other: Any) -> bool: - """Check if two var data objects are equal. - - Args: - other: The other var data object to compare. - - Returns: - True if all fields are equal and collapsed imports are equal. - """ - if not isinstance(other, (ImmutableVarData, VarData)): - return False - - # Don't compare interpolations - that's added in by the decoder, and - # not part of the vardata itself. - return ( - self.state == other.state - and self.hooks - == ( - other.hooks - if isinstance(other, ImmutableVarData) - else tuple(other.hooks.keys()) - ) - and imports.collapse_imports(self.imports) - == imports.collapse_imports(other.imports) - ) - - @classmethod - def from_state(cls, state: Type[BaseState] | str) -> ImmutableVarData: - """Set the state of the var. - - Args: - state: The state to set or the full name of the state. - - Returns: - The var with the set state. - """ - from reflex.utils import format - - state_name = state if isinstance(state, str) else state.get_full_name() - new_var_data = ImmutableVarData( - state=state_name, - hooks={ - "const {0} = useContext(StateContexts.{0})".format( - format.format_state_name(state_name) - ): None - }, - imports={ - f"/{constants.Dirs.CONTEXTS_PATH}": [ImportVar(tag="StateContexts")], - "react": [ImportVar(tag="useContext")], - }, - ) - return new_var_data - - -def _decode_var_immutable(value: str) -> tuple[ImmutableVarData | None, str]: - """Decode the state name from a formatted var. - - Args: - value: The value to extract the state name from. - - Returns: - The extracted state name and the value without the state name. - """ - var_datas = [] - if isinstance(value, str): - # fast path if there is no encoded VarData - if constants.REFLEX_VAR_OPENING_TAG not in value: - return None, value - - offset = 0 - - # Initialize some methods for reading json. - var_data_config = VarData().__config__ - - def json_loads(s): - try: - return var_data_config.json_loads(s) - except json.decoder.JSONDecodeError: - return var_data_config.json_loads(var_data_config.json_loads(f'"{s}"')) - - # Find all tags. - while m := _decode_var_pattern.search(value): - start, end = m.span() - value = value[:start] + value[end:] - - serialized_data = m.group(1) - - if serialized_data.isnumeric() or ( - serialized_data[0] == "-" and serialized_data[1:].isnumeric() - ): - # This is a global immutable var. - var = _global_vars[int(serialized_data)] - var_data = var._get_all_var_data() - - if var_data is not None: - realstart = start + offset - - var_datas.append(var_data) - else: - # Read the JSON, pull out the string length, parse the rest as VarData. - data = json_loads(serialized_data) - string_length = data.pop("string_length", None) - var_data = VarData.parse_obj(data) - - # Use string length to compute positions of interpolations. - if string_length is not None: - realstart = start + offset - var_data.interpolations = [(realstart, realstart + string_length)] - - var_datas.append(var_data) - offset += end - start - - return ImmutableVarData.merge(*var_datas) if var_datas else None, value - - -def _encode_var(value: Var) -> str: - """Encode the state name into a formatted var. - - Args: - value: The value to encode the state name into. - - Returns: - The encoded var. - """ - if value._var_data: - from reflex.utils.serializers import serialize - - final_value = str(value) - data = value._var_data.dict() - data["string_length"] = len(final_value) - data_json = value._var_data.__config__.json_dumps(data, default=serialize) - - return ( - f"{constants.REFLEX_VAR_OPENING_TAG}{data_json}{constants.REFLEX_VAR_CLOSING_TAG}" - + final_value - ) - - return str(value) - - -# Compile regex for finding reflex var tags. -_decode_var_pattern_re = ( - rf"{constants.REFLEX_VAR_OPENING_TAG}(.*?){constants.REFLEX_VAR_CLOSING_TAG}" -) -_decode_var_pattern = re.compile(_decode_var_pattern_re, flags=re.DOTALL) - -# Defined global immutable vars. -_global_vars: Dict[int, Var] = {} - - -def _decode_var(value: str) -> tuple[VarData | None, str]: - """Decode the state name from a formatted var. - - Args: - value: The value to extract the state name from. - - Returns: - The extracted state name and the value without the state name. - """ - var_datas = [] - if isinstance(value, str): - # fast path if there is no encoded VarData - if constants.REFLEX_VAR_OPENING_TAG not in value: - return None, value - - offset = 0 - - # Initialize some methods for reading json. - var_data_config = VarData().__config__ - - def json_loads(s): - try: - return var_data_config.json_loads(s) - except json.decoder.JSONDecodeError: - return var_data_config.json_loads(var_data_config.json_loads(f'"{s}"')) - - # Find all tags. - while m := _decode_var_pattern.search(value): - start, end = m.span() - value = value[:start] + value[end:] - - serialized_data = m.group(1) - - if serialized_data.isnumeric() or ( - serialized_data[0] == "-" and serialized_data[1:].isnumeric() - ): - # This is a global immutable var. - var = _global_vars[int(serialized_data)] - var_data = var._var_data - - if var_data is not None: - realstart = start + offset - - var_datas.append(var_data) - else: - # Read the JSON, pull out the string length, parse the rest as VarData. - data = json_loads(serialized_data) - string_length = data.pop("string_length", None) - var_data = VarData.parse_obj(data) - - # Use string length to compute positions of interpolations. - if string_length is not None: - realstart = start + offset - var_data.interpolations = [(realstart, realstart + string_length)] - - var_datas.append(var_data) - offset += end - start - - return VarData.merge(*var_datas) if var_datas else None, value - - -def _extract_var_data(value: Iterable) -> list[VarData | None]: - """Extract the var imports and hooks from an iterable containing a Var. - - Args: - value: The iterable to extract the VarData from - - Returns: - The extracted VarDatas. - """ - from reflex.style import Style - - var_datas = [] - with contextlib.suppress(TypeError): - for sub in value: - if isinstance(sub, Var): - var_datas.append(sub._var_data) - elif not isinstance(sub, str): - # Recurse into dict values. - if hasattr(sub, "values") and callable(sub.values): - var_datas.extend(_extract_var_data(sub.values())) - # Recurse into iterable values (or dict keys). - var_datas.extend(_extract_var_data(sub)) - - # Style objects should already have _var_data. - if isinstance(value, Style): - var_datas.append(value._var_data) - else: - # Recurse when value is a dict itself. - values = getattr(value, "values", None) - if callable(values): - var_datas.extend(_extract_var_data(values())) - return var_datas - - -class Var: - """An abstract var.""" - - # The name of the var. - _var_name: str - - # The type of the var. - _var_type: Type - - # Whether this is a local javascript variable. - _var_is_local: bool - - # Whether the var is a string literal. - _var_is_string: bool - - # _var_full_name should be prefixed with _var_state - _var_full_name_needs_state_prefix: bool - - # Extra metadata associated with the Var - _var_data: Optional[VarData] - - @classmethod - def create( - cls, - value: Any, - _var_is_local: bool = True, - _var_is_string: bool | None = None, - _var_data: Optional[VarData] = None, - ) -> Var | None: - """Create a var from a value. - - Args: - value: The value to create the var from. - _var_is_local: Whether the var is local. - _var_is_string: Whether the var is a string literal. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The var. - - Raises: - VarTypeError: If the value is JSON-unserializable. - """ - from reflex.utils import format - - # Check for none values. - if value is None: - return None - - # If the value is already a var, do nothing. - if isinstance(value, Var): - return value - - # Try to pull the imports and hooks from contained values. - if not isinstance(value, str): - _var_data = VarData.merge(*_extract_var_data(value), _var_data) - - # Try to serialize the value. - type_ = type(value) - if type_ in types.JSONType: - name = value - else: - name, serialized_type = serializers.serialize(value, get_type=True) - if ( - serialized_type is not None - and _var_is_string is None - and issubclass(serialized_type, str) - ): - _var_is_string = True - if name is None: - raise VarTypeError( - f"No JSON serializer found for var {value} of type {type_}." - ) - name = name if isinstance(name, str) else format.json_dumps(name) - - if _var_is_string is None and type_ is str: - console.deprecate( - feature_name=f"Creating a Var ({value}) from a string without specifying _var_is_string", - reason=( - "Specify _var_is_string=False to create a Var that is not a string literal. " - "In the future, creating a Var from a string will be treated as a string literal " - "by default." - ), - deprecation_version="0.5.4", - removal_version="0.6.0", - ) - - return BaseVar( - _var_name=name, - _var_type=type_, - _var_is_local=_var_is_local, - _var_is_string=_var_is_string if _var_is_string is not None else False, - _var_data=_var_data, - ) - - @classmethod - def create_safe( - cls, - value: Any, - _var_is_local: bool = True, - _var_is_string: bool | None = None, - _var_data: Optional[VarData] = None, - ) -> Var: - """Create a var from a value, asserting that it is not None. - - Args: - value: The value to create the var from. - _var_is_local: Whether the var is local. - _var_is_string: Whether the var is a string literal. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The var. - """ - var = cls.create( - value, - _var_is_local=_var_is_local, - _var_is_string=_var_is_string, - _var_data=_var_data, - ) - assert var is not None - return var - - @classmethod - def __class_getitem__(cls, type_: str) -> _GenericAlias: - """Get a typed var. - - Args: - type_: The type of the var. - - Returns: - The var class item. - """ - return _GenericAlias(cls, type_) - - def __post_init__(self) -> None: - """Post-initialize the var.""" - # Decode any inline Var markup and apply it to the instance - _var_data, _var_name = _decode_var(self._var_name) - if _var_data: - self._var_name = _var_name - self._var_data = VarData.merge(self._var_data, _var_data) - - def _replace(self, merge_var_data=None, **kwargs: Any) -> BaseVar: - """Make a copy of this Var with updated fields. - - Args: - merge_var_data: VarData to merge into the existing VarData. - **kwargs: Var fields to update. - - Returns: - A new BaseVar with the updated fields overwriting the corresponding fields in this Var. - - Raises: - TypeError: If kwargs contains keys that are not allowed. - """ - field_values = dict( - _var_name=kwargs.pop("_var_name", self._var_name), - _var_type=kwargs.pop("_var_type", self._var_type), - _var_is_local=kwargs.pop("_var_is_local", self._var_is_local), - _var_is_string=kwargs.pop("_var_is_string", self._var_is_string), - _var_full_name_needs_state_prefix=kwargs.pop( - "_var_full_name_needs_state_prefix", - self._var_full_name_needs_state_prefix, - ), - _var_data=VarData.merge( - kwargs.pop("_var_data", self._var_data), merge_var_data - ), - ) - - if kwargs: - unexpected_kwargs = ", ".join(kwargs.keys()) - raise TypeError(f"Unexpected keyword arguments: {unexpected_kwargs}") - - return BaseVar(**field_values) - - def _decode(self) -> Any: - """Decode Var as a python value. - - Note that Var with state set cannot be decoded python-side and will be - returned as full_name. - - Returns: - The decoded value or the Var name. - """ - if self._var_is_string: - return self._var_name - try: - return json.loads(self._var_name) - except ValueError: - try: - return json.loads(self.json()) - except (ValueError, NotImplementedError): - return self._var_name - - def equals(self, other: Var) -> bool: - """Check if two vars are equal. - - Args: - other: The other var to compare. - - Returns: - Whether the vars are equal. - """ - from reflex.ivars import ImmutableVar - - if isinstance(other, ImmutableVar) or isinstance(self, ImmutableVar): - return ( - self._var_name == other._var_name - and self._var_type == other._var_type - and ImmutableVarData.merge(self._get_all_var_data()) - == ImmutableVarData.merge(other._get_all_var_data()) - ) - - return ( - self._var_name == other._var_name - and self._var_type == other._var_type - and self._var_is_local == other._var_is_local - and self._var_full_name_needs_state_prefix - == other._var_full_name_needs_state_prefix - and self._var_data == other._var_data - ) - - def _merge(self, other) -> Var: - """Merge two or more dicts. - - Args: - other: The other var to merge. - - Returns: - The merged var. - """ - if other is None: - return self._replace() - if not isinstance(other, Var): - other = Var.create(other, _var_is_string=False) - return self._replace( - _var_name=f"{{...{self._var_name}, ...{other._var_name}}}" # type: ignore - ) - - def to_string(self, json: bool = True) -> Var: - """Convert a var to a string. - - Args: - json: Whether to convert to a JSON string. - - Returns: - The stringified var. - """ - fn = "JSON.stringify" if json else "String" - return self.operation(fn=fn, type_=str) - - def to_int(self) -> Var: - """Convert a var to an int. - - Returns: - The parseInt var. - """ - return self.operation(fn="parseInt", type_=int) - - def __hash__(self) -> int: - """Define a hash function for a var. - - Returns: - The hash of the var. - """ - return hash((self._var_name, str(self._var_type))) - - def __str__(self) -> str: - """Wrap the var so it can be used in templates. - - Returns: - The wrapped var, i.e. {state.var}. - """ - from reflex.utils import format - - if self._var_is_local: - console.deprecate( - feature_name="Local Vars", - reason=( - "Setting _var_is_local to True does not have any effect anymore. " - "Use the new ImmutableVar instead." - ), - deprecation_version="0.5.9", - removal_version="0.6.0", - ) - out = self._var_full_name - else: - out = format.wrap(self._var_full_name, "{") - if self._var_is_string: - out = format.format_string(out) - return out - - def __bool__(self) -> bool: - """Raise exception if using Var in a boolean context. - - Raises: - VarTypeError: when attempting to bool-ify the Var. - """ - raise VarTypeError( - f"Cannot convert Var {self._var_full_name!r} to bool for use with `if`, `and`, `or`, and `not`. " - "Instead use `rx.cond` and bitwise operators `&` (and), `|` (or), `~` (invert)." - ) - - def __iter__(self) -> Any: - """Raise exception if using Var in an iterable context. - - Raises: - VarTypeError: when attempting to iterate over the Var. - """ - raise VarTypeError( - f"Cannot iterate over Var {self._var_full_name!r}. Instead use `rx.foreach`." - ) - - def __format__(self, format_spec: str) -> str: - """Format the var into a Javascript equivalent to an f-string. - - Args: - format_spec: The format specifier (Ignored for now). - - Returns: - The formatted var. - """ - # Encode the _var_data into the formatted output for tracking purposes. - str_self = _encode_var(self) - if self._var_is_local: - return str_self - return f"${str_self}" - - def __getitem__(self, i: Any) -> Var: - """Index into a var. - - Args: - i: The index to index into. - - Returns: - The indexed var. - - Raises: - VarTypeError: If the var is not indexable. - """ - from reflex.utils import format - - # Indexing is only supported for strings, lists, tuples, dicts, and dataframes. - if not ( - types._issubclass(self._var_type, Union[List, Dict, Tuple, str]) - or types.is_dataframe(self._var_type) - ): - if self._var_type == Any: - raise VarTypeError( - "Could not index into var of type Any. (If you are trying to index into a state var, " - "add the correct type annotation to the var.)" - ) - raise VarTypeError( - f"Var {self._var_name} of type {self._var_type} does not support indexing." - ) - - # The type of the indexed var. - type_ = Any - - # Convert any vars to local vars. - if isinstance(i, Var): - i = i._replace(_var_is_local=True) - - # Handle list/tuple/str indexing. - if types._issubclass(self._var_type, Union[List, Tuple, str]): - # List/Tuple/String indices must be ints, slices, or vars. - if ( - not isinstance(i, types.get_args(Union[int, slice, Var])) - or isinstance(i, Var) - and not i._var_type == int - ): - raise VarTypeError("Index must be an integer or an integer var.") - - # Handle slices first. - if isinstance(i, slice): - # Get the start and stop indices. - start = i.start or 0 - stop = i.stop or "undefined" - - # Use the slice function. - return self._replace( - _var_name=f"{self._var_name}.slice({start}, {stop})", - _var_is_string=False, - ) - - # Get the type of the indexed var. - if types.is_generic_alias(self._var_type): - index = i if not isinstance(i, Var) else 0 - type_ = types.get_args(self._var_type) - type_ = type_[index % len(type_)] if type_ else Any - elif types._issubclass(self._var_type, str): - type_ = str - - # Use `at` to support negative indices. - return self._replace( - _var_name=f"{self._var_name}.at({i})", - _var_type=type_, - _var_is_string=False, - ) - - # Dictionary / dataframe indexing. - # Tuples are currently not supported as indexes. - if ( - ( - types._issubclass(self._var_type, Dict) - or types.is_dataframe(self._var_type) - ) - and not isinstance(i, types.get_args(Union[int, str, float, Var])) - ) or ( - isinstance(i, Var) - and not types._issubclass( - i._var_type, types.get_args(Union[int, str, float]) - ) - ): - raise VarTypeError( - "Index must be one of the following types: int, str, int or str Var" - ) - # Get the type of the indexed var. - if isinstance(i, str): - i = format.wrap(i, '"') - type_ = ( - types.get_args(self._var_type)[1] - if types.is_generic_alias(self._var_type) - else Any - ) - - # Use normal indexing here. - return self._replace( - _var_name=f"{self._var_name}[{i}]", - _var_type=type_, - _var_is_string=False, - ) - - def __getattribute__(self, name: str) -> Any: - """Get a var attribute. - - Args: - name: The name of the attribute. - - Returns: - The var attribute. - - Raises: - VarAttributeError: If the attribute cannot be found, or if __getattr__ fallback should be used. - """ - try: - var_attribute = super().__getattribute__(name) - if ( - not name.startswith("_") - and name not in Var.__dict__ - and name not in BaseVar.__dict__ - ): - # Check if the attribute should be accessed through the Var instead of - # accessing one of the Var operations - type_ = types.get_attribute_access_type( - super().__getattribute__("_var_type"), name - ) - if type_ is not None: - raise VarAttributeError( - f"{name} is being accessed through the Var." - ) - # Return the attribute as-is. - return var_attribute - except VarAttributeError: - raise # fall back to __getattr__ anyway - - def __getattr__(self, name: str) -> Var: - """Get a var attribute. - - Args: - name: The name of the attribute. - - Returns: - The var attribute. - - Raises: - VarAttributeError: If the var is wrongly annotated or can't find attribute. - VarTypeError: If an annotation to the var isn't provided. - """ - # Check if the attribute is one of the class fields. - if not name.startswith("_"): - if self._var_type == Any: - raise VarTypeError( - f"You must provide an annotation for the state var `{self._var_full_name}`. Annotation cannot be `{self._var_type}`" - ) from None - is_optional = types.is_optional(self._var_type) - type_ = types.get_attribute_access_type(self._var_type, name) - - if type_ is not None: - return self._replace( - _var_name=f"{self._var_name}{'?' if is_optional else ''}.{name}", - _var_type=type_, - ) - - if name in REPLACED_NAMES: - raise VarAttributeError( - f"Field {name!r} was renamed to {REPLACED_NAMES[name]!r}" - ) - - raise VarAttributeError( - f"The State var `{self._var_full_name}` has no attribute '{name}' or may have been annotated " - f"wrongly." - ) - - raise VarAttributeError( - f"The State var has no attribute '{name}' or may have been annotated wrongly.", - ) - - def operation( - self, - op: str = "", - other: Var | None = None, - type_: Type | None = None, - flip: bool = False, - fn: str | None = None, - invoke_fn: bool = False, - ) -> Var: - """Perform an operation on a var. - - Args: - op: The operation to perform. - other: The other var to perform the operation on. - type_: The type of the operation result. - flip: Whether to flip the order of the operation. - fn: A function to apply to the operation. - invoke_fn: Whether to invoke the function. - - Returns: - The operation result. - - Raises: - VarTypeError: If the operation between two operands is invalid. - VarValueError: If flip is set to true and value of operand is not provided - """ - from reflex.utils import format - - if isinstance(other, str): - other = Var.create(json.dumps(other), _var_is_string=False) - else: - other = Var.create(other, _var_is_string=False) - - type_ = type_ or self._var_type - - if other is None and flip: - raise VarValueError( - "flip_operands cannot be set to True if the value of 'other' operand is not provided" - ) - - left_operand, right_operand = (other, self) if flip else (self, other) - - def get_operand_full_name(operand): - # operand vars that are string literals need to be wrapped in back ticks. - return ( - operand._var_name_unwrapped - if operand._var_is_string - and not operand._var_state - and operand._var_is_local - else operand._var_full_name - ) - - if other is not None: - # check if the operation between operands is valid. - if op and not self.is_valid_operation( - types.get_base_class(left_operand._var_type), # type: ignore - types.get_base_class(right_operand._var_type), # type: ignore - op, - ): - raise VarTypeError( - f"Unsupported Operand type(s) for {op}: `{left_operand._var_full_name}` of type {left_operand._var_type.__name__} and `{right_operand._var_full_name}` of type {right_operand._var_type.__name__}" # type: ignore - ) - - left_operand_full_name = get_operand_full_name(left_operand) - right_operand_full_name = get_operand_full_name(right_operand) - - left_operand_full_name = format.wrap(left_operand_full_name, "(") - right_operand_full_name = format.wrap(right_operand_full_name, "(") - - # apply function to operands - if fn is not None: - if invoke_fn: - # invoke the function on left operand. - operation_name = ( - f"{left_operand_full_name}.{fn}({right_operand_full_name})" # type: ignore - ) - else: - # pass the operands as arguments to the function. - operation_name = ( - f"{left_operand_full_name} {op} {right_operand_full_name}" # type: ignore - ) - operation_name = f"{fn}({operation_name})" - else: - # apply operator to operands (left operand right_operand) - operation_name = ( - f"{left_operand_full_name} {op} {right_operand_full_name}" # type: ignore - ) - operation_name = format.wrap(operation_name, "(") - else: - # apply operator to left operand ( left_operand) - operation_name = f"{op}{get_operand_full_name(self)}" - # apply function to operands - if fn is not None: - operation_name = ( - f"{fn}({operation_name})" - if not invoke_fn - else f"{get_operand_full_name(self)}.{fn}()" - ) - - return self._replace( - _var_name=operation_name, - _var_type=type_, - _var_is_string=False, - _var_full_name_needs_state_prefix=False, - merge_var_data=other._var_data if other is not None else None, - ) - - @staticmethod - def is_valid_operation( - operand1_type: Type, operand2_type: Type, operator: str - ) -> bool: - """Check if an operation between two operands is valid. - - Args: - operand1_type: Type of the operand - operand2_type: Type of the second operand - operator: The operator. - - Returns: - Whether operation is valid or not - - """ - if operator in ALL_OPS or operator in DELIMITERS: - return True - - # bools are subclasses of ints - pair = tuple( - sorted( - [ - int if operand1_type == bool else operand1_type, - int if operand2_type == bool else operand2_type, - ], - key=lambda x: x.__name__, - ) - ) - return pair in OPERATION_MAPPING and operator in OPERATION_MAPPING[pair] - - def compare(self, op: str, other: Var) -> Var: - """Compare two vars with inequalities. - - Args: - op: The comparison operator. - other: The other var to compare with. - - Returns: - The comparison result. - """ - return self.operation(op, other, bool) - - def __invert__(self) -> Var: - """Invert a var. - - Returns: - The inverted var. - """ - return self.operation("!", type_=bool) - - def __neg__(self) -> Var: - """Negate a var. - - Returns: - The negated var. - """ - return self.operation(fn="-") - - def __abs__(self) -> Var: - """Get the absolute value of a var. - - Returns: - A var with the absolute value. - """ - return self.operation(fn="Math.abs") - - def length(self) -> Var: - """Get the length of a list var. - - Returns: - A var with the absolute value. - - Raises: - VarTypeError: If the var is not a list. - """ - if not types._issubclass(self._var_type, List): - raise VarTypeError(f"Cannot get length of non-list var {self}.") - return self._replace( - _var_name=f"{self._var_name}.length", - _var_type=int, - _var_is_string=False, - ) - - def _type(self) -> Var: - """Get the type of the Var in Javascript. - - Returns: - A var representing the type check. - """ - return self._replace( - _var_name=f"typeof {self._var_full_name}", - _var_type=str, - _var_is_string=False, - _var_full_name_needs_state_prefix=False, - ) - - def __eq__(self, other: Union[Var, Type]) -> Var: - """Perform an equality comparison. - - Args: - other: The other var to compare with. - - Returns: - A var representing the equality comparison. - """ - for python_types, js_type in PYTHON_JS_TYPE_MAP.items(): - if not isinstance(other, Var) and other in python_types: - return self.compare("===", Var.create(js_type, _var_is_string=True)) # type: ignore - return self.compare("===", other) - - def __ne__(self, other: Union[Var, Type]) -> Var: - """Perform an inequality comparison. - - Args: - other: The other var to compare with. - - Returns: - A var representing the inequality comparison. - """ - for python_types, js_type in PYTHON_JS_TYPE_MAP.items(): - if not isinstance(other, Var) and other in python_types: - return self.compare("!==", Var.create(js_type, _var_is_string=True)) # type: ignore - return self.compare("!==", other) - - def __gt__(self, other: Var) -> Var: - """Perform a greater than comparison. - - Args: - other: The other var to compare with. - - Returns: - A var representing the greater than comparison. - """ - return self.compare(">", other) - - def __ge__(self, other: Var) -> Var: - """Perform a greater than or equal to comparison. - - Args: - other: The other var to compare with. - - Returns: - A var representing the greater than or equal to comparison. - """ - return self.compare(">=", other) - - def __lt__(self, other: Var) -> Var: - """Perform a less than comparison. - - Args: - other: The other var to compare with. - - Returns: - A var representing the less than comparison. - """ - return self.compare("<", other) - - def __le__(self, other: Var) -> Var: - """Perform a less than or equal to comparison. - - Args: - other: The other var to compare with. - - Returns: - A var representing the less than or equal to comparison. - """ - return self.compare("<=", other) - - def __add__(self, other: Var, flip=False) -> Var: - """Add two vars. - - Args: - other: The other var to add. - flip: Whether to flip operands. - - Returns: - A var representing the sum. - """ - other_type = other._var_type if isinstance(other, Var) else type(other) - # For list-list addition, javascript concatenates the content of the lists instead of - # merging the list, and for that reason we use the spread operator available through spreadArraysOrObjects - # utility function - if ( - types.get_base_class(self._var_type) == list - and types.get_base_class(other_type) == list - ): - return self.operation( - ",", other, fn="spreadArraysOrObjects", flip=flip - )._replace( - merge_var_data=VarData( - imports={ - f"/{constants.Dirs.STATE_PATH}": [ - ImportVar(tag="spreadArraysOrObjects") - ] - }, - ), - ) - return self.operation("+", other, flip=flip) - - def __radd__(self, other: Var) -> Var: - """Add two vars. - - Args: - other: The other var to add. - - Returns: - A var representing the sum. - """ - return self.__add__(other=other, flip=True) - - def __sub__(self, other: Var) -> Var: - """Subtract two vars. - - Args: - other: The other var to subtract. - - Returns: - A var representing the difference. - """ - return self.operation("-", other) - - def __rsub__(self, other: Var) -> Var: - """Subtract two vars. - - Args: - other: The other var to subtract. - - Returns: - A var representing the difference. - """ - return self.operation("-", other, flip=True) - - def __mul__(self, other: Var, flip=True) -> Var: - """Multiply two vars. - - Args: - other: The other var to multiply. - flip: Whether to flip operands - - Returns: - A var representing the product. - """ - other_type = other._var_type if isinstance(other, Var) else type(other) - # For str-int multiplication, we use the repeat function. - # i.e "hello" * 2 is equivalent to "hello".repeat(2) in js. - if (types.get_base_class(self._var_type), types.get_base_class(other_type)) in [ - (int, str), - (str, int), - ]: - return self.operation(other=other, fn="repeat", invoke_fn=True) - - # For list-int multiplication, we use the Array function. - # i.e ["hello"] * 2 is equivalent to Array(2).fill().map(() => ["hello"]).flat() in js. - if (types.get_base_class(self._var_type), types.get_base_class(other_type)) in [ - (int, list), - (list, int), - ]: - other_name = other._var_full_name if isinstance(other, Var) else other - name = f"Array({other_name}).fill().map(() => {self._var_full_name}).flat()" - return self._replace( - _var_name=name, - _var_type=str, - _var_is_string=False, - _var_full_name_needs_state_prefix=False, - ) - - return self.operation("*", other) - - def __rmul__(self, other: Var) -> Var: - """Multiply two vars. - - Args: - other: The other var to multiply. - - Returns: - A var representing the product. - """ - return self.__mul__(other=other, flip=True) - - def __pow__(self, other: Var) -> Var: - """Raise a var to a power. - - Args: - other: The power to raise to. - - Returns: - A var representing the power. - """ - return self.operation(",", other, fn="Math.pow") - - def __rpow__(self, other: Var) -> Var: - """Raise a var to a power. - - Args: - other: The power to raise to. - - Returns: - A var representing the power. - """ - return self.operation(",", other, flip=True, fn="Math.pow") - - def __truediv__(self, other: Var) -> Var: - """Divide two vars. - - Args: - other: The other var to divide. - - Returns: - A var representing the quotient. - """ - return self.operation("/", other) - - def __rtruediv__(self, other: Var) -> Var: - """Divide two vars. - - Args: - other: The other var to divide. - - Returns: - A var representing the quotient. - """ - return self.operation("/", other, flip=True) - - def __floordiv__(self, other: Var) -> Var: - """Divide two vars. - - Args: - other: The other var to divide. - - Returns: - A var representing the quotient. - """ - return self.operation("/", other, fn="Math.floor") - - def __mod__(self, other: Var) -> Var: - """Get the remainder of two vars. - - Args: - other: The other var to divide. - - Returns: - A var representing the remainder. - """ - return self.operation("%", other) - - def __rmod__(self, other: Var) -> Var: - """Get the remainder of two vars. - - Args: - other: The other var to divide. - - Returns: - A var representing the remainder. - """ - return self.operation("%", other, flip=True) - - def __and__(self, other: Var) -> Var: - """Perform a logical and. - - Args: - other: The other var to perform the logical AND with. - - Returns: - A var representing the logical AND. - - Note: - This method provides behavior specific to JavaScript, where it returns the JavaScript - equivalent code (using the '&&' operator) of a logical AND operation. - In JavaScript, the - logical OR operator '&&' is used for Boolean logic, and this method emulates that behavior - by returning the equivalent code as a Var instance. - - In Python, logical AND 'and' operates differently, evaluating expressions immediately, making - it challenging to override the behavior entirely. - Therefore, this method leverages the - bitwise AND '__and__' operator for custom JavaScript-like behavior. - - Example: - >>> var1 = Var.create(True) - >>> var2 = Var.create(False) - >>> js_code = var1 & var2 - >>> print(js_code._var_full_name) - '(true && false)' - """ - return self.operation("&&", other, type_=bool) - - def __rand__(self, other: Var) -> Var: - """Perform a logical and. - - Args: - other: The other var to perform the logical AND with. - - Returns: - A var representing the logical AND. - - Note: - This method provides behavior specific to JavaScript, where it returns the JavaScript - equivalent code (using the '&&' operator) of a logical AND operation. - In JavaScript, the - logical OR operator '&&' is used for Boolean logic, and this method emulates that behavior - by returning the equivalent code as a Var instance. - - In Python, logical AND 'and' operates differently, evaluating expressions immediately, making - it challenging to override the behavior entirely. - Therefore, this method leverages the - bitwise AND '__rand__' operator for custom JavaScript-like behavior. - - Example: - >>> var1 = Var.create(True) - >>> var2 = Var.create(False) - >>> js_code = var1 & var2 - >>> print(js_code._var_full_name) - '(false && true)' - """ - return self.operation("&&", other, type_=bool, flip=True) - - def __or__(self, other: Var) -> Var: - """Perform a logical or. - - Args: - other: The other var to perform the logical or with. - - Returns: - A var representing the logical or. - - Note: - This method provides behavior specific to JavaScript, where it returns the JavaScript - equivalent code (using the '||' operator) of a logical OR operation. In JavaScript, the - logical OR operator '||' is used for Boolean logic, and this method emulates that behavior - by returning the equivalent code as a Var instance. - - In Python, logical OR 'or' operates differently, evaluating expressions immediately, making - it challenging to override the behavior entirely. Therefore, this method leverages the - bitwise OR '__or__' operator for custom JavaScript-like behavior. - - Example: - >>> var1 = Var.create(True) - >>> var2 = Var.create(False) - >>> js_code = var1 | var2 - >>> print(js_code._var_full_name) - '(true || false)' - """ - return self.operation("||", other, type_=bool) - - def __ror__(self, other: Var) -> Var: - """Perform a logical or. - - Args: - other: The other var to perform the logical or with. - - Returns: - A var representing the logical or. - - Note: - This method provides behavior specific to JavaScript, where it returns the JavaScript - equivalent code (using the '||' operator) of a logical OR operation. In JavaScript, the - logical OR operator '||' is used for Boolean logic, and this method emulates that behavior - by returning the equivalent code as a Var instance. - - In Python, logical OR 'or' operates differently, evaluating expressions immediately, making - it challenging to override the behavior entirely. Therefore, this method leverages the - bitwise OR '__or__' operator for custom JavaScript-like behavior. - - Example: - >>> var1 = Var.create(True) - >>> var2 = Var.create(False) - >>> js_code = var1 | var2 - >>> print(js_code) - 'false || true' - """ - return self.operation("||", other, type_=bool, flip=True) - - def __contains__(self, _: Any) -> Var: - """Override the 'in' operator to alert the user that it is not supported. - - Raises: - VarTypeError: the operation is not supported - """ - raise VarTypeError( - "'in' operator not supported for Var types, use Var.contains() instead." - ) - - def contains(self, other: Any, field: Union[Var, None] = None) -> Var: - """Check if a var contains the object `other`. - - Args: - other: The object to check. - field: Optionally specify a field to check on both object and the other var. - - Raises: - VarTypeError: If the var is not a valid type: dict, list, tuple or str. - - Returns: - A var representing the contain check. - """ - if not (types._issubclass(self._var_type, Union[dict, list, tuple, str, set])): - raise VarTypeError( - f"Var {self._var_full_name} of type {self._var_type} does not support contains check." - ) - method = ( - "hasOwnProperty" - if types.get_base_class(self._var_type) == dict - else "includes" - ) - if isinstance(other, str): - other = Var.create(json.dumps(other), _var_is_string=True) - elif not isinstance(other, Var): - other = Var.create(other, _var_is_string=False) - if types._issubclass(self._var_type, Dict): - return self._replace( - _var_name=f"{self._var_name}.{method}({other._var_full_name})", - _var_type=bool, - _var_is_string=False, - merge_var_data=other._var_data, - ) - else: # str, list, tuple - # For strings, the left operand must be a string. - if types._issubclass(self._var_type, str) and not types._issubclass( - other._var_type, str - ): - raise VarTypeError( - f"'in ' requires string as left operand, not {other._var_type}" - ) - - _var_name = None - if field is None: - _var_name = f"{self._var_name}.includes({other._var_full_name})" - else: - field = Var.create_safe(field, _var_is_string=isinstance(field, str)) - _var_name = f"{self._var_name}.some(e=>e[{field._var_name_unwrapped}]==={other._var_full_name})" - - return self._replace( - _var_name=_var_name, - _var_type=bool, - _var_is_string=False, - merge_var_data=other._var_data, - ) - - def reverse(self) -> Var: - """Reverse a list var. - - Raises: - VarTypeError: If the var is not a list. - - Returns: - A var with the reversed list. - """ - if not types._issubclass(self._var_type, list): - raise VarTypeError(f"Cannot reverse non-list var {self._var_full_name}.") - - return self._replace( - _var_name=f"[...{self._var_full_name}].reverse()", - _var_is_string=False, - _var_full_name_needs_state_prefix=False, - ) - - def lower(self) -> Var: - """Convert a string var to lowercase. - - Returns: - A var with the lowercase string. - - Raises: - VarTypeError: If the var is not a string. - """ - if not types._issubclass(self._var_type, str): - raise VarTypeError( - f"Cannot convert non-string var {self._var_full_name} to lowercase." - ) - - return self._replace( - _var_name=f"{self._var_name}.toLowerCase()", - _var_is_string=False, - _var_type=str, - ) - - def upper(self) -> Var: - """Convert a string var to uppercase. - - Returns: - A var with the uppercase string. - - Raises: - VarTypeError: If the var is not a string. - """ - if not types._issubclass(self._var_type, str): - raise VarTypeError( - f"Cannot convert non-string var {self._var_full_name} to uppercase." - ) - - return self._replace( - _var_name=f"{self._var_name}.toUpperCase()", - _var_is_string=False, - _var_type=str, - ) - - def strip(self, other: str | Var[str] = " ") -> Var: - """Strip a string var. - - Args: - other: The string to strip the var with. - - Returns: - A var with the stripped string. - - Raises: - VarTypeError: If the var is not a string. - """ - if not types._issubclass(self._var_type, str): - raise VarTypeError(f"Cannot strip non-string var {self._var_full_name}.") - - other = ( - Var.create_safe(json.dumps(other), _var_is_string=False) - if isinstance(other, str) - else other - ) - - return self._replace( - _var_name=f"{self._var_name}.replace(/^${other._var_full_name}|${other._var_full_name}$/g, '')", - _var_is_string=False, - merge_var_data=other._var_data, - ) - - def split(self, other: str | Var[str] = " ") -> Var: - """Split a string var into a list. - - Args: - other: The string to split the var with. - - Returns: - A var with the list. - - Raises: - VarTypeError: If the var is not a string. - """ - if not types._issubclass(self._var_type, str): - raise VarTypeError(f"Cannot split non-string var {self._var_full_name}.") - - other = ( - Var.create_safe(json.dumps(other), _var_is_string=False) - if isinstance(other, str) - else other - ) - - return self._replace( - _var_name=f"{self._var_name}.split({other._var_full_name})", - _var_is_string=False, - _var_type=List[str], - merge_var_data=other._var_data, - ) - - def join(self, other: str | Var[str] | None = None) -> Var: - """Join a list var into a string. - - Args: - other: The string to join the list with. - - Returns: - A var with the string. - - Raises: - VarTypeError: If the var is not a list. - """ - if not types._issubclass(self._var_type, list): - raise VarTypeError(f"Cannot join non-list var {self._var_full_name}.") - - if other is None: - other = Var.create_safe('""', _var_is_string=False) - if isinstance(other, str): - other = Var.create_safe(json.dumps(other), _var_is_string=False) - else: - other = Var.create_safe(other, _var_is_string=False) - - return self._replace( - _var_name=f"{self._var_name}.join({other._var_full_name})", - _var_is_string=False, - _var_type=str, - merge_var_data=other._var_data, - ) - - def foreach(self, fn: Callable) -> Var: - """Return a list of components. after doing a foreach on this var. - - Args: - fn: The function to call on each component. - - Returns: - A var representing foreach operation. - - Raises: - VarTypeError: If the var is not a list. - """ - inner_types = get_args(self._var_type) - if not inner_types: - raise VarTypeError( - f"Cannot foreach over non-sequence var {self._var_full_name} of type {self._var_type}." - ) - arg = BaseVar( - _var_name=get_unique_variable_name(), - _var_type=inner_types[0], - ) - index = BaseVar( - _var_name=get_unique_variable_name(), - _var_type=int, - ) - fn_signature = inspect.signature(fn) - fn_args = (arg, index) - fn_ret = fn(*fn_args[: len(fn_signature.parameters)]) - return self._replace( - _var_name=f"{self._var_full_name}.map(({arg._var_name}, {index._var_name}) => {fn_ret})", - _var_is_string=False, - ) - - @classmethod - def range( - cls, - v1: Var | int = 0, - v2: Var | int | None = None, - step: Var | int | None = None, - ) -> Var: - """Return an iterator over indices from v1 to v2 (or 0 to v1). - - Args: - v1: The start of the range or end of range if v2 is not given. - v2: The end of the range. - step: The number of numbers between each item. - - Returns: - A var representing range operation. - - Raises: - VarTypeError: If the var is not an int. - """ - if not isinstance(v1, Var): - v1 = Var.create_safe(v1) - if v1._var_type != int: - raise VarTypeError(f"Cannot get range on non-int var {v1._var_full_name}.") - if not isinstance(v2, Var): - v2 = Var.create(v2) - if v2 is None: - v2 = Var.create_safe("undefined", _var_is_string=False) - elif v2._var_type != int: - raise VarTypeError(f"Cannot get range on non-int var {v2._var_full_name}.") - - if not isinstance(step, Var): - step = Var.create(step) - if step is None: - step = Var.create_safe(1) - elif step._var_type != int: - raise VarTypeError( - f"Cannot get range on non-int var {step._var_full_name}." - ) - - return BaseVar( - _var_name=f"Array.from(range({v1._var_full_name}, {v2._var_full_name}, {step._var_name}))", - _var_type=List[int], - _var_is_local=False, - _var_data=VarData.merge( - v1._var_data, - v2._var_data, - step._var_data, - VarData( - imports={ - "/utils/helpers/range.js": [ - ImportVar(tag="range", is_default=True), - ], - }, - ), - ), - ) - - def to(self, type_: Type) -> Var: - """Convert the type of the var. - - Args: - type_: The type to convert to. - - Returns: - The converted var. - """ - return self._replace(_var_type=type_) - - def as_ref(self) -> Var: - """Convert the var to a ref. - - Returns: - The var as a ref. - """ - return self._replace( - _var_name=f"refs['{self._var_full_name}']", - _var_is_local=True, - _var_is_string=False, - _var_full_name_needs_state_prefix=False, - merge_var_data=VarData( - imports={ - f"/{constants.Dirs.STATE_PATH}": [imports.ImportVar(tag="refs")], - }, - ), - ) - - @property - def _var_full_name(self) -> str: - """Get the full name of the var. - - Returns: - The full name of the var. - """ - from reflex.utils import format - - if not self._var_full_name_needs_state_prefix: - return self._var_name - return ( - self._var_name - if self._var_data is None or self._var_data.state == "" - else ".".join( - [format.format_state_name(self._var_data.state), self._var_name] - ) - ) - - def _var_set_state(self, state: Type[BaseState] | str) -> Any: - """Set the state of the var. - - Args: - state: The state to set or the full name of the state. - - Returns: - The var with the set state. - """ - from reflex.utils import format - - state_name = state if isinstance(state, str) else state.get_full_name() - new_var_data = VarData( - state=state_name, - hooks={ - "const {0} = useContext(StateContexts.{0})".format( - format.format_state_name(state_name) - ): None - }, - imports={ - f"/{constants.Dirs.CONTEXTS_PATH}": [ImportVar(tag="StateContexts")], - "react": [ImportVar(tag="useContext")], - }, - ) - self._var_data = VarData.merge(self._var_data, new_var_data) - self._var_full_name_needs_state_prefix = True - return self - - @property - def _var_state(self) -> str: - """Compat method for getting the state. - - Returns: - The state name associated with the var. - """ - return self._var_data.state if self._var_data else "" - - def _get_all_var_data(self) -> VarData | None: - """Get all the var data. - - Returns: - The var data. - """ - return self._var_data - - def json(self) -> str: - """Serialize the var to a JSON string. - - Raises: - NotImplementedError: If the method is not implemented. - """ - raise NotImplementedError("Var subclasses must implement the json method.") - - @property - def _var_name_unwrapped(self) -> str: - """Get the var str without wrapping in curly braces. - - Returns: - The str var without the wrapped curly braces - """ - from reflex.style import Style - - generic_alias = types.is_generic_alias(self._var_type) - - type_ = get_origin(self._var_type) if generic_alias else self._var_type - wrapped_var = str(self) - - return ( - wrapped_var - if not self._var_state - and not generic_alias - and (types._issubclass(type_, dict) or types._issubclass(type_, Style)) - else wrapped_var.strip("{}") - ) - - -# Allow automatic serialization of Var within JSON structures -serializers.serializer(_encode_var) - - -@dataclasses.dataclass( - eq=False, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class BaseVar(Var): - """A base (non-computed) var of the app state.""" - - # The name of the var. - _var_name: str = dataclasses.field() - - # The type of the var. - _var_type: Type = dataclasses.field(default=Any) - - # Whether this is a local javascript variable. - _var_is_local: bool = dataclasses.field(default=False) - - # Whether the var is a string literal. - _var_is_string: bool = dataclasses.field(default=False) - - # _var_full_name should be prefixed with _var_state - _var_full_name_needs_state_prefix: bool = dataclasses.field(default=False) - - # Extra metadata associated with the Var - _var_data: Optional[VarData] = dataclasses.field(default=None) - - def __hash__(self) -> int: - """Define a hash function for a var. - - Returns: - The hash of the var. - """ - return hash((self._var_name, str(self._var_type))) - - def get_default_value(self) -> Any: - """Get the default value of the var. - - Returns: - The default value of the var. - - Raises: - ImportError: If the var is a dataframe and pandas is not installed. - """ - if types.is_optional(self._var_type): - return None - - type_ = ( - get_origin(self._var_type) - if types.is_generic_alias(self._var_type) - else self._var_type - ) - if type_ is Literal: - args = get_args(self._var_type) - return args[0] if args else None - if issubclass(type_, str): - return "" - if issubclass(type_, types.get_args(Union[int, float])): - return 0 - if issubclass(type_, bool): - return False - if issubclass(type_, list): - return [] - if issubclass(type_, dict): - return {} - if issubclass(type_, tuple): - return () - if types.is_dataframe(type_): - try: - import pandas as pd - - return pd.DataFrame() - except ImportError as e: - raise ImportError( - "Please install pandas to use dataframes in your app." - ) from e - return set() if issubclass(type_, set) else None - - def get_setter_name(self, include_state: bool = True) -> str: - """Get the name of the var's generated setter function. - - Args: - include_state: Whether to include the state name in the setter name. - - Returns: - The name of the setter function. - """ - setter = constants.SETTER_PREFIX + self._var_name - if self._var_data is None: - return setter - if not include_state or self._var_data.state == "": - return setter - return ".".join((self._var_data.state, setter)) - - def get_setter(self) -> Callable[[BaseState, Any], None]: - """Get the var's setter function. - - Returns: - A function that that creates a setter for the var. - """ - - def setter(state: BaseState, value: Any): - """Get the setter for the var. - - Args: - state: The state within which we add the setter function. - value: The value to set. - """ - if self._var_type in [int, float]: - try: - value = self._var_type(value) - setattr(state, self._var_name, value) - except ValueError: - console.debug( - f"{type(state).__name__}.{self._var_name}: Failed conversion of {value} to '{self._var_type.__name__}'. Value not set.", - ) - else: - setattr(state, self._var_name, value) - - setter.__qualname__ = self.get_setter_name() - - return setter - - -@dataclasses.dataclass(init=False, eq=False) -class ComputedVar(Var, property): - """A field with computed getters.""" - - # Whether to track dependencies and cache computed values - _cache: bool = dataclasses.field(default=False) - - # Whether the computed var is a backend var - _backend: bool = dataclasses.field(default=False) - - # The initial value of the computed var - _initial_value: Any | types.Unset = dataclasses.field(default=types.Unset()) - - # Explicit var dependencies to track - _static_deps: set[str] = dataclasses.field(default_factory=set) - - # Whether var dependencies should be auto-determined - _auto_deps: bool = dataclasses.field(default=True) - - # Interval at which the computed var should be updated - _update_interval: Optional[datetime.timedelta] = dataclasses.field(default=None) - - # The name of the var. - _var_name: str = dataclasses.field() - - # The type of the var. - _var_type: Type = dataclasses.field(default=Any) - - # Whether this is a local javascript variable. - _var_is_local: bool = dataclasses.field(default=False) - - # Whether the var is a string literal. - _var_is_string: bool = dataclasses.field(default=False) - - # _var_full_name should be prefixed with _var_state - _var_full_name_needs_state_prefix: bool = dataclasses.field(default=False) - - # Extra metadata associated with the Var - _var_data: Optional[VarData] = dataclasses.field(default=None) - - def __init__( - self, - fget: Callable[[BaseState], Any], - initial_value: Any | types.Unset = types.Unset(), - cache: bool = False, - deps: Optional[List[Union[str, Var]]] = None, - auto_deps: bool = True, - interval: Optional[Union[int, datetime.timedelta]] = None, - backend: bool | None = None, - **kwargs, - ): - """Initialize a ComputedVar. - - Args: - fget: The getter function. - initial_value: The initial value of the computed var. - cache: Whether to cache the computed value. - deps: Explicit var dependencies to track. - auto_deps: Whether var dependencies should be auto-determined. - interval: Interval at which the computed var should be updated. - backend: Whether the computed var is a backend var. - **kwargs: additional attributes to set on the instance - - Raises: - TypeError: If the computed var dependencies are not Var instances or var names. - """ - if backend is None: - backend = fget.__name__.startswith("_") - self._backend = backend - - self._initial_value = initial_value - self._cache = cache - if isinstance(interval, int): - interval = datetime.timedelta(seconds=interval) - self._update_interval = interval - if deps is None: - deps = [] - else: - for dep in deps: - if isinstance(dep, Var): - continue - if isinstance(dep, str) and dep != "": - continue - raise TypeError( - "ComputedVar dependencies must be Var instances or var names (non-empty strings)." - ) - self._static_deps = { - dep._var_name if isinstance(dep, Var) else dep for dep in deps - } - self._auto_deps = auto_deps - property.__init__(self, fget) - kwargs["_var_name"] = kwargs.pop("_var_name", fget.__name__) - kwargs["_var_type"] = kwargs.pop("_var_type", self._determine_var_type()) - BaseVar.__init__(self, **kwargs) # type: ignore - - @override - def _replace(self, merge_var_data=None, **kwargs: Any) -> ComputedVar: - """Replace the attributes of the ComputedVar. - - Args: - merge_var_data: VarData to merge into the existing VarData. - **kwargs: Var fields to update. - - Returns: - The new ComputedVar instance. - - Raises: - TypeError: If kwargs contains keys that are not allowed. - """ - field_values = dict( - fget=kwargs.pop("fget", self.fget), - initial_value=kwargs.pop("initial_value", self._initial_value), - cache=kwargs.pop("cache", self._cache), - deps=kwargs.pop("deps", self._static_deps), - auto_deps=kwargs.pop("auto_deps", self._auto_deps), - interval=kwargs.pop("interval", self._update_interval), - backend=kwargs.pop("backend", self._backend), - _var_name=kwargs.pop("_var_name", self._var_name), - _var_type=kwargs.pop("_var_type", self._var_type), - _var_is_local=kwargs.pop("_var_is_local", self._var_is_local), - _var_is_string=kwargs.pop("_var_is_string", self._var_is_string), - _var_full_name_needs_state_prefix=kwargs.pop( - "_var_full_name_needs_state_prefix", - self._var_full_name_needs_state_prefix, - ), - _var_data=VarData.merge(self._var_data, merge_var_data), - ) - - if kwargs: - unexpected_kwargs = ", ".join(kwargs.keys()) - raise TypeError(f"Unexpected keyword arguments: {unexpected_kwargs}") - - return ComputedVar(**field_values) - - @property - def _cache_attr(self) -> str: - """Get the attribute used to cache the value on the instance. - - Returns: - An attribute name. - """ - return f"__cached_{self._var_name}" - - @property - def _last_updated_attr(self) -> str: - """Get the attribute used to store the last updated timestamp. - - Returns: - An attribute name. - """ - return f"__last_updated_{self._var_name}" - - def needs_update(self, instance: BaseState) -> bool: - """Check if the computed var needs to be updated. - - Args: - instance: The state instance that the computed var is attached to. - - Returns: - True if the computed var needs to be updated, False otherwise. - """ - if self._update_interval is None: - return False - last_updated = getattr(instance, self._last_updated_attr, None) - if last_updated is None: - return True - return datetime.datetime.now() - last_updated > self._update_interval - - def __get__(self, instance: BaseState | None, owner): - """Get the ComputedVar value. - - If the value is already cached on the instance, return the cached value. - - Args: - instance: the instance of the class accessing this computed var. - owner: the class that this descriptor is attached to. - - Returns: - The value of the var for the given instance. - """ - if instance is None or not self._cache: - return super().__get__(instance, owner) - - # handle caching - if not hasattr(instance, self._cache_attr) or self.needs_update(instance): - # Set cache attr on state instance. - setattr(instance, self._cache_attr, super().__get__(instance, owner)) - # Ensure the computed var gets serialized to redis. - instance._was_touched = True - # Set the last updated timestamp on the state instance. - setattr(instance, self._last_updated_attr, datetime.datetime.now()) - return getattr(instance, self._cache_attr) - - def _deps( - self, - objclass: Type, - obj: FunctionType | CodeType | None = None, - self_name: Optional[str] = None, - ) -> set[str]: - """Determine var dependencies of this ComputedVar. - - Save references to attributes accessed on "self". Recursively called - when the function makes a method call on "self" or define comprehensions - or nested functions that may reference "self". - - Args: - objclass: the class obj this ComputedVar is attached to. - obj: the object to disassemble (defaults to the fget function). - self_name: if specified, look for this name in LOAD_FAST and LOAD_DEREF instructions. - - Returns: - A set of variable names accessed by the given obj. - - Raises: - VarValueError: if the function references the get_state, parent_state, or substates attributes - (cannot track deps in a related state, only implicitly via parent state). - """ - if not self._auto_deps: - return self._static_deps - d = self._static_deps.copy() - if obj is None: - fget = property.__getattribute__(self, "fget") - if fget is not None: - obj = cast(FunctionType, fget) - else: - return set() - with contextlib.suppress(AttributeError): - # unbox functools.partial - obj = cast(FunctionType, obj.func) # type: ignore - with contextlib.suppress(AttributeError): - # unbox EventHandler - obj = cast(FunctionType, obj.fn) # type: ignore - - if self_name is None and isinstance(obj, FunctionType): - try: - # the first argument to the function is the name of "self" arg - self_name = obj.__code__.co_varnames[0] - except (AttributeError, IndexError): - self_name = None - if self_name is None: - # cannot reference attributes on self if method takes no args - return set() - - invalid_names = ["get_state", "parent_state", "substates", "get_substate"] - self_is_top_of_stack = False - for instruction in dis.get_instructions(obj): - if ( - instruction.opname in ("LOAD_FAST", "LOAD_DEREF") - and instruction.argval == self_name - ): - # bytecode loaded the class instance to the top of stack, next load instruction - # is referencing an attribute on self - self_is_top_of_stack = True - continue - if self_is_top_of_stack and instruction.opname in ( - "LOAD_ATTR", - "LOAD_METHOD", - ): - try: - ref_obj = getattr(objclass, instruction.argval) - except Exception: - ref_obj = None - if instruction.argval in invalid_names: - raise VarValueError( - f"Cached var {self._var_full_name} cannot access arbitrary state via `{instruction.argval}`." - ) - if callable(ref_obj): - # recurse into callable attributes - d.update( - self._deps( - objclass=objclass, - obj=ref_obj, - ) - ) - # recurse into property fget functions - elif isinstance(ref_obj, property) and not isinstance( - ref_obj, ComputedVar - ): - d.update( - self._deps( - objclass=objclass, - obj=ref_obj.fget, # type: ignore - ) - ) - elif ( - instruction.argval in objclass.backend_vars - or instruction.argval in objclass.vars - ): - # var access - d.add(instruction.argval) - elif instruction.opname == "LOAD_CONST" and isinstance( - instruction.argval, CodeType - ): - # recurse into nested functions / comprehensions, which can reference - # instance attributes from the outer scope - d.update( - self._deps( - objclass=objclass, - obj=instruction.argval, - self_name=self_name, - ) - ) - self_is_top_of_stack = False - return d - - def mark_dirty(self, instance) -> None: - """Mark this ComputedVar as dirty. - - Args: - instance: the state instance that needs to recompute the value. - """ - with contextlib.suppress(AttributeError): - delattr(instance, self._cache_attr) - - def _determine_var_type(self) -> Type: - """Get the type of the var. - - Returns: - The type of the var. - """ - hints = get_type_hints(property.__getattribute__(self, "fget")) - if "return" in hints: - return hints["return"] - return Any - - -def computed_var( - fget: Callable[[BaseState], Any] | None = None, - initial_value: Any | types.Unset = types.Unset(), - cache: bool = False, - deps: Optional[List[Union[str, Var]]] = None, - auto_deps: bool = True, - interval: Optional[Union[datetime.timedelta, int]] = None, - backend: bool | None = None, - **kwargs, -) -> ComputedVar | Callable[[Callable[[BaseState], Any]], ComputedVar]: - """A ComputedVar decorator with or without kwargs. - - Args: - fget: The getter function. - initial_value: The initial value of the computed var. - cache: Whether to cache the computed value. - deps: Explicit var dependencies to track. - auto_deps: Whether var dependencies should be auto-determined. - interval: Interval at which the computed var should be updated. - backend: Whether the computed var is a backend var. - **kwargs: additional attributes to set on the instance - - Returns: - A ComputedVar instance. - - Raises: - ValueError: If caching is disabled and an update interval is set. - VarDependencyError: If user supplies dependencies without caching. - """ - if cache is False and interval is not None: - raise ValueError("Cannot set update interval without caching.") - - if cache is False and (deps is not None or auto_deps is False): - raise VarDependencyError("Cannot track dependencies without caching.") - - if fget is not None: - return ComputedVar(fget=fget, cache=cache) - - def wrapper(fget: Callable[[BaseState], Any]) -> ComputedVar: - return ComputedVar( - fget=fget, - initial_value=initial_value, - cache=cache, - deps=deps, - auto_deps=auto_deps, - interval=interval, - backend=backend, - **kwargs, - ) - - return wrapper - - -class CallableVar(BaseVar): - """Decorate a Var-returning function to act as both a Var and a function. - - This is used as a compatibility shim for replacing Var objects in the - API with functions that return a family of Var. - """ - - def __init__(self, fn: Callable[..., BaseVar]): - """Initialize a CallableVar. - - Args: - fn: The function to decorate (must return Var) - """ - self.fn = fn - default_var = fn() - super().__init__(**dataclasses.asdict(default_var)) - - def __call__(self, *args, **kwargs) -> BaseVar: - """Call the decorated function. - - Args: - *args: The args to pass to the function. - **kwargs: The kwargs to pass to the function. - - Returns: - The Var returned from calling the function. - """ - return self.fn(*args, **kwargs) - - -def get_uuid_string_var() -> Var: - """Return a Var that generates a single memoized UUID via .web/utils/state.js. - - useMemo with an empty dependency array ensures that the generated UUID is - consistent across re-renders of the component. - - Returns: - A Var that generates a UUID at runtime. - """ - from reflex.utils.imports import ImportVar - - unique_uuid_var = get_unique_variable_name() - unique_uuid_var_data = VarData( - imports={ - f"/{constants.Dirs.STATE_PATH}": {ImportVar(tag="generateUUID")}, # type: ignore - "react": "useMemo", - }, - hooks={f"const {unique_uuid_var} = useMemo(generateUUID, [])": None}, - ) - - return BaseVar( - _var_name=unique_uuid_var, - _var_type=str, - _var_data=unique_uuid_var_data, - ) diff --git a/reflex/vars.pyi b/reflex/vars.pyi deleted file mode 100644 index 8c923f03e..000000000 --- a/reflex/vars.pyi +++ /dev/null @@ -1,221 +0,0 @@ -"""Generated with stubgen from mypy, then manually edited, do not regen.""" - -from __future__ import annotations - -import datetime -from dataclasses import dataclass -from types import FunctionType -from typing import ( - Any, - Callable, - Dict, - Iterable, - List, - Optional, - Set, - Tuple, - Type, - Union, - _GenericAlias, # type: ignore - overload, -) - -from _typeshed import Incomplete - -from reflex import constants as constants -from reflex.base import Base as Base -from reflex.state import BaseState as BaseState -from reflex.state import State as State -from reflex.utils import console as console -from reflex.utils import format as format -from reflex.utils import types as types -from reflex.utils.imports import ImmutableParsedImportDict, ImportDict, ParsedImportDict - -USED_VARIABLES: Incomplete - -def get_unique_variable_name() -> str: ... -def _encode_var(value: Var) -> str: ... - -_global_vars: Dict[int, Var] - -def _decode_var(value: str) -> tuple[VarData, str]: ... -def _extract_var_data(value: Iterable) -> list[VarData | None]: ... - -class VarData(Base): - state: str = "" - imports: Union[ImportDict, ParsedImportDict] = {} - hooks: Dict[str, None] = {} - interpolations: List[Tuple[int, int]] = [] - @classmethod - def merge(cls, *others: ImmutableVarData | VarData | None) -> VarData | None: ... - -class ImmutableVarData: - state: str = "" - imports: ImmutableParsedImportDict = tuple() - hooks: Tuple[str, ...] = tuple() - def __init__( - self, - state: str = "", - imports: ImportDict | ParsedImportDict | None = None, - hooks: dict[str, None] | None = None, - ) -> None: ... - @classmethod - def merge( - cls, *others: ImmutableVarData | VarData | None - ) -> ImmutableVarData | None: ... - @classmethod - def from_state(cls, state: Type[BaseState] | str) -> ImmutableVarData: ... - -def _decode_var_immutable(value: str) -> tuple[ImmutableVarData, str]: ... - -class Var: - _var_name: str - _var_type: Type - _var_is_local: bool = False - _var_is_string: bool = False - _var_full_name_needs_state_prefix: bool = False - _var_data: VarData | None = None - @classmethod - def create( - cls, - value: Any, - _var_is_local: bool = True, - _var_is_string: bool | None = None, - _var_data: VarData | None = None, - ) -> Optional[Var]: ... - @classmethod - def create_safe( - cls, - value: Any, - _var_is_local: bool = True, - _var_is_string: bool | None = None, - _var_data: VarData | None = None, - ) -> Var: ... - @classmethod - def __class_getitem__(cls, type_: Type) -> _GenericAlias: ... - def _replace(self, merge_var_data=None, **kwargs: Any) -> BaseVar: ... - def equals(self, other: Var) -> bool: ... - def to_string(self) -> Var: ... - def __hash__(self) -> int: ... - def __format__(self, format_spec: str) -> str: ... - def __getitem__(self, i: Any) -> Var: ... - def __getattribute__(self, name: str) -> Var: ... - def operation( - self, - op: str = ..., - other: Optional[Var] = ..., - type_: Optional[Type] = ..., - flip: bool = ..., - fn: Optional[str] = ..., - ) -> Var: ... - def compare(self, op: str, other: Var) -> Var: ... - def __invert__(self) -> Var: ... - def __neg__(self) -> Var: ... - def __abs__(self) -> Var: ... - def length(self) -> Var: ... - def __eq__(self, other: Var) -> Var: ... - def __ne__(self, other: Var) -> Var: ... - def __gt__(self, other: Var) -> Var: ... - def __ge__(self, other: Var) -> Var: ... - def __lt__(self, other: Var) -> Var: ... - def __le__(self, other: Var) -> Var: ... - def __add__(self, other: Var) -> Var: ... - def __radd__(self, other: Var) -> Var: ... - def __sub__(self, other: Var) -> Var: ... - def __rsub__(self, other: Var) -> Var: ... - def __mul__(self, other: Var) -> Var: ... - def __rmul__(self, other: Var) -> Var: ... - def __pow__(self, other: Var) -> Var: ... - def __rpow__(self, other: Var) -> Var: ... - def __truediv__(self, other: Var) -> Var: ... - def __rtruediv__(self, other: Var) -> Var: ... - def __floordiv__(self, other: Var) -> Var: ... - def __mod__(self, other: Var) -> Var: ... - def __rmod__(self, other: Var) -> Var: ... - def __and__(self, other: Var) -> Var: ... - def __rand__(self, other: Var) -> Var: ... - def __or__(self, other: Var) -> Var: ... - def __ror__(self, other: Var) -> Var: ... - def __contains__(self, _: Any) -> Var: ... - def contains(self, other: Any, field: Union[Var, None] = None) -> Var: ... - def reverse(self) -> Var: ... - def foreach(self, fn: Callable) -> Var: ... - @classmethod - def range( - cls, - v1: Var | int = 0, - v2: Var | int | None = None, - step: Var | int | None = None, - ) -> Var: ... - def to(self, type_: Type) -> Var: ... - def as_ref(self) -> Var: ... - @property - def _var_full_name(self) -> str: ... - def _var_set_state(self, state: Type[BaseState] | str) -> Any: ... - def _get_all_var_data(self) -> VarData | ImmutableVarData: ... - def json(self) -> str: ... - def _type(self) -> Var: ... - -@dataclass(eq=False) -class BaseVar(Var): - _var_name: str - _var_type: Any - _var_is_local: bool = False - _var_is_string: bool = False - _var_full_name_needs_state_prefix: bool = False - _var_data: VarData | None = None - def __hash__(self) -> int: ... - def get_default_value(self) -> Any: ... - def get_setter_name(self, include_state: bool = ...) -> str: ... - def get_setter(self) -> Callable[[BaseState, Any], None]: ... - -@dataclass(init=False) -class ComputedVar(Var): - _var_cache: bool - fget: FunctionType - @property - def _cache_attr(self) -> str: ... - def __get__(self, instance, owner): ... - def _deps(self, objclass: Type, obj: Optional[FunctionType] = ...) -> Set[str]: ... - def _replace(self, merge_var_data=None, **kwargs: Any) -> ComputedVar: ... - def mark_dirty(self, instance) -> None: ... - def needs_update(self, instance) -> bool: ... - def _determine_var_type(self) -> Type: ... - @overload - def __init__( - self, - fget: Callable[[BaseState], Any], - **kwargs, - ) -> None: ... - @overload - def __init__(self, func) -> None: ... - -@overload -def computed_var( - fget: Callable[[BaseState], Any] | None = None, - initial_value: Any | types.Unset = types.Unset(), - cache: bool = False, - deps: Optional[List[Union[str, Var]]] = None, - auto_deps: bool = True, - interval: Optional[Union[datetime.timedelta, int]] = None, - **kwargs, -) -> Callable[[Callable[[Any], Any]], ComputedVar]: ... -@overload -def computed_var(fget: Callable[[Any], Any]) -> ComputedVar: ... -@overload -def cached_var( - fget: Callable[[BaseState], Any] | None = None, - initial_value: Any | types.Unset = types.Unset(), - deps: Optional[List[Union[str, Var]]] = None, - auto_deps: bool = True, - interval: Optional[Union[datetime.timedelta, int]] = None, - **kwargs, -) -> Callable[[Callable[[Any], Any]], ComputedVar]: ... -@overload -def cached_var(fget: Callable[[Any], Any]) -> ComputedVar: ... - -class CallableVar(BaseVar): - def __init__(self, fn: Callable[..., BaseVar]): ... - def __call__(self, *args, **kwargs) -> BaseVar: ... - -def get_uuid_string_var() -> Var: ... diff --git a/reflex/ivars/__init__.py b/reflex/vars/__init__.py similarity index 69% rename from reflex/ivars/__init__.py rename to reflex/vars/__init__.py index 2c1837510..1a4cebe19 100644 --- a/reflex/ivars/__init__.py +++ b/reflex/vars/__init__.py @@ -1,8 +1,14 @@ -"""Experimental Immutable-Based Var System.""" +"""Immutable-Based Var System.""" -from .base import ImmutableVar as ImmutableVar +from .base import Field as Field from .base import LiteralVar as LiteralVar +from .base import Var as Var +from .base import VarData as VarData +from .base import field as field +from .base import get_unique_variable_name as get_unique_variable_name +from .base import get_uuid_string_var as get_uuid_string_var from .base import var_operation as var_operation +from .base import var_operation_return as var_operation_return from .function import FunctionStringVar as FunctionStringVar from .function import FunctionVar as FunctionVar from .function import VarOperationCall as VarOperationCall diff --git a/reflex/vars/base.py b/reflex/vars/base.py new file mode 100644 index 000000000..6df8eec6f --- /dev/null +++ b/reflex/vars/base.py @@ -0,0 +1,2918 @@ +"""Collection of base classes.""" + +from __future__ import annotations + +import contextlib +import dataclasses +import datetime +import dis +import functools +import inspect +import json +import random +import re +import string +import sys +import warnings +from types import CodeType, FunctionType +from typing import ( + TYPE_CHECKING, + Any, + Callable, + ClassVar, + Dict, + FrozenSet, + Generic, + Iterable, + List, + Literal, + NoReturn, + Optional, + Set, + Tuple, + Type, + TypeVar, + Union, + cast, + get_args, + overload, +) + +from typing_extensions import ( + ParamSpec, + TypeGuard, + deprecated, + get_type_hints, + override, +) + +from reflex import constants +from reflex.base import Base +from reflex.utils import console, imports, serializers, types +from reflex.utils.exceptions import ( + VarAttributeError, + VarDependencyError, + VarTypeError, + VarValueError, +) +from reflex.utils.format import format_state_name +from reflex.utils.imports import ( + ImmutableParsedImportDict, + ImportDict, + ImportVar, + ParsedImportDict, + parse_imports, +) +from reflex.utils.types import GenericType, Self, get_origin, has_args, unionize + +if TYPE_CHECKING: + from reflex.state import BaseState + + from .function import FunctionVar + from .number import ( + BooleanVar, + NumberVar, + ) + from .object import ObjectVar + from .sequence import ArrayVar, StringVar + + +VAR_TYPE = TypeVar("VAR_TYPE", covariant=True) +OTHER_VAR_TYPE = TypeVar("OTHER_VAR_TYPE") + +warnings.filterwarnings("ignore", message="fields may not start with an underscore") + + +@dataclasses.dataclass( + eq=False, + frozen=True, +) +class VarSubclassEntry: + """Entry for a Var subclass.""" + + var_subclass: Type[Var] + to_var_subclass: Type[ToOperation] + python_types: Tuple[GenericType, ...] + + +_var_subclasses: List[VarSubclassEntry] = [] +_var_literal_subclasses: List[Tuple[Type[LiteralVar], VarSubclassEntry]] = [] + + +@dataclasses.dataclass( + eq=True, + frozen=True, +) +class VarData: + """Metadata associated with a x.""" + + # The name of the enclosing state. + state: str = dataclasses.field(default="") + + # The name of the field in the state. + field_name: str = dataclasses.field(default="") + + # Imports needed to render this var + imports: ImmutableParsedImportDict = dataclasses.field(default_factory=tuple) + + # Hooks that need to be present in the component to render this var + hooks: Tuple[str, ...] = dataclasses.field(default_factory=tuple) + + def __init__( + self, + state: str = "", + field_name: str = "", + imports: ImportDict | ParsedImportDict | None = None, + hooks: dict[str, None] | None = None, + ): + """Initialize the var data. + + Args: + state: The name of the enclosing state. + field_name: The name of the field in the state. + imports: Imports needed to render this var. + hooks: Hooks that need to be present in the component to render this var. + """ + immutable_imports: ImmutableParsedImportDict = tuple( + sorted( + ((k, tuple(sorted(v))) for k, v in parse_imports(imports or {}).items()) + ) + ) + object.__setattr__(self, "state", state) + object.__setattr__(self, "field_name", field_name) + object.__setattr__(self, "imports", immutable_imports) + object.__setattr__(self, "hooks", tuple(hooks or {})) + + def old_school_imports(self) -> ImportDict: + """Return the imports as a mutable dict. + + Returns: + The imports as a mutable dict. + """ + return dict((k, list(v)) for k, v in self.imports) + + @classmethod + def merge(cls, *others: VarData | None) -> VarData | None: + """Merge multiple var data objects. + + Args: + *others: The var data objects to merge. + + Returns: + The merged var data object. + """ + state = "" + field_name = "" + _imports = {} + hooks = {} + for var_data in others: + if var_data is None: + continue + state = state or var_data.state + field_name = field_name or var_data.field_name + _imports = imports.merge_imports(_imports, var_data.imports) + hooks.update( + var_data.hooks + if isinstance(var_data.hooks, dict) + else {k: None for k in var_data.hooks} + ) + + if state or _imports or hooks or field_name: + return VarData( + state=state, + field_name=field_name, + imports=_imports, + hooks=hooks, + ) + return None + + def __bool__(self) -> bool: + """Check if the var data is non-empty. + + Returns: + True if any field is set to a non-default value. + """ + return bool(self.state or self.imports or self.hooks or self.field_name) + + @classmethod + def from_state(cls, state: Type[BaseState] | str, field_name: str = "") -> VarData: + """Set the state of the var. + + Args: + state: The state to set or the full name of the state. + field_name: The name of the field in the state. Optional. + + Returns: + The var with the set state. + """ + from reflex.utils import format + + state_name = state if isinstance(state, str) else state.get_full_name() + return VarData( + state=state_name, + field_name=field_name, + hooks={ + "const {0} = useContext(StateContexts.{0})".format( + format.format_state_name(state_name) + ): None + }, + imports={ + f"/{constants.Dirs.CONTEXTS_PATH}": [ImportVar(tag="StateContexts")], + "react": [ImportVar(tag="useContext")], + }, + ) + + +def _decode_var_immutable(value: str) -> tuple[VarData | None, str]: + """Decode the state name from a formatted var. + + Args: + value: The value to extract the state name from. + + Returns: + The extracted state name and the value without the state name. + """ + var_datas = [] + if isinstance(value, str): + # fast path if there is no encoded VarData + if constants.REFLEX_VAR_OPENING_TAG not in value: + return None, value + + offset = 0 + + # Find all tags. + while m := _decode_var_pattern.search(value): + start, end = m.span() + value = value[:start] + value[end:] + + serialized_data = m.group(1) + + if serialized_data.isnumeric() or ( + serialized_data[0] == "-" and serialized_data[1:].isnumeric() + ): + # This is a global immutable var. + var = _global_vars[int(serialized_data)] + var_data = var._get_all_var_data() + + if var_data is not None: + var_datas.append(var_data) + offset += end - start + + return VarData.merge(*var_datas) if var_datas else None, value + + +@dataclasses.dataclass( + eq=False, + frozen=True, +) +class Var(Generic[VAR_TYPE]): + """Base class for immutable vars.""" + + # The name of the var. + _js_expr: str = dataclasses.field() + + # The type of the var. + _var_type: types.GenericType = dataclasses.field(default=Any) + + # Extra metadata associated with the Var + _var_data: Optional[VarData] = dataclasses.field(default=None) + + def __str__(self) -> str: + """String representation of the var. Guaranteed to be a valid Javascript expression. + + Returns: + The name of the var. + """ + return self._js_expr + + @property + def _var_is_local(self) -> bool: + """Whether this is a local javascript variable. + + Returns: + False + """ + return False + + @property + @deprecated("Use `_js_expr` instead.") + def _var_name(self) -> str: + """The name of the var. + + Returns: + The name of the var. + """ + return self._js_expr + + @property + def _var_field_name(self) -> str: + """The name of the field. + + Returns: + The name of the field. + """ + var_data = self._get_all_var_data() + field_name = var_data.field_name if var_data else None + return field_name or self._js_expr + + @property + @deprecated("Use `_js_expr` instead.") + def _var_name_unwrapped(self) -> str: + """The name of the var without extra curly braces. + + Returns: + The name of the var. + """ + return self._js_expr + + @property + def _var_is_string(self) -> bool: + """Whether the var is a string literal. + + Returns: + False + """ + return False + + def __init_subclass__( + cls, python_types: Tuple[GenericType, ...] | GenericType = types.Unset, **kwargs + ): + """Initialize the subclass. + + Args: + python_types: The python types that the var represents. + **kwargs: Additional keyword arguments. + """ + super().__init_subclass__(**kwargs) + + if python_types is not types.Unset: + python_types = ( + python_types if isinstance(python_types, tuple) else (python_types,) + ) + + @dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, + ) + class ToVarOperation(ToOperation, cls): + """Base class of converting a var to another var type.""" + + _original: Var = dataclasses.field( + default=Var(_js_expr="null", _var_type=None), + ) + + _default_var_type: ClassVar[GenericType] = python_types[0] + + ToVarOperation.__name__ = f'To{cls.__name__.removesuffix("Var")}Operation' + + _var_subclasses.append(VarSubclassEntry(cls, ToVarOperation, python_types)) + + def __post_init__(self): + """Post-initialize the var.""" + # Decode any inline Var markup and apply it to the instance + _var_data, _js_expr = _decode_var_immutable(self._js_expr) + + if _var_data or _js_expr != self._js_expr: + self.__init__( + _js_expr=_js_expr, + _var_type=self._var_type, + _var_data=VarData.merge(self._var_data, _var_data), + ) + + def __hash__(self) -> int: + """Define a hash function for the var. + + Returns: + The hash of the var. + """ + return hash((self._js_expr, self._var_type, self._var_data)) + + def _get_all_var_data(self) -> VarData | None: + """Get all VarData associated with the Var. + + Returns: + The VarData of the components and all of its children. + """ + return self._var_data + + def equals(self, other: Var) -> bool: + """Check if two vars are equal. + + Args: + other: The other var to compare. + + Returns: + Whether the vars are equal. + """ + return ( + self._js_expr == other._js_expr + and self._var_type == other._var_type + and self._get_all_var_data() == other._get_all_var_data() + ) + + @overload + def _replace( + self, _var_type: Type[OTHER_VAR_TYPE], merge_var_data=None, **kwargs: Any + ) -> Var[OTHER_VAR_TYPE]: ... + + @overload + def _replace( + self, _var_type: GenericType | None = None, merge_var_data=None, **kwargs: Any + ) -> Self: ... + + def _replace( + self, _var_type: GenericType | None = None, merge_var_data=None, **kwargs: Any + ) -> Self | Var: + """Make a copy of this Var with updated fields. + + Args: + merge_var_data: VarData to merge into the existing VarData. + **kwargs: Var fields to update. + + Returns: + A new Var with the updated fields overwriting the corresponding fields in this Var. + + Raises: + TypeError: If _var_is_local, _var_is_string, or _var_full_name_needs_state_prefix is not None. + """ + if kwargs.get("_var_is_local", False) is not False: + raise TypeError("The _var_is_local argument is not supported for Var.") + + if kwargs.get("_var_is_string", False) is not False: + raise TypeError("The _var_is_string argument is not supported for Var.") + + if kwargs.get("_var_full_name_needs_state_prefix", False) is not False: + raise TypeError( + "The _var_full_name_needs_state_prefix argument is not supported for Var." + ) + + value_with_replaced = dataclasses.replace( + self, + _var_type=_var_type or self._var_type, + _var_data=VarData.merge( + kwargs.get("_var_data", self._var_data), merge_var_data + ), + **kwargs, + ) + + if (js_expr := kwargs.get("_js_expr")) is not None: + object.__setattr__(value_with_replaced, "_js_expr", js_expr) + + return value_with_replaced + + @classmethod + def create( + cls, + value: Any, + _var_is_local: bool | None = None, + _var_is_string: bool | None = None, + _var_data: VarData | None = None, + ) -> Var: + """Create a var from a value. + + Args: + value: The value to create the var from. + _var_is_local: Whether the var is local. Deprecated. + _var_is_string: Whether the var is a string literal. Deprecated. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The var. + """ + if _var_is_local is not None: + console.deprecate( + feature_name="_var_is_local", + reason="The _var_is_local argument is not supported for Var." + "If you want to create a Var from a raw Javascript expression, use the constructor directly", + deprecation_version="0.6.0", + removal_version="0.7.0", + ) + if _var_is_string is not None: + console.deprecate( + feature_name="_var_is_string", + reason="The _var_is_string argument is not supported for Var." + "If you want to create a Var from a raw Javascript expression, use the constructor directly", + deprecation_version="0.6.0", + removal_version="0.7.0", + ) + + # If the value is already a var, do nothing. + if isinstance(value, Var): + return value + + # Try to pull the imports and hooks from contained values. + if not isinstance(value, str): + return LiteralVar.create(value) + + if _var_is_string is False or _var_is_local is True: + return cls( + _js_expr=value, + _var_data=_var_data, + ) + + return LiteralVar.create(value, _var_data=_var_data) + + @classmethod + @deprecated("Use `.create()` instead.") + def create_safe( + cls, + *args: Any, + **kwargs: Any, + ) -> Var: + """Create a var from a value. + + Args: + *args: The arguments to create the var from. + **kwargs: The keyword arguments to create the var from. + + Returns: + The var. + """ + return cls.create(*args, **kwargs) + + def __format__(self, format_spec: str) -> str: + """Format the var into a Javascript equivalent to an f-string. + + Args: + format_spec: The format specifier (Ignored for now). + + Returns: + The formatted var. + """ + hashed_var = hash(self) + + _global_vars[hashed_var] = self + + # Encode the _var_data into the formatted output for tracking purposes. + return f"{constants.REFLEX_VAR_OPENING_TAG}{hashed_var}{constants.REFLEX_VAR_CLOSING_TAG}{self._js_expr}" + + @overload + def to(self, output: Type[StringVar]) -> StringVar: ... + + @overload + def to(self, output: Type[str]) -> StringVar: ... + + @overload + def to(self, output: Type[BooleanVar]) -> BooleanVar: ... + + @overload + def to( + self, output: Type[NumberVar], var_type: type[int] | type[float] = float + ) -> NumberVar: ... + + @overload + def to( + self, + output: Type[ArrayVar], + var_type: type[list] | type[tuple] | type[set] = list, + ) -> ArrayVar: ... + + @overload + def to( + self, output: Type[ObjectVar], var_type: types.GenericType = dict + ) -> ObjectVar: ... + + @overload + def to( + self, output: Type[FunctionVar], var_type: Type[Callable] = Callable + ) -> FunctionVar: ... + + @overload + def to( + self, + output: Type[OUTPUT] | types.GenericType, + var_type: types.GenericType | None = None, + ) -> OUTPUT: ... + + def to( + self, + output: Type[OUTPUT] | types.GenericType, + var_type: types.GenericType | None = None, + ) -> Var: + """Convert the var to a different type. + + Args: + output: The output type. + var_type: The type of the var. + + Returns: + The converted var. + """ + from .object import ObjectVar + + base_type = var_type + if types.is_optional(base_type): + base_type = types.get_args(base_type)[0] + + fixed_output_type = get_origin(output) or output + + # If the first argument is a python type, we map it to the corresponding Var type. + for var_subclass in _var_subclasses[::-1]: + if fixed_output_type in var_subclass.python_types: + return self.to(var_subclass.var_subclass, output) + + if fixed_output_type is None: + return get_to_operation(NoneVar).create(self) # type: ignore + + # Handle fixed_output_type being Base or a dataclass. + try: + if issubclass(fixed_output_type, Base): + return self.to(ObjectVar, output) + except TypeError: + pass + if dataclasses.is_dataclass(fixed_output_type) and not issubclass( + fixed_output_type, Var + ): + return self.to(ObjectVar, output) + + if inspect.isclass(output): + for var_subclass in _var_subclasses[::-1]: + if issubclass(output, var_subclass.var_subclass): + to_operation_return = var_subclass.to_var_subclass.create( + value=self, _var_type=var_type + ) + return to_operation_return # type: ignore + + # If we can't determine the first argument, we just replace the _var_type. + if not issubclass(output, Var) or var_type is None: + return dataclasses.replace( + self, + _var_type=output, + ) + + # We couldn't determine the output type to be any other Var type, so we replace the _var_type. + if var_type is not None: + return dataclasses.replace( + self, + _var_type=var_type, + ) + + return self + + @overload + def guess_type(self: Var[str]) -> StringVar: ... + + @overload + def guess_type(self: Var[bool]) -> BooleanVar: ... + + @overload + def guess_type(self: Var[int] | Var[float] | Var[int | float]) -> NumberVar: ... + + @overload + def guess_type(self) -> Self: ... + + def guess_type(self) -> Var: + """Guesses the type of the variable based on its `_var_type` attribute. + + Returns: + Var: The guessed type of the variable. + + Raises: + TypeError: If the type is not supported for guessing. + """ + from .number import NumberVar + from .object import ObjectVar + + var_type = self._var_type + if var_type is None: + return self.to(None) + if types.is_optional(var_type): + var_type = types.get_args(var_type)[0] + + if var_type is Any: + return self + + fixed_type = get_origin(var_type) or var_type + + if fixed_type in types.UnionTypes: + inner_types = get_args(var_type) + + if all( + inspect.isclass(t) and issubclass(t, (int, float)) for t in inner_types + ): + return self.to(NumberVar, self._var_type) + + if all( + inspect.isclass(t) + and (issubclass(t, Base) or dataclasses.is_dataclass(t)) + for t in inner_types + ): + return self.to(ObjectVar, self._var_type) + + return self + + if fixed_type is Literal: + args = get_args(var_type) + fixed_type = unionize(*(type(arg) for arg in args)) + + if not inspect.isclass(fixed_type): + raise TypeError(f"Unsupported type {var_type} for guess_type.") + + if fixed_type is None: + return self.to(None) + + for var_subclass in _var_subclasses[::-1]: + if issubclass(fixed_type, var_subclass.python_types): + return self.to(var_subclass.var_subclass, self._var_type) + + try: + if issubclass(fixed_type, Base): + return self.to(ObjectVar, self._var_type) + except TypeError: + pass + if dataclasses.is_dataclass(fixed_type): + return self.to(ObjectVar, self._var_type) + return self + + def get_default_value(self) -> Any: + """Get the default value of the var. + + Returns: + The default value of the var. + + Raises: + ImportError: If the var is a dataframe and pandas is not installed. + """ + if types.is_optional(self._var_type): + return None + + type_ = ( + get_origin(self._var_type) + if types.is_generic_alias(self._var_type) + else self._var_type + ) + if type_ is Literal: + args = get_args(self._var_type) + return args[0] if args else None + if issubclass(type_, str): + return "" + if issubclass(type_, types.get_args(Union[int, float])): + return 0 + if issubclass(type_, bool): + return False + if issubclass(type_, list): + return [] + if issubclass(type_, dict): + return {} + if issubclass(type_, tuple): + return () + if types.is_dataframe(type_): + try: + import pandas as pd + + return pd.DataFrame() + except ImportError as e: + raise ImportError( + "Please install pandas to use dataframes in your app." + ) from e + return set() if issubclass(type_, set) else None + + def get_setter_name(self, include_state: bool = True) -> str: + """Get the name of the var's generated setter function. + + Args: + include_state: Whether to include the state name in the setter name. + + Returns: + The name of the setter function. + """ + setter = constants.SETTER_PREFIX + self._var_field_name + var_data = self._get_all_var_data() + if var_data is None: + return setter + if not include_state or var_data.state == "": + return setter + return ".".join((var_data.state, setter)) + + def get_setter(self) -> Callable[[BaseState, Any], None]: + """Get the var's setter function. + + Returns: + A function that that creates a setter for the var. + """ + actual_name = self._var_field_name + + def setter(state: BaseState, value: Any): + """Get the setter for the var. + + Args: + state: The state within which we add the setter function. + value: The value to set. + """ + if self._var_type in [int, float]: + try: + value = self._var_type(value) + setattr(state, actual_name, value) + except ValueError: + console.debug( + f"{type(state).__name__}.{self._js_expr}: Failed conversion of {value} to '{self._var_type.__name__}'. Value not set.", + ) + else: + setattr(state, actual_name, value) + + setter.__qualname__ = self.get_setter_name() + + return setter + + def _var_set_state(self, state: type[BaseState] | str): + """Set the state of the var. + + Args: + state: The state to set. + + Returns: + The var with the state set. + """ + formatted_state_name = ( + state + if isinstance(state, str) + else format_state_name(state.get_full_name()) + ) + + return StateOperation.create( + formatted_state_name, + self, + _var_data=VarData.merge( + VarData.from_state(state, self._js_expr), self._var_data + ), + ).guess_type() + + def __eq__(self, other: Var | Any) -> BooleanVar: + """Check if the current variable is equal to the given variable. + + Args: + other (Var | Any): The variable to compare with. + + Returns: + BooleanVar: A BooleanVar object representing the result of the equality check. + """ + from .number import equal_operation + + return equal_operation(self, other) + + def __ne__(self, other: Var | Any) -> BooleanVar: + """Check if the current object is not equal to the given object. + + Parameters: + other (Var | Any): The object to compare with. + + Returns: + BooleanVar: A BooleanVar object representing the result of the comparison. + """ + from .number import equal_operation + + return ~equal_operation(self, other) + + def bool(self) -> BooleanVar: + """Convert the var to a boolean. + + Returns: + The boolean var. + """ + from .number import boolify + + return boolify(self) + + def __and__(self, other: Var | Any) -> Var: + """Perform a logical AND operation on the current instance and another variable. + + Args: + other: The variable to perform the logical AND operation with. + + Returns: + A `BooleanVar` object representing the result of the logical AND operation. + """ + return and_operation(self, other) + + def __rand__(self, other: Var | Any) -> Var: + """Perform a logical AND operation on the current instance and another variable. + + Args: + other: The variable to perform the logical AND operation with. + + Returns: + A `BooleanVar` object representing the result of the logical AND operation. + """ + return and_operation(other, self) + + def __or__(self, other: Var | Any) -> Var: + """Perform a logical OR operation on the current instance and another variable. + + Args: + other: The variable to perform the logical OR operation with. + + Returns: + A `BooleanVar` object representing the result of the logical OR operation. + """ + return or_operation(self, other) + + def __ror__(self, other: Var | Any) -> Var: + """Perform a logical OR operation on the current instance and another variable. + + Args: + other: The variable to perform the logical OR operation with. + + Returns: + A `BooleanVar` object representing the result of the logical OR operation. + """ + return or_operation(other, self) + + def __invert__(self) -> BooleanVar: + """Perform a logical NOT operation on the current instance. + + Returns: + A `BooleanVar` object representing the result of the logical NOT operation. + """ + return ~self.bool() + + def to_string(self, use_json: bool = True) -> StringVar: + """Convert the var to a string. + + Args: + use_json: Whether to use JSON stringify. If False, uses Object.prototype.toString. + + Returns: + The string var. + """ + from .function import JSON_STRINGIFY, PROTOTYPE_TO_STRING + from .sequence import StringVar + + return ( + JSON_STRINGIFY.call(self).to(StringVar) + if use_json + else PROTOTYPE_TO_STRING.call(self).to(StringVar) + ) + + def as_ref(self) -> Var: + """Get a reference to the var. + + Returns: + The reference to the var. + """ + from .object import ObjectVar + + refs = Var( + _js_expr="refs", + _var_data=VarData( + imports={ + f"/{constants.Dirs.STATE_PATH}": [imports.ImportVar(tag="refs")] + } + ), + ).to(ObjectVar, Dict[str, str]) + return refs[LiteralVar.create(str(self))] + + @deprecated("Use `.js_type()` instead.") + def _type(self) -> StringVar: + """Returns the type of the object. + + This method uses the `typeof` function from the `FunctionStringVar` class + to determine the type of the object. + + Returns: + StringVar: A string variable representing the type of the object. + """ + return self.js_type() + + def js_type(self) -> StringVar: + """Returns the javascript type of the object. + + This method uses the `typeof` function from the `FunctionStringVar` class + to determine the type of the object. + + Returns: + StringVar: A string variable representing the type of the object. + """ + from .function import FunctionStringVar + from .sequence import StringVar + + type_of = FunctionStringVar("typeof") + return type_of.call(self).to(StringVar) + + def without_data(self): + """Create a copy of the var without the data. + + Returns: + The var without the data. + """ + return dataclasses.replace(self, _var_data=None) + + def contains(self, value: Any = None, field: Any = None): + """Get an attribute of the var. + + Args: + value: The value to check for. + field: The field to check for. + + Raises: + TypeError: If the var does not support contains check. + """ + raise TypeError( + f"Var of type {self._var_type} does not support contains check." + ) + + def __get__(self, instance: Any, owner: Any): + """Get the var. + + Args: + instance: The instance to get the var from. + owner: The owner of the var. + + Returns: + The var. + """ + return self + + def reverse(self): + """Reverse the var. + + Raises: + TypeError: If the var does not support reverse. + """ + raise TypeError("Cannot reverse non-list var.") + + def __getattr__(self, name: str): + """Get an attribute of the var. + + Args: + name: The name of the attribute. + + Returns: + The attribute. + + Raises: + VarAttributeError: If the attribute does not exist. + TypeError: If the var type is Any. + """ + if name.startswith("_"): + return self.__getattribute__(name) + + if self._var_type is Any: + raise TypeError( + f"You must provide an annotation for the state var `{str(self)}`. Annotation cannot be `{self._var_type}`." + ) + + if name in REPLACED_NAMES: + raise VarAttributeError( + f"Field {name!r} was renamed to {REPLACED_NAMES[name]!r}" + ) + + raise VarAttributeError( + f"The State var has no attribute '{name}' or may have been annotated wrongly.", + ) + + def _decode(self) -> Any: + """Decode Var as a python value. + + Note that Var with state set cannot be decoded python-side and will be + returned as full_name. + + Returns: + The decoded value or the Var name. + """ + if isinstance(self, LiteralVar): + return self._var_value # type: ignore + try: + return json.loads(str(self)) + except ValueError: + try: + return json.loads(self.json()) + except (ValueError, NotImplementedError): + return str(self) + + @property + def _var_state(self) -> str: + """Compat method for getting the state. + + Returns: + The state name associated with the var. + """ + var_data = self._get_all_var_data() + return var_data.state if var_data else "" + + @overload + @classmethod + def range(cls, stop: int | NumberVar, /) -> ArrayVar[List[int]]: ... + + @overload + @classmethod + def range( + cls, + start: int | NumberVar, + end: int | NumberVar, + step: int | NumberVar = 1, + /, + ) -> ArrayVar[List[int]]: ... + + @classmethod + def range( + cls, + first_endpoint: int | NumberVar, + second_endpoint: int | NumberVar | None = None, + step: int | NumberVar | None = None, + ) -> ArrayVar[List[int]]: + """Create a range of numbers. + + Args: + first_endpoint: The end of the range if second_endpoint is not provided, otherwise the start of the range. + second_endpoint: The end of the range. + step: The step of the range. + + Returns: + The range of numbers. + """ + from .sequence import ArrayVar + + return ArrayVar.range(first_endpoint, second_endpoint, step) + + def __bool__(self) -> bool: + """Raise exception if using Var in a boolean context. + + Raises: + VarTypeError: when attempting to bool-ify the Var. + """ + raise VarTypeError( + f"Cannot convert Var {str(self)!r} to bool for use with `if`, `and`, `or`, and `not`. " + "Instead use `rx.cond` and bitwise operators `&` (and), `|` (or), `~` (invert)." + ) + + def __iter__(self) -> Any: + """Raise exception if using Var in an iterable context. + + Raises: + VarTypeError: when attempting to iterate over the Var. + """ + raise VarTypeError( + f"Cannot iterate over Var {str(self)!r}. Instead use `rx.foreach`." + ) + + def __contains__(self, _: Any) -> Var: + """Override the 'in' operator to alert the user that it is not supported. + + Raises: + VarTypeError: the operation is not supported + """ + raise VarTypeError( + "'in' operator not supported for Var types, use Var.contains() instead." + ) + + def json(self) -> str: + """Serialize the var to a JSON string. + + Raises: + NotImplementedError: If the method is not implemented. + """ + raise NotImplementedError("Var subclasses must implement the json method.") + + +OUTPUT = TypeVar("OUTPUT", bound=Var) + + +class ToOperation: + """A var operation that converts a var to another type.""" + + def __getattr__(self, name: str) -> Any: + """Get an attribute of the var. + + Args: + name: The name of the attribute. + + Returns: + The attribute of the var. + """ + from .object import ObjectVar + + if isinstance(self, ObjectVar) and name != "_js_expr": + return ObjectVar.__getattr__(self, name) + return getattr(self._original, name) + + def __post_init__(self): + """Post initialization.""" + object.__delattr__(self, "_js_expr") + + def __hash__(self) -> int: + """Calculate the hash value of the object. + + Returns: + int: The hash value of the object. + """ + return hash(self._original) + + def _get_all_var_data(self) -> VarData | None: + """Get all the var data. + + Returns: + The var data. + """ + return VarData.merge( + self._original._get_all_var_data(), + self._var_data, # type: ignore + ) + + @classmethod + def create( + cls, + value: Var, + _var_type: GenericType | None = None, + _var_data: VarData | None = None, + ): + """Create a ToOperation. + + Args: + value: The value of the var. + _var_type: The type of the Var. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The ToOperation. + """ + return cls( + _js_expr="", # type: ignore + _var_data=_var_data, # type: ignore + _var_type=_var_type or cls._default_var_type, # type: ignore + _original=value, # type: ignore + ) + + +class LiteralVar(Var): + """Base class for immutable literal vars.""" + + def __init_subclass__(cls, **kwargs): + """Initialize the subclass. + + Args: + **kwargs: Additional keyword arguments. + + Raises: + TypeError: If the LiteralVar subclass does not have a corresponding Var subclass. + """ + super().__init_subclass__(**kwargs) + + bases = cls.__bases__ + + bases_normalized = [ + base if inspect.isclass(base) else get_origin(base) for base in bases + ] + + possible_bases = [ + base + for base in bases_normalized + if issubclass(base, Var) and base != LiteralVar + ] + + if not possible_bases: + raise TypeError( + f"LiteralVar subclass {cls} must have a base class that is a subclass of Var and not LiteralVar." + ) + + var_subclasses = [ + var_subclass + for var_subclass in _var_subclasses + if var_subclass.var_subclass in possible_bases + ] + + if not var_subclasses: + raise TypeError( + f"LiteralVar {cls} must have a base class annotated with `python_types`." + ) + + if len(var_subclasses) != 1: + raise TypeError( + f"LiteralVar {cls} must have exactly one base class annotated with `python_types`." + ) + + var_subclass = var_subclasses[0] + + # Remove the old subclass, happens because __init_subclass__ is called twice + # for each subclass. This is because of __slots__ in dataclasses. + for var_literal_subclass in list(_var_literal_subclasses): + if var_literal_subclass[1] is var_subclass: + _var_literal_subclasses.remove(var_literal_subclass) + + _var_literal_subclasses.append((cls, var_subclass)) + + @classmethod + def create( + cls, + value: Any, + _var_data: VarData | None = None, + ) -> Var: + """Create a var from a value. + + Args: + value: The value to create the var from. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The var. + + Raises: + TypeError: If the value is not a supported type for LiteralVar. + """ + from .object import LiteralObjectVar + from .sequence import LiteralStringVar + + if isinstance(value, Var): + if _var_data is None: + return value + return value._replace(merge_var_data=_var_data) + + for literal_subclass, var_subclass in _var_literal_subclasses[::-1]: + if isinstance(value, var_subclass.python_types): + return literal_subclass.create(value, _var_data=_var_data) + + from reflex.event import EventHandler + from reflex.utils.format import get_event_handler_parts + + if isinstance(value, EventHandler): + return Var(_js_expr=".".join(filter(None, get_event_handler_parts(value)))) + + serialized_value = serializers.serialize(value) + if serialized_value is not None: + if isinstance(serialized_value, dict): + return LiteralObjectVar.create( + serialized_value, + _var_type=type(value), + _var_data=_var_data, + ) + if isinstance(serialized_value, str): + return LiteralStringVar.create( + serialized_value, _var_type=type(value), _var_data=_var_data + ) + return LiteralVar.create(serialized_value, _var_data=_var_data) + + if isinstance(value, Base): + # get the fields of the pydantic class + fields = value.__fields__.keys() + one_level_dict = {field: getattr(value, field) for field in fields} + + return LiteralObjectVar.create( + { + field: value + for field, value in one_level_dict.items() + if not callable(value) + }, + _var_type=type(value), + _var_data=_var_data, + ) + + if dataclasses.is_dataclass(value) and not isinstance(value, type): + return LiteralObjectVar.create( + { + k: (None if callable(v) else v) + for k, v in dataclasses.asdict(value).items() + }, + _var_type=type(value), + _var_data=_var_data, + ) + + raise TypeError( + f"Unsupported type {type(value)} for LiteralVar. Tried to create a LiteralVar from {value}." + ) + + def __post_init__(self): + """Post-initialize the var.""" + + def json(self) -> str: + """Serialize the var to a JSON string. + + Raises: + NotImplementedError: If the method is not implemented. + """ + raise NotImplementedError( + "LiteralVar subclasses must implement the json method." + ) + + +@serializers.serializer +def serialize_literal(value: LiteralVar): + """Serialize a Literal type. + + Args: + value: The Literal to serialize. + + Returns: + The serialized Literal. + """ + return value._var_value + + +def get_python_literal(value: Union[LiteralVar, Any]) -> Any | None: + """Get the Python literal value. + + Args: + value: The value to get the Python literal value of. + + Returns: + The Python literal value. + """ + if isinstance(value, LiteralVar): + return value._var_value + if isinstance(value, Var): + return None + return value + + +P = ParamSpec("P") +T = TypeVar("T") + + +# NoReturn is used to match CustomVarOperationReturn with no type hint. +@overload +def var_operation( + func: Callable[P, CustomVarOperationReturn[NoReturn]], +) -> Callable[P, Var]: ... + + +@overload +def var_operation( + func: Callable[P, CustomVarOperationReturn[bool]], +) -> Callable[P, BooleanVar]: ... + + +NUMBER_T = TypeVar("NUMBER_T", int, float, Union[int, float]) + + +@overload +def var_operation( + func: Callable[P, CustomVarOperationReturn[NUMBER_T]], +) -> Callable[P, NumberVar[NUMBER_T]]: ... + + +@overload +def var_operation( + func: Callable[P, CustomVarOperationReturn[str]], +) -> Callable[P, StringVar]: ... + + +LIST_T = TypeVar("LIST_T", bound=Union[List[Any], Tuple, Set]) + + +@overload +def var_operation( + func: Callable[P, CustomVarOperationReturn[LIST_T]], +) -> Callable[P, ArrayVar[LIST_T]]: ... + + +OBJECT_TYPE = TypeVar("OBJECT_TYPE", bound=Dict) + + +@overload +def var_operation( + func: Callable[P, CustomVarOperationReturn[OBJECT_TYPE]], +) -> Callable[P, ObjectVar[OBJECT_TYPE]]: ... + + +@overload +def var_operation( + func: Callable[P, CustomVarOperationReturn[T]], +) -> Callable[P, Var[T]]: ... + + +def var_operation( + func: Callable[P, CustomVarOperationReturn[T]], +) -> Callable[P, Var[T]]: + """Decorator for creating a var operation. + + Example: + ```python + @var_operation + def add(a: NumberVar, b: NumberVar): + return custom_var_operation(f"{a} + {b}") + ``` + + Args: + func: The function to decorate. + + Returns: + The decorated function. + """ + + @functools.wraps(func) + def wrapper(*args: P.args, **kwargs: P.kwargs) -> Var[T]: + func_args = list(inspect.signature(func).parameters) + args_vars = { + func_args[i]: (LiteralVar.create(arg) if not isinstance(arg, Var) else arg) + for i, arg in enumerate(args) + } + kwargs_vars = { + key: LiteralVar.create(value) if not isinstance(value, Var) else value + for key, value in kwargs.items() + } + + return CustomVarOperation.create( + name=func.__name__, + args=tuple(list(args_vars.items()) + list(kwargs_vars.items())), + return_var=func(*args_vars.values(), **kwargs_vars), # type: ignore + ).guess_type() + + return wrapper + + +def figure_out_type(value: Any) -> types.GenericType: + """Figure out the type of the value. + + Args: + value: The value to figure out the type of. + + Returns: + The type of the value. + """ + if isinstance(value, Var): + return value._var_type + type_ = type(value) + if has_args(type_): + return type_ + if isinstance(value, list): + return List[unionize(*(figure_out_type(v) for v in value))] + if isinstance(value, set): + return Set[unionize(*(figure_out_type(v) for v in value))] + if isinstance(value, tuple): + return Tuple[unionize(*(figure_out_type(v) for v in value)), ...] + if isinstance(value, dict): + return Dict[ + unionize(*(figure_out_type(k) for k in value)), + unionize(*(figure_out_type(v) for v in value.values())), + ] + return type(value) + + +class cached_property_no_lock(functools.cached_property): + """A special version of functools.cached_property that does not use a lock.""" + + def __init__(self, func): + """Initialize the cached_property_no_lock. + + Args: + func: The function to cache. + """ + super().__init__(func) + self.lock = contextlib.nullcontext() + + +class CachedVarOperation: + """Base class for cached var operations to lower boilerplate code.""" + + def __post_init__(self): + """Post-initialize the CachedVarOperation.""" + object.__delattr__(self, "_js_expr") + + def __getattr__(self, name: str) -> Any: + """Get an attribute of the var. + + Args: + name: The name of the attribute. + + Returns: + The attribute. + """ + if name == "_js_expr": + return self._cached_var_name + + parent_classes = inspect.getmro(self.__class__) + + next_class = parent_classes[parent_classes.index(CachedVarOperation) + 1] + + return next_class.__getattr__(self, name) # type: ignore + + def _get_all_var_data(self) -> VarData | None: + """Get all VarData associated with the Var. + + Returns: + The VarData of the components and all of its children. + """ + return self._cached_get_all_var_data + + @cached_property_no_lock + def _cached_get_all_var_data(self) -> VarData | None: + """Get the cached VarData. + + Returns: + The cached VarData. + """ + return VarData.merge( + *map( + lambda value: ( + value._get_all_var_data() if isinstance(value, Var) else None + ), + map( + lambda field: getattr(self, field.name), + dataclasses.fields(self), # type: ignore + ), + ), + self._var_data, + ) + + def __hash__(self) -> int: + """Calculate the hash of the object. + + Returns: + The hash of the object. + """ + return hash( + ( + self.__class__.__name__, + *[ + getattr(self, field.name) + for field in dataclasses.fields(self) # type: ignore + if field.name not in ["_js_expr", "_var_data", "_var_type"] + ], + ) + ) + + +def and_operation(a: Var | Any, b: Var | Any) -> Var: + """Perform a logical AND operation on two variables. + + Args: + a: The first variable. + b: The second variable. + + Returns: + The result of the logical AND operation. + """ + return _and_operation(a, b) # type: ignore + + +@var_operation +def _and_operation(a: Var, b: Var): + """Perform a logical AND operation on two variables. + + Args: + a: The first variable. + b: The second variable. + + Returns: + The result of the logical AND operation. + """ + return var_operation_return( + js_expression=f"({a} && {b})", + var_type=unionize(a._var_type, b._var_type), + ) + + +def or_operation(a: Var | Any, b: Var | Any) -> Var: + """Perform a logical OR operation on two variables. + + Args: + a: The first variable. + b: The second variable. + + Returns: + The result of the logical OR operation. + """ + return _or_operation(a, b) # type: ignore + + +@var_operation +def _or_operation(a: Var, b: Var): + """Perform a logical OR operation on two variables. + + Args: + a: The first variable. + b: The second variable. + + Returns: + The result of the logical OR operation. + """ + return var_operation_return( + js_expression=f"({a} || {b})", + var_type=unionize(a._var_type, b._var_type), + ) + + +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +class CallableVar(Var): + """Decorate a Var-returning function to act as both a Var and a function. + + This is used as a compatibility shim for replacing Var objects in the + API with functions that return a family of Var. + """ + + fn: Callable[..., Var] = dataclasses.field( + default_factory=lambda: lambda: Var(_js_expr="undefined") + ) + original_var: Var = dataclasses.field( + default_factory=lambda: Var(_js_expr="undefined") + ) + + def __init__(self, fn: Callable[..., Var]): + """Initialize a CallableVar. + + Args: + fn: The function to decorate (must return Var) + """ + original_var = fn() + super(CallableVar, self).__init__( + _js_expr=original_var._js_expr, + _var_type=original_var._var_type, + _var_data=VarData.merge(original_var._get_all_var_data()), + ) + object.__setattr__(self, "fn", fn) + object.__setattr__(self, "original_var", original_var) + + def __call__(self, *args, **kwargs) -> Var: + """Call the decorated function. + + Args: + *args: The args to pass to the function. + **kwargs: The kwargs to pass to the function. + + Returns: + The Var returned from calling the function. + """ + return self.fn(*args, **kwargs) + + def __hash__(self) -> int: + """Calculate the hash of the object. + + Returns: + The hash of the object. + """ + return hash((self.__class__.__name__, self.original_var)) + + +RETURN_TYPE = TypeVar("RETURN_TYPE") + +DICT_KEY = TypeVar("DICT_KEY") +DICT_VAL = TypeVar("DICT_VAL") + +LIST_INSIDE = TypeVar("LIST_INSIDE") + + +class FakeComputedVarBaseClass(property): + """A fake base class for ComputedVar to avoid inheriting from property.""" + + __pydantic_run_validation__ = False + + +def is_computed_var(obj: Any) -> TypeGuard[ComputedVar]: + """Check if the object is a ComputedVar. + + Args: + obj: The object to check. + + Returns: + Whether the object is a ComputedVar. + """ + return isinstance(obj, FakeComputedVarBaseClass) + + +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +class ComputedVar(Var[RETURN_TYPE]): + """A field with computed getters.""" + + # Whether to track dependencies and cache computed values + _cache: bool = dataclasses.field(default=False) + + # Whether the computed var is a backend var + _backend: bool = dataclasses.field(default=False) + + # The initial value of the computed var + _initial_value: RETURN_TYPE | types.Unset = dataclasses.field(default=types.Unset()) + + # Explicit var dependencies to track + _static_deps: set[str] = dataclasses.field(default_factory=set) + + # Whether var dependencies should be auto-determined + _auto_deps: bool = dataclasses.field(default=True) + + # Interval at which the computed var should be updated + _update_interval: Optional[datetime.timedelta] = dataclasses.field(default=None) + + _fget: Callable[[BaseState], RETURN_TYPE] = dataclasses.field( + default_factory=lambda: lambda _: None + ) # type: ignore + + def __init__( + self, + fget: Callable[[BASE_STATE], RETURN_TYPE], + initial_value: RETURN_TYPE | types.Unset = types.Unset(), + cache: bool = False, + deps: Optional[List[Union[str, Var]]] = None, + auto_deps: bool = True, + interval: Optional[Union[int, datetime.timedelta]] = None, + backend: bool | None = None, + **kwargs, + ): + """Initialize a ComputedVar. + + Args: + fget: The getter function. + initial_value: The initial value of the computed var. + cache: Whether to cache the computed value. + deps: Explicit var dependencies to track. + auto_deps: Whether var dependencies should be auto-determined. + interval: Interval at which the computed var should be updated. + backend: Whether the computed var is a backend var. + **kwargs: additional attributes to set on the instance + + Raises: + TypeError: If the computed var dependencies are not Var instances or var names. + """ + hint = kwargs.pop("return_type", None) or get_type_hints(fget).get( + "return", Any + ) + + kwargs.setdefault("_js_expr", fget.__name__) + kwargs.setdefault("_var_type", hint) + + Var.__init__( + self, + _js_expr=kwargs.pop("_js_expr"), + _var_type=kwargs.pop("_var_type"), + _var_data=kwargs.pop("_var_data", None), + ) + + if kwargs: + raise TypeError(f"Unexpected keyword arguments: {tuple(kwargs)}") + + if backend is None: + backend = fget.__name__.startswith("_") + + object.__setattr__(self, "_backend", backend) + object.__setattr__(self, "_initial_value", initial_value) + object.__setattr__(self, "_cache", cache) + + if isinstance(interval, int): + interval = datetime.timedelta(seconds=interval) + + object.__setattr__(self, "_update_interval", interval) + + if deps is None: + deps = [] + else: + for dep in deps: + if isinstance(dep, Var): + continue + if isinstance(dep, str) and dep != "": + continue + raise TypeError( + "ComputedVar dependencies must be Var instances or var names (non-empty strings)." + ) + object.__setattr__( + self, + "_static_deps", + {dep._js_expr if isinstance(dep, Var) else dep for dep in deps}, + ) + object.__setattr__(self, "_auto_deps", auto_deps) + + object.__setattr__(self, "_fget", fget) + + @override + def _replace(self, merge_var_data=None, **kwargs: Any) -> Self: + """Replace the attributes of the ComputedVar. + + Args: + merge_var_data: VarData to merge into the existing VarData. + **kwargs: Var fields to update. + + Returns: + The new ComputedVar instance. + + Raises: + TypeError: If kwargs contains keys that are not allowed. + """ + field_values = dict( + fget=kwargs.pop("fget", self._fget), + initial_value=kwargs.pop("initial_value", self._initial_value), + cache=kwargs.pop("cache", self._cache), + deps=kwargs.pop("deps", self._static_deps), + auto_deps=kwargs.pop("auto_deps", self._auto_deps), + interval=kwargs.pop("interval", self._update_interval), + backend=kwargs.pop("backend", self._backend), + _js_expr=kwargs.pop("_js_expr", self._js_expr), + _var_type=kwargs.pop("_var_type", self._var_type), + _var_data=kwargs.pop( + "_var_data", VarData.merge(self._var_data, merge_var_data) + ), + ) + + if kwargs: + unexpected_kwargs = ", ".join(kwargs.keys()) + raise TypeError(f"Unexpected keyword arguments: {unexpected_kwargs}") + + return type(self)(**field_values) + + @property + def _cache_attr(self) -> str: + """Get the attribute used to cache the value on the instance. + + Returns: + An attribute name. + """ + return f"__cached_{self._js_expr}" + + @property + def _last_updated_attr(self) -> str: + """Get the attribute used to store the last updated timestamp. + + Returns: + An attribute name. + """ + return f"__last_updated_{self._js_expr}" + + def needs_update(self, instance: BaseState) -> bool: + """Check if the computed var needs to be updated. + + Args: + instance: The state instance that the computed var is attached to. + + Returns: + True if the computed var needs to be updated, False otherwise. + """ + if self._update_interval is None: + return False + last_updated = getattr(instance, self._last_updated_attr, None) + if last_updated is None: + return True + return datetime.datetime.now() - last_updated > self._update_interval + + @overload + def __get__( + self: ComputedVar[int] | ComputedVar[float], + instance: None, + owner: Type, + ) -> NumberVar: ... + + @overload + def __get__( + self: ComputedVar[str], + instance: None, + owner: Type, + ) -> StringVar: ... + + @overload + def __get__( + self: ComputedVar[dict[DICT_KEY, DICT_VAL]], + instance: None, + owner: Type, + ) -> ObjectVar[dict[DICT_KEY, DICT_VAL]]: ... + + @overload + def __get__( + self: ComputedVar[list[LIST_INSIDE]], + instance: None, + owner: Type, + ) -> ArrayVar[list[LIST_INSIDE]]: ... + + @overload + def __get__( + self: ComputedVar[set[LIST_INSIDE]], + instance: None, + owner: Type, + ) -> ArrayVar[set[LIST_INSIDE]]: ... + + @overload + def __get__( + self: ComputedVar[tuple[LIST_INSIDE, ...]], + instance: None, + owner: Type, + ) -> ArrayVar[tuple[LIST_INSIDE, ...]]: ... + + @overload + def __get__(self, instance: None, owner: Type) -> ComputedVar[RETURN_TYPE]: ... + + @overload + def __get__(self, instance: BaseState, owner: Type) -> RETURN_TYPE: ... + + def __get__(self, instance: BaseState | None, owner): + """Get the ComputedVar value. + + If the value is already cached on the instance, return the cached value. + + Args: + instance: the instance of the class accessing this computed var. + owner: the class that this descriptor is attached to. + + Returns: + The value of the var for the given instance. + """ + if instance is None: + state_where_defined = owner + while self._js_expr in state_where_defined.inherited_vars: + state_where_defined = state_where_defined.get_parent_state() + + field_name = ( + format_state_name(state_where_defined.get_full_name()) + + "." + + self._js_expr + ) + + return dispatch( + field_name, + var_data=VarData.from_state(state_where_defined, self._js_expr), + result_var_type=self._var_type, + existing_var=self, + ) + + if not self._cache: + return self.fget(instance) + + # handle caching + if not hasattr(instance, self._cache_attr) or self.needs_update(instance): + # Set cache attr on state instance. + setattr(instance, self._cache_attr, self.fget(instance)) + # Ensure the computed var gets serialized to redis. + instance._was_touched = True + # Set the last updated timestamp on the state instance. + setattr(instance, self._last_updated_attr, datetime.datetime.now()) + return getattr(instance, self._cache_attr) + + def _deps( + self, + objclass: Type, + obj: FunctionType | CodeType | None = None, + self_name: Optional[str] = None, + ) -> set[str]: + """Determine var dependencies of this ComputedVar. + + Save references to attributes accessed on "self". Recursively called + when the function makes a method call on "self" or define comprehensions + or nested functions that may reference "self". + + Args: + objclass: the class obj this ComputedVar is attached to. + obj: the object to disassemble (defaults to the fget function). + self_name: if specified, look for this name in LOAD_FAST and LOAD_DEREF instructions. + + Returns: + A set of variable names accessed by the given obj. + + Raises: + VarValueError: if the function references the get_state, parent_state, or substates attributes + (cannot track deps in a related state, only implicitly via parent state). + """ + if not self._auto_deps: + return self._static_deps + d = self._static_deps.copy() + if obj is None: + fget = self._fget + if fget is not None: + obj = cast(FunctionType, fget) + else: + return set() + with contextlib.suppress(AttributeError): + # unbox functools.partial + obj = cast(FunctionType, obj.func) # type: ignore + with contextlib.suppress(AttributeError): + # unbox EventHandler + obj = cast(FunctionType, obj.fn) # type: ignore + + if self_name is None and isinstance(obj, FunctionType): + try: + # the first argument to the function is the name of "self" arg + self_name = obj.__code__.co_varnames[0] + except (AttributeError, IndexError): + self_name = None + if self_name is None: + # cannot reference attributes on self if method takes no args + return set() + + invalid_names = ["get_state", "parent_state", "substates", "get_substate"] + self_is_top_of_stack = False + for instruction in dis.get_instructions(obj): + if ( + instruction.opname in ("LOAD_FAST", "LOAD_DEREF") + and instruction.argval == self_name + ): + # bytecode loaded the class instance to the top of stack, next load instruction + # is referencing an attribute on self + self_is_top_of_stack = True + continue + if self_is_top_of_stack and instruction.opname in ( + "LOAD_ATTR", + "LOAD_METHOD", + ): + try: + ref_obj = getattr(objclass, instruction.argval) + except Exception: + ref_obj = None + if instruction.argval in invalid_names: + raise VarValueError( + f"Cached var {str(self)} cannot access arbitrary state via `{instruction.argval}`." + ) + if callable(ref_obj): + # recurse into callable attributes + d.update( + self._deps( + objclass=objclass, + obj=ref_obj, + ) + ) + # recurse into property fget functions + elif isinstance(ref_obj, property) and not isinstance( + ref_obj, ComputedVar + ): + d.update( + self._deps( + objclass=objclass, + obj=ref_obj.fget, # type: ignore + ) + ) + elif ( + instruction.argval in objclass.backend_vars + or instruction.argval in objclass.vars + ): + # var access + d.add(instruction.argval) + elif instruction.opname == "LOAD_CONST" and isinstance( + instruction.argval, CodeType + ): + # recurse into nested functions / comprehensions, which can reference + # instance attributes from the outer scope + d.update( + self._deps( + objclass=objclass, + obj=instruction.argval, + self_name=self_name, + ) + ) + self_is_top_of_stack = False + return d + + def mark_dirty(self, instance) -> None: + """Mark this ComputedVar as dirty. + + Args: + instance: the state instance that needs to recompute the value. + """ + with contextlib.suppress(AttributeError): + delattr(instance, self._cache_attr) + + def _determine_var_type(self) -> Type: + """Get the type of the var. + + Returns: + The type of the var. + """ + hints = get_type_hints(self._fget) + if "return" in hints: + return hints["return"] + return Any + + @property + def __class__(self) -> Type: + """Get the class of the var. + + Returns: + The class of the var. + """ + return FakeComputedVarBaseClass + + @property + def fget(self) -> Callable[[BaseState], RETURN_TYPE]: + """Get the getter function. + + Returns: + The getter function. + """ + return self._fget + + +class DynamicRouteVar(ComputedVar[Union[str, List[str]]]): + """A ComputedVar that represents a dynamic route.""" + + pass + + +if TYPE_CHECKING: + BASE_STATE = TypeVar("BASE_STATE", bound=BaseState) + + +@overload +def computed_var( + fget: None = None, + initial_value: Any | types.Unset = types.Unset(), + cache: bool = False, + deps: Optional[List[Union[str, Var]]] = None, + auto_deps: bool = True, + interval: Optional[Union[datetime.timedelta, int]] = None, + backend: bool | None = None, + **kwargs, +) -> Callable[[Callable[[BASE_STATE], RETURN_TYPE]], ComputedVar[RETURN_TYPE]]: ... + + +@overload +def computed_var( + fget: Callable[[BASE_STATE], RETURN_TYPE], + initial_value: RETURN_TYPE | types.Unset = types.Unset(), + cache: bool = False, + deps: Optional[List[Union[str, Var]]] = None, + auto_deps: bool = True, + interval: Optional[Union[datetime.timedelta, int]] = None, + backend: bool | None = None, + **kwargs, +) -> ComputedVar[RETURN_TYPE]: ... + + +def computed_var( + fget: Callable[[BASE_STATE], Any] | None = None, + initial_value: Any | types.Unset = types.Unset(), + cache: bool = False, + deps: Optional[List[Union[str, Var]]] = None, + auto_deps: bool = True, + interval: Optional[Union[datetime.timedelta, int]] = None, + backend: bool | None = None, + **kwargs, +) -> ComputedVar | Callable[[Callable[[BASE_STATE], Any]], ComputedVar]: + """A ComputedVar decorator with or without kwargs. + + Args: + fget: The getter function. + initial_value: The initial value of the computed var. + cache: Whether to cache the computed value. + deps: Explicit var dependencies to track. + auto_deps: Whether var dependencies should be auto-determined. + interval: Interval at which the computed var should be updated. + backend: Whether the computed var is a backend var. + **kwargs: additional attributes to set on the instance + + Returns: + A ComputedVar instance. + + Raises: + ValueError: If caching is disabled and an update interval is set. + VarDependencyError: If user supplies dependencies without caching. + """ + if cache is False and interval is not None: + raise ValueError("Cannot set update interval without caching.") + + if cache is False and (deps is not None or auto_deps is False): + raise VarDependencyError("Cannot track dependencies without caching.") + + if fget is not None: + return ComputedVar(fget, cache=cache) + + def wrapper(fget: Callable[[BASE_STATE], Any]) -> ComputedVar: + return ComputedVar( + fget, + initial_value=initial_value, + cache=cache, + deps=deps, + auto_deps=auto_deps, + interval=interval, + backend=backend, + **kwargs, + ) + + return wrapper + + +RETURN = TypeVar("RETURN") + + +class CustomVarOperationReturn(Var[RETURN]): + """Base class for custom var operations.""" + + @classmethod + def create( + cls, + js_expression: str, + _var_type: Type[RETURN] | None = None, + _var_data: VarData | None = None, + ) -> CustomVarOperationReturn[RETURN]: + """Create a CustomVarOperation. + + Args: + js_expression: The JavaScript expression to evaluate. + _var_type: The type of the var. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The CustomVarOperation. + """ + return CustomVarOperationReturn( + _js_expr=js_expression, + _var_type=_var_type or Any, + _var_data=_var_data, + ) + + +def var_operation_return( + js_expression: str, + var_type: Type[RETURN] | None = None, + var_data: VarData | None = None, +) -> CustomVarOperationReturn[RETURN]: + """Shortcut for creating a CustomVarOperationReturn. + + Args: + js_expression: The JavaScript expression to evaluate. + var_type: The type of the var. + var_data: Additional hooks and imports associated with the Var. + + Returns: + The CustomVarOperationReturn. + """ + return CustomVarOperationReturn.create( + js_expression, + var_type, + var_data, + ) + + +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +class CustomVarOperation(CachedVarOperation, Var[T]): + """Base class for custom var operations.""" + + _name: str = dataclasses.field(default="") + + _args: Tuple[Tuple[str, Var], ...] = dataclasses.field(default_factory=tuple) + + _return: CustomVarOperationReturn[T] = dataclasses.field( + default_factory=lambda: CustomVarOperationReturn.create("") + ) + + @cached_property_no_lock + def _cached_var_name(self) -> str: + """Get the cached var name. + + Returns: + The cached var name. + """ + return str(self._return) + + @cached_property_no_lock + def _cached_get_all_var_data(self) -> VarData | None: + """Get the cached VarData. + + Returns: + The cached VarData. + """ + return VarData.merge( + *map( + lambda arg: arg[1]._get_all_var_data(), + self._args, + ), + self._return._get_all_var_data(), + self._var_data, + ) + + @classmethod + def create( + cls, + name: str, + args: Tuple[Tuple[str, Var], ...], + return_var: CustomVarOperationReturn[T], + _var_data: VarData | None = None, + ) -> CustomVarOperation[T]: + """Create a CustomVarOperation. + + Args: + name: The name of the operation. + args: The arguments to the operation. + return_var: The return var. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The CustomVarOperation. + """ + return CustomVarOperation( + _js_expr="", + _var_type=return_var._var_type, + _var_data=_var_data, + _name=name, + _args=args, + _return=return_var, + ) + + +class NoneVar(Var[None], python_types=type(None)): + """A var representing None.""" + + +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +class LiteralNoneVar(LiteralVar, NoneVar): + """A var representing None.""" + + _var_value: None = None + + def json(self) -> str: + """Serialize the var to a JSON string. + + Returns: + The JSON string. + """ + return "null" + + @classmethod + def create( + cls, + value: None = None, + _var_data: VarData | None = None, + ) -> LiteralNoneVar: + """Create a var from a value. + + Args: + value: The value of the var. Must be None. Existed for compatibility with LiteralVar. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The var. + """ + return LiteralNoneVar( + _js_expr="null", + _var_type=None, + _var_data=_var_data, + ) + + +def get_to_operation(var_subclass: Type[Var]) -> Type[ToOperation]: + """Get the ToOperation class for a given Var subclass. + + Args: + var_subclass: The Var subclass. + + Returns: + The ToOperation class. + + Raises: + ValueError: If the ToOperation class cannot be found. + """ + possible_classes = [ + saved_var_subclass.to_var_subclass + for saved_var_subclass in _var_subclasses + if saved_var_subclass.var_subclass is var_subclass + ] + if not possible_classes: + raise ValueError(f"Could not find ToOperation for {var_subclass}.") + return possible_classes[0] + + +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +class StateOperation(CachedVarOperation, Var): + """A var operation that accesses a field on an object.""" + + _state_name: str = dataclasses.field(default="") + _field: Var = dataclasses.field(default_factory=lambda: LiteralNoneVar.create()) + + @cached_property_no_lock + def _cached_var_name(self) -> str: + """Get the cached var name. + + Returns: + The cached var name. + """ + return f"{str(self._state_name)}.{str(self._field)}" + + def __getattr__(self, name: str) -> Any: + """Get an attribute of the var. + + Args: + name: The name of the attribute. + + Returns: + The attribute. + """ + if name == "_js_expr": + return self._cached_var_name + + return getattr(self._field, name) + + @classmethod + def create( + cls, + state_name: str, + field: Var, + _var_data: VarData | None = None, + ) -> StateOperation: + """Create a DotOperation. + + Args: + state_name: The name of the state. + field: The field of the state. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The DotOperation. + """ + return StateOperation( + _js_expr="", + _var_type=field._var_type, + _var_data=_var_data, + _state_name=state_name, + _field=field, + ) + + +def get_uuid_string_var() -> Var: + """Return a Var that generates a single memoized UUID via .web/utils/state.js. + + useMemo with an empty dependency array ensures that the generated UUID is + consistent across re-renders of the component. + + Returns: + A Var that generates a UUID at runtime. + """ + from reflex.utils.imports import ImportVar + from reflex.vars import Var + + unique_uuid_var = get_unique_variable_name() + unique_uuid_var_data = VarData( + imports={ + f"/{constants.Dirs.STATE_PATH}": {ImportVar(tag="generateUUID")}, # type: ignore + "react": "useMemo", + }, + hooks={f"const {unique_uuid_var} = useMemo(generateUUID, [])": None}, + ) + + return Var( + _js_expr=unique_uuid_var, + _var_type=str, + _var_data=unique_uuid_var_data, + ) + + +# Set of unique variable names. +USED_VARIABLES = set() + + +def get_unique_variable_name() -> str: + """Get a unique variable name. + + Returns: + The unique variable name. + """ + name = "".join([random.choice(string.ascii_lowercase) for _ in range(8)]) + if name not in USED_VARIABLES: + USED_VARIABLES.add(name) + return name + return get_unique_variable_name() + + +# Compile regex for finding reflex var tags. +_decode_var_pattern_re = ( + rf"{constants.REFLEX_VAR_OPENING_TAG}(.*?){constants.REFLEX_VAR_CLOSING_TAG}" +) +_decode_var_pattern = re.compile(_decode_var_pattern_re, flags=re.DOTALL) + +# Defined global immutable vars. +_global_vars: Dict[int, Var] = {} + + +def _extract_var_data(value: Iterable) -> list[VarData | None]: + """Extract the var imports and hooks from an iterable containing a Var. + + Args: + value: The iterable to extract the VarData from + + Returns: + The extracted VarDatas. + """ + from reflex.style import Style + from reflex.vars import Var + + var_datas = [] + with contextlib.suppress(TypeError): + for sub in value: + if isinstance(sub, Var): + var_datas.append(sub._var_data) + elif not isinstance(sub, str): + # Recurse into dict values. + if hasattr(sub, "values") and callable(sub.values): + var_datas.extend(_extract_var_data(sub.values())) + # Recurse into iterable values (or dict keys). + var_datas.extend(_extract_var_data(sub)) + + # Style objects should already have _var_data. + if isinstance(value, Style): + var_datas.append(value._var_data) + else: + # Recurse when value is a dict itself. + values = getattr(value, "values", None) + if callable(values): + var_datas.extend(_extract_var_data(values())) + return var_datas + + +# These names were changed in reflex 0.3.0 +REPLACED_NAMES = { + "full_name": "_var_full_name", + "name": "_js_expr", + "state": "_var_data.state", + "type_": "_var_type", + "is_local": "_var_is_local", + "is_string": "_var_is_string", + "set_state": "_var_set_state", + "deps": "_deps", +} + + +dispatchers: Dict[GenericType, Callable[[Var], Var]] = {} + + +def transform(fn: Callable[[Var], Var]) -> Callable[[Var], Var]: + """Register a function to transform a Var. + + Args: + fn: The function to register. + + Returns: + The decorator. + + Raises: + TypeError: If the return type of the function is not a Var. + TypeError: If the Var return type does not have a generic type. + ValueError: If a function for the generic type is already registered. + """ + return_type = fn.__annotations__["return"] + + origin = get_origin(return_type) + + if origin is not Var: + raise TypeError( + f"Expected return type of {fn.__name__} to be a Var, got {origin}." + ) + + generic_args = get_args(return_type) + + if not generic_args: + raise TypeError( + f"Expected Var return type of {fn.__name__} to have a generic type." + ) + + generic_type = get_origin(generic_args[0]) or generic_args[0] + + if generic_type in dispatchers: + raise ValueError(f"Function for {generic_type} already registered.") + + dispatchers[generic_type] = fn + + return fn + + +def generic_type_to_actual_type_map( + generic_type: GenericType, actual_type: GenericType +) -> Dict[TypeVar, GenericType]: + """Map the generic type to the actual type. + + Args: + generic_type: The generic type. + actual_type: The actual type. + + Returns: + The mapping of type variables to actual types. + + Raises: + TypeError: If the generic type and actual type do not match. + TypeError: If the number of generic arguments and actual arguments do not match. + """ + generic_origin = get_origin(generic_type) or generic_type + actual_origin = get_origin(actual_type) or actual_type + + if generic_origin is not actual_origin: + if isinstance(generic_origin, TypeVar): + return {generic_origin: actual_origin} + raise TypeError( + f"Type mismatch: expected {generic_origin}, got {actual_origin}." + ) + + generic_args = get_args(generic_type) + actual_args = get_args(actual_type) + + if len(generic_args) != len(actual_args): + raise TypeError( + f"Number of generic arguments mismatch: expected {len(generic_args)}, got {len(actual_args)}." + ) + + # call recursively for nested generic types and merge the results + return { + k: v + for generic_arg, actual_arg in zip(generic_args, actual_args) + for k, v in generic_type_to_actual_type_map(generic_arg, actual_arg).items() + } + + +def resolve_generic_type_with_mapping( + generic_type: GenericType, type_mapping: Dict[TypeVar, GenericType] +): + """Resolve a generic type with a type mapping. + + Args: + generic_type: The generic type. + type_mapping: The type mapping. + + Returns: + The resolved generic type. + """ + if isinstance(generic_type, TypeVar): + return type_mapping.get(generic_type, generic_type) + + generic_origin = get_origin(generic_type) or generic_type + + generic_args = get_args(generic_type) + + if not generic_args: + return generic_type + + mapping_for_older_python = { + list: List, + set: Set, + dict: Dict, + tuple: Tuple, + frozenset: FrozenSet, + } + + return mapping_for_older_python.get(generic_origin, generic_origin)[ + tuple( + resolve_generic_type_with_mapping(arg, type_mapping) for arg in generic_args + ) + ] + + +def resolve_arg_type_from_return_type( + arg_type: GenericType, return_type: GenericType, actual_return_type: GenericType +) -> GenericType: + """Resolve the argument type from the return type. + + Args: + arg_type: The argument type. + return_type: The return type. + actual_return_type: The requested return type. + + Returns: + The argument type without the generics that are resolved. + """ + return resolve_generic_type_with_mapping( + arg_type, generic_type_to_actual_type_map(return_type, actual_return_type) + ) + + +def dispatch( + field_name: str, + var_data: VarData, + result_var_type: GenericType, + existing_var: Var | None = None, +) -> Var: + """Dispatch a Var to the appropriate transformation function. + + Args: + field_name: The name of the field. + var_data: The VarData associated with the Var. + result_var_type: The type of the Var. + existing_var: The existing Var to transform. Optional. + + Returns: + The transformed Var. + + Raises: + TypeError: If the return type of the function is not a Var. + TypeError: If the Var return type does not have a generic type. + TypeError: If the first argument of the function is not a Var. + TypeError: If the first argument of the function does not have a generic type + """ + result_origin_var_type = get_origin(result_var_type) or result_var_type + + if result_origin_var_type in dispatchers: + fn = dispatchers[result_origin_var_type] + fn_first_arg_type = list(inspect.signature(fn).parameters.values())[ + 0 + ].annotation + + fn_return = inspect.signature(fn).return_annotation + + fn_return_origin = get_origin(fn_return) or fn_return + + if fn_return_origin is not Var: + raise TypeError( + f"Expected return type of {fn.__name__} to be a Var, got {fn_return}." + ) + + fn_return_generic_args = get_args(fn_return) + + if not fn_return_generic_args: + raise TypeError(f"Expected generic type of {fn_return} to be a type.") + + arg_origin = get_origin(fn_first_arg_type) or fn_first_arg_type + + if arg_origin is not Var: + raise TypeError( + f"Expected first argument of {fn.__name__} to be a Var, got {fn_first_arg_type}." + ) + + arg_generic_args = get_args(fn_first_arg_type) + + if not arg_generic_args: + raise TypeError( + f"Expected generic type of {fn_first_arg_type} to be a type." + ) + + arg_type = arg_generic_args[0] + fn_return_type = fn_return_generic_args[0] + + var = ( + Var( + field_name, + _var_data=var_data, + _var_type=resolve_arg_type_from_return_type( + arg_type, fn_return_type, result_var_type + ), + ).guess_type() + if existing_var is None + else existing_var._replace( + _var_type=resolve_arg_type_from_return_type( + arg_type, fn_return_type, result_var_type + ), + _var_data=var_data, + _js_expr=field_name, + ).guess_type() + ) + + return fn(var) + + if existing_var is not None: + return existing_var._replace( + _js_expr=field_name, + _var_data=var_data, + _var_type=result_var_type, + ).guess_type() + return Var( + field_name, + _var_data=var_data, + _var_type=result_var_type, + ).guess_type() + + +V = TypeVar("V") + + +class Field(Generic[T]): + """Shadow class for Var to allow for type hinting in the IDE.""" + + def __set__(self, instance, value: T): + """Set the Var. + + Args: + instance: The instance of the class setting the Var. + value: The value to set the Var to. + """ + + @overload + def __get__(self: Field[bool], instance: None, owner) -> BooleanVar: ... + + @overload + def __get__(self: Field[int], instance: None, owner) -> NumberVar: ... + + @overload + def __get__(self: Field[str], instance: None, owner) -> StringVar: ... + + @overload + def __get__(self: Field[None], instance: None, owner) -> NoneVar: ... + + @overload + def __get__( + self: Field[List[V]] | Field[Set[V]] | Field[Tuple[V, ...]], + instance: None, + owner, + ) -> ArrayVar[List[V]]: ... + + @overload + def __get__( + self: Field[Dict[str, V]], instance: None, owner + ) -> ObjectVar[Dict[str, V]]: ... + + @overload + def __get__(self, instance: None, owner) -> Var[T]: ... + + @overload + def __get__(self, instance, owner) -> T: ... + + def __get__(self, instance, owner): # type: ignore + """Get the Var. + + Args: + instance: The instance of the class accessing the Var. + owner: The class that the Var is attached to. + """ + + +def field(value: T) -> Field[T]: + """Create a Field with a value. + + Args: + value: The value of the Field. + + Returns: + The Field. + """ + return value # type: ignore diff --git a/reflex/ivars/function.py b/reflex/vars/function.py similarity index 70% rename from reflex/ivars/function.py rename to reflex/vars/function.py index 1a987b1cf..9d734a458 100644 --- a/reflex/ivars/function.py +++ b/reflex/vars/function.py @@ -7,12 +7,17 @@ import sys from typing import Any, Callable, Optional, Tuple, Type, Union from reflex.utils.types import GenericType -from reflex.vars import ImmutableVarData, Var, VarData -from .base import CachedVarOperation, ImmutableVar, LiteralVar, cached_property_no_lock +from .base import ( + CachedVarOperation, + LiteralVar, + Var, + VarData, + cached_property_no_lock, +) -class FunctionVar(ImmutableVar[Callable]): +class FunctionVar(Var[Callable], python_types=Callable): """Base class for immutable function vars.""" def __call__(self, *args: Var | Any) -> ArgsFunctionOperation: @@ -26,7 +31,7 @@ class FunctionVar(ImmutableVar[Callable]): """ return ArgsFunctionOperation.create( ("...args",), - VarOperationCall.create(self, *args, ImmutableVar.create_safe("...args")), + VarOperationCall.create(self, *args, Var(_js_expr="...args")), ) def call(self, *args: Var | Any) -> VarOperationCall: @@ -61,9 +66,9 @@ class FunctionStringVar(FunctionVar): The function var. """ return cls( - _var_name=func, + _js_expr=func, _var_type=_var_type, - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, ) @@ -72,7 +77,7 @@ class FunctionStringVar(FunctionVar): frozen=True, **{"slots": True} if sys.version_info >= (3, 10) else {}, ) -class VarOperationCall(CachedVarOperation, ImmutableVar): +class VarOperationCall(CachedVarOperation, Var): """Base class for immutable vars that are the result of a function call.""" _func: Optional[FunctionVar] = dataclasses.field(default=None) @@ -88,13 +93,13 @@ class VarOperationCall(CachedVarOperation, ImmutableVar): return f"({str(self._func)}({', '.join([str(LiteralVar.create(arg)) for arg in self._args])}))" @cached_property_no_lock - def _cached_get_all_var_data(self) -> ImmutableVarData | None: + def _cached_get_all_var_data(self) -> VarData | None: """Get all the var data associated with the var. Returns: All the var data associated with the var. """ - return ImmutableVarData.merge( + return VarData.merge( self._func._get_all_var_data() if self._func is not None else None, *[LiteralVar.create(arg)._get_all_var_data() for arg in self._args], self._var_data, @@ -119,9 +124,9 @@ class VarOperationCall(CachedVarOperation, ImmutableVar): The function call var. """ return cls( - _var_name="", + _js_expr="", _var_type=_var_type, - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, _func=func, _args=args, ) @@ -166,58 +171,16 @@ class ArgsFunctionOperation(CachedVarOperation, FunctionVar): The function var. """ return cls( - _var_name="", + _js_expr="", _var_type=_var_type, - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, _args_names=args_names, _return_expr=return_expr, ) -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ToFunctionOperation(CachedVarOperation, FunctionVar): - """Base class of converting a var to a function.""" - - _original_var: Var = dataclasses.field( - default_factory=lambda: LiteralVar.create(None) - ) - - @cached_property_no_lock - def _cached_var_name(self) -> str: - """The name of the var. - - Returns: - The name of the var. - """ - return str(self._original_var) - - @classmethod - def create( - cls, - original_var: Var, - _var_type: GenericType = Callable, - _var_data: VarData | None = None, - ) -> ToFunctionOperation: - """Create a new function var. - - Args: - original_var: The original var to convert to a function. - _var_type: The type of the function. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The function var. - """ - return cls( - _var_name="", - _var_type=_var_type, - _var_data=ImmutableVarData.merge(_var_data), - _original_var=original_var, - ) - - JSON_STRINGIFY = FunctionStringVar.create("JSON.stringify") +ARRAY_ISARRAY = FunctionStringVar.create("Array.isArray") +PROTOTYPE_TO_STRING = FunctionStringVar.create( + "((__to_string) => __to_string.toString())" +) diff --git a/reflex/ivars/number.py b/reflex/vars/number.py similarity index 66% rename from reflex/ivars/number.py rename to reflex/vars/number.py index 68c856d18..77c728d13 100644 --- a/reflex/ivars/number.py +++ b/reflex/vars/number.py @@ -4,29 +4,67 @@ from __future__ import annotations import dataclasses import json +import math import sys -from typing import Any, Callable, TypeVar, Union +from typing import ( + TYPE_CHECKING, + Any, + Callable, + NoReturn, + Type, + TypeVar, + Union, + overload, +) -from reflex.vars import ImmutableVarData, Var, VarData +from reflex.constants.base import Dirs +from reflex.utils.exceptions import PrimitiveUnserializableToJSON, VarTypeError +from reflex.utils.imports import ImportDict, ImportVar +from reflex.utils.types import is_optional from .base import ( - CachedVarOperation, CustomVarOperationReturn, - ImmutableVar, LiteralVar, - cached_property_no_lock, + Var, + VarData, unionize, var_operation, var_operation_return, ) -NUMBER_T = TypeVar("NUMBER_T", int, float, Union[int, float]) +NUMBER_T = TypeVar("NUMBER_T", int, float, Union[int, float], bool) + +if TYPE_CHECKING: + from .sequence import ArrayVar -class NumberVar(ImmutableVar[NUMBER_T]): +def raise_unsupported_operand_types( + operator: str, operands_types: tuple[type, ...] +) -> NoReturn: + """Raise an unsupported operand types error. + + Args: + operator: The operator. + operands_types: The types of the operands. + + Raises: + VarTypeError: The operand types are unsupported. + """ + raise VarTypeError( + f"Unsupported Operand type(s) for {operator}: {', '.join(map(lambda t: t.__name__, operands_types))}" + ) + + +class NumberVar(Var[NUMBER_T], python_types=(int, float)): """Base class for immutable number vars.""" - def __add__(self, other: number_types | boolean_types): + @overload + def __add__(self, other: number_types) -> NumberVar: ... + + @overload + def __add__(self, other: NoReturn) -> NoReturn: ... + + def __add__(self, other: Any): """Add two numbers. Args: @@ -35,9 +73,17 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number addition operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("+", (type(self), type(other))) return number_add_operation(self, +other) - def __radd__(self, other: number_types | boolean_types): + @overload + def __radd__(self, other: number_types) -> NumberVar: ... + + @overload + def __radd__(self, other: NoReturn) -> NoReturn: ... + + def __radd__(self, other: Any): """Add two numbers. Args: @@ -46,9 +92,17 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number addition operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("+", (type(other), type(self))) return number_add_operation(+other, self) - def __sub__(self, other: number_types | boolean_types): + @overload + def __sub__(self, other: number_types) -> NumberVar: ... + + @overload + def __sub__(self, other: NoReturn) -> NoReturn: ... + + def __sub__(self, other: Any): """Subtract two numbers. Args: @@ -57,9 +111,18 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number subtraction operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("-", (type(self), type(other))) + return number_subtract_operation(self, +other) - def __rsub__(self, other: number_types | boolean_types): + @overload + def __rsub__(self, other: number_types) -> NumberVar: ... + + @overload + def __rsub__(self, other: NoReturn) -> NoReturn: ... + + def __rsub__(self, other: Any): """Subtract two numbers. Args: @@ -68,6 +131,9 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number subtraction operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("-", (type(other), type(self))) + return number_subtract_operation(+other, self) def __abs__(self): @@ -78,7 +144,13 @@ class NumberVar(ImmutableVar[NUMBER_T]): """ return number_abs_operation(self) - def __mul__(self, other: number_types | boolean_types): + @overload + def __mul__(self, other: number_types | boolean_types) -> NumberVar: ... + + @overload + def __mul__(self, other: list | tuple | set | ArrayVar) -> ArrayVar: ... + + def __mul__(self, other: Any): """Multiply two numbers. Args: @@ -87,9 +159,25 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number multiplication operation. """ + from .sequence import ArrayVar, LiteralArrayVar + + if isinstance(other, (list, tuple, set, ArrayVar)): + if isinstance(other, ArrayVar): + return other * self + return LiteralArrayVar.create(other) * self + + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("*", (type(self), type(other))) + return number_multiply_operation(self, +other) - def __rmul__(self, other: number_types | boolean_types): + @overload + def __rmul__(self, other: number_types | boolean_types) -> NumberVar: ... + + @overload + def __rmul__(self, other: list | tuple | set | ArrayVar) -> ArrayVar: ... + + def __rmul__(self, other: Any): """Multiply two numbers. Args: @@ -98,9 +186,25 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number multiplication operation. """ + from .sequence import ArrayVar, LiteralArrayVar + + if isinstance(other, (list, tuple, set, ArrayVar)): + if isinstance(other, ArrayVar): + return other * self + return LiteralArrayVar.create(other) * self + + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("*", (type(other), type(self))) + return number_multiply_operation(+other, self) - def __truediv__(self, other: number_types | boolean_types): + @overload + def __truediv__(self, other: number_types) -> NumberVar: ... + + @overload + def __truediv__(self, other: NoReturn) -> NoReturn: ... + + def __truediv__(self, other: Any): """Divide two numbers. Args: @@ -109,9 +213,18 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number true division operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("/", (type(self), type(other))) + return number_true_division_operation(self, +other) - def __rtruediv__(self, other: number_types | boolean_types): + @overload + def __rtruediv__(self, other: number_types) -> NumberVar: ... + + @overload + def __rtruediv__(self, other: NoReturn) -> NoReturn: ... + + def __rtruediv__(self, other: Any): """Divide two numbers. Args: @@ -120,9 +233,18 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number true division operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("/", (type(other), type(self))) + return number_true_division_operation(+other, self) - def __floordiv__(self, other: number_types | boolean_types): + @overload + def __floordiv__(self, other: number_types) -> NumberVar: ... + + @overload + def __floordiv__(self, other: NoReturn) -> NoReturn: ... + + def __floordiv__(self, other: Any): """Floor divide two numbers. Args: @@ -131,9 +253,18 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number floor division operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("//", (type(self), type(other))) + return number_floor_division_operation(self, +other) - def __rfloordiv__(self, other: number_types | boolean_types): + @overload + def __rfloordiv__(self, other: number_types) -> NumberVar: ... + + @overload + def __rfloordiv__(self, other: NoReturn) -> NoReturn: ... + + def __rfloordiv__(self, other: Any): """Floor divide two numbers. Args: @@ -142,9 +273,18 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number floor division operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("//", (type(other), type(self))) + return number_floor_division_operation(+other, self) - def __mod__(self, other: number_types | boolean_types): + @overload + def __mod__(self, other: number_types) -> NumberVar: ... + + @overload + def __mod__(self, other: NoReturn) -> NoReturn: ... + + def __mod__(self, other: Any): """Modulo two numbers. Args: @@ -153,9 +293,18 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number modulo operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("%", (type(self), type(other))) + return number_modulo_operation(self, +other) - def __rmod__(self, other: number_types | boolean_types): + @overload + def __rmod__(self, other: number_types) -> NumberVar: ... + + @overload + def __rmod__(self, other: NoReturn) -> NoReturn: ... + + def __rmod__(self, other: Any): """Modulo two numbers. Args: @@ -164,9 +313,18 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number modulo operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("%", (type(other), type(self))) + return number_modulo_operation(+other, self) - def __pow__(self, other: number_types | boolean_types): + @overload + def __pow__(self, other: number_types) -> NumberVar: ... + + @overload + def __pow__(self, other: NoReturn) -> NoReturn: ... + + def __pow__(self, other: Any): """Exponentiate two numbers. Args: @@ -175,9 +333,18 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number exponent operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("**", (type(self), type(other))) + return number_exponent_operation(self, +other) - def __rpow__(self, other: number_types | boolean_types): + @overload + def __rpow__(self, other: number_types) -> NumberVar: ... + + @overload + def __rpow__(self, other: NoReturn) -> NoReturn: ... + + def __rpow__(self, other: Any): """Exponentiate two numbers. Args: @@ -186,6 +353,9 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The number exponent operation. """ + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("**", (type(other), type(self))) + return number_exponent_operation(+other, self) def __neg__(self): @@ -244,6 +414,12 @@ class NumberVar(ImmutableVar[NUMBER_T]): """ return number_trunc_operation(self) + @overload + def __lt__(self, other: number_types) -> BooleanVar: ... + + @overload + def __lt__(self, other: NoReturn) -> NoReturn: ... + def __lt__(self, other: Any): """Less than comparison. @@ -253,9 +429,15 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The result of the comparison. """ - if isinstance(other, (NumberVar, BooleanVar, int, float, bool)): - return less_than_operation(self, +other) - return less_than_operation(self, other) + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("<", (type(self), type(other))) + return less_than_operation(self, +other) + + @overload + def __le__(self, other: number_types) -> BooleanVar: ... + + @overload + def __le__(self, other: NoReturn) -> NoReturn: ... def __le__(self, other: Any): """Less than or equal comparison. @@ -266,9 +448,9 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The result of the comparison. """ - if isinstance(other, (NumberVar, BooleanVar, int, float, bool)): - return less_than_or_equal_operation(self, +other) - return less_than_or_equal_operation(self, other) + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types("<=", (type(self), type(other))) + return less_than_or_equal_operation(self, +other) def __eq__(self, other: Any): """Equal comparison. @@ -279,7 +461,7 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The result of the comparison. """ - if isinstance(other, (NumberVar, BooleanVar, int, float, bool)): + if isinstance(other, NUMBER_TYPES): return equal_operation(self, +other) return equal_operation(self, other) @@ -292,10 +474,16 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The result of the comparison. """ - if isinstance(other, (NumberVar, BooleanVar, int, float, bool)): + if isinstance(other, NUMBER_TYPES): return not_equal_operation(self, +other) return not_equal_operation(self, other) + @overload + def __gt__(self, other: number_types) -> BooleanVar: ... + + @overload + def __gt__(self, other: NoReturn) -> NoReturn: ... + def __gt__(self, other: Any): """Greater than comparison. @@ -305,9 +493,15 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The result of the comparison. """ - if isinstance(other, (NumberVar, BooleanVar, int, float, bool)): - return greater_than_operation(self, +other) - return greater_than_operation(self, other) + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types(">", (type(self), type(other))) + return greater_than_operation(self, +other) + + @overload + def __ge__(self, other: number_types) -> BooleanVar: ... + + @overload + def __ge__(self, other: NoReturn) -> NoReturn: ... def __ge__(self, other: Any): """Greater than or equal comparison. @@ -318,9 +512,9 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The result of the comparison. """ - if isinstance(other, (NumberVar, BooleanVar, int, float, bool)): - return greater_than_or_equal_operation(self, +other) - return greater_than_or_equal_operation(self, other) + if not isinstance(other, NUMBER_TYPES): + raise_unsupported_operand_types(">=", (type(self), type(other))) + return greater_than_or_equal_operation(self, +other) def bool(self): """Boolean conversion. @@ -328,8 +522,26 @@ class NumberVar(ImmutableVar[NUMBER_T]): Returns: The boolean value of the number. """ + if is_optional(self._var_type): + return boolify((self != None) & (self != 0)) # noqa: E711 return self != 0 + def _is_strict_float(self) -> bool: + """Check if the number is a float. + + Returns: + bool: True if the number is a float. + """ + return issubclass(self._var_type, float) + + def _is_strict_int(self) -> bool: + """Check if the number is an int. + + Returns: + bool: True if the number is an int. + """ + return issubclass(self._var_type, int) + def binary_number_operation( func: Callable[[NumberVar, NumberVar], str], @@ -545,7 +757,7 @@ def number_trunc_operation(value: NumberVar): return var_operation_return(js_expression=f"Math.trunc({value})", var_type=int) -class BooleanVar(ImmutableVar[bool]): +class BooleanVar(NumberVar[bool], python_types=bool): """Base class for immutable boolean vars.""" def __invert__(self): @@ -580,7 +792,7 @@ class BooleanVar(ImmutableVar[bool]): """ return self - def __lt__(self, other: boolean_types | number_types): + def __lt__(self, other: Any): """Less than comparison. Args: @@ -589,9 +801,9 @@ class BooleanVar(ImmutableVar[bool]): Returns: The result of the comparison. """ - return less_than_operation(+self, +other) + return +self < other - def __le__(self, other: boolean_types | number_types): + def __le__(self, other: Any): """Less than or equal comparison. Args: @@ -600,31 +812,9 @@ class BooleanVar(ImmutableVar[bool]): Returns: The result of the comparison. """ - return less_than_or_equal_operation(+self, +other) + return +self <= other - def __eq__(self, other: boolean_types | number_types): - """Equal comparison. - - Args: - other: The other boolean. - - Returns: - The result of the comparison. - """ - return equal_operation(+self, +other) - - def __ne__(self, other: boolean_types | number_types): - """Not equal comparison. - - Args: - other: The other boolean. - - Returns: - The result of the comparison. - """ - return not_equal_operation(+self, +other) - - def __gt__(self, other: boolean_types | number_types): + def __gt__(self, other: Any): """Greater than comparison. Args: @@ -633,9 +823,9 @@ class BooleanVar(ImmutableVar[bool]): Returns: The result of the comparison. """ - return greater_than_operation(+self, +other) + return +self > other - def __ge__(self, other: boolean_types | number_types): + def __ge__(self, other: Any): """Greater than or equal comparison. Args: @@ -644,7 +834,7 @@ class BooleanVar(ImmutableVar[bool]): Returns: The result of the comparison. """ - return greater_than_or_equal_operation(+self, +other) + return +self >= other @var_operation @@ -791,6 +981,65 @@ def boolean_not_operation(value: BooleanVar): return var_operation_return(js_expression=f"!({value})", var_type=bool) +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +class LiteralNumberVar(LiteralVar, NumberVar): + """Base class for immutable literal number vars.""" + + _var_value: float | int = dataclasses.field(default=0) + + def json(self) -> str: + """Get the JSON representation of the var. + + Returns: + The JSON representation of the var. + + Raises: + PrimitiveUnserializableToJSON: If the var is unserializable to JSON. + """ + if math.isinf(self._var_value) or math.isnan(self._var_value): + raise PrimitiveUnserializableToJSON( + f"No valid JSON representation for {self}" + ) + return json.dumps(self._var_value) + + def __hash__(self) -> int: + """Calculate the hash value of the object. + + Returns: + int: The hash value of the object. + """ + return hash((self.__class__.__name__, self._var_value)) + + @classmethod + def create(cls, value: float | int, _var_data: VarData | None = None): + """Create the number var. + + Args: + value: The value of the var. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The number var. + """ + if math.isinf(value): + js_expr = "Infinity" if value > 0 else "-Infinity" + elif math.isnan(value): + js_expr = "NaN" + else: + js_expr = str(value) + + return cls( + _js_expr=js_expr, + _var_type=type(value), + _var_data=_var_data, + _var_value=value, + ) + + @dataclasses.dataclass( eq=False, frozen=True, @@ -829,54 +1078,9 @@ class LiteralBooleanVar(LiteralVar, BooleanVar): The boolean var. """ return cls( - _var_name="true" if value else "false", + _js_expr="true" if value else "false", _var_type=bool, - _var_data=ImmutableVarData.merge(_var_data), - _var_value=value, - ) - - -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class LiteralNumberVar(LiteralVar, NumberVar): - """Base class for immutable literal number vars.""" - - _var_value: float | int = dataclasses.field(default=0) - - def json(self) -> str: - """Get the JSON representation of the var. - - Returns: - The JSON representation of the var. - """ - return json.dumps(self._var_value) - - def __hash__(self) -> int: - """Calculate the hash value of the object. - - Returns: - int: The hash value of the object. - """ - return hash((self.__class__.__name__, self._var_value)) - - @classmethod - def create(cls, value: float | int, _var_data: VarData | None = None): - """Create the number var. - - Args: - value: The value of the var. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The number var. - """ - return cls( - _var_name=str(value), - _var_type=type(value), - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, _var_value=value, ) @@ -885,94 +1089,9 @@ number_types = Union[NumberVar, int, float] boolean_types = Union[BooleanVar, bool] -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ToNumberVarOperation(CachedVarOperation, NumberVar): - """Base class for immutable number vars that are the result of a number operation.""" - - _original_value: Var = dataclasses.field( - default_factory=lambda: LiteralNumberVar.create(0) - ) - - @cached_property_no_lock - def _cached_var_name(self) -> str: - """The name of the var. - - Returns: - The name of the var. - """ - return str(self._original_value) - - @classmethod - def create( - cls, - value: Var, - _var_type: type[int] | type[float] = float, - _var_data: VarData | None = None, - ): - """Create the number var. - - Args: - value: The value of the var. - _var_type: The type of the Var. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The number var. - """ - return cls( - _var_name="", - _var_type=_var_type, - _var_data=ImmutableVarData.merge(_var_data), - _original_value=value, - ) - - -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ToBooleanVarOperation(CachedVarOperation, BooleanVar): - """Base class for immutable boolean vars that are the result of a boolean operation.""" - - _original_value: Var = dataclasses.field( - default_factory=lambda: LiteralBooleanVar.create(False) - ) - - @cached_property_no_lock - def _cached_var_name(self) -> str: - """The name of the var. - - Returns: - The name of the var. - """ - return str(self._original_value) - - @classmethod - def create( - cls, - value: Var, - _var_data: VarData | None = None, - ): - """Create the boolean var. - - Args: - value: The value of the var. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The boolean var. - """ - return cls( - _var_name="", - _var_type=bool, - _var_data=ImmutableVarData.merge(_var_data), - _original_value=value, - ) +_IS_TRUE_IMPORT: ImportDict = { + f"/{Dirs.STATE_PATH}": [ImportVar(tag="isTrue")], +} @var_operation @@ -986,13 +1105,18 @@ def boolify(value: Var): The boolean value. """ return var_operation_return( - js_expression=f"Boolean({value})", + js_expression=f"isTrue({value})", var_type=bool, + var_data=VarData(imports=_IS_TRUE_IMPORT), ) +T = TypeVar("T") +U = TypeVar("U") + + @var_operation -def ternary_operation(condition: BooleanVar, if_true: Var, if_false: Var): +def ternary_operation(condition: BooleanVar, if_true: Var[T], if_false: Var[U]): """Create a ternary operation. Args: @@ -1003,7 +1127,14 @@ def ternary_operation(condition: BooleanVar, if_true: Var, if_false: Var): Returns: The ternary operation. """ - return var_operation_return( - js_expression=f"({condition} ? {if_true} : {if_false})", - var_type=unionize(if_true._var_type, if_false._var_type), + type_value: Union[Type[T], Type[U]] = unionize( + if_true._var_type, if_false._var_type ) + value: CustomVarOperationReturn[Union[T, U]] = var_operation_return( + js_expression=f"({condition} ? {if_true} : {if_false})", + var_type=type_value, + ) + return value + + +NUMBER_TYPES = (int, float, NumberVar) diff --git a/reflex/ivars/object.py b/reflex/vars/object.py similarity index 86% rename from reflex/ivars/object.py rename to reflex/vars/object.py index 49a21226f..56f3535d8 100644 --- a/reflex/ivars/object.py +++ b/reflex/vars/object.py @@ -22,18 +22,18 @@ from typing import ( from reflex.utils import types from reflex.utils.exceptions import VarAttributeError from reflex.utils.types import GenericType, get_attribute_access_type, get_origin -from reflex.vars import ImmutableVarData, Var, VarData from .base import ( CachedVarOperation, - ImmutableVar, LiteralVar, + Var, + VarData, cached_property_no_lock, figure_out_type, var_operation, var_operation_return, ) -from .number import BooleanVar, NumberVar +from .number import BooleanVar, NumberVar, raise_unsupported_operand_types from .sequence import ArrayVar, StringVar OBJECT_TYPE = TypeVar("OBJECT_TYPE", bound=Dict) @@ -46,7 +46,7 @@ ARRAY_INNER_TYPE = TypeVar("ARRAY_INNER_TYPE") OTHER_KEY_TYPE = TypeVar("OTHER_KEY_TYPE") -class ObjectVar(ImmutableVar[OBJECT_TYPE]): +class ObjectVar(Var[OBJECT_TYPE], python_types=dict): """Base class for immutable object vars.""" def _key_type(self) -> Type: @@ -117,6 +117,8 @@ class ObjectVar(ImmutableVar[OBJECT_TYPE]): """ return object_entries_operation(self) + items = entries + def merge(self, other: ObjectVar): """Merge two objects. @@ -133,7 +135,7 @@ class ObjectVar(ImmutableVar[OBJECT_TYPE]): def __getitem__( self: ObjectVar[Dict[KEY_TYPE, NoReturn]], key: Var | Any, - ) -> ImmutableVar: ... + ) -> Var: ... @overload def __getitem__( @@ -175,7 +177,7 @@ class ObjectVar(ImmutableVar[OBJECT_TYPE]): key: Var | Any, ) -> ObjectVar[dict[OTHER_KEY_TYPE, VALUE_TYPE]]: ... - def __getitem__(self, key: Var | Any) -> ImmutableVar: + def __getitem__(self, key: Var | Any) -> Var: """Get an item from the object. Args: @@ -184,6 +186,10 @@ class ObjectVar(ImmutableVar[OBJECT_TYPE]): Returns: The item from the object. """ + if not isinstance(key, (StringVar, str, int, NumberVar)) or ( + isinstance(key, NumberVar) and key._is_strict_float() + ): + raise_unsupported_operand_types("[]", (type(self), type(key))) return ObjectItemOperation.create(self, key).guess_type() # NoReturn is used here to catch when key value is Any @@ -191,7 +197,7 @@ class ObjectVar(ImmutableVar[OBJECT_TYPE]): def __getattr__( self: ObjectVar[Dict[KEY_TYPE, NoReturn]], name: str, - ) -> ImmutableVar: ... + ) -> Var: ... @overload def __getattr__( @@ -233,7 +239,7 @@ class ObjectVar(ImmutableVar[OBJECT_TYPE]): name: str, ) -> ObjectVar[dict[OTHER_KEY_TYPE, VALUE_TYPE]]: ... - def __getattr__(self, name) -> ImmutableVar: + def __getattr__(self, name) -> Var: """Get an attribute of the var. Args: @@ -254,7 +260,9 @@ class ObjectVar(ImmutableVar[OBJECT_TYPE]): var_type = get_args(var_type)[0] fixed_type = var_type if isclass(var_type) else get_origin(var_type) - if isclass(fixed_type) and not issubclass(fixed_type, dict): + if (isclass(fixed_type) and not issubclass(fixed_type, dict)) or ( + fixed_type in types.UnionTypes + ): attribute_type = get_attribute_access_type(var_type, name) if attribute_type is None: raise VarAttributeError( @@ -348,16 +356,16 @@ class LiteralObjectVar(CachedVarOperation, ObjectVar[OBJECT_TYPE], LiteralVar): Returns: The hash of the var. """ - return hash((self.__class__.__name__, self._var_name)) + return hash((self.__class__.__name__, self._js_expr)) @cached_property_no_lock - def _cached_get_all_var_data(self) -> ImmutableVarData | None: + def _cached_get_all_var_data(self) -> VarData | None: """Get all the var data. Returns: The var data. """ - return ImmutableVarData.merge( + return VarData.merge( *[LiteralVar.create(var)._get_all_var_data() for var in self._var_value], *[ LiteralVar.create(var)._get_all_var_data() @@ -384,9 +392,9 @@ class LiteralObjectVar(CachedVarOperation, ObjectVar[OBJECT_TYPE], LiteralVar): The literal object var. """ return LiteralObjectVar( - _var_name="", + _js_expr="", _var_type=(figure_out_type(_var_value) if _var_type is None else _var_type), - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, _var_value=_var_value, ) @@ -464,7 +472,7 @@ def object_merge_operation(lhs: ObjectVar, rhs: ObjectVar): frozen=True, **{"slots": True} if sys.version_info >= (3, 10) else {}, ) -class ObjectItemOperation(CachedVarOperation, ImmutableVar): +class ObjectItemOperation(CachedVarOperation, Var): """Operation to get an item from an object.""" _object: ObjectVar = dataclasses.field( @@ -503,60 +511,14 @@ class ObjectItemOperation(CachedVarOperation, ImmutableVar): The object item operation. """ return cls( - _var_name="", + _js_expr="", _var_type=object._value_type() if _var_type is None else _var_type, - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, _object=object, _key=key if isinstance(key, Var) else LiteralVar.create(key), ) -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ToObjectOperation(CachedVarOperation, ObjectVar): - """Operation to convert a var to an object.""" - - _original_var: Var = dataclasses.field( - default_factory=lambda: LiteralObjectVar.create({}) - ) - - @cached_property_no_lock - def _cached_var_name(self) -> str: - """The name of the operation. - - Returns: - The name of the operation. - """ - return str(self._original_var) - - @classmethod - def create( - cls, - original_var: Var, - _var_type: GenericType | None = None, - _var_data: VarData | None = None, - ) -> ToObjectOperation: - """Create the to object operation. - - Args: - original_var: The original var to convert. - _var_type: The type of the var. - _var_data: Additional hooks and imports associated with the operation. - - Returns: - The to object operation. - """ - return cls( - _var_name="", - _var_type=dict if _var_type is None else _var_type, - _var_data=ImmutableVarData.merge(_var_data), - _original_var=original_var, - ) - - @var_operation def object_has_own_property_operation(object: ObjectVar, key: Var): """Check if an object has a key. diff --git a/reflex/ivars/sequence.py b/reflex/vars/sequence.py similarity index 50% rename from reflex/ivars/sequence.py rename to reflex/vars/sequence.py index 25586e4df..39139ce3f 100644 --- a/reflex/ivars/sequence.py +++ b/reflex/vars/sequence.py @@ -14,31 +14,33 @@ from typing import ( Dict, List, Literal, + NoReturn, Set, Tuple, Type, - TypeVar, Union, overload, ) +from typing_extensions import TypeVar + from reflex import constants from reflex.constants.base import REFLEX_VAR_OPENING_TAG +from reflex.constants.colors import Color +from reflex.utils.exceptions import VarTypeError from reflex.utils.types import GenericType, get_origin -from reflex.vars import ( - ImmutableVarData, - Var, - VarData, - _global_vars, -) from .base import ( CachedVarOperation, CustomVarOperationReturn, - ImmutableVar, LiteralVar, + Var, + VarData, + _global_vars, cached_property_no_lock, figure_out_type, + get_python_literal, + get_unique_variable_name, unionize, var_operation, var_operation_return, @@ -47,16 +49,26 @@ from .number import ( BooleanVar, LiteralNumberVar, NumberVar, + raise_unsupported_operand_types, + ternary_operation, ) if TYPE_CHECKING: from .object import ObjectVar +STRING_TYPE = TypeVar("STRING_TYPE", default=str) -class StringVar(ImmutableVar[str]): + +class StringVar(Var[STRING_TYPE], python_types=str): """Base class for immutable string vars.""" - def __add__(self, other: StringVar | str) -> ConcatVarOperation: + @overload + def __add__(self, other: StringVar | str) -> ConcatVarOperation: ... + + @overload + def __add__(self, other: NoReturn) -> NoReturn: ... + + def __add__(self, other: Any) -> ConcatVarOperation: """Concatenate two strings. Args: @@ -65,9 +77,18 @@ class StringVar(ImmutableVar[str]): Returns: The string concatenation operation. """ + if not isinstance(other, (StringVar, str)): + raise_unsupported_operand_types("+", (type(self), type(other))) + return ConcatVarOperation.create(self, other) - def __radd__(self, other: StringVar | str) -> ConcatVarOperation: + @overload + def __radd__(self, other: StringVar | str) -> ConcatVarOperation: ... + + @overload + def __radd__(self, other: NoReturn) -> NoReturn: ... + + def __radd__(self, other: Any) -> ConcatVarOperation: """Concatenate two strings. Args: @@ -76,31 +97,58 @@ class StringVar(ImmutableVar[str]): Returns: The string concatenation operation. """ + if not isinstance(other, (StringVar, str)): + raise_unsupported_operand_types("+", (type(other), type(self))) + return ConcatVarOperation.create(other, self) - def __mul__(self, other: NumberVar | int) -> StringVar: + @overload + def __mul__(self, other: NumberVar | int) -> StringVar: ... + + @overload + def __mul__(self, other: NoReturn) -> NoReturn: ... + + def __mul__(self, other: Any) -> StringVar: """Multiply the sequence by a number or an integer. Args: - other (NumberVar | int): The number or integer to multiply the sequence by. + other: The number or integer to multiply the sequence by. Returns: StringVar: The resulting sequence after multiplication. """ + if not isinstance(other, (NumberVar, int)): + raise_unsupported_operand_types("*", (type(self), type(other))) + return (self.split() * other).join() - def __rmul__(self, other: NumberVar | int) -> StringVar: + @overload + def __rmul__(self, other: NumberVar | int) -> StringVar: ... + + @overload + def __rmul__(self, other: NoReturn) -> NoReturn: ... + + def __rmul__(self, other: Any) -> StringVar: """Multiply the sequence by a number or an integer. Args: - other (NumberVar | int): The number or integer to multiply the sequence by. + other: The number or integer to multiply the sequence by. Returns: StringVar: The resulting sequence after multiplication. """ + if not isinstance(other, (NumberVar, int)): + raise_unsupported_operand_types("*", (type(other), type(self))) + return (self.split() * other).join() - def __getitem__(self, i: slice | int | NumberVar) -> StringVar: + @overload + def __getitem__(self, i: slice) -> StringVar: ... + + @overload + def __getitem__(self, i: int | NumberVar) -> StringVar: ... + + def __getitem__(self, i: Any) -> StringVar: """Get a slice of the string. Args: @@ -111,6 +159,10 @@ class StringVar(ImmutableVar[str]): """ if isinstance(i, slice): return self.split()[i].join() + if not isinstance(i, (int, NumberVar)) or ( + isinstance(i, NumberVar) and i._is_strict_float() + ): + raise_unsupported_operand_types("[]", (type(self), type(i))) return string_item_operation(self, i) def length(self) -> NumberVar: @@ -145,14 +197,6 @@ class StringVar(ImmutableVar[str]): """ return string_strip_operation(self) - def bool(self): - """Boolean conversion. - - Returns: - The boolean value of the string. - """ - return self.length() != 0 - def reversed(self) -> StringVar: """Reverse the string. @@ -161,18 +205,41 @@ class StringVar(ImmutableVar[str]): """ return self.split().reverse().join() - def contains(self, other: StringVar | str) -> BooleanVar: + @overload + def contains( + self, other: StringVar | str, field: StringVar | str | None = None + ) -> BooleanVar: ... + + @overload + def contains( + self, other: NoReturn, field: StringVar | str | None = None + ) -> NoReturn: ... + + def contains(self, other: Any, field: Any = None) -> BooleanVar: """Check if the string contains another string. Args: other: The other string. + field: The field to check. Returns: The string contains operation. """ + if not isinstance(other, (StringVar, str)): + raise_unsupported_operand_types("contains", (type(self), type(other))) + if field is not None: + if not isinstance(field, (StringVar, str)): + raise_unsupported_operand_types("contains", (type(self), type(field))) + return string_contains_field_operation(self, other, field) return string_contains_operation(self, other) - def split(self, separator: StringVar | str = "") -> ArrayVar[List[str]]: + @overload + def split(self, separator: StringVar | str = "") -> ArrayVar[List[str]]: ... + + @overload + def split(self, separator: NoReturn) -> NoReturn: ... + + def split(self, separator: Any = "") -> ArrayVar[List[str]]: """Split the string. Args: @@ -181,9 +248,17 @@ class StringVar(ImmutableVar[str]): Returns: The string split operation. """ + if not isinstance(separator, (StringVar, str)): + raise_unsupported_operand_types("split", (type(self), type(separator))) return string_split_operation(self, separator) - def startswith(self, prefix: StringVar | str) -> BooleanVar: + @overload + def startswith(self, prefix: StringVar | str) -> BooleanVar: ... + + @overload + def startswith(self, prefix: NoReturn) -> NoReturn: ... + + def startswith(self, prefix: Any) -> BooleanVar: """Check if the string starts with a prefix. Args: @@ -192,11 +267,149 @@ class StringVar(ImmutableVar[str]): Returns: The string starts with operation. """ + if not isinstance(prefix, (StringVar, str)): + raise_unsupported_operand_types("startswith", (type(self), type(prefix))) return string_starts_with_operation(self, prefix) + @overload + def __lt__(self, other: StringVar | str) -> BooleanVar: ... + + @overload + def __lt__(self, other: NoReturn) -> NoReturn: ... + + def __lt__(self, other: Any): + """Check if the string is less than another string. + + Args: + other: The other string. + + Returns: + The string less than operation. + """ + if not isinstance(other, (StringVar, str)): + raise_unsupported_operand_types("<", (type(self), type(other))) + + return string_lt_operation(self, other) + + @overload + def __gt__(self, other: StringVar | str) -> BooleanVar: ... + + @overload + def __gt__(self, other: NoReturn) -> NoReturn: ... + + def __gt__(self, other: Any): + """Check if the string is greater than another string. + + Args: + other: The other string. + + Returns: + The string greater than operation. + """ + if not isinstance(other, (StringVar, str)): + raise_unsupported_operand_types(">", (type(self), type(other))) + + return string_gt_operation(self, other) + + @overload + def __le__(self, other: StringVar | str) -> BooleanVar: ... + + @overload + def __le__(self, other: NoReturn) -> NoReturn: ... + + def __le__(self, other: Any): + """Check if the string is less than or equal to another string. + + Args: + other: The other string. + + Returns: + The string less than or equal operation. + """ + if not isinstance(other, (StringVar, str)): + raise_unsupported_operand_types("<=", (type(self), type(other))) + + return string_le_operation(self, other) + + @overload + def __ge__(self, other: StringVar | str) -> BooleanVar: ... + + @overload + def __ge__(self, other: NoReturn) -> NoReturn: ... + + def __ge__(self, other: Any): + """Check if the string is greater than or equal to another string. + + Args: + other: The other string. + + Returns: + The string greater than or equal operation. + """ + if not isinstance(other, (StringVar, str)): + raise_unsupported_operand_types(">=", (type(self), type(other))) + + return string_ge_operation(self, other) + @var_operation -def string_lower_operation(string: StringVar): +def string_lt_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str): + """Check if a string is less than another string. + + Args: + lhs: The left-hand side string. + rhs: The right-hand side string. + + Returns: + The string less than operation. + """ + return var_operation_return(js_expression=f"{lhs} < {rhs}", var_type=bool) + + +@var_operation +def string_gt_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str): + """Check if a string is greater than another string. + + Args: + lhs: The left-hand side string. + rhs: The right-hand side string. + + Returns: + The string greater than operation. + """ + return var_operation_return(js_expression=f"{lhs} > {rhs}", var_type=bool) + + +@var_operation +def string_le_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str): + """Check if a string is less than or equal to another string. + + Args: + lhs: The left-hand side string. + rhs: The right-hand side string. + + Returns: + The string less than or equal operation. + """ + return var_operation_return(js_expression=f"{lhs} <= {rhs}", var_type=bool) + + +@var_operation +def string_ge_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str): + """Check if a string is greater than or equal to another string. + + Args: + lhs: The left-hand side string. + rhs: The right-hand side string. + + Returns: + The string greater than or equal operation. + """ + return var_operation_return(js_expression=f"{lhs} >= {rhs}", var_type=bool) + + +@var_operation +def string_lower_operation(string: StringVar[Any]): """Convert a string to lowercase. Args: @@ -209,7 +422,7 @@ def string_lower_operation(string: StringVar): @var_operation -def string_upper_operation(string: StringVar): +def string_upper_operation(string: StringVar[Any]): """Convert a string to uppercase. Args: @@ -222,7 +435,7 @@ def string_upper_operation(string: StringVar): @var_operation -def string_strip_operation(string: StringVar): +def string_strip_operation(string: StringVar[Any]): """Strip a string. Args: @@ -235,7 +448,27 @@ def string_strip_operation(string: StringVar): @var_operation -def string_contains_operation(haystack: StringVar, needle: StringVar | str): +def string_contains_field_operation( + haystack: StringVar[Any], needle: StringVar[Any] | str, field: StringVar[Any] | str +): + """Check if a string contains another string. + + Args: + haystack: The haystack. + needle: The needle. + field: The field to check. + + Returns: + The string contains operation. + """ + return var_operation_return( + js_expression=f"{haystack}.some(obj => obj[{field}] === {needle})", + var_type=bool, + ) + + +@var_operation +def string_contains_operation(haystack: StringVar[Any], needle: StringVar[Any] | str): """Check if a string contains another string. Args: @@ -251,7 +484,9 @@ def string_contains_operation(haystack: StringVar, needle: StringVar | str): @var_operation -def string_starts_with_operation(full_string: StringVar, prefix: StringVar | str): +def string_starts_with_operation( + full_string: StringVar[Any], prefix: StringVar[Any] | str +): """Check if a string starts with a prefix. Args: @@ -267,7 +502,7 @@ def string_starts_with_operation(full_string: StringVar, prefix: StringVar | str @var_operation -def string_item_operation(string: StringVar, index: NumberVar | int): +def string_item_operation(string: StringVar[Any], index: NumberVar | int): """Get an item from a string. Args: @@ -281,7 +516,7 @@ def string_item_operation(string: StringVar, index: NumberVar | int): @var_operation -def array_join_operation(array: ArrayVar, sep: StringVar | str = ""): +def array_join_operation(array: ArrayVar, sep: StringVar[Any] | str = ""): """Join the elements of an array. Args: @@ -294,6 +529,26 @@ def array_join_operation(array: ArrayVar, sep: StringVar | str = ""): return var_operation_return(js_expression=f"{array}.join({sep})", var_type=str) +@var_operation +def string_replace_operation( + string: StringVar, search_value: StringVar | str, new_value: StringVar | str +): + """Replace a string with a value. + + Args: + string: The string. + search_value: The string to search. + new_value: The value to be replaced with. + + Returns: + The string replace operation. + """ + return var_operation_return( + js_expression=f"{string}.replace({search_value}, {new_value})", + var_type=str, + ) + + # Compile regex for finding reflex var tags. _decode_var_pattern_re = ( rf"{constants.REFLEX_VAR_OPENING_TAG}(.*?){constants.REFLEX_VAR_CLOSING_TAG}" @@ -306,7 +561,7 @@ _decode_var_pattern = re.compile(_decode_var_pattern_re, flags=re.DOTALL) frozen=True, **{"slots": True} if sys.version_info >= (3, 10) else {}, ) -class LiteralStringVar(LiteralVar, StringVar): +class LiteralStringVar(LiteralVar, StringVar[str]): """Base class for immutable literal string vars.""" _var_value: str = dataclasses.field(default="") @@ -315,32 +570,26 @@ class LiteralStringVar(LiteralVar, StringVar): def create( cls, value: str, + _var_type: GenericType | None = None, _var_data: VarData | None = None, - ) -> LiteralStringVar | ConcatVarOperation: + ) -> StringVar: """Create a var from a string value. Args: value: The value to create the var from. + _var_type: The type of the var. _var_data: Additional hooks and imports associated with the Var. Returns: The var. """ + # Determine var type in case the value is inherited from str. + _var_type = _var_type or type(value) or str + if REFLEX_VAR_OPENING_TAG in value: strings_and_vals: list[Var | str] = [] offset = 0 - # Initialize some methods for reading json. - var_data_config = VarData().__config__ - - def json_loads(s): - try: - return var_data_config.json_loads(s) - except json.decoder.JSONDecodeError: - return var_data_config.json_loads( - var_data_config.json_loads(f'"{s}"') - ) - # Find all tags while m := _decode_var_pattern.search(value): start, end = m.span() @@ -355,31 +604,7 @@ class LiteralStringVar(LiteralVar, StringVar): # This is a global immutable var. var = _global_vars[int(serialized_data)] strings_and_vals.append(var) - value = value[(end + len(var._var_name)) :] - else: - data = json_loads(serialized_data) - string_length = data.pop("string_length", None) - var_data = VarData.parse_obj(data) - - # Use string length to compute positions of interpolations. - if string_length is not None: - realstart = start + offset - var_data.interpolations = [ - (realstart, realstart + string_length) - ] - var_content = value[end : (end + string_length)] - if ( - var_content[0] == "{" - and var_content[-1] == "}" - and strings_and_vals - and strings_and_vals[-1][-1] == "$" - ): - strings_and_vals[-1] = strings_and_vals[-1][:-1] - var_content = "(" + var_content[1:-1] + ")" - strings_and_vals.append( - ImmutableVar.create_safe(var_content, _var_data=var_data) - ) - value = value[(end + string_length) :] + value = value[(end + len(var._js_expr)) :] offset += end - start @@ -388,19 +613,51 @@ class LiteralStringVar(LiteralVar, StringVar): filtered_strings_and_vals = [ s for s in strings_and_vals if isinstance(s, Var) or s ] - if len(filtered_strings_and_vals) == 1: - return filtered_strings_and_vals[0].to(StringVar) # type: ignore + only_string = filtered_strings_and_vals[0] + if isinstance(only_string, str): + return LiteralVar.create(only_string).to(StringVar, _var_type) + else: + return only_string.to(StringVar, only_string._var_type) - return ConcatVarOperation.create( + if len( + literal_strings := [ + s + for s in filtered_strings_and_vals + if isinstance(s, (str, LiteralStringVar)) + ] + ) == len(filtered_strings_and_vals): + return LiteralStringVar.create( + "".join( + s._var_value if isinstance(s, LiteralStringVar) else s + for s in literal_strings + ), + _var_type=_var_type, + _var_data=VarData.merge( + _var_data, + *( + s._get_all_var_data() + for s in filtered_strings_and_vals + if isinstance(s, Var) + ), + ), + ) + + concat_result = ConcatVarOperation.create( *filtered_strings_and_vals, _var_data=_var_data, ) + return ( + concat_result + if _var_type is str + else concat_result.to(StringVar, _var_type) + ) + return LiteralStringVar( - _var_name=json.dumps(value), - _var_type=str, - _var_data=ImmutableVarData.merge(_var_data), + _js_expr=json.dumps(value), + _var_type=_var_type, + _var_data=_var_data, _var_value=value, ) @@ -426,7 +683,7 @@ class LiteralStringVar(LiteralVar, StringVar): frozen=True, **{"slots": True} if sys.version_info >= (3, 10) else {}, ) -class ConcatVarOperation(CachedVarOperation, StringVar): +class ConcatVarOperation(CachedVarOperation, StringVar[str]): """Representing a concatenation of literal string vars.""" _var_value: Tuple[Var, ...] = dataclasses.field(default_factory=tuple) @@ -462,13 +719,13 @@ class ConcatVarOperation(CachedVarOperation, StringVar): return "(" + "+".join(list_of_strs_filtered) + ")" @cached_property_no_lock - def _cached_get_all_var_data(self) -> ImmutableVarData | None: - """Get all the VarData associated with the Var. + def _cached_get_all_var_data(self) -> VarData | None: + """Get all the VarData asVarDatae Var. Returns: The VarData associated with the Var. """ - return ImmutableVarData.merge( + return VarData.merge( *[ var._get_all_var_data() for var in self._var_value @@ -493,9 +750,9 @@ class ConcatVarOperation(CachedVarOperation, StringVar): The var. """ return cls( - _var_name="", + _js_expr="", _var_type=str, - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, _var_value=tuple(map(LiteralVar.create, value)), ) @@ -510,10 +767,16 @@ KEY_TYPE = TypeVar("KEY_TYPE") VALUE_TYPE = TypeVar("VALUE_TYPE") -class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): +class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)): """Base class for immutable array vars.""" - def join(self, sep: StringVar | str = "") -> StringVar: + @overload + def join(self, sep: StringVar | str = "") -> StringVar: ... + + @overload + def join(self, sep: NoReturn) -> NoReturn: ... + + def join(self, sep: Any = "") -> StringVar: """Join the elements of the array. Args: @@ -522,6 +785,28 @@ class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): Returns: The joined elements. """ + if not isinstance(sep, (StringVar, str)): + raise_unsupported_operand_types("join", (type(self), type(sep))) + if ( + isinstance(self, LiteralArrayVar) + and ( + len( + args := [ + x + for x in self._var_value + if isinstance(x, (LiteralStringVar, str)) + ] + ) + == len(self._var_value) + ) + and isinstance(sep, (LiteralStringVar, str)) + ): + sep_str = sep._var_value if isinstance(sep, LiteralStringVar) else sep + return LiteralStringVar.create( + sep_str.join( + i._var_value if isinstance(i, LiteralStringVar) else i for i in args + ) + ) return array_join_operation(self, sep) def reverse(self) -> ArrayVar[ARRAY_VAR_TYPE]: @@ -532,15 +817,24 @@ class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): """ return array_reverse_operation(self) - def __add__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> ArrayVar[ARRAY_VAR_TYPE]: + @overload + def __add__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> ArrayVar[ARRAY_VAR_TYPE]: ... + + @overload + def __add__(self, other: NoReturn) -> NoReturn: ... + + def __add__(self, other: Any) -> ArrayVar[ARRAY_VAR_TYPE]: """Concatenate two arrays. Parameters: - other (ArrayVar[ARRAY_VAR_TYPE]): The other array to concatenate. + other: The other array to concatenate. Returns: ArrayConcatOperation: The concatenation of the two arrays. """ + if not isinstance(other, ArrayVar): + raise_unsupported_operand_types("+", (type(self), type(other))) + return array_concat_operation(self, other) @overload @@ -618,6 +912,12 @@ class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): i: int | NumberVar, ) -> ArrayVar[Set[INNER_ARRAY_VAR]]: ... + @overload + def __getitem__( + self: ARRAY_VAR_OF_LIST_ELEMENT[Tuple[KEY_TYPE, VALUE_TYPE]], + i: int | NumberVar, + ) -> ArrayVar[Tuple[KEY_TYPE, VALUE_TYPE]]: ... + @overload def __getitem__( self: ARRAY_VAR_OF_LIST_ELEMENT[Tuple[INNER_ARRAY_VAR, ...]], @@ -631,11 +931,9 @@ class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): ) -> ObjectVar[Dict[KEY_TYPE, VALUE_TYPE]]: ... @overload - def __getitem__(self, i: int | NumberVar) -> ImmutableVar: ... + def __getitem__(self, i: int | NumberVar) -> Var: ... - def __getitem__( - self, i: slice | int | NumberVar - ) -> ArrayVar[ARRAY_VAR_TYPE] | ImmutableVar: + def __getitem__(self, i: Any) -> ArrayVar[ARRAY_VAR_TYPE] | Var: """Get a slice of the array. Args: @@ -646,6 +944,10 @@ class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): """ if isinstance(i, slice): return ArraySliceOperation.create(self, i) + if not isinstance(i, (int, NumberVar)) or ( + isinstance(i, NumberVar) and i._is_strict_float() + ): + raise_unsupported_operand_types("[]", (type(self), type(i))) return array_item_operation(self, i) def length(self) -> NumberVar: @@ -670,6 +972,15 @@ class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): /, ) -> ArrayVar[List[int]]: ... + @overload + @classmethod + def range( + cls, + first_endpoint: int | NumberVar, + second_endpoint: int | NumberVar | None = None, + step: int | NumberVar | None = None, + ) -> ArrayVar[List[int]]: ... + @classmethod def range( cls, @@ -687,6 +998,14 @@ class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): Returns: The range of numbers. """ + if any( + not isinstance(i, (int, NumberVar)) + for i in (first_endpoint, second_endpoint, step) + if i is not None + ): + raise_unsupported_operand_types( + "range", (type(first_endpoint), type(second_endpoint), type(step)) + ) if second_endpoint is None: start = 0 end = first_endpoint @@ -696,30 +1015,190 @@ class ArrayVar(ImmutableVar[ARRAY_VAR_TYPE]): return array_range_operation(start, end, step or 1) - def contains(self, other: Any) -> BooleanVar: + @overload + def contains(self, other: Any) -> BooleanVar: ... + + @overload + def contains(self, other: Any, field: StringVar | str) -> BooleanVar: ... + + def contains(self, other: Any, field: Any = None) -> BooleanVar: """Check if the array contains an element. Args: other: The element to check for. + field: The field to check. Returns: The array contains operation. """ + if field is not None: + if not isinstance(field, (StringVar, str)): + raise_unsupported_operand_types("contains", (type(self), type(field))) + return array_contains_field_operation(self, other, field) return array_contains_operation(self, other) - def __mul__(self, other: NumberVar | int) -> ArrayVar[ARRAY_VAR_TYPE]: + def pluck(self, field: StringVar | str) -> ArrayVar: + """Pluck a field from the array. + + Args: + field: The field to pluck from the array. + + Returns: + The array pluck operation. + """ + return array_pluck_operation(self, field) + + @overload + def __mul__(self, other: NumberVar | int) -> ArrayVar[ARRAY_VAR_TYPE]: ... + + @overload + def __mul__(self, other: NoReturn) -> NoReturn: ... + + def __mul__(self, other: Any) -> ArrayVar[ARRAY_VAR_TYPE]: """Multiply the sequence by a number or integer. Parameters: - other (NumberVar | int): The number or integer to multiply the sequence by. + other: The number or integer to multiply the sequence by. Returns: ArrayVar[ARRAY_VAR_TYPE]: The result of multiplying the sequence by the given number or integer. """ + if not isinstance(other, (NumberVar, int)) or ( + isinstance(other, NumberVar) and other._is_strict_float() + ): + raise_unsupported_operand_types("*", (type(self), type(other))) + return repeat_array_operation(self, other) __rmul__ = __mul__ # type: ignore + @overload + def __lt__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> BooleanVar: ... + + @overload + def __lt__(self, other: list | tuple) -> BooleanVar: ... + + def __lt__(self, other: Any): + """Check if the array is less than another array. + + Args: + other: The other array. + + Returns: + The array less than operation. + """ + if not isinstance(other, (ArrayVar, list, tuple)): + raise_unsupported_operand_types("<", (type(self), type(other))) + + return array_lt_operation(self, other) + + @overload + def __gt__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> BooleanVar: ... + + @overload + def __gt__(self, other: list | tuple) -> BooleanVar: ... + + def __gt__(self, other: Any): + """Check if the array is greater than another array. + + Args: + other: The other array. + + Returns: + The array greater than operation. + """ + if not isinstance(other, (ArrayVar, list, tuple)): + raise_unsupported_operand_types(">", (type(self), type(other))) + + return array_gt_operation(self, other) + + @overload + def __le__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> BooleanVar: ... + + @overload + def __le__(self, other: list | tuple) -> BooleanVar: ... + + def __le__(self, other: Any): + """Check if the array is less than or equal to another array. + + Args: + other: The other array. + + Returns: + The array less than or equal operation. + """ + if not isinstance(other, (ArrayVar, list, tuple)): + raise_unsupported_operand_types("<=", (type(self), type(other))) + + return array_le_operation(self, other) + + @overload + def __ge__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> BooleanVar: ... + + @overload + def __ge__(self, other: list | tuple) -> BooleanVar: ... + + def __ge__(self, other: Any): + """Check if the array is greater than or equal to another array. + + Args: + other: The other array. + + Returns: + The array greater than or equal operation. + """ + if not isinstance(other, (ArrayVar, list, tuple)): + raise_unsupported_operand_types(">=", (type(self), type(other))) + + return array_ge_operation(self, other) + + def foreach(self, fn: Any): + """Apply a function to each element of the array. + + Args: + fn: The function to apply. + + Returns: + The array after applying the function. + + Raises: + VarTypeError: If the function takes more than one argument. + """ + from .function import ArgsFunctionOperation + + if not callable(fn): + raise_unsupported_operand_types("foreach", (type(self), type(fn))) + # get the number of arguments of the function + num_args = len(inspect.signature(fn).parameters) + if num_args > 1: + raise VarTypeError( + "The function passed to foreach should take at most one argument." + ) + + if num_args == 0: + return_value = fn() + function_var = ArgsFunctionOperation.create(tuple(), return_value) + else: + # generic number var + number_var = Var("").to(NumberVar, int) + + first_arg_type = self[number_var]._var_type + + arg_name = get_unique_variable_name() + + # get first argument type + first_arg = Var( + _js_expr=arg_name, + _var_type=first_arg_type, + ).guess_type() + + function_var = ArgsFunctionOperation.create( + (arg_name,), + Var.create(fn(first_arg)), + ) + + return map_array_operation(self, function_var) + LIST_ELEMENT = TypeVar("LIST_ELEMENT") @@ -739,7 +1218,9 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]): """Base class for immutable literal array vars.""" _var_value: Union[ - List[Union[Var, Any]], Set[Union[Var, Any]], Tuple[Union[Var, Any], ...] + List[Union[Var, Any]], + Set[Union[Var, Any]], + Tuple[Union[Var, Any], ...], ] = dataclasses.field(default_factory=list) @cached_property_no_lock @@ -758,13 +1239,13 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]): ) @cached_property_no_lock - def _cached_get_all_var_data(self) -> ImmutableVarData | None: + def _cached_get_all_var_data(self) -> VarData | None: """Get all the VarData associated with the Var. Returns: The VarData associated with the Var. """ - return ImmutableVarData.merge( + return VarData.merge( *[ LiteralVar.create(element)._get_all_var_data() for element in self._var_value @@ -778,7 +1259,7 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]): Returns: The hash of the var. """ - return hash((self.__class__.__name__, self._var_name)) + return hash((self.__class__.__name__, self._js_expr)) def json(self) -> str: """Get the JSON representation of the var. @@ -811,15 +1292,15 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]): The var. """ return cls( - _var_name="", + _js_expr="", _var_type=figure_out_type(value) if _var_type is None else _var_type, - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, _var_value=value, ) @var_operation -def string_split_operation(string: StringVar, sep: StringVar | str = ""): +def string_split_operation(string: StringVar[Any], sep: StringVar | str = ""): """Split a string. Args: @@ -862,14 +1343,10 @@ class ArraySliceOperation(CachedVarOperation, ArrayVar): start, end, step = self._start, self._stop, self._step normalized_start = ( - LiteralVar.create(start) - if start is not None - else ImmutableVar.create_safe("undefined") + LiteralVar.create(start) if start is not None else Var(_js_expr="undefined") ) normalized_end = ( - LiteralVar.create(end) - if end is not None - else ImmutableVar.create_safe("undefined") + LiteralVar.create(end) if end is not None else Var(_js_expr="undefined") ) if step is None: return f"{str(self._array)}.slice({str(normalized_start)}, {str(normalized_end)})" @@ -905,9 +1382,9 @@ class ArraySliceOperation(CachedVarOperation, ArrayVar): The var. """ return cls( - _var_name="", + _js_expr="", _var_type=array._var_type, - _var_data=ImmutableVarData.merge(_var_data), + _var_data=_var_data, _array=array, _start=slice.start, _stop=slice.stop, @@ -915,6 +1392,26 @@ class ArraySliceOperation(CachedVarOperation, ArrayVar): ) +@var_operation +def array_pluck_operation( + array: ArrayVar[ARRAY_VAR_TYPE], + field: StringVar | str, +) -> CustomVarOperationReturn[ARRAY_VAR_TYPE]: + """Pluck a field from an array of objects. + + Args: + array: The array to pluck from. + field: The field to pluck from the objects in the array. + + Returns: + The reversed array. + """ + return var_operation_return( + js_expression=f"{array}.map(e=>e?.[{field}])", + var_type=array._var_type, + ) + + @var_operation def array_reverse_operation( array: ArrayVar[ARRAY_VAR_TYPE], @@ -933,6 +1430,62 @@ def array_reverse_operation( ) +@var_operation +def array_lt_operation(lhs: ArrayVar | list | tuple, rhs: ArrayVar | list | tuple): + """Check if an array is less than another array. + + Args: + lhs: The left-hand side array. + rhs: The right-hand side array. + + Returns: + The array less than operation. + """ + return var_operation_return(js_expression=f"{lhs} < {rhs}", var_type=bool) + + +@var_operation +def array_gt_operation(lhs: ArrayVar | list | tuple, rhs: ArrayVar | list | tuple): + """Check if an array is greater than another array. + + Args: + lhs: The left-hand side array. + rhs: The right-hand side array. + + Returns: + The array greater than operation. + """ + return var_operation_return(js_expression=f"{lhs} > {rhs}", var_type=bool) + + +@var_operation +def array_le_operation(lhs: ArrayVar | list | tuple, rhs: ArrayVar | list | tuple): + """Check if an array is less than or equal to another array. + + Args: + lhs: The left-hand side array. + rhs: The right-hand side array. + + Returns: + The array less than or equal operation. + """ + return var_operation_return(js_expression=f"{lhs} <= {rhs}", var_type=bool) + + +@var_operation +def array_ge_operation(lhs: ArrayVar | list | tuple, rhs: ArrayVar | list | tuple): + """Check if an array is greater than or equal to another array. + + Args: + lhs: The left-hand side array. + rhs: The right-hand side array. + + Returns: + The array greater than or equal operation. + """ + return var_operation_return(js_expression=f"{lhs} >= {rhs}", var_type=bool) + + @var_operation def array_length_operation(array: ArrayVar): """Get the length of an array. @@ -1007,6 +1560,26 @@ def array_range_operation( ) +@var_operation +def array_contains_field_operation( + haystack: ArrayVar, needle: Any | Var, field: StringVar | str +): + """Check if an array contains an element. + + Args: + haystack: The array to check. + needle: The element to check for. + field: The field to check. + + Returns: + The array contains operation. + """ + return var_operation_return( + js_expression=f"{haystack}.some(obj => obj[{field}] === {needle})", + var_type=bool, + ) + + @var_operation def array_contains_operation(haystack: ArrayVar, needle: Any | Var): """Check if an array contains an element. @@ -1024,95 +1597,6 @@ def array_contains_operation(haystack: ArrayVar, needle: Any | Var): ) -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ToStringOperation(CachedVarOperation, StringVar): - """Base class for immutable string vars that are the result of a to string operation.""" - - _original_var: Var = dataclasses.field( - default_factory=lambda: LiteralStringVar.create("") - ) - - @cached_property_no_lock - def _cached_var_name(self) -> str: - """The name of the var. - - Returns: - The name of the var. - """ - return str(self._original_var) - - @classmethod - def create( - cls, - original_var: Var, - _var_data: VarData | None = None, - ) -> ToStringOperation: - """Create a var from a string value. - - Args: - original_var: The original var. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The var. - """ - return cls( - _var_name="", - _var_type=str, - _var_data=ImmutableVarData.merge(_var_data), - _original_var=original_var, - ) - - -@dataclasses.dataclass( - eq=False, - frozen=True, - **{"slots": True} if sys.version_info >= (3, 10) else {}, -) -class ToArrayOperation(CachedVarOperation, ArrayVar): - """Base class for immutable array vars that are the result of a to array operation.""" - - _original_var: Var = dataclasses.field( - default_factory=lambda: LiteralArrayVar.create([]) - ) - - @cached_property_no_lock - def _cached_var_name(self) -> str: - """The name of the var. - - Returns: - The name of the var. - """ - return str(self._original_var) - - @classmethod - def create( - cls, - original_var: Var, - _var_type: type[list] | type[set] | type[tuple] | None = None, - _var_data: VarData | None = None, - ) -> ToArrayOperation: - """Create a var from a string value. - - Args: - original_var: The original var. - _var_data: Additional hooks and imports associated with the Var. - - Returns: - The var. - """ - return cls( - _var_name="", - _var_type=list if _var_type is None else _var_type, - _var_data=ImmutableVarData.merge(_var_data), - _original_var=original_var, - ) - - @var_operation def repeat_array_operation( array: ArrayVar[ARRAY_VAR_TYPE], count: NumberVar | int @@ -1132,6 +1616,29 @@ def repeat_array_operation( ) +if TYPE_CHECKING: + from .function import FunctionVar + + +@var_operation +def map_array_operation( + array: ArrayVar[ARRAY_VAR_TYPE], + function: FunctionVar, +): + """Map a function over an array. + + Args: + array: The array. + function: The function to map. + + Returns: + The mapped array. + """ + return var_operation_return( + js_expression=f"{array}.map({function})", var_type=List[Any] + ) + + @var_operation def array_concat_operation( lhs: ArrayVar[ARRAY_VAR_TYPE], rhs: ArrayVar[ARRAY_VAR_TYPE] @@ -1149,3 +1656,134 @@ def array_concat_operation( js_expression=f"[...{lhs}, ...{rhs}]", var_type=Union[lhs._var_type, rhs._var_type], ) + + +class ColorVar(StringVar[Color], python_types=Color): + """Base class for immutable color vars.""" + + +@dataclasses.dataclass( + eq=False, + frozen=True, + **{"slots": True} if sys.version_info >= (3, 10) else {}, +) +class LiteralColorVar(CachedVarOperation, LiteralVar, ColorVar): + """Base class for immutable literal color vars.""" + + _var_value: Color = dataclasses.field(default_factory=lambda: Color(color="black")) + + @classmethod + def create( + cls, + value: Color, + _var_type: Type[Color] | None = None, + _var_data: VarData | None = None, + ) -> ColorVar: + """Create a var from a string value. + + Args: + value: The value to create the var from. + _var_type: The type of the var. + _var_data: Additional hooks and imports associated with the Var. + + Returns: + The var. + """ + return cls( + _js_expr="", + _var_type=_var_type or Color, + _var_data=_var_data, + _var_value=value, + ) + + def __hash__(self) -> int: + """Get the hash of the var. + + Returns: + The hash of the var. + """ + return hash( + ( + self.__class__.__name__, + self._var_value.color, + self._var_value.alpha, + self._var_value.shade, + ) + ) + + @cached_property_no_lock + def _cached_var_name(self) -> str: + """The name of the var. + + Returns: + The name of the var. + """ + alpha = self._var_value.alpha + alpha = ( + ternary_operation( + alpha, + LiteralStringVar.create("a"), + LiteralStringVar.create(""), + ) + if isinstance(alpha, Var) + else LiteralStringVar.create("a" if alpha else "") + ) + + shade = self._var_value.shade + shade = ( + shade.to_string(use_json=False) + if isinstance(shade, Var) + else LiteralStringVar.create(str(shade)) + ) + return str( + ConcatVarOperation.create( + LiteralStringVar.create("var(--"), + self._var_value.color, + LiteralStringVar.create("-"), + alpha, + shade, + LiteralStringVar.create(")"), + ) + ) + + @cached_property_no_lock + def _cached_get_all_var_data(self) -> VarData | None: + """Get all the var data. + + Returns: + The var data. + """ + return VarData.merge( + *[ + LiteralVar.create(var)._get_all_var_data() + for var in ( + self._var_value.color, + self._var_value.alpha, + self._var_value.shade, + ) + ], + self._var_data, + ) + + def json(self) -> str: + """Get the JSON representation of the var. + + Returns: + The JSON representation of the var. + + Raises: + TypeError: If the color is not a valid color. + """ + color, alpha, shade = map( + get_python_literal, + (self._var_value.color, self._var_value.alpha, self._var_value.shade), + ) + if color is None or alpha is None or shade is None: + raise TypeError("Cannot serialize color that contains non-literal vars.") + if ( + not isinstance(color, str) + or not isinstance(alpha, bool) + or not isinstance(shade, int) + ): + raise TypeError("Color is not a valid color.") + return f"var(--{color}-{'a' if alpha else ''}{shade})" diff --git a/scripts/bun_install.sh b/scripts/bun_install.sh new file mode 100644 index 000000000..08a0817f6 --- /dev/null +++ b/scripts/bun_install.sh @@ -0,0 +1,311 @@ +#!/usr/bin/env bash +set -euo pipefail + +platform=$(uname -ms) + +if [[ ${OS:-} = Windows_NT ]]; then + if [[ $platform != MINGW64* ]]; then + powershell -c "irm bun.sh/install.ps1|iex" + exit $? + fi +fi + +# Reset +Color_Off='' + +# Regular Colors +Red='' +Green='' +Dim='' # White + +# Bold +Bold_White='' +Bold_Green='' + +if [[ -t 1 ]]; then + # Reset + Color_Off='\033[0m' # Text Reset + + # Regular Colors + Red='\033[0;31m' # Red + Green='\033[0;32m' # Green + Dim='\033[0;2m' # White + + # Bold + Bold_Green='\033[1;32m' # Bold Green + Bold_White='\033[1m' # Bold White +fi + +error() { + echo -e "${Red}error${Color_Off}:" "$@" >&2 + exit 1 +} + +info() { + echo -e "${Dim}$@ ${Color_Off}" +} + +info_bold() { + echo -e "${Bold_White}$@ ${Color_Off}" +} + +success() { + echo -e "${Green}$@ ${Color_Off}" +} + +command -v unzip >/dev/null || + error 'unzip is required to install bun' + +if [[ $# -gt 2 ]]; then + error 'Too many arguments, only 2 are allowed. The first can be a specific tag of bun to install. (e.g. "bun-v0.1.4") The second can be a build variant of bun to install. (e.g. "debug-info")' +fi + +case $platform in +'Darwin x86_64') + target=darwin-x64 + ;; +'Darwin arm64') + target=darwin-aarch64 + ;; +'Linux aarch64' | 'Linux arm64') + target=linux-aarch64 + ;; +'MINGW64'*) + target=windows-x64 + ;; +'Linux x86_64' | *) + target=linux-x64 + ;; +esac + +if [[ $target = darwin-x64 ]]; then + # Is this process running in Rosetta? + # redirect stderr to devnull to avoid error message when not running in Rosetta + if [[ $(sysctl -n sysctl.proc_translated 2>/dev/null) = 1 ]]; then + target=darwin-aarch64 + info "Your shell is running in Rosetta 2. Downloading bun for $target instead" + fi +fi + +GITHUB=${GITHUB-"https://github.com"} + +github_repo="$GITHUB/oven-sh/bun" + +if [[ $target = darwin-x64 ]]; then + # If AVX2 isn't supported, use the -baseline build + if [[ $(sysctl -a | grep machdep.cpu | grep AVX2) == '' ]]; then + target=darwin-x64-baseline + fi +fi + +if [[ $target = linux-x64 ]]; then + # If AVX2 isn't supported, use the -baseline build + if [[ $(cat /proc/cpuinfo | grep avx2) = '' ]]; then + target=linux-x64-baseline + fi +fi + +exe_name=bun + +if [[ $# = 2 && $2 = debug-info ]]; then + target=$target-profile + exe_name=bun-profile + info "You requested a debug build of bun. More information will be shown if a crash occurs." +fi + +if [[ $# = 0 ]]; then + bun_uri=$github_repo/releases/latest/download/bun-$target.zip +else + bun_uri=$github_repo/releases/download/$1/bun-$target.zip +fi + +install_env=BUN_INSTALL +bin_env=\$$install_env/bin + +install_dir=${!install_env:-$HOME/.bun} +bin_dir=$install_dir/bin +exe=$bin_dir/bun + +if [[ ! -d $bin_dir ]]; then + mkdir -p "$bin_dir" || + error "Failed to create install directory \"$bin_dir\"" +fi + +curl --fail --location --progress-bar --output "$exe.zip" "$bun_uri" || + error "Failed to download bun from \"$bun_uri\"" + +unzip -oqd "$bin_dir" "$exe.zip" || + error 'Failed to extract bun' + +mv "$bin_dir/bun-$target/$exe_name" "$exe" || + error 'Failed to move extracted bun to destination' + +chmod +x "$exe" || + error 'Failed to set permissions on bun executable' + +rm -r "$bin_dir/bun-$target" "$exe.zip" + +tildify() { + if [[ $1 = $HOME/* ]]; then + local replacement=\~/ + + echo "${1/$HOME\//$replacement}" + else + echo "$1" + fi +} + +success "bun was installed successfully to $Bold_Green$(tildify "$exe")" + +if command -v bun >/dev/null; then + # Install completions, but we don't care if it fails + IS_BUN_AUTO_UPDATE=true $exe completions &>/dev/null || : + + echo "Run 'bun --help' to get started" + exit +fi + +refresh_command='' + +tilde_bin_dir=$(tildify "$bin_dir") +quoted_install_dir=\"${install_dir//\"/\\\"}\" + +if [[ $quoted_install_dir = \"$HOME/* ]]; then + quoted_install_dir=${quoted_install_dir/$HOME\//\$HOME/} +fi + +echo + +case $(basename "$SHELL") in +fish) + # Install completions, but we don't care if it fails + IS_BUN_AUTO_UPDATE=true SHELL=fish $exe completions &>/dev/null || : + + commands=( + "set --export $install_env $quoted_install_dir" + "set --export PATH $bin_env \$PATH" + ) + + fish_config=$HOME/.config/fish/config.fish + tilde_fish_config=$(tildify "$fish_config") + + if [[ -w $fish_config ]]; then + { + echo -e '\n# bun' + + for command in "${commands[@]}"; do + echo "$command" + done + } >>"$fish_config" + + info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_fish_config\"" + + refresh_command="source $tilde_fish_config" + else + echo "Manually add the directory to $tilde_fish_config (or similar):" + + for command in "${commands[@]}"; do + info_bold " $command" + done + fi + ;; +zsh) + # Install completions, but we don't care if it fails + IS_BUN_AUTO_UPDATE=true SHELL=zsh $exe completions &>/dev/null || : + + commands=( + "export $install_env=$quoted_install_dir" + "export PATH=\"$bin_env:\$PATH\"" + ) + + zsh_config=$HOME/.zshrc + tilde_zsh_config=$(tildify "$zsh_config") + + if [[ -w $zsh_config ]]; then + { + echo -e '\n# bun' + + for command in "${commands[@]}"; do + echo "$command" + done + } >>"$zsh_config" + + info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_zsh_config\"" + + refresh_command="exec $SHELL" + else + echo "Manually add the directory to $tilde_zsh_config (or similar):" + + for command in "${commands[@]}"; do + info_bold " $command" + done + fi + ;; +bash) + # Install completions, but we don't care if it fails + IS_BUN_AUTO_UPDATE=true SHELL=bash $exe completions &>/dev/null || : + + commands=( + "export $install_env=$quoted_install_dir" + "export PATH=\"$bin_env:\$PATH\"" + ) + + bash_configs=( + "$HOME/.bashrc" + "$HOME/.bash_profile" + ) + + if [[ ${XDG_CONFIG_HOME:-} ]]; then + bash_configs+=( + "$XDG_CONFIG_HOME/.bash_profile" + "$XDG_CONFIG_HOME/.bashrc" + "$XDG_CONFIG_HOME/bash_profile" + "$XDG_CONFIG_HOME/bashrc" + ) + fi + + set_manually=true + for bash_config in "${bash_configs[@]}"; do + tilde_bash_config=$(tildify "$bash_config") + + if [[ -w $bash_config ]]; then + { + echo -e '\n# bun' + + for command in "${commands[@]}"; do + echo "$command" + done + } >>"$bash_config" + + info "Added \"$tilde_bin_dir\" to \$PATH in \"$tilde_bash_config\"" + + refresh_command="source $bash_config" + set_manually=false + break + fi + done + + if [[ $set_manually = true ]]; then + echo "Manually add the directory to $tilde_bash_config (or similar):" + + for command in "${commands[@]}"; do + info_bold " $command" + done + fi + ;; +*) + echo 'Manually add the directory to ~/.bashrc (or similar):' + info_bold " export $install_env=$quoted_install_dir" + info_bold " export PATH=\"$bin_env:\$PATH\"" + ;; +esac + +echo +info "To get started, run:" +echo + +if [[ $refresh_command ]]; then + info_bold " $refresh_command" +fi + +info_bold " bun --help" diff --git a/tests/components/datadisplay/test_table.py b/tests/components/datadisplay/test_table.py deleted file mode 100644 index 8740d4b8c..000000000 --- a/tests/components/datadisplay/test_table.py +++ /dev/null @@ -1,177 +0,0 @@ -import sys -from typing import List, Tuple - -import pytest -from reflex_chakra.components.datadisplay.table import Tbody, Tfoot, Thead - -from reflex.state import BaseState - -PYTHON_GT_V38 = sys.version_info.major >= 3 and sys.version_info.minor > 8 - - -class TableState(BaseState): - """Test State class.""" - - rows_List_List_str: List[List[str]] = [["random", "row"]] - rows_List_List: List[List] = [["random", "row"]] - rows_List_str: List[str] = ["random", "row"] - rows_Tuple_List_str: Tuple[List[str]] = (["random", "row"],) - rows_Tuple_List: Tuple[List] = ["random", "row"] # type: ignore - rows_Tuple_str_str: Tuple[str, str] = ( - "random", - "row", - ) - rows_Tuple_Tuple_str_str: Tuple[Tuple[str, str]] = ( - ( - "random", - "row", - ), - ) - rows_Tuple_Tuple: Tuple[Tuple] = ( - ( - "random", - "row", - ), - ) - rows_str: str = "random, row" - headers_List_str: List[str] = ["header1", "header2"] - headers_Tuple_str_str: Tuple[str, str] = ( - "header1", - "header2", - ) - headers_str: str = "headers1, headers2" - footers_List_str: List[str] = ["footer1", "footer2"] - footers_Tuple_str_str: Tuple[str, str] = ( - "footer1", - "footer2", - ) - footers_str: str = "footer1, footer2" - - if sys.version_info.major >= 3 and sys.version_info.minor > 8: - rows_list_list_str: list[list[str]] = [["random", "row"]] - rows_list_list: list[list] = [["random", "row"]] - rows_list_str: list[str] = ["random", "row"] - rows_tuple_list_str: tuple[list[str]] = (["random", "row"],) - rows_tuple_list: tuple[list] = ["random", "row"] # type: ignore - rows_tuple_str_str: tuple[str, str] = ( - "random", - "row", - ) - rows_tuple_tuple_str_str: tuple[tuple[str, str]] = ( - ( - "random", - "row", - ), - ) - rows_tuple_tuple: tuple[tuple] = ( - ( - "random", - "row", - ), - ) - - -valid_extras = ( - [ - TableState.rows_list_list_str, - TableState.rows_list_list, - TableState.rows_tuple_list_str, - TableState.rows_tuple_list, - TableState.rows_tuple_tuple_str_str, - TableState.rows_tuple_tuple, - ] - if PYTHON_GT_V38 - else [] -) -invalid_extras = ( - [TableState.rows_list_str, TableState.rows_tuple_str_str] if PYTHON_GT_V38 else [] -) - - -@pytest.mark.parametrize( - "rows", - [ - [["random", "row"]], - TableState.rows_List_List_str, - TableState.rows_List_List, - TableState.rows_Tuple_List_str, - TableState.rows_Tuple_List, - TableState.rows_Tuple_Tuple_str_str, - TableState.rows_Tuple_Tuple, - *valid_extras, - ], -) -def test_create_table_body_with_valid_rows_prop(rows): - render_dict = Tbody.create(rows=rows).render() - assert render_dict["name"] == "Tbody" - assert len(render_dict["children"]) == 1 - - -@pytest.mark.parametrize( - "rows", - [ - ["random", "row"], - "random, rows", - TableState.rows_List_str, - TableState.rows_Tuple_str_str, - TableState.rows_str, - *invalid_extras, - ], -) -def test_create_table_body_with_invalid_rows_prop(rows): - with pytest.raises(TypeError): - Tbody.create(rows=rows) - - -@pytest.mark.parametrize( - "headers", - [ - ["random", "header"], - TableState.headers_List_str, - TableState.headers_Tuple_str_str, - ], -) -def test_create_table_head_with_valid_headers_prop(headers): - render_dict = Thead.create(headers=headers).render() - assert render_dict["name"] == "Thead" - assert len(render_dict["children"]) == 1 - assert render_dict["children"][0]["name"] == "Tr" - - -@pytest.mark.parametrize( - "headers", - [ - "random, header", - TableState.headers_str, - ], -) -def test_create_table_head_with_invalid_headers_prop(headers): - with pytest.raises(TypeError): - Thead.create(headers=headers) - - -@pytest.mark.parametrize( - "footers", - [ - ["random", "footers"], - TableState.footers_List_str, - TableState.footers_Tuple_str_str, - ], -) -def test_create_table_footer_with_valid_footers_prop(footers): - render_dict = Tfoot.create(footers=footers).render() - assert render_dict["name"] == "Tfoot" - assert len(render_dict["children"]) == 1 - assert render_dict["children"][0]["name"] == "Tr" - - -@pytest.mark.parametrize( - "footers", - [ - "random, footers", - TableState.footers_str, - ], -) -def test_create_table_footer_with_invalid_footers_prop(footers): - with pytest.raises(TypeError): - Tfoot.create(footers=footers) diff --git a/tests/components/media/test_icon.py b/tests/components/media/test_icon.py deleted file mode 100644 index 6a152c587..000000000 --- a/tests/components/media/test_icon.py +++ /dev/null @@ -1,55 +0,0 @@ -import pytest -from reflex_chakra.components.media.icon import ICON_LIST, Icon - -from reflex.utils import format - - -def test_no_tag_errors(): - """Test that an icon without a tag raises an error.""" - with pytest.raises(AttributeError): - Icon.create() - - -def test_children_errors(): - """Test that an icon with children raises an error.""" - with pytest.raises(AttributeError): - Icon.create("child", tag="search") - - -@pytest.mark.parametrize( - "tag", - ICON_LIST, -) -def test_valid_icon(tag: str): - """Test that a valid icon does not raise an error. - - Args: - tag: The icon tag. - """ - icon = Icon.create(tag=tag) - assert icon.tag == format.to_title_case(tag) + "Icon" - - -@pytest.mark.parametrize("tag", ["", " ", "invalid", 123]) -def test_invalid_icon(tag): - """Test that an invalid icon raises an error. - - Args: - tag: The icon tag. - """ - with pytest.raises(ValueError): - Icon.create(tag=tag) - - -@pytest.mark.parametrize( - "tag", - ["Check", "Close", "eDit"], -) -def test_tag_with_capital(tag: str): - """Test that an icon that tag with capital does not raise an error. - - Args: - tag: The icon tag. - """ - icon = Icon.create(tag=tag) - assert icon.tag == format.to_title_case(tag) + "Icon" diff --git a/integration/__init__.py b/tests/integration/__init__.py similarity index 100% rename from integration/__init__.py rename to tests/integration/__init__.py diff --git a/integration/conftest.py b/tests/integration/conftest.py similarity index 100% rename from integration/conftest.py rename to tests/integration/conftest.py diff --git a/integration/init-test/Dockerfile b/tests/integration/init-test/Dockerfile similarity index 91% rename from integration/init-test/Dockerfile rename to tests/integration/init-test/Dockerfile index aa11344b1..f30466e7f 100644 --- a/integration/init-test/Dockerfile +++ b/tests/integration/init-test/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8 +FROM python:3.9 ARG USERNAME=kerrigan RUN useradd -m $USERNAME diff --git a/integration/init-test/in_docker_test_script.sh b/tests/integration/init-test/in_docker_test_script.sh similarity index 96% rename from integration/init-test/in_docker_test_script.sh rename to tests/integration/init-test/in_docker_test_script.sh index 4e898ac99..31d245588 100755 --- a/integration/init-test/in_docker_test_script.sh +++ b/tests/integration/init-test/in_docker_test_script.sh @@ -13,7 +13,7 @@ function do_export () { reflex init --template "$template" reflex export ( - cd "$SCRIPTPATH/../.." + cd "$SCRIPTPATH/../../.." scripts/integration.sh ~/"$template" dev pkill -9 -f 'next-server|python3' || true sleep 10 diff --git a/integration/shared/state.py b/tests/integration/shared/state.py similarity index 100% rename from integration/shared/state.py rename to tests/integration/shared/state.py diff --git a/integration/test_background_task.py b/tests/integration/test_background_task.py similarity index 98% rename from integration/test_background_task.py rename to tests/integration/test_background_task.py index 3764f67b4..a445112f3 100644 --- a/integration/test_background_task.py +++ b/tests/integration/test_background_task.py @@ -13,7 +13,6 @@ def BackgroundTask(): import asyncio import pytest - import reflex_chakra as rc import reflex as rx from reflex.state import ImmutableStateError @@ -24,6 +23,7 @@ def BackgroundTask(): iterations: int = 10 @rx.background + @rx.event async def handle_event(self): async with self: self._task_id += 1 @@ -33,6 +33,7 @@ def BackgroundTask(): await asyncio.sleep(0.005) @rx.background + @rx.event async def handle_event_yield_only(self): async with self: self._task_id += 1 @@ -43,6 +44,7 @@ def BackgroundTask(): yield State.increment() # type: ignore await asyncio.sleep(0.005) + @rx.event def increment(self): self.counter += 1 @@ -51,13 +53,16 @@ def BackgroundTask(): async with self: self.counter += int(amount) + @rx.event def reset_counter(self): self.counter = 0 + @rx.event async def blocking_pause(self): await asyncio.sleep(0.02) @rx.background + @rx.event async def non_blocking_pause(self): await asyncio.sleep(0.02) @@ -70,12 +75,14 @@ def BackgroundTask(): await asyncio.sleep(0.005) @rx.background + @rx.event async def handle_racy_event(self): await asyncio.gather( self.racy_task(), self.racy_task(), self.racy_task(), self.racy_task() ) @rx.background + @rx.event async def nested_async_with_self(self): async with self: self.counter += 1 @@ -88,6 +95,7 @@ def BackgroundTask(): await third_state._triple_count() @rx.background + @rx.event async def yield_in_async_with_self(self): async with self: self.counter += 1 @@ -96,6 +104,7 @@ def BackgroundTask(): class OtherState(rx.State): @rx.background + @rx.event async def get_other_state(self): async with self: state = await self.get_state(State) @@ -116,11 +125,11 @@ def BackgroundTask(): def index() -> rx.Component: return rx.vstack( - rc.input( + rx.input( id="token", value=State.router.session.client_token, is_read_only=True ), rx.heading(State.counter, id="counter"), - rc.input( + rx.input( id="iterations", placeholder="Iterations", value=State.iterations.to_string(), # type: ignore diff --git a/integration/test_call_script.py b/tests/integration/test_call_script.py similarity index 65% rename from integration/test_call_script.py rename to tests/integration/test_call_script.py index 5a3b83abf..a949dc451 100644 --- a/integration/test_call_script.py +++ b/tests/integration/test_call_script.py @@ -46,6 +46,7 @@ def CallScript(): inline_counter: int = 0 external_counter: int = 0 value: str = "Initial" + last_result: str = "" def call_script_callback(self, result): self.results.append(result) @@ -53,15 +54,18 @@ def CallScript(): def call_script_callback_other_arg(self, result, other_arg): self.results.append([other_arg, result]) + @rx.event def call_scripts_inline_yield(self): yield rx.call_script("inline1()") yield rx.call_script("inline2()") yield rx.call_script("inline3()") yield rx.call_script("inline4()") + @rx.event def call_script_inline_return(self): return rx.call_script("inline2()") + @rx.event def call_scripts_inline_yield_callback(self): yield rx.call_script( "inline1()", callback=CallScriptState.call_script_callback @@ -76,11 +80,13 @@ def CallScript(): "inline4()", callback=CallScriptState.call_script_callback ) + @rx.event def call_script_inline_return_callback(self): return rx.call_script( "inline3()", callback=CallScriptState.call_script_callback ) + @rx.event def call_script_inline_return_lambda(self): return rx.call_script( "inline2()", @@ -89,21 +95,25 @@ def CallScript(): ), ) + @rx.event def get_inline_counter(self): return rx.call_script( "inline_counter", callback=CallScriptState.set_inline_counter, # type: ignore ) + @rx.event def call_scripts_external_yield(self): yield rx.call_script("external1()") yield rx.call_script("external2()") yield rx.call_script("external3()") yield rx.call_script("external4()") + @rx.event def call_script_external_return(self): return rx.call_script("external2()") + @rx.event def call_scripts_external_yield_callback(self): yield rx.call_script( "external1()", callback=CallScriptState.call_script_callback @@ -118,11 +128,13 @@ def CallScript(): "external4()", callback=CallScriptState.call_script_callback ) + @rx.event def call_script_external_return_callback(self): return rx.call_script( "external3()", callback=CallScriptState.call_script_callback ) + @rx.event def call_script_external_return_lambda(self): return rx.call_script( "external2()", @@ -131,12 +143,44 @@ def CallScript(): ), ) + @rx.event def get_external_counter(self): return rx.call_script( "external_counter", callback=CallScriptState.set_external_counter, # type: ignore ) + @rx.event + def call_with_var_f_string(self): + return rx.call_script( + f"{rx.Var('inline_counter')} + {rx.Var('external_counter')}", + callback=CallScriptState.set_last_result, # type: ignore + ) + + @rx.event + def call_with_var_str_cast(self): + return rx.call_script( + f"{str(rx.Var('inline_counter'))} + {str(rx.Var('external_counter'))}", + callback=CallScriptState.set_last_result, # type: ignore + ) + + @rx.event + def call_with_var_f_string_wrapped(self): + return rx.call_script( + rx.Var(f"{rx.Var('inline_counter')} + {rx.Var('external_counter')}"), + callback=CallScriptState.set_last_result, # type: ignore + ) + + @rx.event + def call_with_var_str_cast_wrapped(self): + return rx.call_script( + rx.Var( + f"{str(rx.Var('inline_counter'))} + {str(rx.Var('external_counter'))}" + ), + callback=CallScriptState.set_last_result, # type: ignore + ) + + @rx.event def reset_(self): yield rx.call_script("inline_counter = 0; external_counter = 0") self.reset() @@ -234,6 +278,68 @@ def CallScript(): id="update_value", ), rx.button("Reset", id="reset", on_click=CallScriptState.reset_), + rx.input( + value=CallScriptState.last_result, + id="last_result", + read_only=True, + on_click=CallScriptState.set_last_result(""), # type: ignore + ), + rx.button( + "call_with_var_f_string", + on_click=CallScriptState.call_with_var_f_string, + id="call_with_var_f_string", + ), + rx.button( + "call_with_var_str_cast", + on_click=CallScriptState.call_with_var_str_cast, + id="call_with_var_str_cast", + ), + rx.button( + "call_with_var_f_string_wrapped", + on_click=CallScriptState.call_with_var_f_string_wrapped, + id="call_with_var_f_string_wrapped", + ), + rx.button( + "call_with_var_str_cast_wrapped", + on_click=CallScriptState.call_with_var_str_cast_wrapped, + id="call_with_var_str_cast_wrapped", + ), + rx.button( + "call_with_var_f_string_inline", + on_click=rx.call_script( + f"{rx.Var('inline_counter')} + {CallScriptState.last_result}", + callback=CallScriptState.set_last_result, # type: ignore + ), + id="call_with_var_f_string_inline", + ), + rx.button( + "call_with_var_str_cast_inline", + on_click=rx.call_script( + f"{str(rx.Var('inline_counter'))} + {str(rx.Var('external_counter'))}", + callback=CallScriptState.set_last_result, # type: ignore + ), + id="call_with_var_str_cast_inline", + ), + rx.button( + "call_with_var_f_string_wrapped_inline", + on_click=rx.call_script( + rx.Var( + f"{rx.Var('inline_counter')} + {CallScriptState.last_result}" + ), + callback=CallScriptState.set_last_result, # type: ignore + ), + id="call_with_var_f_string_wrapped_inline", + ), + rx.button( + "call_with_var_str_cast_wrapped_inline", + on_click=rx.call_script( + rx.Var( + f"{str(rx.Var('inline_counter'))} + {str(rx.Var('external_counter'))}" + ), + callback=CallScriptState.set_last_result, # type: ignore + ), + id="call_with_var_str_cast_wrapped_inline", + ), ) @@ -363,3 +469,73 @@ def test_call_script( call_script.poll_for_content(update_value_button, exp_not_equal="Initial") == "updated" ) + + +def test_call_script_w_var( + call_script: AppHarness, + driver: WebDriver, +): + """Test evaluating javascript expressions containing Vars. + + Args: + call_script: harness for CallScript app. + driver: WebDriver instance. + """ + assert_token(driver) + last_result = driver.find_element(By.ID, "last_result") + assert last_result.get_attribute("value") == "" + + inline_return_button = driver.find_element(By.ID, "inline_return") + + call_with_var_f_string_button = driver.find_element(By.ID, "call_with_var_f_string") + call_with_var_str_cast_button = driver.find_element(By.ID, "call_with_var_str_cast") + call_with_var_f_string_wrapped_button = driver.find_element( + By.ID, "call_with_var_f_string_wrapped" + ) + call_with_var_str_cast_wrapped_button = driver.find_element( + By.ID, "call_with_var_str_cast_wrapped" + ) + call_with_var_f_string_inline_button = driver.find_element( + By.ID, "call_with_var_f_string_inline" + ) + call_with_var_str_cast_inline_button = driver.find_element( + By.ID, "call_with_var_str_cast_inline" + ) + call_with_var_f_string_wrapped_inline_button = driver.find_element( + By.ID, "call_with_var_f_string_wrapped_inline" + ) + call_with_var_str_cast_wrapped_inline_button = driver.find_element( + By.ID, "call_with_var_str_cast_wrapped_inline" + ) + + inline_return_button.click() + call_with_var_f_string_button.click() + assert call_script.poll_for_value(last_result, exp_not_equal="") == "1" + + inline_return_button.click() + call_with_var_str_cast_button.click() + assert call_script.poll_for_value(last_result, exp_not_equal="1") == "2" + + inline_return_button.click() + call_with_var_f_string_wrapped_button.click() + assert call_script.poll_for_value(last_result, exp_not_equal="2") == "3" + + inline_return_button.click() + call_with_var_str_cast_wrapped_button.click() + assert call_script.poll_for_value(last_result, exp_not_equal="3") == "4" + + inline_return_button.click() + call_with_var_f_string_inline_button.click() + assert call_script.poll_for_value(last_result, exp_not_equal="4") == "9" + + inline_return_button.click() + call_with_var_str_cast_inline_button.click() + assert call_script.poll_for_value(last_result, exp_not_equal="9") == "6" + + inline_return_button.click() + call_with_var_f_string_wrapped_inline_button.click() + assert call_script.poll_for_value(last_result, exp_not_equal="6") == "13" + + inline_return_button.click() + call_with_var_str_cast_wrapped_inline_button.click() + assert call_script.poll_for_value(last_result, exp_not_equal="13") == "8" diff --git a/integration/test_client_storage.py b/tests/integration/test_client_storage.py similarity index 99% rename from integration/test_client_storage.py rename to tests/integration/test_client_storage.py index e88d2fa14..ae66087e2 100644 --- a/integration/test_client_storage.py +++ b/tests/integration/test_client_storage.py @@ -17,8 +17,6 @@ from . import utils def ClientSide(): """App for testing client-side state.""" - import reflex_chakra as rc - import reflex as rx class ClientSideState(rx.State): @@ -57,6 +55,7 @@ def ClientSide(): def set_l6(self, my_param: str): self.l6 = my_param + @rx.event def set_var(self): setattr(self, self.state_var, self.input_value) self.state_var = self.input_value = "" @@ -66,24 +65,25 @@ def ClientSide(): l1s: str = rx.LocalStorage() s1s: str = rx.SessionStorage() + @rx.event def set_var(self): setattr(self, self.state_var, self.input_value) self.state_var = self.input_value = "" def index(): return rx.fragment( - rc.input( + rx.input( value=ClientSideState.router.session.client_token, is_read_only=True, id="token", ), - rc.input( + rx.input( placeholder="state var", value=ClientSideState.state_var, on_change=ClientSideState.set_state_var, # type: ignore id="state_var", ), - rc.input( + rx.input( placeholder="input value", value=ClientSideState.input_value, on_change=ClientSideState.set_input_value, # type: ignore @@ -313,7 +313,6 @@ async def test_client_side_state( # no cookies should be set yet! assert not driver.get_cookies() local_storage_items = local_storage.items() - local_storage_items.pop("chakra-ui-color-mode", None) local_storage_items.pop("last_compiled_time", None) assert not local_storage_items @@ -429,7 +428,6 @@ async def test_client_side_state( assert f"{sub_state_name}.c3" not in cookie_info_map(driver) local_storage_items = local_storage.items() - local_storage_items.pop("chakra-ui-color-mode", None) local_storage_items.pop("last_compiled_time", None) assert local_storage_items.pop(f"{sub_state_name}.l1") == "l1 value" assert local_storage_items.pop(f"{sub_state_name}.l2") == "l2 value" diff --git a/tests/integration/test_component_state.py b/tests/integration/test_component_state.py new file mode 100644 index 000000000..f4a295d07 --- /dev/null +++ b/tests/integration/test_component_state.py @@ -0,0 +1,204 @@ +"""Test that per-component state scaffold works and operates independently.""" + +from typing import Generator + +import pytest +from selenium.webdriver.common.by import By + +from reflex.state import State, _substate_key +from reflex.testing import AppHarness + +from . import utils + + +def ComponentStateApp(): + """App using per component state.""" + from typing import Generic, TypeVar + + import reflex as rx + + E = TypeVar("E") + + class MultiCounter(rx.ComponentState, Generic[E]): + """ComponentState style.""" + + count: int = 0 + _be: E + _be_int: int + _be_str: str = "42" + + @rx.event + def increment(self): + self.count += 1 + self._be = self.count # type: ignore + + @classmethod + def get_component(cls, *children, **props): + return rx.vstack( + *children, + rx.heading(cls.count, id=f"count-{props.get('id', 'default')}"), + rx.button( + "Increment", + on_click=cls.increment, + id=f"button-{props.get('id', 'default')}", + ), + **props, + ) + + def multi_counter_func(id: str = "default") -> rx.Component: + """Local-substate style. + + Args: + id: identifier for this instance + + Returns: + A new instance of the component with its own state. + """ + + class _Counter(rx.State): + count: int = 0 + + @rx.event + def increment(self): + self.count += 1 + + return rx.vstack( + rx.heading(_Counter.count, id=f"count-{id}"), + rx.button( + "Increment", + on_click=_Counter.increment, + id=f"button-{id}", + ), + State=_Counter, + ) + + app = rx.App(state=rx.State) # noqa + + @rx.page() + def index(): + mc_a = MultiCounter.create(id="a") + mc_b = MultiCounter.create(id="b") + mc_c = multi_counter_func(id="c") + mc_d = multi_counter_func(id="d") + assert mc_a.State != mc_b.State + assert mc_c.State != mc_d.State + return rx.vstack( + mc_a, + mc_b, + mc_c, + mc_d, + rx.button( + "Inc A", + on_click=mc_a.State.increment, # type: ignore + id="inc-a", + ), + rx.text( + mc_a.State.get_name() if mc_a.State is not None else "", + id="a_state_name", + ), + rx.text( + mc_b.State.get_name() if mc_b.State is not None else "", + id="b_state_name", + ), + ) + + +@pytest.fixture() +def component_state_app(tmp_path) -> Generator[AppHarness, None, None]: + """Start ComponentStateApp app at tmp_path via AppHarness. + + Args: + tmp_path: pytest tmp_path fixture + + Yields: + running AppHarness instance + """ + with AppHarness.create( + root=tmp_path, + app_source=ComponentStateApp, # type: ignore + ) as harness: + yield harness + + +@pytest.mark.asyncio +async def test_component_state_app(component_state_app: AppHarness): + """Increment counters independently. + + Args: + component_state_app: harness for ComponentStateApp app + """ + assert component_state_app.app_instance is not None, "app is not running" + driver = component_state_app.frontend() + + ss = utils.SessionStorage(driver) + assert AppHarness._poll_for(lambda: ss.get("token") is not None), "token not found" + root_state_token = _substate_key(ss.get("token"), State) + + count_a = driver.find_element(By.ID, "count-a") + count_b = driver.find_element(By.ID, "count-b") + button_a = driver.find_element(By.ID, "button-a") + button_b = driver.find_element(By.ID, "button-b") + button_inc_a = driver.find_element(By.ID, "inc-a") + + # Check that backend vars in mixins are okay + a_state_name = driver.find_element(By.ID, "a_state_name").text + b_state_name = driver.find_element(By.ID, "b_state_name").text + root_state = await component_state_app.get_state(root_state_token) + a_state = root_state.substates[a_state_name] + b_state = root_state.substates[b_state_name] + assert a_state._backend_vars == a_state.backend_vars + assert a_state._backend_vars == b_state._backend_vars + assert a_state._backend_vars["_be"] is None + assert a_state._backend_vars["_be_int"] == 0 + assert a_state._backend_vars["_be_str"] == "42" + + assert count_a.text == "0" + + button_a.click() + assert component_state_app.poll_for_content(count_a, exp_not_equal="0") == "1" + + button_a.click() + assert component_state_app.poll_for_content(count_a, exp_not_equal="1") == "2" + + button_inc_a.click() + assert component_state_app.poll_for_content(count_a, exp_not_equal="2") == "3" + + root_state = await component_state_app.get_state(root_state_token) + a_state = root_state.substates[a_state_name] + b_state = root_state.substates[b_state_name] + assert a_state._backend_vars != a_state.backend_vars + assert a_state._be == a_state._backend_vars["_be"] == 3 + assert b_state._be is None + assert b_state._backend_vars["_be"] is None + + assert count_b.text == "0" + + button_b.click() + assert component_state_app.poll_for_content(count_b, exp_not_equal="0") == "1" + + button_b.click() + assert component_state_app.poll_for_content(count_b, exp_not_equal="1") == "2" + + root_state = await component_state_app.get_state(root_state_token) + a_state = root_state.substates[a_state_name] + b_state = root_state.substates[b_state_name] + assert b_state._backend_vars != b_state.backend_vars + assert b_state._be == b_state._backend_vars["_be"] == 2 + + # Check locally-defined substate style + count_c = driver.find_element(By.ID, "count-c") + count_d = driver.find_element(By.ID, "count-d") + button_c = driver.find_element(By.ID, "button-c") + button_d = driver.find_element(By.ID, "button-d") + + assert component_state_app.poll_for_content(count_c, exp_not_equal="") == "0" + assert component_state_app.poll_for_content(count_d, exp_not_equal="") == "0" + button_c.click() + assert component_state_app.poll_for_content(count_c, exp_not_equal="0") == "1" + assert component_state_app.poll_for_content(count_d, exp_not_equal="") == "0" + button_c.click() + assert component_state_app.poll_for_content(count_c, exp_not_equal="1") == "2" + assert component_state_app.poll_for_content(count_d, exp_not_equal="") == "0" + button_d.click() + assert component_state_app.poll_for_content(count_c, exp_not_equal="1") == "2" + assert component_state_app.poll_for_content(count_d, exp_not_equal="0") == "1" diff --git a/integration/test_computed_vars.py b/tests/integration/test_computed_vars.py similarity index 99% rename from integration/test_computed_vars.py rename to tests/integration/test_computed_vars.py index 28f774de5..1f585cd8b 100644 --- a/integration/test_computed_vars.py +++ b/tests/integration/test_computed_vars.py @@ -58,9 +58,11 @@ def ComputedVars(): def depends_on_count3(self) -> int: return self.count + @rx.event def increment(self): self.count += 1 + @rx.event def mark_dirty(self): self._mark_dirty() diff --git a/integration/test_connection_banner.py b/tests/integration/test_connection_banner.py similarity index 99% rename from integration/test_connection_banner.py rename to tests/integration/test_connection_banner.py index b83a493ce..6921444b0 100644 --- a/integration/test_connection_banner.py +++ b/tests/integration/test_connection_banner.py @@ -20,6 +20,7 @@ def ConnectionBanner(): class State(rx.State): foo: int = 0 + @rx.event async def delay(self): await asyncio.sleep(5) diff --git a/integration/test_deploy_url.py b/tests/integration/test_deploy_url.py similarity index 99% rename from integration/test_deploy_url.py rename to tests/integration/test_deploy_url.py index b0421cfb7..f93e9db27 100644 --- a/integration/test_deploy_url.py +++ b/tests/integration/test_deploy_url.py @@ -17,6 +17,7 @@ def DeployUrlSample() -> None: import reflex as rx class State(rx.State): + @rx.event def goto_self(self): return rx.redirect(rx.config.get_config().deploy_url) # type: ignore diff --git a/tests/integration/test_dynamic_components.py b/tests/integration/test_dynamic_components.py new file mode 100644 index 000000000..aeebd10e9 --- /dev/null +++ b/tests/integration/test_dynamic_components.py @@ -0,0 +1,169 @@ +"""Integration tests for var operations.""" + +import time +from typing import Callable, Generator, TypeVar + +import pytest +from selenium.webdriver.common.by import By + +from reflex.testing import AppHarness + +# pyright: reportOptionalMemberAccess=false, reportGeneralTypeIssues=false, reportUnknownMemberType=false + + +def DynamicComponents(): + """App with var operations.""" + import reflex as rx + + class DynamicComponentsState(rx.State): + value: int = 10 + + button: rx.Component = rx.button( + "Click me", + custom_attrs={ + "id": "button", + }, + ) + + def got_clicked(self): + self.button = rx.button( + "Clicked", + custom_attrs={ + "id": "button", + }, + ) + + @rx.var + def client_token_component(self) -> rx.Component: + return rx.vstack( + rx.el.input( + custom_attrs={ + "id": "token", + }, + value=self.router.session.client_token, + is_read_only=True, + ), + rx.button( + "Update", + custom_attrs={ + "id": "update", + }, + on_click=DynamicComponentsState.got_clicked, + ), + ) + + app = rx.App() + + def factorial(n: int) -> int: + if n == 0: + return 1 + return n * factorial(n - 1) + + @app.add_page + def index(): + return rx.vstack( + DynamicComponentsState.client_token_component, + DynamicComponentsState.button, + rx.text( + DynamicComponentsState._evaluate( + lambda state: factorial(state.value), of_type=int + ), + id="factorial", + ), + ) + + +@pytest.fixture(scope="module") +def dynamic_components(tmp_path_factory) -> Generator[AppHarness, None, None]: + """Start VarOperations app at tmp_path via AppHarness. + + Args: + tmp_path_factory: pytest tmp_path_factory fixture + + Yields: + running AppHarness instance + """ + with AppHarness.create( + root=tmp_path_factory.mktemp("dynamic_components"), + app_source=DynamicComponents, # type: ignore + ) as harness: + assert harness.app_instance is not None, "app is not running" + yield harness + + +T = TypeVar("T") + + +def poll_for_result( + f: Callable[[], T], exception=Exception, max_attempts=5, seconds_between_attempts=1 +) -> T: + """Poll for a result from a function. + + Args: + f: function to call + exception: exception to catch + max_attempts: maximum number of attempts + seconds_between_attempts: seconds to wait between + + Returns: + Result of the function + + Raises: + AssertionError: if the function does not return a value + """ + attempts = 0 + while attempts < max_attempts: + try: + return f() + except exception: + attempts += 1 + time.sleep(seconds_between_attempts) + raise AssertionError("Function did not return a value") + + +@pytest.fixture +def driver(dynamic_components: AppHarness): + """Get an instance of the browser open to the dynamic components app. + + Args: + dynamic_components: AppHarness for the dynamic components + + Yields: + WebDriver instance. + """ + driver = dynamic_components.frontend() + try: + token_input = poll_for_result(lambda: driver.find_element(By.ID, "token")) + assert token_input + # wait for the backend connection to send the token + token = dynamic_components.poll_for_value(token_input) + assert token is not None + + yield driver + finally: + driver.quit() + + +def test_dynamic_components(driver, dynamic_components: AppHarness): + """Test that the var operations produce the right results. + + Args: + driver: selenium WebDriver open to the app + dynamic_components: AppHarness for the dynamic components + """ + button = poll_for_result(lambda: driver.find_element(By.ID, "button")) + assert button + assert button.text == "Click me" + + update_button = driver.find_element(By.ID, "update") + assert update_button + update_button.click() + + assert ( + dynamic_components.poll_for_content(button, exp_not_equal="Click me") + == "Clicked" + ) + + factorial = poll_for_result(lambda: driver.find_element(By.ID, "factorial")) + assert factorial + assert factorial.text == "3628800" diff --git a/integration/test_dynamic_routes.py b/tests/integration/test_dynamic_routes.py similarity index 67% rename from integration/test_dynamic_routes.py rename to tests/integration/test_dynamic_routes.py index 0ce4ef2c9..31b7fa419 100644 --- a/integration/test_dynamic_routes.py +++ b/tests/integration/test_dynamic_routes.py @@ -17,20 +17,21 @@ def DynamicRoute(): """App for testing dynamic routes.""" from typing import List - import reflex_chakra as rc - import reflex as rx class DynamicState(rx.State): order: List[str] = [] - page_id: str = "" def on_load(self): - self.order.append(f"{self.router.page.path}-{self.page_id or 'no page id'}") + page_data = f"{self.router.page.path}-{self.page_id or 'no page id'}" + print(f"on_load: {page_data}") + self.order.append(page_data) def on_load_redir(self): query_params = self.router.page.params - self.order.append(f"on_load_redir-{query_params}") + page_data = f"on_load_redir-{query_params}" + print(f"on_load_redir: {page_data}") + self.order.append(page_data) return rx.redirect(f"/page/{query_params['page_id']}") @rx.var @@ -42,15 +43,15 @@ def DynamicRoute(): def index(): return rx.fragment( - rc.input( + rx.input( value=DynamicState.router.session.client_token, - is_read_only=True, + read_only=True, id="token", ), - rc.input(value=DynamicState.page_id, is_read_only=True, id="page_id"), - rc.input( + rx.input(value=rx.State.page_id, read_only=True, id="page_id"), # type: ignore + rx.input( value=DynamicState.router.page.raw_path, - is_read_only=True, + read_only=True, id="raw_path", ), rx.link("index", href="/", id="link_index"), @@ -61,22 +62,80 @@ def DynamicRoute(): id="link_page_next", # type: ignore ), rx.link("missing", href="/missing", id="link_missing"), - rc.list( + rx.list( # type: ignore rx.foreach( DynamicState.order, # type: ignore - lambda i: rc.list_item(rx.text(i)), + lambda i: rx.list_item(rx.text(i)), ), ), ) + class ArgState(rx.State): + """The app state.""" + + @rx.var + def arg(self) -> int: + return int(self.arg_str or 0) + + class ArgSubState(ArgState): + @rx.var(cache=True) + def cached_arg(self) -> int: + return self.arg + + @rx.var(cache=True) + def cached_arg_str(self) -> str: + return self.arg_str + + @rx.page(route="/arg/[arg_str]") + def arg() -> rx.Component: + return rx.vstack( + rx.data_list.root( + rx.data_list.item( + rx.data_list.label("rx.State.arg_str (dynamic)"), + rx.data_list.value(rx.State.arg_str, id="state-arg_str"), # type: ignore + ), + rx.data_list.item( + rx.data_list.label("ArgState.arg_str (dynamic) (inherited)"), + rx.data_list.value(ArgState.arg_str, id="argstate-arg_str"), # type: ignore + ), + rx.data_list.item( + rx.data_list.label("ArgState.arg"), + rx.data_list.value(ArgState.arg, id="argstate-arg"), + ), + rx.data_list.item( + rx.data_list.label("ArgSubState.arg_str (dynamic) (inherited)"), + rx.data_list.value(ArgSubState.arg_str, id="argsubstate-arg_str"), # type: ignore + ), + rx.data_list.item( + rx.data_list.label("ArgSubState.arg (inherited)"), + rx.data_list.value(ArgSubState.arg, id="argsubstate-arg"), + ), + rx.data_list.item( + rx.data_list.label("ArgSubState.cached_arg"), + rx.data_list.value( + ArgSubState.cached_arg, id="argsubstate-cached_arg" + ), + ), + rx.data_list.item( + rx.data_list.label("ArgSubState.cached_arg_str"), + rx.data_list.value( + ArgSubState.cached_arg_str, id="argsubstate-cached_arg_str" + ), + ), + ), + rx.link("+", href=f"/arg/{ArgState.arg + 1}", id="next-page"), + align="center", + height="100vh", + ) + @rx.page(route="/redirect-page/[page_id]", on_load=DynamicState.on_load_redir) # type: ignore def redirect_page(): return rx.fragment(rx.text("redirecting...")) app = rx.App(state=rx.State) - app.add_page(index) app.add_page(index, route="/page/[page_id]", on_load=DynamicState.on_load) # type: ignore app.add_page(index, route="/static/x", on_load=DynamicState.on_load) # type: ignore + app.add_page(index) app.add_custom_404_page(on_load=DynamicState.on_load) # type: ignore @@ -166,8 +225,11 @@ def poll_for_order( dynamic_state_name ].order == exp_order - await AppHarness._poll_for_async(_check) - assert (await _backend_state()).substates[dynamic_state_name].order == exp_order + await AppHarness._poll_for_async(_check, timeout=60) + assert ( + list((await _backend_state()).substates[dynamic_state_name].order) + == exp_order + ) return _poll_for_order @@ -305,3 +367,50 @@ async def test_on_load_navigate_non_dynamic( link.click() assert urlsplit(driver.current_url).path == "/static/x/" await poll_for_order(["/static/x-no page id", "/static/x-no page id"]) + + +@pytest.mark.asyncio +async def test_render_dynamic_arg( + dynamic_route: AppHarness, + driver: WebDriver, +): + """Assert that dynamic arg var is rendered correctly in different contexts. + + Args: + dynamic_route: harness for DynamicRoute app. + driver: WebDriver instance. + """ + assert dynamic_route.app_instance is not None + with poll_for_navigation(driver): + driver.get(f"{dynamic_route.frontend_url}/arg/0") + + def assert_content(expected: str, expect_not: str): + ids = [ + "state-arg_str", + "argstate-arg", + "argstate-arg_str", + "argsubstate-arg_str", + "argsubstate-arg", + "argsubstate-cached_arg", + "argsubstate-cached_arg_str", + ] + for id in ids: + el = driver.find_element(By.ID, id) + assert el + assert ( + dynamic_route.poll_for_content(el, exp_not_equal=expect_not) == expected + ) + + assert_content("0", "") + next_page_link = driver.find_element(By.ID, "next-page") + assert next_page_link + with poll_for_navigation(driver): + next_page_link.click() + assert driver.current_url == f"{dynamic_route.frontend_url}/arg/1/" + assert_content("1", "0") + next_page_link = driver.find_element(By.ID, "next-page") + assert next_page_link + with poll_for_navigation(driver): + next_page_link.click() + assert driver.current_url == f"{dynamic_route.frontend_url}/arg/2/" + assert_content("2", "1") diff --git a/integration/test_event_actions.py b/tests/integration/test_event_actions.py similarity index 98% rename from integration/test_event_actions.py rename to tests/integration/test_event_actions.py index 5845d80f1..5d278835e 100644 --- a/integration/test_event_actions.py +++ b/tests/integration/test_event_actions.py @@ -16,8 +16,6 @@ def TestEventAction(): """App for testing event_actions.""" from typing import List, Optional - import reflex_chakra as rc - import reflex as rx class EventActionState(rx.State): @@ -26,6 +24,7 @@ def TestEventAction(): def on_click(self, ev): self.order.append(f"on_click:{ev}") + @rx.event def on_click2(self): self.order.append("on_click2") @@ -55,7 +54,7 @@ def TestEventAction(): def index(): return rx.vstack( - rc.input( + rx.input( value=EventActionState.router.session.client_token, is_read_only=True, id="token", @@ -148,10 +147,10 @@ def TestEventAction(): 200 ).stop_propagation, ), - rc.list( + rx.list( # type: ignore rx.foreach( EventActionState.order, # type: ignore - rc.list_item, + rx.list_item, ), ), on_click=EventActionState.on_click("outer"), # type: ignore diff --git a/integration/test_event_chain.py b/tests/integration/test_event_chain.py similarity index 97% rename from integration/test_event_chain.py rename to tests/integration/test_event_chain.py index cdef575a1..ea2d2191c 100644 --- a/integration/test_event_chain.py +++ b/tests/integration/test_event_chain.py @@ -18,8 +18,6 @@ def EventChain(): import time from typing import List - import reflex_chakra as rc - import reflex as rx # repeated here since the outer global isn't exported into the App module @@ -29,45 +27,55 @@ def EventChain(): event_order: List[str] = [] interim_value: str = "" + @rx.event def event_no_args(self): self.event_order.append("event_no_args") + @rx.event def event_arg(self, arg): self.event_order.append(f"event_arg:{arg}") + @rx.event def event_arg_repr_type(self, arg): self.event_order.append(f"event_arg_repr:{arg!r}_{type(arg).__name__}") + @rx.event def event_nested_1(self): self.event_order.append("event_nested_1") yield State.event_nested_2 yield State.event_arg("nested_1") # type: ignore + @rx.event def event_nested_2(self): self.event_order.append("event_nested_2") yield State.event_nested_3 yield rx.console_log("event_nested_2") yield State.event_arg("nested_2") # type: ignore + @rx.event def event_nested_3(self): self.event_order.append("event_nested_3") yield State.event_no_args yield State.event_arg("nested_3") # type: ignore + @rx.event def on_load_return_chain(self): self.event_order.append("on_load_return_chain") return [State.event_arg(1), State.event_arg(2), State.event_arg(3)] # type: ignore + @rx.event def on_load_yield_chain(self): self.event_order.append("on_load_yield_chain") yield State.event_arg(4) # type: ignore yield State.event_arg(5) # type: ignore yield State.event_arg(6) # type: ignore + @rx.event def click_return_event(self): self.event_order.append("click_return_event") return State.event_no_args + @rx.event def click_return_events(self): self.event_order.append("click_return_events") return [ @@ -77,6 +85,7 @@ def EventChain(): State.event_arg(9), # type: ignore ] + @rx.event def click_yield_chain(self): self.event_order.append("click_yield_chain:0") yield State.event_arg(10) # type: ignore @@ -87,6 +96,7 @@ def EventChain(): yield State.event_arg(12) # type: ignore self.event_order.append("click_yield_chain:3") + @rx.event def click_yield_many_events(self): self.event_order.append("click_yield_many_events") for ix in range(MANY_EVENTS): @@ -94,33 +104,40 @@ def EventChain(): yield rx.console_log(f"many_events_{ix}") self.event_order.append("click_yield_many_events_done") + @rx.event def click_yield_nested(self): self.event_order.append("click_yield_nested") yield State.event_nested_1 yield State.event_arg("yield_nested") # type: ignore + @rx.event def redirect_return_chain(self): self.event_order.append("redirect_return_chain") yield rx.redirect("/on-load-return-chain") + @rx.event def redirect_yield_chain(self): self.event_order.append("redirect_yield_chain") yield rx.redirect("/on-load-yield-chain") + @rx.event def click_return_int_type(self): self.event_order.append("click_return_int_type") return State.event_arg_repr_type(1) # type: ignore + @rx.event def click_return_dict_type(self): self.event_order.append("click_return_dict_type") return State.event_arg_repr_type({"a": 1}) # type: ignore + @rx.event async def click_yield_interim_value_async(self): self.interim_value = "interim" yield await asyncio.sleep(0.5) self.interim_value = "final" + @rx.event def click_yield_interim_value(self): self.interim_value = "interim" yield @@ -129,7 +146,7 @@ def EventChain(): app = rx.App(state=rx.State) - token_input = rc.input( + token_input = rx.input( value=State.router.session.client_token, is_read_only=True, id="token" ) @@ -137,7 +154,7 @@ def EventChain(): def index(): return rx.fragment( token_input, - rc.input(value=State.interim_value, is_read_only=True, id="interim_value"), + rx.input(value=State.interim_value, is_read_only=True, id="interim_value"), rx.button( "Return Event", id="return_event", diff --git a/integration/test_exception_handlers.py b/tests/integration/test_exception_handlers.py similarity index 100% rename from integration/test_exception_handlers.py rename to tests/integration/test_exception_handlers.py diff --git a/integration/test_form_submit.py b/tests/integration/test_form_submit.py similarity index 78% rename from integration/test_form_submit.py rename to tests/integration/test_form_submit.py index acc6bca96..a020a7e15 100644 --- a/integration/test_form_submit.py +++ b/tests/integration/test_form_submit.py @@ -20,8 +20,6 @@ def FormSubmit(form_component): """ from typing import Dict, List - import reflex_chakra as rc - import reflex as rx class FormState(rx.State): @@ -37,28 +35,29 @@ def FormSubmit(form_component): @app.add_page def index(): return rx.vstack( - rc.input( + rx.input( value=FormState.router.session.client_token, is_read_only=True, id="token", ), eval(form_component)( rx.vstack( - rc.input(id="name_input"), - rx.hstack(rc.pin_input(length=4, id="pin_input")), - rc.number_input(id="number_input"), + rx.input(id="name_input"), rx.checkbox(id="bool_input"), rx.switch(id="bool_input2"), rx.checkbox(id="bool_input3"), rx.switch(id="bool_input4"), rx.slider(id="slider_input", default_value=[50], width="100%"), - rc.range_slider(id="range_input"), rx.radio(["option1", "option2"], id="radio_input"), rx.radio(FormState.var_options, id="radio_input_var"), - rc.select(["option1", "option2"], id="select_input"), - rc.select(FormState.var_options, id="select_input_var"), + rx.select( + ["option1", "option2"], + name="select_input", + default_value="option1", + ), + rx.select(FormState.var_options, id="select_input_var"), rx.text_area(id="text_area_input"), - rc.input( + rx.input( id="debounce_input", debounce_timeout=0, on_change=rx.console_log, @@ -81,8 +80,6 @@ def FormSubmitName(form_component): """ from typing import Dict, List - import reflex_chakra as rc - import reflex as rx class FormState(rx.State): @@ -98,22 +95,19 @@ def FormSubmitName(form_component): @app.add_page def index(): return rx.vstack( - rc.input( + rx.input( value=FormState.router.session.client_token, is_read_only=True, id="token", ), eval(form_component)( rx.vstack( - rc.input(name="name_input"), - rx.hstack(rc.pin_input(length=4, name="pin_input")), - rc.number_input(name="number_input"), + rx.input(name="name_input"), rx.checkbox(name="bool_input"), rx.switch(name="bool_input2"), rx.checkbox(name="bool_input3"), rx.switch(name="bool_input4"), rx.slider(name="slider_input", default_value=[50], width="100%"), - rc.range_slider(name="range_input"), rx.radio(FormState.options, name="radio_input"), rx.select( FormState.options, @@ -121,21 +115,13 @@ def FormSubmitName(form_component): default_value=FormState.options[0], ), rx.text_area(name="text_area_input"), - rc.input_group( - rc.input_left_element(rx.icon(tag="chevron_right")), - rc.input( - name="debounce_input", - debounce_timeout=0, - on_change=rx.console_log, - ), - rc.input_right_element(rx.icon(tag="chevron_left")), - ), - rc.button_group( - rx.button("Submit", type_="submit"), - rx.icon_button(FormState.val, icon=rx.icon(tag="plus")), - variant="outline", - is_attached=True, + rx.input( + name="debounce_input", + debounce_timeout=0, + on_change=rx.console_log, ), + rx.button("Submit", type_="submit"), + rx.icon_button(FormState.val, icon=rx.icon(tag="plus")), ), on_submit=FormState.form_submit, custom_attrs={"action": "/invalid"}, @@ -152,16 +138,12 @@ def FormSubmitName(form_component): functools.partial(FormSubmitName, form_component="rx.form.root"), functools.partial(FormSubmit, form_component="rx.el.form"), functools.partial(FormSubmitName, form_component="rx.el.form"), - functools.partial(FormSubmit, form_component="rc.form"), - functools.partial(FormSubmitName, form_component="rc.form"), ], ids=[ "id-radix", "name-radix", "id-html", "name-html", - "id-chakra", - "name-chakra", ], ) def form_submit(request, tmp_path_factory) -> Generator[AppHarness, None, None]: @@ -224,16 +206,6 @@ async def test_submit(driver, form_submit: AppHarness): name_input = driver.find_element(by, "name_input") name_input.send_keys("foo") - pin_inputs = driver.find_elements(By.CLASS_NAME, "chakra-pin-input") - pin_values = ["8", "1", "6", "4"] - for i, pin_input in enumerate(pin_inputs): - pin_input.send_keys(pin_values[i]) - - number_input = driver.find_element(By.CLASS_NAME, "chakra-numberinput") - buttons = number_input.find_elements(By.XPATH, "//div[@role='button']") - for _ in range(3): - buttons[1].click() - checkbox_input = driver.find_element(By.XPATH, "//button[@role='checkbox']") checkbox_input.click() @@ -275,15 +247,12 @@ async def test_submit(driver, form_submit: AppHarness): print(form_data) assert form_data["name_input"] == "foo" - assert form_data["pin_input"] == pin_values - assert form_data["number_input"] == "-3" assert form_data["bool_input"] assert form_data["bool_input2"] assert not form_data.get("bool_input3", False) assert not form_data.get("bool_input4", False) assert form_data["slider_input"] == "50" - assert form_data["range_input"] == ["25", "75"] assert form_data["radio_input"] == "option2" assert form_data["select_input"] == "option1" assert form_data["text_area_input"] == "Some\nText" diff --git a/integration/test_input.py b/tests/integration/test_input.py similarity index 100% rename from integration/test_input.py rename to tests/integration/test_input.py diff --git a/integration/test_large_state.py b/tests/integration/test_large_state.py similarity index 100% rename from integration/test_large_state.py rename to tests/integration/test_large_state.py diff --git a/integration/test_lifespan.py b/tests/integration/test_lifespan.py similarity index 99% rename from integration/test_lifespan.py rename to tests/integration/test_lifespan.py index f8bcf2397..22c399c07 100644 --- a/integration/test_lifespan.py +++ b/tests/integration/test_lifespan.py @@ -51,6 +51,7 @@ def LifespanApp(): def context_global(self) -> int: return lifespan_context_global + @rx.event def tick(self, date): pass diff --git a/integration/test_login_flow.py b/tests/integration/test_login_flow.py similarity index 99% rename from integration/test_login_flow.py rename to tests/integration/test_login_flow.py index 7d583e433..ecaade9cf 100644 --- a/integration/test_login_flow.py +++ b/tests/integration/test_login_flow.py @@ -21,9 +21,11 @@ def LoginSample(): class State(rx.State): auth_token: str = rx.LocalStorage("") + @rx.event def logout(self): self.set_auth_token("") + @rx.event def login(self): self.set_auth_token("12345") yield rx.redirect("/") diff --git a/integration/test_media.py b/tests/integration/test_media.py similarity index 100% rename from integration/test_media.py rename to tests/integration/test_media.py diff --git a/integration/test_navigation.py b/tests/integration/test_navigation.py similarity index 100% rename from integration/test_navigation.py rename to tests/integration/test_navigation.py diff --git a/integration/test_server_side_event.py b/tests/integration/test_server_side_event.py similarity index 95% rename from integration/test_server_side_event.py rename to tests/integration/test_server_side_event.py index 8687b0f32..cacf6e1c5 100644 --- a/integration/test_server_side_event.py +++ b/tests/integration/test_server_side_event.py @@ -11,21 +11,22 @@ from reflex.testing import AppHarness def ServerSideEvent(): """App with inputs set via event handlers and set_value.""" - import reflex_chakra as rc - import reflex as rx class SSState(rx.State): + @rx.event def set_value_yield(self): yield rx.set_value("a", "") yield rx.set_value("b", "") yield rx.set_value("c", "") + @rx.event def set_value_yield_return(self): yield rx.set_value("a", "") yield rx.set_value("b", "") return rx.set_value("c", "") + @rx.event def set_value_return(self): return [ rx.set_value("a", ""), @@ -33,6 +34,7 @@ def ServerSideEvent(): rx.set_value("c", ""), ] + @rx.event def set_value_return_c(self): return rx.set_value("c", "") @@ -41,12 +43,12 @@ def ServerSideEvent(): @app.add_page def index(): return rx.fragment( - rc.input( + rx.input( id="token", value=SSState.router.session.client_token, is_read_only=True ), - rc.input(default_value="a", id="a"), - rc.input(default_value="b", id="b"), - rc.input(default_value="c", id="c"), + rx.input(default_value="a", id="a"), + rx.input(default_value="b", id="b"), + rx.input(default_value="c", id="c"), rx.button( "Clear Immediate", id="clear_immediate", diff --git a/integration/test_shared_state.py b/tests/integration/test_shared_state.py similarity index 96% rename from integration/test_shared_state.py rename to tests/integration/test_shared_state.py index a1a3d6080..6f59c5142 100644 --- a/integration/test_shared_state.py +++ b/tests/integration/test_shared_state.py @@ -12,7 +12,7 @@ from reflex.testing import AppHarness, WebDriver def SharedStateApp(): """Test that shared state works as expected.""" import reflex as rx - from integration.shared.state import SharedState + from tests.integration.shared.state import SharedState class State(SharedState): pass diff --git a/integration/test_state_inheritance.py b/tests/integration/test_state_inheritance.py similarity index 100% rename from integration/test_state_inheritance.py rename to tests/integration/test_state_inheritance.py diff --git a/integration/test_stateless_app.py b/tests/integration/test_stateless_app.py similarity index 100% rename from integration/test_stateless_app.py rename to tests/integration/test_stateless_app.py diff --git a/tests/integration/test_table.py b/tests/integration/test_table.py new file mode 100644 index 000000000..09004a874 --- /dev/null +++ b/tests/integration/test_table.py @@ -0,0 +1,117 @@ +"""Integration tests for table and related components.""" + +from typing import Generator + +import pytest +from selenium.webdriver.common.by import By + +from reflex.testing import AppHarness + + +def Table(): + """App using table component.""" + import reflex as rx + + app = rx.App(state=rx.State) + + @app.add_page + def index(): + return rx.center( + rx.input( + id="token", + value=rx.State.router.session.client_token, + is_read_only=True, + ), + rx.table.root( + rx.table.header( + rx.table.row( + rx.table.column_header_cell("Name"), + rx.table.column_header_cell("Age"), + rx.table.column_header_cell("Location"), + ), + ), + rx.table.body( + rx.table.row( + rx.table.row_header_cell("John"), + rx.table.cell(30), + rx.table.cell("New York"), + ), + rx.table.row( + rx.table.row_header_cell("Jane"), + rx.table.cell(31), + rx.table.cell("San Fransisco"), + ), + rx.table.row( + rx.table.row_header_cell("Joe"), + rx.table.cell(32), + rx.table.cell("Los Angeles"), + ), + ), + width="100%", + ), + ) + + +@pytest.fixture() +def table(tmp_path_factory) -> Generator[AppHarness, None, None]: + """Start Table app at tmp_path via AppHarness. + + Args: + tmp_path_factory: pytest tmp_path_factory fixture + + Yields: + running AppHarness instance + + """ + with AppHarness.create( + root=tmp_path_factory.mktemp("table"), + app_source=Table, # type: ignore + ) as harness: + assert harness.app_instance is not None, "app is not running" + yield harness + + +@pytest.fixture +def driver(table: AppHarness): + """GEt an instance of the browser open to the table app. + + Args: + table: harness for Table app + + Yields: + WebDriver instance. + """ + driver = table.frontend() + try: + token_input = driver.find_element(By.ID, "token") + assert token_input + # wait for the backend connection to send the token + token = table.poll_for_value(token_input) + assert token is not None + + yield driver + finally: + driver.quit() + + +def test_table(driver, table: AppHarness): + """Test that a table component is rendered properly. + + Args: + driver: Selenium WebDriver open to the app + table: Harness for Table app + """ + assert table.app_instance is not None, "app is not running" + + thead = driver.find_element(By.TAG_NAME, "thead") + # poll till page is fully loaded. + table.poll_for_content(element=thead) + # check headers + assert thead.find_element(By.TAG_NAME, "tr").text == "Name Age Location" + # check first row value + assert ( + driver.find_element(By.TAG_NAME, "tbody") + .find_elements(By.TAG_NAME, "tr")[0] + .text + == "John 30 New York" + ) diff --git a/integration/test_tailwind.py b/tests/integration/test_tailwind.py similarity index 96% rename from integration/test_tailwind.py rename to tests/integration/test_tailwind.py index a3d90e645..bda664a1c 100644 --- a/integration/test_tailwind.py +++ b/tests/integration/test_tailwind.py @@ -27,8 +27,6 @@ def TailwindApp( """ from pathlib import Path - import reflex_chakra as rc - import reflex as rx class UnusedState(rx.State): @@ -36,7 +34,7 @@ def TailwindApp( def index(): return rx.el.div( - rc.text(paragraph_text, class_name=paragraph_class_name), + rx.text(paragraph_text, class_name=paragraph_class_name), rx.el.p(paragraph_text, class_name=paragraph_class_name), rx.text(paragraph_text, as_="p", class_name=paragraph_class_name), rx.el.div("Test external stylesheet", class_name="external"), @@ -109,7 +107,7 @@ def test_tailwind_app(tailwind_app: AppHarness, tailwind_disabled: bool): assert len(paragraphs) == 3 for p in paragraphs: assert tailwind_app.poll_for_content(p, exp_not_equal="") == PARAGRAPH_TEXT - assert p.value_of_css_property("font-family") == '"monospace"' + assert p.value_of_css_property("font-family") == "monospace" if tailwind_disabled: # expect default color, not "text-red-500" from tailwind utility class assert p.value_of_css_property("color") not in TEXT_RED_500_COLOR diff --git a/integration/test_upload.py b/tests/integration/test_upload.py similarity index 99% rename from integration/test_upload.py rename to tests/integration/test_upload.py index 1f8b39efc..813313462 100644 --- a/integration/test_upload.py +++ b/tests/integration/test_upload.py @@ -16,8 +16,6 @@ def UploadFile(): """App for testing dynamic routes.""" from typing import Dict, List - import reflex_chakra as rc - import reflex as rx class UploadState(rx.State): @@ -46,7 +44,7 @@ def UploadFile(): def index(): return rx.vstack( - rc.input( + rx.input( value=UploadState.router.session.client_token, is_read_only=True, id="token", diff --git a/tests/integration/test_urls.py b/tests/integration/test_urls.py new file mode 100755 index 000000000..81689aa18 --- /dev/null +++ b/tests/integration/test_urls.py @@ -0,0 +1,68 @@ +"""Integration tests for all urls in Reflex.""" + +import os +import re +from pathlib import Path + +import pytest +import requests + + +def check_urls(repo_dir: Path): + """Check that all URLs in the repo are valid and secure. + + Args: + repo_dir: The directory of the repo. + + Returns: + A list of errors. + """ + url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') + errors = [] + + for root, _dirs, files in os.walk(repo_dir): + root = Path(root) + if root.stem == "__pycache__": + continue + + for file_name in files: + if not file_name.endswith(".py") and not file_name.endswith(".md"): + continue + + file_path = root / file_name + try: + for line in file_path.read_text().splitlines(): + urls = url_pattern.findall(line) + for url in set(urls): + if url.startswith("http://"): + errors.append( + f"Found insecure HTTP URL: {url} in {file_path}" + ) + url = url.strip('"\n') + try: + response = requests.head( + url, allow_redirects=True, timeout=5 + ) + response.raise_for_status() + except requests.RequestException as e: + errors.append( + f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check your path ends with a /" + ) + except Exception as e: + errors.append(f"Error reading file: {file_path} | Error: {e}") + + return errors + + +@pytest.mark.parametrize( + "repo_dir", + [Path(__file__).resolve().parent.parent / "reflex"], +) +def test_find_and_check_urls(repo_dir: Path): + """Test that all URLs in the repo are valid and secure. + + Args: + repo_dir: The directory of the repo. + """ + errors = check_urls(repo_dir) + assert not errors, "\n".join(errors) diff --git a/integration/test_var_operations.py b/tests/integration/test_var_operations.py similarity index 96% rename from integration/test_var_operations.py rename to tests/integration/test_var_operations.py index 7a8f5473a..919a39f3b 100644 --- a/integration/test_var_operations.py +++ b/tests/integration/test_var_operations.py @@ -14,11 +14,12 @@ def VarOperations(): """App with var operations.""" from typing import Dict, List - import reflex_chakra as rc - import reflex as rx - from reflex.ivars.base import LiteralVar - from reflex.ivars.sequence import ArrayVar + from reflex.vars.base import LiteralVar + from reflex.vars.sequence import ArrayVar + + class Object(rx.Base): + str: str = "hello" class VarOperationState(rx.State): int_var1: int = 10 @@ -29,6 +30,7 @@ def VarOperations(): list1: List = [1, 2] list2: List = [3, 4] list3: List = ["first", "second", "third"] + list4: List = [Object(name="obj_1"), Object(name="obj_2")] str_var1: str = "first" str_var2: str = "second" str_var3: str = "ThIrD" @@ -474,6 +476,7 @@ def VarOperations(): rx.text( VarOperationState.list1.contains(1).to_string(), id="list_contains" ), + rx.text(VarOperationState.list4.pluck("name").to_string(), id="list_pluck"), rx.text(VarOperationState.list1.reverse().to_string(), id="list_reverse"), # LIST, INT rx.text( @@ -547,10 +550,7 @@ def VarOperations(): VarOperationState.html_str, id="html_str", ), - rc.highlight( - "second", - query=[VarOperationState.str_var2], - ), + rx.el.mark("second"), rx.text(ArrayVar.range(2, 5).join(","), id="list_join_range1"), rx.text(ArrayVar.range(2, 10, 2).join(","), id="list_join_range2"), rx.text(ArrayVar.range(5, 0, -1).join(","), id="list_join_range3"), @@ -588,6 +588,16 @@ def VarOperations(): int_var2=VarOperationState.int_var2, id="memo_comp_nested", ), + # foreach in a match + rx.box( + rx.match( + VarOperationState.list3.length(), + (0, rx.text("No choices")), + (1, rx.text("One choice")), + rx.foreach(VarOperationState.list3, lambda choice: rx.text(choice)), + ), + id="foreach_in_match", + ), ) @@ -749,6 +759,7 @@ def test_var_operations(driver, var_operations: AppHarness): ("list_and_list", "[3,4]"), ("list_or_list", "[1,2]"), ("list_contains", "true"), + ("list_pluck", '["obj_1","obj_2"]'), ("list_reverse", "[2,1]"), ("list_join", "firstsecondthird"), ("list_join_comma", "first,second,third"), @@ -782,8 +793,10 @@ def test_var_operations(driver, var_operations: AppHarness): ("foreach_list_ix", "1\n2"), ("foreach_list_nested", "1\n1\n2"), # rx.memo component with state - ("memo_comp", "1210"), - ("memo_comp_nested", "345"), + ("memo_comp", "[1,2]10"), + ("memo_comp_nested", "[3,4]5"), + # foreach in a match + ("foreach_in_match", "first\nsecond\nthird"), ] for tag, expected in tests: diff --git a/integration/utils.py b/tests/integration/utils.py similarity index 100% rename from integration/utils.py rename to tests/integration/utils.py diff --git a/tests/test_node_version.py b/tests/test_node_version.py new file mode 100644 index 000000000..9555eb524 --- /dev/null +++ b/tests/test_node_version.py @@ -0,0 +1,73 @@ +"""Test for latest node version being able to run reflex.""" + +from __future__ import annotations + +from typing import Any, Generator + +import httpx +import pytest +from playwright.sync_api import Page, expect + +from reflex.testing import AppHarness + + +def TestNodeVersionApp(): + """A test app for node latest version.""" + import reflex as rx + from reflex.utils.prerequisites import get_node_version + + class TestNodeVersionConfig(rx.Config): + pass + + class TestNodeVersionState(rx.State): + @rx.var + def node_version(self) -> str: + return str(get_node_version()) + + app = rx.App() + + @app.add_page + def index(): + return rx.heading("Node Version check v", TestNodeVersionState.node_version) + + +@pytest.fixture() +def node_version_app(tmp_path) -> Generator[AppHarness, Any, None]: + """Fixture to start TestNodeVersionApp app at tmp_path via AppHarness. + + Args: + tmp_path: pytest tmp_path fixture + + Yields: + running AppHarness instance + """ + with AppHarness.create( + root=tmp_path, + app_source=TestNodeVersionApp, # type: ignore + ) as harness: + yield harness + + +def test_node_version(node_version_app: AppHarness, page: Page): + """Test for latest node version being able to run reflex. + + Args: + node_version_app: running AppHarness instance + page: playwright page instance + """ + + def get_latest_node_version(): + response = httpx.get("https://nodejs.org/dist/index.json") + versions = response.json() + + # Assuming the first entry in the API response is the most recent version + if versions: + latest_version = versions[0]["version"] + return latest_version + return None + + assert node_version_app.frontend_url is not None + page.goto(node_version_app.frontend_url) + expect(page.get_by_role("heading")).to_have_text( + f"Node Version check {get_latest_node_version()}" + ) diff --git a/tests/units/__init__.py b/tests/units/__init__.py new file mode 100644 index 000000000..d0196603c --- /dev/null +++ b/tests/units/__init__.py @@ -0,0 +1,5 @@ +"""Root directory for tests.""" + +import os + +from reflex import constants diff --git a/tests/compiler/__init__.py b/tests/units/compiler/__init__.py similarity index 100% rename from tests/compiler/__init__.py rename to tests/units/compiler/__init__.py diff --git a/tests/compiler/test_compiler.py b/tests/units/compiler/test_compiler.py similarity index 98% rename from tests/compiler/test_compiler.py rename to tests/units/compiler/test_compiler.py index 63014cf33..afacf43c5 100644 --- a/tests/compiler/test_compiler.py +++ b/tests/units/compiler/test_compiler.py @@ -1,4 +1,4 @@ -import os +from pathlib import Path from typing import List import pytest @@ -130,7 +130,7 @@ def test_compile_stylesheets(tmp_path, mocker): ] assert compiler.compile_root_stylesheet(stylesheets) == ( - os.path.join(".web", "styles", "styles.css"), + str(Path(".web") / "styles" / "styles.css"), f"@import url('./tailwind.css'); \n" f"@import url('https://fonts.googleapis.com/css?family=Sofia&effect=neon|outline|emboss|shadow-multiple'); \n" f"@import url('https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css'); \n" @@ -164,7 +164,7 @@ def test_compile_stylesheets_exclude_tailwind(tmp_path, mocker): ] assert compiler.compile_root_stylesheet(stylesheets) == ( - os.path.join(".web", "styles", "styles.css"), + str(Path(".web") / "styles" / "styles.css"), "@import url('../public/styles.css'); \n", ) diff --git a/tests/compiler/test_compiler_utils.py b/tests/units/compiler/test_compiler_utils.py similarity index 100% rename from tests/compiler/test_compiler_utils.py rename to tests/units/compiler/test_compiler_utils.py diff --git a/tests/components/__init__.py b/tests/units/components/__init__.py similarity index 100% rename from tests/components/__init__.py rename to tests/units/components/__init__.py diff --git a/tests/components/base/test_bare.py b/tests/units/components/base/test_bare.py similarity index 87% rename from tests/components/base/test_bare.py rename to tests/units/components/base/test_bare.py index adc7ac1b0..c30ffaf15 100644 --- a/tests/components/base/test_bare.py +++ b/tests/units/components/base/test_bare.py @@ -1,9 +1,9 @@ import pytest from reflex.components.base.bare import Bare -from reflex.ivars.base import ImmutableVar +from reflex.vars.base import Var -STATE_VAR = ImmutableVar.create_safe("default_state.name") +STATE_VAR = Var(_js_expr="default_state.name") @pytest.mark.parametrize( diff --git a/tests/units/components/base/test_link.py b/tests/units/components/base/test_link.py new file mode 100644 index 000000000..7713330c4 --- /dev/null +++ b/tests/units/components/base/test_link.py @@ -0,0 +1,15 @@ +from reflex.components.base.link import RawLink, ScriptTag + + +def test_raw_link(): + raw_link = RawLink.create("https://example.com").render() + assert raw_link["name"] == "link" + assert raw_link["children"][0]["contents"] == '{"https://example.com"}' + + +def test_script_tag(): + script_tag = ScriptTag.create("console.log('Hello, world!');").render() + assert script_tag["name"] == "script" + assert ( + script_tag["children"][0]["contents"] == "{\"console.log('Hello, world!');\"}" + ) diff --git a/tests/components/base/test_script.py b/tests/units/components/base/test_script.py similarity index 87% rename from tests/components/base/test_script.py rename to tests/units/components/base/test_script.py index c6b67da11..b909b6c61 100644 --- a/tests/components/base/test_script.py +++ b/tests/units/components/base/test_script.py @@ -2,6 +2,7 @@ import pytest +import reflex as rx from reflex.components.base.script import Script from reflex.state import BaseState @@ -35,14 +36,17 @@ def test_script_neither(): class EvState(BaseState): """State for testing event handlers.""" + @rx.event def on_ready(self): """Empty event handler.""" pass + @rx.event def on_load(self): """Empty event handler.""" pass + @rx.event def on_error(self): """Empty event handler.""" pass @@ -58,14 +62,14 @@ def test_script_event_handler(): ) render_dict = component.render() assert ( - f'onReady={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_ready", ({{ }})))], args, ({{ }})))))}}' + f'onReady={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_ready", ({{ }}), ({{ }})))], args, ({{ }})))))}}' in render_dict["props"] ) assert ( - f'onLoad={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_load", ({{ }})))], args, ({{ }})))))}}' + f'onLoad={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_load", ({{ }}), ({{ }})))], args, ({{ }})))))}}' in render_dict["props"] ) assert ( - f'onError={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_error", ({{ }})))], args, ({{ }})))))}}' + f'onError={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_error", ({{ }}), ({{ }})))], args, ({{ }})))))}}' in render_dict["props"] ) diff --git a/tests/components/core/__init__.py b/tests/units/components/core/__init__.py similarity index 100% rename from tests/components/core/__init__.py rename to tests/units/components/core/__init__.py diff --git a/tests/components/core/test_banner.py b/tests/units/components/core/test_banner.py similarity index 73% rename from tests/components/core/test_banner.py rename to tests/units/components/core/test_banner.py index f46ee16b1..02b030902 100644 --- a/tests/components/core/test_banner.py +++ b/tests/units/components/core/test_banner.py @@ -19,12 +19,14 @@ def test_websocket_target_url(): def test_connection_banner(): banner = ConnectionBanner.create() _imports = banner._get_all_imports(collapse=True) - assert tuple(_imports) == ( - "react", - "/utils/context", - "/utils/state", - "@radix-ui/themes@^3.0.0", - "/env.json", + assert sorted(tuple(_imports)) == sorted( + ( + "react", + "/utils/context", + "/utils/state", + "@radix-ui/themes@^3.0.0", + "/env.json", + ) ) msg = "Connection error" @@ -35,12 +37,14 @@ def test_connection_banner(): def test_connection_modal(): modal = ConnectionModal.create() _imports = modal._get_all_imports(collapse=True) - assert tuple(_imports) == ( - "react", - "/utils/context", - "/utils/state", - "@radix-ui/themes@^3.0.0", - "/env.json", + assert sorted(tuple(_imports)) == sorted( + ( + "react", + "/utils/context", + "/utils/state", + "@radix-ui/themes@^3.0.0", + "/env.json", + ) ) msg = "Connection error" diff --git a/tests/components/core/test_colors.py b/tests/units/components/core/test_colors.py similarity index 79% rename from tests/components/core/test_colors.py rename to tests/units/components/core/test_colors.py index ace7adad6..74fbeb20f 100644 --- a/tests/components/core/test_colors.py +++ b/tests/units/components/core/test_colors.py @@ -1,9 +1,11 @@ +from typing import Type, Union + import pytest import reflex as rx from reflex.components.datadisplay.code import CodeBlock from reflex.constants.colors import Color -from reflex.ivars.base import LiteralVar +from reflex.vars.base import LiteralVar class ColorState(rx.State): @@ -12,6 +14,7 @@ class ColorState(rx.State): color: str = "mint" color_part: str = "tom" shade: int = 4 + alpha: bool = False color_state_name = ColorState.get_full_name().replace(".", "__") @@ -22,44 +25,52 @@ def create_color_var(color): @pytest.mark.parametrize( - "color, expected", + "color, expected, expected_type", [ - (create_color_var(rx.color("mint")), '"var(--mint-7)"'), - (create_color_var(rx.color("mint", 3)), '"var(--mint-3)"'), - (create_color_var(rx.color("mint", 3, True)), '"var(--mint-a3)"'), + (create_color_var(rx.color("mint")), '"var(--mint-7)"', Color), + (create_color_var(rx.color("mint", 3)), '"var(--mint-3)"', Color), + (create_color_var(rx.color("mint", 3, True)), '"var(--mint-a3)"', Color), ( create_color_var(rx.color(ColorState.color, ColorState.shade)), # type: ignore - f'("var(--"+{str(color_state_name)}.color+"-"+{str(color_state_name)}.shade+")")', + f'("var(--"+{str(color_state_name)}.color+"-"+(((__to_string) => __to_string.toString())({str(color_state_name)}.shade))+")")', + Color, + ), + ( + create_color_var( + rx.color(ColorState.color, ColorState.shade, ColorState.alpha) # type: ignore + ), + f'("var(--"+{str(color_state_name)}.color+"-"+({str(color_state_name)}.alpha ? "a" : "")+(((__to_string) => __to_string.toString())({str(color_state_name)}.shade))+")")', + Color, ), ( create_color_var(rx.color(f"{ColorState.color}", f"{ColorState.shade}")), # type: ignore f'("var(--"+{str(color_state_name)}.color+"-"+{str(color_state_name)}.shade+")")', + Color, ), ( create_color_var( rx.color(f"{ColorState.color_part}ato", f"{ColorState.shade}") # type: ignore ), - f'("var(--"+{str(color_state_name)}.color_part+"ato-"+{str(color_state_name)}.shade+")")', + f'("var(--"+({str(color_state_name)}.color_part+"ato")+"-"+{str(color_state_name)}.shade+")")', + Color, ), ( create_color_var(f'{rx.color(ColorState.color, f"{ColorState.shade}")}'), # type: ignore f'("var(--"+{str(color_state_name)}.color+"-"+{str(color_state_name)}.shade+")")', + str, ), ( create_color_var( f'{rx.color(f"{ColorState.color}", f"{ColorState.shade}")}' # type: ignore ), f'("var(--"+{str(color_state_name)}.color+"-"+{str(color_state_name)}.shade+")")', + str, ), ], ) -def test_color(color, expected): - assert color._var_is_string or color._var_type is str - assert color._var_full_name == expected - if color._var_type == Color: - assert str(color) == f"{{`{expected}`}}" - else: - assert str(color) == expected +def test_color(color, expected, expected_type: Union[Type[str], Type[Color]]): + assert color._var_type is expected_type + assert str(color) == expected @pytest.mark.parametrize( diff --git a/tests/components/core/test_cond.py b/tests/units/components/core/test_cond.py similarity index 89% rename from tests/components/core/test_cond.py rename to tests/units/components/core/test_cond.py index 53f8e0640..f9bdc7d60 100644 --- a/tests/components/core/test_cond.py +++ b/tests/units/components/core/test_cond.py @@ -6,10 +6,9 @@ import pytest from reflex.components.base.fragment import Fragment from reflex.components.core.cond import Cond, cond from reflex.components.radix.themes.typography.text import Text -from reflex.ivars.base import ImmutableVar, LiteralVar, immutable_computed_var -from reflex.state import BaseState, State +from reflex.state import BaseState from reflex.utils.format import format_state_name -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var, computed_var @pytest.fixture @@ -46,7 +45,7 @@ def test_validate_cond(cond_state: BaseState): Text.create("cond is True"), Text.create("cond is False"), ) - cond_dict = cond_component.render() if type(cond_component) == Fragment else {} + cond_dict = cond_component.render() if type(cond_component) is Fragment else {} assert cond_dict["name"] == "Fragment" [condition] = cond_dict["children"] @@ -76,7 +75,7 @@ def test_validate_cond(cond_state: BaseState): (32, 0), ("hello", ""), (2.3, 0.0), - (Var.create("a"), Var.create("b")), + (LiteralVar.create("a"), LiteralVar.create("b")), ], ) def test_prop_cond(c1: Any, c2: Any): @@ -97,13 +96,13 @@ def test_prop_cond(c1: Any, c2: Any): c1 = json.dumps(c1) if not isinstance(c2, Var): c2 = json.dumps(c2) - assert str(prop_cond) == f"(true ? {c1} : {c2})" + assert str(prop_cond) == f"(true ? {str(c1)} : {str(c2)})" def test_cond_no_mix(): """Test if cond can't mix components and props.""" with pytest.raises(ValueError): - cond(True, Var.create("hello"), Text.create("world")) + cond(True, LiteralVar.create("hello"), Text.create("world")) def test_cond_no_else(): @@ -125,19 +124,19 @@ def test_cond_no_else(): def test_cond_computed_var(): """Test if cond works with computed vars.""" - class CondStateComputed(State): - @immutable_computed_var + class CondStateComputed(BaseState): + @computed_var def computed_int(self) -> int: return 0 - @immutable_computed_var + @computed_var def computed_str(self) -> str: return "a string" comp = cond(True, CondStateComputed.computed_int, CondStateComputed.computed_str) # TODO: shouln't this be a ComputedVar? - assert isinstance(comp, ImmutableVar) + assert isinstance(comp, Var) state_name = format_state_name(CondStateComputed.get_full_name()) assert ( diff --git a/tests/components/core/test_debounce.py b/tests/units/components/core/test_debounce.py similarity index 88% rename from tests/components/core/test_debounce.py rename to tests/units/components/core/test_debounce.py index 95feb7ae6..7856ee090 100644 --- a/tests/components/core/test_debounce.py +++ b/tests/units/components/core/test_debounce.py @@ -4,8 +4,8 @@ import pytest import reflex as rx from reflex.components.core.debounce import DEFAULT_DEBOUNCE_TIMEOUT -from reflex.ivars.base import LiteralVar from reflex.state import BaseState +from reflex.vars.base import LiteralVar, Var def test_create_no_child(): @@ -37,6 +37,7 @@ class S(BaseState): value: str = "" + @rx.event def on_change(self, v: str): """Dummy on_change handler. @@ -57,7 +58,7 @@ def test_render_child_props(): on_change=S.on_change, ) )._render() - assert "css" in tag.props and isinstance(tag.props["css"], rx.Var) + assert "css" in tag.props and isinstance(tag.props["css"], rx.vars.Var) for prop in ["foo", "bar", "baz", "quuc"]: assert prop in str(tag.props["css"]) assert tag.props["value"].equals(LiteralVar.create("real")) @@ -73,7 +74,7 @@ def test_render_with_class_name(): class_name="foo baz", ) )._render() - assert isinstance(tag.props["className"], rx.Var) + assert isinstance(tag.props["className"], rx.vars.Var) assert "foo baz" in str(tag.props["className"]) @@ -84,7 +85,7 @@ def test_render_with_ref(): id="foo_bar", ) )._render() - assert isinstance(tag.props["inputRef"], rx.Var) + assert isinstance(tag.props["inputRef"], rx.vars.Var) assert "foo_bar" in str(tag.props["inputRef"]) @@ -95,12 +96,12 @@ def test_render_with_key(): key="foo_bar", ) )._render() - assert isinstance(tag.props["key"], rx.Var) + assert isinstance(tag.props["key"], rx.vars.Var) assert "foo_bar" in str(tag.props["key"]) def test_render_with_special_props(): - special_prop = rx.Var.create_safe("{foo_bar}", _var_is_string=False) + special_prop = Var(_js_expr="{foo_bar}") tag = rx.debounce_input( rx.input( on_change=S.on_change, @@ -149,13 +150,13 @@ def test_render_child_props_recursive(): ), force_notify_by_enter=False, )._render() - assert "css" in tag.props and isinstance(tag.props["css"], rx.Var) + assert "css" in tag.props and isinstance(tag.props["css"], rx.vars.Var) for prop in ["foo", "bar", "baz", "quuc"]: assert prop in str(tag.props["css"]) assert tag.props["value"].equals(LiteralVar.create("outer")) - assert tag.props["forceNotifyOnBlur"]._var_name == "false" - assert tag.props["forceNotifyByEnter"]._var_name == "false" - assert tag.props["debounceTimeout"]._var_name == "42" + assert tag.props["forceNotifyOnBlur"]._js_expr == "false" + assert tag.props["forceNotifyByEnter"]._js_expr == "false" + assert tag.props["debounceTimeout"]._js_expr == "42" assert len(tag.props["onChange"].events) == 1 assert tag.props["onChange"].events[0].handler == S.on_change assert tag.contents == "" @@ -167,7 +168,7 @@ def test_full_control_implicit_debounce(): value=S.value, on_change=S.on_change, )._render() - assert tag.props["debounceTimeout"]._var_name == str(DEFAULT_DEBOUNCE_TIMEOUT) + assert tag.props["debounceTimeout"]._js_expr == str(DEFAULT_DEBOUNCE_TIMEOUT) assert len(tag.props["onChange"].events) == 1 assert tag.props["onChange"].events[0].handler == S.on_change assert tag.contents == "" @@ -179,7 +180,7 @@ def test_full_control_implicit_debounce_text_area(): value=S.value, on_change=S.on_change, )._render() - assert tag.props["debounceTimeout"]._var_name == str(DEFAULT_DEBOUNCE_TIMEOUT) + assert tag.props["debounceTimeout"]._js_expr == str(DEFAULT_DEBOUNCE_TIMEOUT) assert len(tag.props["onChange"].events) == 1 assert tag.props["onChange"].events[0].handler == S.on_change assert tag.contents == "" diff --git a/tests/components/core/test_foreach.py b/tests/units/components/core/test_foreach.py similarity index 93% rename from tests/components/core/test_foreach.py rename to tests/units/components/core/test_foreach.py index f1fae2577..228165d3e 100644 --- a/tests/components/core/test_foreach.py +++ b/tests/units/components/core/test_foreach.py @@ -13,7 +13,9 @@ from reflex.components.core.foreach import ( from reflex.components.radix.themes.layout.box import box from reflex.components.radix.themes.typography.text import text from reflex.state import BaseState, ComponentState -from reflex.vars import Var +from reflex.vars.base import Var +from reflex.vars.number import NumberVar +from reflex.vars.sequence import ArrayVar class ForEachState(BaseState): @@ -45,7 +47,7 @@ class ForEachState(BaseState): color_index_tuple: Tuple[int, str] = (0, "red") -class TestComponentState(ComponentState): +class ComponentStateTest(ComponentState): """A test component state.""" foo: bool @@ -65,7 +67,7 @@ class TestComponentState(ComponentState): def display_color(color): - assert color._var_type == str + assert color._var_type is str return box(text(color)) @@ -104,18 +106,18 @@ def display_nested_color_with_shades_v2(color): def display_color_tuple(color): - assert color._var_type == str + assert color._var_type is str return box(text(color)) def display_colors_set(color): - assert color._var_type == str + assert color._var_type is str return box(text(color)) -def display_nested_list_element(element: Var[str], index: Var[int]): +def display_nested_list_element(element: ArrayVar[List[str]], index: NumberVar[int]): assert element._var_type == List[str] - assert index._var_type == int + assert index._var_type is int return box(text(element[index])) @@ -237,9 +239,9 @@ def test_foreach_render(state_var, render_fn, render_dict): # Make sure the index vars are unique. arg_index = rend["arg_index"] assert isinstance(arg_index, Var) - assert arg_index._var_name not in seen_index_vars - assert arg_index._var_type == int - seen_index_vars.add(arg_index._var_name) + assert arg_index._js_expr not in seen_index_vars + assert arg_index._var_type is int + seen_index_vars.add(arg_index._js_expr) def test_foreach_bad_annotations(): @@ -286,5 +288,5 @@ def test_foreach_component_state(): with pytest.raises(TypeError): Foreach.create( ForEachState.colors_list, - TestComponentState.create, + ComponentStateTest.create, ) diff --git a/tests/components/core/test_html.py b/tests/units/components/core/test_html.py similarity index 100% rename from tests/components/core/test_html.py rename to tests/units/components/core/test_html.py diff --git a/tests/components/core/test_match.py b/tests/units/components/core/test_match.py similarity index 92% rename from tests/components/core/test_match.py rename to tests/units/components/core/test_match.py index 1843b914d..f09e800e5 100644 --- a/tests/components/core/test_match.py +++ b/tests/units/components/core/test_match.py @@ -6,7 +6,7 @@ import reflex as rx from reflex.components.core.match import Match from reflex.state import BaseState from reflex.utils.exceptions import MatchTypeError -from reflex.vars import Var +from reflex.vars.base import Var class MatchState(BaseState): @@ -40,40 +40,40 @@ def test_match_components(): match_cases = match_child["match_cases"] assert len(match_cases) == 6 - assert match_cases[0][0]._var_name == "1" - assert match_cases[0][0]._var_type == int + assert match_cases[0][0]._js_expr == "1" + assert match_cases[0][0]._var_type is int first_return_value_render = match_cases[0][1].render() assert first_return_value_render["name"] == "RadixThemesText" assert first_return_value_render["children"][0]["contents"] == '{"first value"}' - assert match_cases[1][0]._var_name == "2" - assert match_cases[1][0]._var_type == int - assert match_cases[1][1]._var_name == "3" - assert match_cases[1][1]._var_type == int + assert match_cases[1][0]._js_expr == "2" + assert match_cases[1][0]._var_type is int + assert match_cases[1][1]._js_expr == "3" + assert match_cases[1][1]._var_type is int second_return_value_render = match_cases[1][2].render() assert second_return_value_render["name"] == "RadixThemesText" assert second_return_value_render["children"][0]["contents"] == '{"second value"}' - assert match_cases[2][0]._var_name == "[1, 2]" + assert match_cases[2][0]._js_expr == "[1, 2]" assert match_cases[2][0]._var_type == List[int] third_return_value_render = match_cases[2][1].render() assert third_return_value_render["name"] == "RadixThemesText" assert third_return_value_render["children"][0]["contents"] == '{"third value"}' - assert match_cases[3][0]._var_name == '"random"' - assert match_cases[3][0]._var_type == str + assert match_cases[3][0]._js_expr == '"random"' + assert match_cases[3][0]._var_type is str fourth_return_value_render = match_cases[3][1].render() assert fourth_return_value_render["name"] == "RadixThemesText" assert fourth_return_value_render["children"][0]["contents"] == '{"fourth value"}' - assert match_cases[4][0]._var_name == '({ ["foo"] : "bar" })' + assert match_cases[4][0]._js_expr == '({ ["foo"] : "bar" })' assert match_cases[4][0]._var_type == Dict[str, str] fifth_return_value_render = match_cases[4][1].render() assert fifth_return_value_render["name"] == "RadixThemesText" assert fifth_return_value_render["children"][0]["contents"] == '{"fifth value"}' - assert match_cases[5][0]._var_name == f"({MatchState.get_name()}.num + 1)" - assert match_cases[5][0]._var_type == int + assert match_cases[5][0]._js_expr == f"({MatchState.get_name()}.num + 1)" + assert match_cases[5][0]._var_type is int fifth_return_value_render = match_cases[5][1].render() assert fifth_return_value_render["name"] == "RadixThemesText" assert fifth_return_value_render["children"][0]["contents"] == '{"sixth value"}' @@ -136,7 +136,7 @@ def test_match_vars(cases, expected): """ match_comp = Match.create(MatchState.value, *cases) assert isinstance(match_comp, Var) - assert match_comp._var_full_name == expected + assert str(match_comp) == expected def test_match_on_component_without_default(): @@ -248,7 +248,7 @@ def test_match_case_tuple_elements(match_case): rx.text("default value"), ), 'Match cases should have the same return types. Case 3 with return value `"red"` of type ' - " is not ", + " is not ", ), ( ( @@ -261,7 +261,7 @@ def test_match_case_tuple_elements(match_case): rx.text("default value"), ), 'Match cases should have the same return types. Case 3 with return value ` {"first value"} ` ' - "of type is not ", + "of type is not ", ), ], ) diff --git a/tests/components/core/test_responsive.py b/tests/units/components/core/test_responsive.py similarity index 100% rename from tests/components/core/test_responsive.py rename to tests/units/components/core/test_responsive.py diff --git a/tests/components/core/test_upload.py b/tests/units/components/core/test_upload.py similarity index 79% rename from tests/components/core/test_upload.py rename to tests/units/components/core/test_upload.py index e6b27effc..710baa161 100644 --- a/tests/components/core/test_upload.py +++ b/tests/units/components/core/test_upload.py @@ -1,3 +1,6 @@ +from typing import Any + +from reflex import event from reflex.components.core.upload import ( StyledUpload, Upload, @@ -8,13 +11,14 @@ from reflex.components.core.upload import ( ) from reflex.event import EventSpec from reflex.state import State -from reflex.vars import Var +from reflex.vars.base import LiteralVar, Var -class TestUploadState(State): +class UploadStateTest(State): """Test upload state.""" - def drop_handler(self, files): + @event + def drop_handler(self, files: Any): """Handle the drop event. Args: @@ -22,7 +26,8 @@ class TestUploadState(State): """ pass - def not_drop_handler(self, not_files): + @event + def not_drop_handler(self, not_files: Any): """Handle the drop event without defining the files argument. Args: @@ -42,7 +47,7 @@ def test_get_upload_url(): def test__on_drop_spec(): - assert isinstance(_on_drop_spec(Var.create([])), list) + assert isinstance(_on_drop_spec(LiteralVar.create([])), tuple) def test_upload_create(): @@ -55,7 +60,7 @@ def test_upload_create(): up_comp_2 = Upload.create( id="foo_id", - on_drop=TestUploadState.drop_handler([]), # type: ignore + on_drop=UploadStateTest.drop_handler([]), # type: ignore ) assert isinstance(up_comp_2, Upload) assert up_comp_2.is_used @@ -65,7 +70,7 @@ def test_upload_create(): up_comp_3 = Upload.create( id="foo_id", - on_drop=TestUploadState.drop_handler, + on_drop=UploadStateTest.drop_handler, ) assert isinstance(up_comp_3, Upload) assert up_comp_3.is_used @@ -75,7 +80,7 @@ def test_upload_create(): up_comp_4 = Upload.create( id="foo_id", - on_drop=TestUploadState.not_drop_handler([]), # type: ignore + on_drop=UploadStateTest.not_drop_handler([]), # type: ignore ) assert isinstance(up_comp_4, Upload) assert up_comp_4.is_used @@ -91,7 +96,7 @@ def test_styled_upload_create(): styled_up_comp_2 = StyledUpload.create( id="foo_id", - on_drop=TestUploadState.drop_handler([]), # type: ignore + on_drop=UploadStateTest.drop_handler([]), # type: ignore ) assert isinstance(styled_up_comp_2, StyledUpload) assert styled_up_comp_2.is_used @@ -101,7 +106,7 @@ def test_styled_upload_create(): styled_up_comp_3 = StyledUpload.create( id="foo_id", - on_drop=TestUploadState.drop_handler, + on_drop=UploadStateTest.drop_handler, ) assert isinstance(styled_up_comp_3, StyledUpload) assert styled_up_comp_3.is_used @@ -111,7 +116,7 @@ def test_styled_upload_create(): styled_up_comp_4 = StyledUpload.create( id="foo_id", - on_drop=TestUploadState.not_drop_handler([]), # type: ignore + on_drop=UploadStateTest.not_drop_handler([]), # type: ignore ) assert isinstance(styled_up_comp_4, StyledUpload) assert styled_up_comp_4.is_used diff --git a/tests/components/datadisplay/__init__.py b/tests/units/components/datadisplay/__init__.py similarity index 100% rename from tests/components/datadisplay/__init__.py rename to tests/units/components/datadisplay/__init__.py diff --git a/tests/components/datadisplay/conftest.py b/tests/units/components/datadisplay/conftest.py similarity index 100% rename from tests/components/datadisplay/conftest.py rename to tests/units/components/datadisplay/conftest.py diff --git a/tests/components/datadisplay/test_code.py b/tests/units/components/datadisplay/test_code.py similarity index 75% rename from tests/components/datadisplay/test_code.py rename to tests/units/components/datadisplay/test_code.py index 49fbae09f..809c68fe5 100644 --- a/tests/components/datadisplay/test_code.py +++ b/tests/units/components/datadisplay/test_code.py @@ -1,15 +1,16 @@ import pytest -from reflex.components.datadisplay.code import CodeBlock +from reflex.components.datadisplay.code import CodeBlock, Theme @pytest.mark.parametrize( - "theme, expected", [("light", '"one-light"'), ("dark", '"one-dark"')] + "theme, expected", + [(Theme.one_light, "oneLight"), (Theme.one_dark, "oneDark")], ) def test_code_light_dark_theme(theme, expected): code_block = CodeBlock.create(theme=theme) - assert code_block.theme._var_name == expected # type: ignore + assert code_block.theme._js_expr == expected # type: ignore def generate_custom_code(language, expected_case): diff --git a/tests/units/components/datadisplay/test_dataeditor.py b/tests/units/components/datadisplay/test_dataeditor.py new file mode 100644 index 000000000..63b156e74 --- /dev/null +++ b/tests/units/components/datadisplay/test_dataeditor.py @@ -0,0 +1,11 @@ +from reflex.components.datadisplay.dataeditor import DataEditor + + +def test_dataeditor(): + editor_wrapper = DataEditor.create().render() + editor = editor_wrapper["children"][0] + assert editor_wrapper["name"] == "div" + assert editor_wrapper["props"] == [ + 'css={({ ["width"] : "100%", ["height"] : "100%" })}' + ] + assert editor["name"] == "DataEditor" diff --git a/tests/components/datadisplay/test_datatable.py b/tests/units/components/datadisplay/test_datatable.py similarity index 100% rename from tests/components/datadisplay/test_datatable.py rename to tests/units/components/datadisplay/test_datatable.py diff --git a/tests/units/components/datadisplay/test_shiki_code.py b/tests/units/components/datadisplay/test_shiki_code.py new file mode 100644 index 000000000..eb473ba06 --- /dev/null +++ b/tests/units/components/datadisplay/test_shiki_code.py @@ -0,0 +1,172 @@ +import pytest + +from reflex.components.datadisplay.shiki_code_block import ( + ShikiBaseTransformers, + ShikiCodeBlock, + ShikiHighLevelCodeBlock, + ShikiJsTransformer, +) +from reflex.components.el.elements.forms import Button +from reflex.components.lucide.icon import Icon +from reflex.components.radix.themes.layout.box import Box +from reflex.style import Style +from reflex.vars import Var + + +@pytest.mark.parametrize( + "library, fns, expected_output, raises_exception", + [ + ("some_library", ["function_one"], ["function_one"], False), + ("some_library", [123], None, True), + ("some_library", [], [], False), + ( + "some_library", + ["function_one", "function_two"], + ["function_one", "function_two"], + False, + ), + ("", ["function_one"], ["function_one"], False), + ("some_library", ["function_one", 789], None, True), + ("", [], [], False), + ], +) +def test_create_transformer(library, fns, expected_output, raises_exception): + if raises_exception: + # Ensure ValueError is raised for invalid cases + with pytest.raises(ValueError): + ShikiCodeBlock.create_transformer(library, fns) + else: + transformer = ShikiCodeBlock.create_transformer(library, fns) + assert isinstance(transformer, ShikiBaseTransformers) + assert transformer.library == library + + # Verify that the functions are correctly wrapped in FunctionStringVar + function_names = [str(fn) for fn in transformer.fns] + assert function_names == expected_output + + +@pytest.mark.parametrize( + "code_block, children, props, expected_first_child, expected_styles", + [ + ("print('Hello')", ["print('Hello')"], {}, "print('Hello')", {}), + ( + "print('Hello')", + ["print('Hello')", "More content"], + {}, + "print('Hello')", + {}, + ), + ( + "print('Hello')", + ["print('Hello')"], + { + "transformers": [ + ShikiBaseTransformers( + library="lib", fns=[], style=Style({"color": "red"}) + ) + ] + }, + "print('Hello')", + {"color": "red"}, + ), + ( + "print('Hello')", + ["print('Hello')"], + { + "transformers": [ + ShikiBaseTransformers( + library="lib", fns=[], style=Style({"color": "red"}) + ) + ], + "style": {"background": "blue"}, + }, + "print('Hello')", + {"color": "red", "background": "blue"}, + ), + ], +) +def test_create_shiki_code_block( + code_block, children, props, expected_first_child, expected_styles +): + component = ShikiCodeBlock.create(code_block, *children, **props) + + # Test that the created component is a Box + assert isinstance(component, Box) + + # Test that the first child is the code + code_block_component = component.children[0] + assert code_block_component.code._var_value == expected_first_child # type: ignore + + applied_styles = component.style + for key, value in expected_styles.items(): + assert Var.create(applied_styles[key])._var_value == value + + +@pytest.mark.parametrize( + "children, props, expected_transformers, expected_button_type", + [ + (["print('Hello')"], {"use_transformers": True}, [ShikiJsTransformer], None), + (["print('Hello')"], {"can_copy": True}, None, Button), + ( + ["print('Hello')"], + { + "can_copy": True, + "copy_button": Button.create(Icon.create(tag="a_arrow_down")), + }, + None, + Button, + ), + ], +) +def test_create_shiki_high_level_code_block( + children, props, expected_transformers, expected_button_type +): + component = ShikiHighLevelCodeBlock.create(*children, **props) + + # Test that the created component is a Box + assert isinstance(component, Box) + + # Test that the first child is the code block component + code_block_component = component.children[0] + assert code_block_component.code._var_value == children[0] # type: ignore + + # Check if the transformer is set correctly if expected + if expected_transformers: + exp_trans_names = [t.__name__ for t in expected_transformers] + for transformer in code_block_component.transformers._var_value: # type: ignore + assert type(transformer).__name__ in exp_trans_names + + # Check if the second child is the copy button if can_copy is True + if props.get("can_copy", False): + if props.get("copy_button"): + assert isinstance(component.children[1], expected_button_type) + assert component.children[1] == props["copy_button"] + else: + assert isinstance(component.children[1], expected_button_type) + else: + assert len(component.children) == 1 + + +@pytest.mark.parametrize( + "children, props", + [ + (["print('Hello')"], {"theme": "dark"}), + (["print('Hello')"], {"language": "javascript"}), + ], +) +def test_shiki_high_level_code_block_theme_language_mapping(children, props): + component = ShikiHighLevelCodeBlock.create(*children, **props) + + # Test that the theme is mapped correctly + if "theme" in props: + assert component.children[ + 0 + ].theme._var_value == ShikiHighLevelCodeBlock._map_themes(props["theme"]) # type: ignore + + # Test that the language is mapped correctly + if "language" in props: + assert component.children[ + 0 + ].language._var_value == ShikiHighLevelCodeBlock._map_languages( # type: ignore + props["language"] + ) diff --git a/tests/components/el/test_html.py b/tests/units/components/el/test_html.py similarity index 100% rename from tests/components/el/test_html.py rename to tests/units/components/el/test_html.py diff --git a/tests/units/components/el/test_svg.py b/tests/units/components/el/test_svg.py new file mode 100644 index 000000000..29aaa96dd --- /dev/null +++ b/tests/units/components/el/test_svg.py @@ -0,0 +1,74 @@ +from reflex.components.el.elements.media import ( + Circle, + Defs, + Ellipse, + Line, + LinearGradient, + Path, + Polygon, + RadialGradient, + Rect, + Stop, + Svg, + Text, +) + + +def test_circle(): + circle = Circle.create().render() + assert circle["name"] == "circle" + + +def test_defs(): + defs = Defs.create().render() + assert defs["name"] == "defs" + + +def test_ellipse(): + ellipse = Ellipse.create().render() + assert ellipse["name"] == "ellipse" + + +def test_line(): + line = Line.create().render() + assert line["name"] == "line" + + +def test_linear_gradient(): + linear_gradient = LinearGradient.create().render() + assert linear_gradient["name"] == "linearGradient" + + +def test_path(): + path = Path.create().render() + assert path["name"] == "path" + + +def test_polygon(): + polygon = Polygon.create().render() + assert polygon["name"] == "polygon" + + +def test_radial_gradient(): + radial_gradient = RadialGradient.create().render() + assert radial_gradient["name"] == "radialGradient" + + +def test_rect(): + rect = Rect.create().render() + assert rect["name"] == "rect" + + +def test_svg(): + svg = Svg.create().render() + assert svg["name"] == "svg" + + +def test_text(): + text = Text.create().render() + assert text["name"] == "text" + + +def test_stop(): + stop = Stop.create().render() + assert stop["name"] == "stop" diff --git a/tests/components/forms/__init__.py b/tests/units/components/forms/__init__.py similarity index 100% rename from tests/components/forms/__init__.py rename to tests/units/components/forms/__init__.py diff --git a/tests/components/forms/test_form.py b/tests/units/components/forms/test_form.py similarity index 54% rename from tests/components/forms/test_form.py rename to tests/units/components/forms/test_form.py index b979d261a..5f3ba2d37 100644 --- a/tests/components/forms/test_form.py +++ b/tests/units/components/forms/test_form.py @@ -1,13 +1,12 @@ -from reflex_chakra.components.forms.form import Form - -from reflex.event import EventChain -from reflex.vars import BaseVar +from reflex.components.radix.primitives.form import Form +from reflex.event import EventChain, prevent_default +from reflex.vars.base import Var def test_render_on_submit(): """Test that on_submit event chain is rendered as a separate function.""" - submit_it = BaseVar( - _var_name="submit_it", + submit_it = Var( + _js_expr="submit_it", _var_type=EventChain, ) f = Form.create(on_submit=submit_it) @@ -16,7 +15,6 @@ def test_render_on_submit(): def test_render_no_on_submit(): - """A form without on_submit should not render a submit handler.""" + """A form without on_submit should render a prevent_default handler.""" f = Form.create() - for prop in f.render()["props"]: - assert "onSubmit" not in prop + assert f.event_triggers["on_submit"] == prevent_default diff --git a/tests/components/forms/test_uploads.py b/tests/units/components/forms/test_uploads.py similarity index 100% rename from tests/components/forms/test_uploads.py rename to tests/units/components/forms/test_uploads.py diff --git a/tests/components/graphing/__init__.py b/tests/units/components/graphing/__init__.py similarity index 100% rename from tests/components/graphing/__init__.py rename to tests/units/components/graphing/__init__.py diff --git a/tests/components/graphing/test_plotly.py b/tests/units/components/graphing/test_plotly.py similarity index 100% rename from tests/components/graphing/test_plotly.py rename to tests/units/components/graphing/test_plotly.py diff --git a/tests/components/graphing/test_recharts.py b/tests/units/components/graphing/test_recharts.py similarity index 100% rename from tests/components/graphing/test_recharts.py rename to tests/units/components/graphing/test_recharts.py diff --git a/tests/components/layout/__init__.py b/tests/units/components/layout/__init__.py similarity index 100% rename from tests/components/layout/__init__.py rename to tests/units/components/layout/__init__.py diff --git a/tests/components/lucide/test_icon.py b/tests/units/components/lucide/test_icon.py similarity index 100% rename from tests/components/lucide/test_icon.py rename to tests/units/components/lucide/test_icon.py diff --git a/tests/components/media/__init__.py b/tests/units/components/media/__init__.py similarity index 100% rename from tests/components/media/__init__.py rename to tests/units/components/media/__init__.py diff --git a/tests/components/media/test_image.py b/tests/units/components/media/test_image.py similarity index 90% rename from tests/components/media/test_image.py rename to tests/units/components/media/test_image.py index ba8353260..f8618347c 100644 --- a/tests/components/media/test_image.py +++ b/tests/units/components/media/test_image.py @@ -1,4 +1,3 @@ -# PIL is only available in python 3.8+ import numpy as np import PIL import pytest @@ -6,8 +5,8 @@ from PIL.Image import Image as Img import reflex as rx from reflex.components.next.image import Image # type: ignore -from reflex.ivars.sequence import StringVar from reflex.utils.serializers import serialize, serialize_image +from reflex.vars.sequence import StringVar @pytest.fixture @@ -53,7 +52,7 @@ def test_set_src_img(pil_image: Img): pil_image: The image to serialize. """ image = Image.create(src=pil_image) - assert str(image.src._var_name) == '"' + serialize_image(pil_image) + '"' # type: ignore + assert str(image.src._js_expr) == '"' + serialize_image(pil_image) + '"' # type: ignore def test_render(pil_image: Img): diff --git a/tests/components/radix/test_icon_button.py b/tests/units/components/radix/test_icon_button.py similarity index 86% rename from tests/components/radix/test_icon_button.py rename to tests/units/components/radix/test_icon_button.py index 852c0c97c..8047cf7b2 100644 --- a/tests/components/radix/test_icon_button.py +++ b/tests/units/components/radix/test_icon_button.py @@ -3,7 +3,7 @@ import pytest from reflex.components.lucide.icon import Icon from reflex.components.radix.themes.components.icon_button import IconButton from reflex.style import Style -from reflex.vars import Var +from reflex.vars.base import LiteralVar def test_icon_button(): @@ -26,5 +26,5 @@ def test_icon_button_size_prop(): ib1 = IconButton.create("activity", size="2") assert isinstance(ib1, IconButton) - ib2 = IconButton.create("activity", size=Var.create("2")) + ib2 = IconButton.create("activity", size=LiteralVar.create("2")) assert isinstance(ib2, IconButton) diff --git a/tests/components/radix/test_layout.py b/tests/units/components/radix/test_layout.py similarity index 100% rename from tests/components/radix/test_layout.py rename to tests/units/components/radix/test_layout.py diff --git a/tests/units/components/recharts/test_cartesian.py b/tests/units/components/recharts/test_cartesian.py new file mode 100644 index 000000000..3337427bd --- /dev/null +++ b/tests/units/components/recharts/test_cartesian.py @@ -0,0 +1,50 @@ +from reflex.components.recharts import ( + Area, + Bar, + Brush, + Line, + Scatter, + XAxis, + YAxis, + ZAxis, +) + + +def test_xaxis(): + x_axis = XAxis.create("x").render() + assert x_axis["name"] == "RechartsXAxis" + + +def test_yaxis(): + x_axis = YAxis.create("y").render() + assert x_axis["name"] == "RechartsYAxis" + + +def test_zaxis(): + x_axis = ZAxis.create("z").render() + assert x_axis["name"] == "RechartsZAxis" + + +def test_brush(): + brush = Brush.create().render() + assert brush["name"] == "RechartsBrush" + + +def test_area(): + area = Area.create().render() + assert area["name"] == "RechartsArea" + + +def test_bar(): + bar = Bar.create().render() + assert bar["name"] == "RechartsBar" + + +def test_line(): + line = Line.create().render() + assert line["name"] == "RechartsLine" + + +def test_scatter(): + scatter = Scatter.create().render() + assert scatter["name"] == "RechartsScatter" diff --git a/tests/units/components/recharts/test_polar.py b/tests/units/components/recharts/test_polar.py new file mode 100644 index 000000000..4e4af0f49 --- /dev/null +++ b/tests/units/components/recharts/test_polar.py @@ -0,0 +1,38 @@ +from reflex.components.recharts import ( + Pie, + PolarAngleAxis, + PolarGrid, + PolarRadiusAxis, + Radar, + RadialBar, +) + + +def test_pie(): + pie = Pie.create().render() + assert pie["name"] == "RechartsPie" + + +def test_radar(): + radar = Radar.create().render() + assert radar["name"] == "RechartsRadar" + + +def test_radialbar(): + radialbar = RadialBar.create().render() + assert radialbar["name"] == "RechartsRadialBar" + + +def test_polarangleaxis(): + polarangleaxis = PolarAngleAxis.create().render() + assert polarangleaxis["name"] == "RechartsPolarAngleAxis" + + +def test_polargrid(): + polargrid = PolarGrid.create().render() + assert polargrid["name"] == "RechartsPolarGrid" + + +def test_polarradiusaxis(): + polarradiusaxis = PolarRadiusAxis.create().render() + assert polarradiusaxis["name"] == "RechartsPolarRadiusAxis" diff --git a/tests/components/test_component.py b/tests/units/components/test_component.py similarity index 91% rename from tests/components/test_component.py rename to tests/units/components/test_component.py index 3c824ed01..b7b721a92 100644 --- a/tests/components/test_component.py +++ b/tests/units/components/test_component.py @@ -2,8 +2,6 @@ from contextlib import nullcontext from typing import Any, Dict, List, Optional, Type, Union import pytest -import reflex_chakra as rc -from reflex_chakra.components.layout.box import Box import reflex as rx from reflex.base import Base @@ -16,15 +14,22 @@ from reflex.components.component import ( StatefulComponent, custom_component, ) +from reflex.components.radix.themes.layout.box import Box from reflex.constants import EventTriggers -from reflex.event import EventChain, EventHandler, parse_args_spec -from reflex.ivars.base import LiteralVar +from reflex.event import ( + EventChain, + EventHandler, + empty_event, + input_event, + parse_args_spec, +) from reflex.state import BaseState from reflex.style import Style from reflex.utils import imports from reflex.utils.exceptions import EventFnArgMismatch, EventHandlerArgMismatch from reflex.utils.imports import ImportDict, ImportVar, ParsedImportDict, parse_imports -from reflex.vars import BaseVar, Var, VarData +from reflex.vars import VarData +from reflex.vars.base import LiteralVar, Var @pytest.fixture @@ -270,121 +275,121 @@ def test_create_component(component1): [ pytest.param( "text", - Var.create("hello"), + LiteralVar.create("hello"), None, id="text", ), pytest.param( "text", - BaseVar(_var_name="hello", _var_type=Optional[str]), + Var(_js_expr="hello", _var_type=Optional[str]), None, id="text-optional", ), pytest.param( "text", - BaseVar(_var_name="hello", _var_type=Union[str, None]), + Var(_js_expr="hello", _var_type=Union[str, None]), None, id="text-union-str-none", ), pytest.param( "text", - BaseVar(_var_name="hello", _var_type=Union[None, str]), + Var(_js_expr="hello", _var_type=Union[None, str]), None, id="text-union-none-str", ), pytest.param( "text", - Var.create(1), + LiteralVar.create(1), TypeError, id="text-int", ), pytest.param( "number", - Var.create(1), + LiteralVar.create(1), None, id="number", ), pytest.param( "number", - BaseVar(_var_name="1", _var_type=Optional[int]), + Var(_js_expr="1", _var_type=Optional[int]), None, id="number-optional", ), pytest.param( "number", - BaseVar(_var_name="1", _var_type=Union[int, None]), + Var(_js_expr="1", _var_type=Union[int, None]), None, id="number-union-int-none", ), pytest.param( "number", - BaseVar(_var_name="1", _var_type=Union[None, int]), + Var(_js_expr="1", _var_type=Union[None, int]), None, id="number-union-none-int", ), pytest.param( "number", - Var.create("1"), + LiteralVar.create("1"), TypeError, id="number-str", ), pytest.param( "text_or_number", - Var.create("hello"), + LiteralVar.create("hello"), None, id="text_or_number-str", ), pytest.param( "text_or_number", - Var.create(1), + LiteralVar.create(1), None, id="text_or_number-int", ), pytest.param( "text_or_number", - BaseVar(_var_name="hello", _var_type=Optional[str]), + Var(_js_expr="hello", _var_type=Optional[str]), None, id="text_or_number-optional-str", ), pytest.param( "text_or_number", - BaseVar(_var_name="hello", _var_type=Union[str, None]), + Var(_js_expr="hello", _var_type=Union[str, None]), None, id="text_or_number-union-str-none", ), pytest.param( "text_or_number", - BaseVar(_var_name="hello", _var_type=Union[None, str]), + Var(_js_expr="hello", _var_type=Union[None, str]), None, id="text_or_number-union-none-str", ), pytest.param( "text_or_number", - BaseVar(_var_name="1", _var_type=Optional[int]), + Var(_js_expr="1", _var_type=Optional[int]), None, id="text_or_number-optional-int", ), pytest.param( "text_or_number", - BaseVar(_var_name="1", _var_type=Union[int, None]), + Var(_js_expr="1", _var_type=Union[int, None]), None, id="text_or_number-union-int-none", ), pytest.param( "text_or_number", - BaseVar(_var_name="1", _var_type=Union[None, int]), + Var(_js_expr="1", _var_type=Union[None, int]), None, id="text_or_number-union-none-int", ), pytest.param( "text_or_number", - Var.create(1.0), + LiteralVar.create(1.0), TypeError, id="text_or_number-float", ), pytest.param( "text_or_number", - BaseVar(_var_name="hello", _var_type=Optional[Union[str, int]]), + Var(_js_expr="hello", _var_type=Optional[Union[str, int]]), None, id="text_or_number-optional-union-str-int", ), @@ -638,21 +643,21 @@ def test_component_create_unallowed_types(children, test_component): "props": [], "contents": "", "args": None, - "special_props": set(), + "special_props": [], "children": [ { "name": "RadixThemesText", "props": ['as={"p"}'], "contents": "", "args": None, - "special_props": set(), + "special_props": [], "children": [ { "name": "", "props": [], "contents": '{"first_text"}', "args": None, - "special_props": set(), + "special_props": [], "children": [], "autofocus": False, } @@ -680,13 +685,13 @@ def test_component_create_unallowed_types(children, test_component): "contents": '{"first_text"}', "name": "", "props": [], - "special_props": set(), + "special_props": [], } ], "contents": "", "name": "RadixThemesText", "props": ['as={"p"}'], - "special_props": set(), + "special_props": [], }, { "args": None, @@ -699,19 +704,19 @@ def test_component_create_unallowed_types(children, test_component): "contents": '{"second_text"}', "name": "", "props": [], - "special_props": set(), + "special_props": [], } ], "contents": "", "name": "RadixThemesText", "props": ['as={"p"}'], - "special_props": set(), + "special_props": [], }, ], "contents": "", "name": "Fragment", "props": [], - "special_props": set(), + "special_props": [], }, ), ( @@ -731,13 +736,13 @@ def test_component_create_unallowed_types(children, test_component): "contents": '{"first_text"}', "name": "", "props": [], - "special_props": set(), + "special_props": [], } ], "contents": "", "name": "RadixThemesText", "props": ['as={"p"}'], - "special_props": set(), + "special_props": [], }, { "args": None, @@ -758,31 +763,31 @@ def test_component_create_unallowed_types(children, test_component): "contents": '{"second_text"}', "name": "", "props": [], - "special_props": set(), + "special_props": [], } ], "contents": "", "name": "RadixThemesText", "props": ['as={"p"}'], - "special_props": set(), + "special_props": [], } ], "contents": "", "name": "Fragment", "props": [], - "special_props": set(), + "special_props": [], } ], "contents": "", "name": "RadixThemesBox", "props": [], - "special_props": set(), + "special_props": [], }, ], "contents": "", "name": "Fragment", "props": [], - "special_props": set(), + "special_props": [], }, ), ], @@ -833,7 +838,7 @@ def test_component_event_trigger_arbitrary_args(): assert comp.render()["props"][0] == ( "onFoo={((__e, _alpha, _bravo, _charlie) => ((addEvents(" - f'[(Event("{C1State.get_full_name()}.mock_handler", ({{ ["_e"] : __e["target"]["value"], ["_bravo"] : _bravo["nested"], ["_charlie"] : (_charlie["custom"] + 42) }})))], ' + f'[(Event("{C1State.get_full_name()}.mock_handler", ({{ ["_e"] : __e["target"]["value"], ["_bravo"] : _bravo["nested"], ["_charlie"] : (_charlie["custom"] + 42) }}), ({{ }})))], ' "[__e, _alpha, _bravo, _charlie], ({ })))))}" ) @@ -874,7 +879,7 @@ def test_custom_component_wrapper(): from reflex.components.radix.themes.typography.text import Text ccomponent = my_component( - rx.text("child"), width=Var.create(1), color=Var.create("red") + rx.text("child"), width=LiteralVar.create(1), color=LiteralVar.create("red") ) assert isinstance(ccomponent, CustomComponent) assert len(ccomponent.children) == 1 @@ -1114,8 +1119,8 @@ def test_component_with_only_valid_children(fixture, request): [ (rx.text("hi"), '\n {"hi"}\n'), ( - rx.box(rc.heading("test", size="md")), - '\n \n {"test"}\n\n', + rx.box(rx.heading("test", size="3")), + '\n \n {"test"}\n\n', ), ], ) @@ -1175,13 +1180,12 @@ TEST_VAR = LiteralVar.create("test")._replace( hooks={"useTest": None}, imports={"test": [ImportVar(tag="test")]}, state="Test", - interpolations=[], ) ) FORMATTED_TEST_VAR = LiteralVar.create(f"foo{TEST_VAR}bar") -STYLE_VAR = TEST_VAR._replace(_var_name="style") -EVENT_CHAIN_VAR = TEST_VAR._replace(_var_type=EventChain) -ARG_VAR = Var.create("arg") +STYLE_VAR = TEST_VAR._replace(_js_expr="style") +EVENT_CHAIN_VAR = TEST_VAR.to(EventChain) +ARG_VAR = Var(_js_expr="arg") TEST_VAR_DICT_OF_DICT = LiteralVar.create({"a": {"b": "test"}})._replace( merge_var_data=TEST_VAR._var_data @@ -1226,6 +1230,7 @@ class EventState(rx.State): v: int = 42 + @rx.event def handler(self): """A handler that does nothing.""" @@ -1291,12 +1296,22 @@ class EventState(rx.State): id="fstring-class_name", ), pytest.param( - rx.fragment(special_props={TEST_VAR}), + rx.fragment(class_name=f"foo{TEST_VAR}bar other-class"), + [LiteralVar.create(f"{FORMATTED_TEST_VAR} other-class")], + id="fstring-dual-class_name", + ), + pytest.param( + rx.fragment(class_name=[TEST_VAR, "other-class"]), + [LiteralVar.create([TEST_VAR, "other-class"]).join(" ")], + id="fstring-dual-class_name", + ), + pytest.param( + rx.fragment(special_props=[TEST_VAR]), [TEST_VAR], id="direct-special_props", ), pytest.param( - rx.fragment(special_props={LiteralVar.create(f"foo{TEST_VAR}bar")}), + rx.fragment(special_props=[LiteralVar.create(f"foo{TEST_VAR}bar")]), [FORMATTED_TEST_VAR], id="fstring-special_props", ), @@ -1399,11 +1414,12 @@ class EventState(rx.State): ), ) def test_get_vars(component, exp_vars): - comp_vars = sorted(component._get_vars(), key=lambda v: v._var_name) + comp_vars = sorted(component._get_vars(), key=lambda v: v._js_expr) assert len(comp_vars) == len(exp_vars) + print(comp_vars, exp_vars) for comp_var, exp_var in zip( comp_vars, - sorted(exp_vars, key=lambda v: v._var_name), + sorted(exp_vars, key=lambda v: v._js_expr), ): # print(str(comp_var), str(exp_var)) # print(comp_var._get_all_var_data(), exp_var._get_all_var_data()) @@ -1518,7 +1534,7 @@ def test_validate_valid_children(): True, rx.fragment(valid_component2()), rx.fragment( - rx.foreach(Var.create([1, 2, 3]), lambda x: valid_component2(x)) # type: ignore + rx.foreach(LiteralVar.create([1, 2, 3]), lambda x: valid_component2(x)) # type: ignore ), ) ) @@ -1578,7 +1594,7 @@ def test_validate_valid_parents(): rx.fragment(valid_component3()), rx.fragment( rx.foreach( - Var.create([1, 2, 3]), # type: ignore + LiteralVar.create([1, 2, 3]), # type: ignore lambda x: valid_component2(valid_component3(x)), ) ), @@ -1645,7 +1661,9 @@ def test_validate_invalid_children(): True, rx.fragment(invalid_component()), rx.fragment( - rx.foreach(Var.create([1, 2, 3]), lambda x: invalid_component(x)) # type: ignore + rx.foreach( + LiteralVar.create([1, 2, 3]), lambda x: invalid_component(x) + ) # type: ignore ), ) ) @@ -1767,7 +1785,7 @@ def test_custom_component_declare_event_handlers_in_fields(): return { **super().get_event_triggers(), "on_a": lambda e0: [e0], - "on_b": lambda e0: [e0.target.value], + "on_b": input_event, "on_c": lambda e0: [], "on_d": lambda: [], "on_e": lambda: [], @@ -1776,9 +1794,9 @@ def test_custom_component_declare_event_handlers_in_fields(): class TestComponent(Component): on_a: EventHandler[lambda e0: [e0]] - on_b: EventHandler[lambda e0: [e0.target.value]] - on_c: EventHandler[lambda e0: []] - on_d: EventHandler[lambda: []] + on_b: EventHandler[input_event] + on_c: EventHandler[empty_event] + on_d: EventHandler[empty_event] on_e: EventHandler on_f: EventHandler[lambda a, b, c: [c, b, a]] @@ -2027,8 +2045,8 @@ def test_component_add_hooks_var(): return [ "const hook3 = useRef(null)", "const hook1 = 42", - Var.create( - "useEffect(() => () => {}, [])", + Var( + _js_expr="useEffect(() => () => {}, [])", _var_data=VarData( hooks={ "const hook2 = 43": None, @@ -2037,11 +2055,9 @@ def test_component_add_hooks_var(): imports={"react": [ImportVar(tag="useEffect")]}, ), ), - Var.create( - "const hook3 = useRef(null)", - _var_data=VarData( - imports={"react": [ImportVar(tag="useRef")]}, - ), + Var( + _js_expr="const hook3 = useRef(null)", + _var_data=VarData(imports={"react": [ImportVar(tag="useRef")]}), ), ] @@ -2132,6 +2148,7 @@ def test_add_style_foreach(): class TriggerState(rx.State): """Test state with event handlers.""" + @rx.event def do_something(self): """Sample event handler.""" pass @@ -2150,7 +2167,7 @@ class TriggerState(rx.State): rx.text("random text", on_click=TriggerState.do_something), rx.text( "random text", - on_click=BaseVar(_var_name="toggleColorMode", _var_type=EventChain), + on_click=Var(_js_expr="toggleColorMode").to(EventChain), ), ), True, @@ -2160,7 +2177,7 @@ class TriggerState(rx.State): rx.text("random text", on_click=rx.console_log("log")), rx.text( "random text", - on_click=BaseVar(_var_name="toggleColorMode", _var_type=EventChain), + on_click=Var(_js_expr="toggleColorMode").to(EventChain), ), ), False, @@ -2200,3 +2217,56 @@ class TriggerState(rx.State): ) def test_has_state_event_triggers(component, output): assert component._has_stateful_event_triggers() == output + + +class SpecialComponent(Box): + """A special component with custom attributes.""" + + data_prop: Var[str] + aria_prop: Var[str] + + +@pytest.mark.parametrize( + ("component_kwargs", "exp_custom_attrs", "exp_style"), + [ + ( + {"data_test": "test", "aria_test": "test"}, + {"data-test": "test", "aria-test": "test"}, + {}, + ), + ( + {"data-test": "test", "aria-test": "test"}, + {"data-test": "test", "aria-test": "test"}, + {}, + ), + ( + {"custom_attrs": {"data-existing": "test"}, "data_new": "test"}, + {"data-existing": "test", "data-new": "test"}, + {}, + ), + ( + {"data_test": "test", "data_prop": "prop"}, + {"data-test": "test"}, + {}, + ), + ( + {"aria_test": "test", "aria_prop": "prop"}, + {"aria-test": "test"}, + {}, + ), + ], +) +def test_special_props(component_kwargs, exp_custom_attrs, exp_style): + """Test that data_ and aria_ special props are correctly added to the component. + + Args: + component_kwargs: The component kwargs. + exp_custom_attrs: The expected custom attributes. + exp_style: The expected style. + """ + component = SpecialComponent.create(**component_kwargs) + assert component.custom_attrs == exp_custom_attrs + assert component.style == exp_style + for prop in SpecialComponent.get_props(): + if prop in component_kwargs: + assert getattr(component, prop)._var_value == component_kwargs[prop] diff --git a/tests/components/test_component_future_annotations.py b/tests/units/components/test_component_future_annotations.py similarity index 84% rename from tests/components/test_component_future_annotations.py rename to tests/units/components/test_component_future_annotations.py index 37aeb813a..44ec52c16 100644 --- a/tests/components/test_component_future_annotations.py +++ b/tests/units/components/test_component_future_annotations.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Any from reflex.components.component import Component -from reflex.event import EventHandler +from reflex.event import EventHandler, empty_event, input_event # This is a repeat of its namesake in test_component.py. @@ -25,9 +25,9 @@ def test_custom_component_declare_event_handlers_in_fields(): class TestComponent(Component): on_a: EventHandler[lambda e0: [e0]] - on_b: EventHandler[lambda e0: [e0.target.value]] - on_c: EventHandler[lambda e0: []] - on_d: EventHandler[lambda: []] + on_b: EventHandler[input_event] + on_c: EventHandler[empty_event] + on_d: EventHandler[empty_event] custom_component = ReferenceComponent.create() test_component = TestComponent.create() diff --git a/tests/components/test_component_state.py b/tests/units/components/test_component_state.py similarity index 100% rename from tests/components/test_component_state.py rename to tests/units/components/test_component_state.py diff --git a/tests/components/test_tag.py b/tests/units/components/test_tag.py similarity index 94% rename from tests/components/test_tag.py rename to tests/units/components/test_tag.py index d43f73842..a69e40b8b 100644 --- a/tests/components/test_tag.py +++ b/tests/units/components/test_tag.py @@ -3,8 +3,7 @@ from typing import Dict, List import pytest from reflex.components.tags import CondTag, Tag, tagless -from reflex.ivars.base import LiteralVar -from reflex.vars import BaseVar, Var +from reflex.vars.base import LiteralVar, Var @pytest.mark.parametrize( @@ -111,7 +110,7 @@ def test_format_cond_tag(): tag = CondTag( true_value=dict(Tag(name="h1", contents="True content")), false_value=dict(Tag(name="h2", contents="False content")), - cond=BaseVar(_var_name="logged_in", _var_type=bool), + cond=Var(_js_expr="logged_in", _var_type=bool), ) tag_dict = dict(tag) cond, true_value, false_value = ( @@ -119,8 +118,8 @@ def test_format_cond_tag(): tag_dict["true_value"], tag_dict["false_value"], ) - assert cond._var_name == "logged_in" - assert cond._var_type == bool + assert cond._js_expr == "logged_in" + assert cond._var_type is bool assert true_value["name"] == "h1" assert true_value["contents"] == "True content" diff --git a/tests/components/typography/__init__.py b/tests/units/components/typography/__init__.py similarity index 100% rename from tests/components/typography/__init__.py rename to tests/units/components/typography/__init__.py diff --git a/tests/components/typography/test_markdown.py b/tests/units/components/typography/test_markdown.py similarity index 90% rename from tests/components/typography/test_markdown.py rename to tests/units/components/typography/test_markdown.py index 2ef6fbce4..5e9abbb1f 100644 --- a/tests/components/typography/test_markdown.py +++ b/tests/units/components/typography/test_markdown.py @@ -1,5 +1,4 @@ import pytest -import reflex_chakra as rc import reflex as rx from reflex.components.markdown import Markdown @@ -37,9 +36,7 @@ def test_get_component(tag, expected): def test_set_component_map(): """Test setting the component map.""" component_map = { - "h1": lambda value: rx.box( - rc.heading(value, as_="h1", size="2xl"), padding="1em" - ), + "h1": lambda value: rx.box(rx.heading(value, as_="h1"), padding="1em"), "p": lambda value: rx.box(rx.text(value), padding="1em"), } md = Markdown.create("# Hello", component_map=component_map) diff --git a/tests/conftest.py b/tests/units/conftest.py similarity index 97% rename from tests/conftest.py rename to tests/units/conftest.py index 589d35cd7..2f619a941 100644 --- a/tests/conftest.py +++ b/tests/units/conftest.py @@ -1,5 +1,6 @@ """Test fixtures.""" +import asyncio import contextlib import os import platform @@ -24,6 +25,11 @@ from .states import ( ) +def pytest_configure(config): + if config.getoption("asyncio_mode") == "auto": + asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy()) + + @pytest.fixture def app() -> App: """A base app. diff --git a/tests/experimental/custom_script.js b/tests/units/experimental/custom_script.js similarity index 100% rename from tests/experimental/custom_script.js rename to tests/units/experimental/custom_script.js diff --git a/tests/experimental/test_assets.py b/tests/units/experimental/test_assets.py similarity index 100% rename from tests/experimental/test_assets.py rename to tests/units/experimental/test_assets.py diff --git a/tests/middleware/__init__.py b/tests/units/middleware/__init__.py similarity index 100% rename from tests/middleware/__init__.py rename to tests/units/middleware/__init__.py diff --git a/tests/middleware/conftest.py b/tests/units/middleware/conftest.py similarity index 100% rename from tests/middleware/conftest.py rename to tests/units/middleware/conftest.py diff --git a/tests/middleware/test_hydrate_middleware.py b/tests/units/middleware/test_hydrate_middleware.py similarity index 100% rename from tests/middleware/test_hydrate_middleware.py rename to tests/units/middleware/test_hydrate_middleware.py diff --git a/tests/states/__init__.py b/tests/units/states/__init__.py similarity index 100% rename from tests/states/__init__.py rename to tests/units/states/__init__.py diff --git a/tests/states/mutation.py b/tests/units/states/mutation.py similarity index 100% rename from tests/states/mutation.py rename to tests/units/states/mutation.py diff --git a/tests/states/upload.py b/tests/units/states/upload.py similarity index 100% rename from tests/states/upload.py rename to tests/units/states/upload.py diff --git a/tests/test_app.py b/tests/units/test_app.py similarity index 96% rename from tests/test_app.py rename to tests/units/test_app.py index f933149f1..a4ecfc5f7 100644 --- a/tests/test_app.py +++ b/tests/units/test_app.py @@ -13,7 +13,6 @@ from typing import Generator, List, Tuple, Type from unittest.mock import AsyncMock import pytest -import reflex_chakra as rc import sqlmodel from fastapi import FastAPI, UploadFile from starlette_admin.auth import AuthProvider @@ -50,7 +49,7 @@ from reflex.state import ( ) from reflex.style import Style from reflex.utils import exceptions, format -from reflex.vars import computed_var +from reflex.vars.base import computed_var from .conftest import chdir from .states import ( @@ -69,7 +68,7 @@ class EmptyState(BaseState): @pytest.fixture -def index_page(): +def index_page() -> ComponentCallable: """An index page. Returns: @@ -83,7 +82,7 @@ def index_page(): @pytest.fixture -def about_page(): +def about_page() -> ComponentCallable: """An about page. Returns: @@ -268,8 +267,6 @@ def test_add_page_set_route_dynamic(index_page, windows_platform: bool): app = App(state=EmptyState) assert app.state is not None route = "/test/[dynamic]" - if windows_platform: - route.lstrip("/").replace("/", "\\") assert app.pages == {} app.add_page(index_page, route=route) assert app.pages.keys() == {"test/[dynamic]"} @@ -768,7 +765,8 @@ async def test_upload_file(tmp_path, state, delta, token: str, mocker): ) state._tmp_path = tmp_path # The App state must be the "root" of the state tree - app = App(state=State) + app = App() + app._enable_state() app.event_namespace.emit = AsyncMock() # type: ignore current_state = await app.state_manager.get_state(_substate_key(token, state)) data = b"This is binary data" @@ -902,11 +900,12 @@ class DynamicState(BaseState): """Event handler for page on_load, should trigger for all navigation events.""" self.loaded = self.loaded + 1 + @rx.event def on_counter(self): """Increment the counter var.""" self.counter = self.counter + 1 - @computed_var + @computed_var(cache=True) def comp_dynamic(self) -> str: """A computed var that depends on the dynamic var. @@ -919,9 +918,57 @@ class DynamicState(BaseState): on_load_internal = OnLoadInternalState.on_load_internal.fn +def test_dynamic_arg_shadow( + index_page: ComponentCallable, + windows_platform: bool, + token: str, + app_module_mock: unittest.mock.Mock, + mocker, +): + """Create app with dynamic route var and try to add a page with a dynamic arg that shadows a state var. + + Args: + index_page: The index page. + windows_platform: Whether the system is windows. + token: a Token. + app_module_mock: Mocked app module. + mocker: pytest mocker object. + """ + arg_name = "counter" + route = f"/test/[{arg_name}]" + app = app_module_mock.app = App(state=DynamicState) + assert app.state is not None + with pytest.raises(NameError): + app.add_page(index_page, route=route, on_load=DynamicState.on_load) # type: ignore + + +def test_multiple_dynamic_args( + index_page: ComponentCallable, + windows_platform: bool, + token: str, + app_module_mock: unittest.mock.Mock, + mocker, +): + """Create app with multiple dynamic route vars with the same name. + + Args: + index_page: The index page. + windows_platform: Whether the system is windows. + token: a Token. + app_module_mock: Mocked app module. + mocker: pytest mocker object. + """ + arg_name = "my_arg" + route = f"/test/[{arg_name}]" + route2 = f"/test2/[{arg_name}]" + app = app_module_mock.app = App(state=EmptyState) + app.add_page(index_page, route=route) + app.add_page(index_page, route=route2) + + @pytest.mark.asyncio async def test_dynamic_route_var_route_change_completed_on_load( - index_page, + index_page: ComponentCallable, windows_platform: bool, token: str, app_module_mock: unittest.mock.Mock, @@ -941,8 +988,6 @@ async def test_dynamic_route_var_route_change_completed_on_load( """ arg_name = "dynamic" route = f"/test/[{arg_name}]" - if windows_platform: - route.lstrip("/").replace("/", "\\") app = app_module_mock.app = App(state=DynamicState) assert app.state is not None assert arg_name not in app.state.vars @@ -1049,9 +1094,6 @@ async def test_dynamic_route_var_route_change_completed_on_load( assert on_load_update == StateUpdate( delta={ state.get_name(): { - # These computed vars _shouldn't_ be here, because they didn't change - arg_name: exp_val, - f"comp_{arg_name}": exp_val, "loaded": exp_index + 1, }, }, @@ -1073,9 +1115,6 @@ async def test_dynamic_route_var_route_change_completed_on_load( assert on_set_is_hydrated_update == StateUpdate( delta={ state.get_name(): { - # These computed vars _shouldn't_ be here, because they didn't change - arg_name: exp_val, - f"comp_{arg_name}": exp_val, "is_hydrated": True, }, }, @@ -1097,9 +1136,6 @@ async def test_dynamic_route_var_route_change_completed_on_load( assert update == StateUpdate( delta={ state.get_name(): { - # These computed vars _shouldn't_ be here, because they didn't change - f"comp_{arg_name}": exp_val, - arg_name: exp_val, "counter": exp_index + 1, } }, @@ -1276,13 +1312,13 @@ def test_app_wrap_priority(compilable_app: tuple[App, Path]): tag = "Fragment1" def _get_app_wrap_components(self) -> dict[tuple[int, str], Component]: - return {(99, "Box"): rc.box()} + return {(99, "Box"): rx.box()} class Fragment2(Component): tag = "Fragment2" def _get_app_wrap_components(self) -> dict[tuple[int, str], Component]: - return {(50, "Text"): rc.text()} + return {(50, "Text"): rx.text()} class Fragment3(Component): tag = "Fragment3" @@ -1302,19 +1338,17 @@ def test_app_wrap_priority(compilable_app: tuple[App, Path]): assert ( "function AppWrap({children}) {" "return (" - "" - "" - "" - "" + "" + '' + "" "" "" "{children}" "" "" - "" - "" - "" - "" + "" + "" + "" ")" "}" ) in "".join(app_js_lines) diff --git a/tests/test_attribute_access_type.py b/tests/units/test_attribute_access_type.py similarity index 100% rename from tests/test_attribute_access_type.py rename to tests/units/test_attribute_access_type.py diff --git a/tests/test_base.py b/tests/units/test_base.py similarity index 100% rename from tests/test_base.py rename to tests/units/test_base.py diff --git a/tests/test_config.py b/tests/units/test_config.py similarity index 97% rename from tests/test_config.py rename to tests/units/test_config.py index 31dd77649..c4a143bc5 100644 --- a/tests/test_config.py +++ b/tests/units/test_config.py @@ -5,6 +5,7 @@ import pytest import reflex as rx import reflex.config +from reflex.config import environment from reflex.constants import Endpoint @@ -178,7 +179,7 @@ def test_replace_defaults( def reflex_dir_constant(): - return rx.constants.Reflex.DIR + return environment.REFLEX_DIR def test_reflex_dir_env_var(monkeypatch, tmp_path): @@ -192,4 +193,4 @@ def test_reflex_dir_env_var(monkeypatch, tmp_path): mp_ctx = multiprocessing.get_context(method="spawn") with mp_ctx.Pool(processes=1) as pool: - assert pool.apply(reflex_dir_constant) == str(tmp_path) + assert pool.apply(reflex_dir_constant) == tmp_path diff --git a/tests/test_db_config.py b/tests/units/test_db_config.py similarity index 100% rename from tests/test_db_config.py rename to tests/units/test_db_config.py diff --git a/tests/test_event.py b/tests/units/test_event.py similarity index 80% rename from tests/test_event.py rename to tests/units/test_event.py index a484e0a3c..d7b7cf7a2 100644 --- a/tests/test_event.py +++ b/tests/units/test_event.py @@ -2,12 +2,18 @@ from typing import List import pytest -from reflex import event -from reflex.event import Event, EventHandler, EventSpec, call_event_handler, fix_events -from reflex.ivars.base import ImmutableVar, LiteralVar +from reflex.event import ( + Event, + EventChain, + EventHandler, + EventSpec, + call_event_handler, + event, + fix_events, +) from reflex.state import BaseState from reflex.utils import format -from reflex.vars import Var +from reflex.vars.base import Field, LiteralVar, Var, field def make_var(value) -> Var: @@ -19,9 +25,7 @@ def make_var(value) -> Var: Returns: The var. """ - var = Var.create(value) - assert var is not None - return var + return Var(_js_expr=value) def test_create_event(): @@ -57,10 +61,10 @@ def test_call_event_handler(): # Test passing vars as args. assert event_spec.handler == handler - assert event_spec.args[0][0].equals(Var.create_safe("arg1")) - assert event_spec.args[0][1].equals(Var.create_safe("first")) - assert event_spec.args[1][0].equals(Var.create_safe("arg2")) - assert event_spec.args[1][1].equals(Var.create_safe("second")) + assert event_spec.args[0][0].equals(Var(_js_expr="arg1")) + assert event_spec.args[0][1].equals(Var(_js_expr="first")) + assert event_spec.args[1][0].equals(Var(_js_expr="arg2")) + assert event_spec.args[1][1].equals(Var(_js_expr="second")) assert ( format.format_event(event_spec) == 'Event("test_fn_with_args", {arg1:first,arg2:second})' @@ -82,9 +86,9 @@ def test_call_event_handler(): ) assert event_spec.handler == handler - assert event_spec.args[0][0].equals(Var.create_safe("arg1")) - assert event_spec.args[0][1].equals(Var.create_safe(first)) - assert event_spec.args[1][0].equals(Var.create_safe("arg2")) + assert event_spec.args[0][0].equals(Var(_js_expr="arg1")) + assert event_spec.args[0][1].equals(LiteralVar.create(first)) + assert event_spec.args[1][0].equals(Var(_js_expr="arg2")) assert event_spec.args[1][1].equals(LiteralVar.create(second)) handler = EventHandler(fn=test_fn_with_args) @@ -100,7 +104,7 @@ def test_call_event_handler_partial(): test_fn_with_args.__qualname__ = "test_fn_with_args" - def spec(a2: str) -> List[str]: + def spec(a2: Var[str]) -> List[Var[str]]: return [a2] handler = EventHandler(fn=test_fn_with_args) @@ -109,17 +113,17 @@ def test_call_event_handler_partial(): assert event_spec.handler == handler assert len(event_spec.args) == 1 - assert event_spec.args[0][0].equals(Var.create_safe("arg1")) - assert event_spec.args[0][1].equals(Var.create_safe("first")) + assert event_spec.args[0][0].equals(Var(_js_expr="arg1")) + assert event_spec.args[0][1].equals(Var(_js_expr="first")) assert format.format_event(event_spec) == 'Event("test_fn_with_args", {arg1:first})' assert event_spec2 is not event_spec assert event_spec2.handler == handler assert len(event_spec2.args) == 2 - assert event_spec2.args[0][0].equals(Var.create_safe("arg1")) - assert event_spec2.args[0][1].equals(Var.create_safe("first")) - assert event_spec2.args[1][0].equals(Var.create_safe("arg2")) - assert event_spec2.args[1][1].equals(Var.create_safe("_a2")) + assert event_spec2.args[0][0].equals(Var(_js_expr="arg1")) + assert event_spec2.args[0][1].equals(Var(_js_expr="first")) + assert event_spec2.args[1][0].equals(Var(_js_expr="arg2")) + assert event_spec2.args[1][1].equals(Var(_js_expr="_a2", _var_type=str)) assert ( format.format_event(event_spec2) == 'Event("test_fn_with_args", {arg1:first,arg2:_a2})' @@ -171,7 +175,7 @@ def test_fix_events(arg1, arg2): 'Event("_redirect", {path:"/path",external:false,replace:false})', ), ( - (Var.create_safe("path"), None, None), + (Var(_js_expr="path"), None, None), 'Event("_redirect", {path:path,external:false,replace:false})', ), ( @@ -202,8 +206,8 @@ def test_event_redirect(input, output): assert spec.handler.fn.__qualname__ == "_redirect" # this asserts need comment about what it's testing (they fail with Var as input) - # assert spec.args[0][0].equals(Var.create_safe("path")) - # assert spec.args[0][1].equals(Var.create_safe("/path")) + # assert spec.args[0][0].equals(Var(_js_expr="path")) + # assert spec.args[0][1].equals(Var(_js_expr="/path")) assert format.format_event(spec) == output @@ -213,10 +217,10 @@ def test_event_console_log(): spec = event.console_log("message") assert isinstance(spec, EventSpec) assert spec.handler.fn.__qualname__ == "_console" - assert spec.args[0][0].equals(ImmutableVar(_var_name="message", _var_type=str)) + assert spec.args[0][0].equals(Var(_js_expr="message")) assert spec.args[0][1].equals(LiteralVar.create("message")) assert format.format_event(spec) == 'Event("_console", {message:"message"})' - spec = event.console_log(ImmutableVar.create_safe("message")) + spec = event.console_log(Var(_js_expr="message")) assert format.format_event(spec) == 'Event("_console", {message:message})' @@ -225,10 +229,10 @@ def test_event_window_alert(): spec = event.window_alert("message") assert isinstance(spec, EventSpec) assert spec.handler.fn.__qualname__ == "_alert" - assert spec.args[0][0].equals(ImmutableVar(_var_name="message", _var_type=str)) + assert spec.args[0][0].equals(Var(_js_expr="message")) assert spec.args[0][1].equals(LiteralVar.create("message")) assert format.format_event(spec) == 'Event("_alert", {message:"message"})' - spec = event.window_alert(ImmutableVar.create_safe("message")) + spec = event.window_alert(Var(_js_expr="message")) assert format.format_event(spec) == 'Event("_alert", {message:message})' @@ -237,7 +241,7 @@ def test_set_focus(): spec = event.set_focus("input1") assert isinstance(spec, EventSpec) assert spec.handler.fn.__qualname__ == "_set_focus" - assert spec.args[0][0].equals(Var.create_safe("ref")) + assert spec.args[0][0].equals(Var(_js_expr="ref")) assert spec.args[0][1].equals(LiteralVar.create("ref_input1")) assert format.format_event(spec) == 'Event("_set_focus", {ref:"ref_input1"})' spec = event.set_focus("input1") @@ -249,14 +253,14 @@ def test_set_value(): spec = event.set_value("input1", "") assert isinstance(spec, EventSpec) assert spec.handler.fn.__qualname__ == "_set_value" - assert spec.args[0][0].equals(Var.create_safe("ref")) + assert spec.args[0][0].equals(Var(_js_expr="ref")) assert spec.args[0][1].equals(LiteralVar.create("ref_input1")) - assert spec.args[1][0].equals(Var.create_safe("value")) + assert spec.args[1][0].equals(Var(_js_expr="value")) assert spec.args[1][1].equals(LiteralVar.create("")) assert ( format.format_event(spec) == 'Event("_set_value", {ref:"ref_input1",value:""})' ) - spec = event.set_value("input1", ImmutableVar.create_safe("message")) + spec = event.set_value("input1", Var(_js_expr="message")) assert ( format.format_event(spec) == 'Event("_set_value", {ref:"ref_input1",value:message})' @@ -268,9 +272,9 @@ def test_remove_cookie(): spec = event.remove_cookie("testkey") assert isinstance(spec, EventSpec) assert spec.handler.fn.__qualname__ == "_remove_cookie" - assert spec.args[0][0].equals(Var.create_safe("key")) + assert spec.args[0][0].equals(Var(_js_expr="key")) assert spec.args[0][1].equals(LiteralVar.create("testkey")) - assert spec.args[1][0].equals(Var.create_safe("options")) + assert spec.args[1][0].equals(Var(_js_expr="options")) assert spec.args[1][1].equals(LiteralVar.create({"path": "/"})) assert ( format.format_event(spec) @@ -289,9 +293,9 @@ def test_remove_cookie_with_options(): spec = event.remove_cookie("testkey", options) assert isinstance(spec, EventSpec) assert spec.handler.fn.__qualname__ == "_remove_cookie" - assert spec.args[0][0].equals(Var.create_safe("key")) + assert spec.args[0][0].equals(Var(_js_expr="key")) assert spec.args[0][1].equals(LiteralVar.create("testkey")) - assert spec.args[1][0].equals(Var.create_safe("options")) + assert spec.args[1][0].equals(Var(_js_expr="options")) assert spec.args[1][1].equals(LiteralVar.create(options)) assert ( format.format_event(spec) @@ -313,7 +317,7 @@ def test_remove_local_storage(): spec = event.remove_local_storage("testkey") assert isinstance(spec, EventSpec) assert spec.handler.fn.__qualname__ == "_remove_local_storage" - assert spec.args[0][0].equals(Var.create_safe("key")) + assert spec.args[0][0].equals(Var(_js_expr="key")) assert spec.args[0][1].equals(LiteralVar.create("testkey")) assert ( format.format_event(spec) == 'Event("_remove_local_storage", {key:"testkey"})' @@ -391,3 +395,28 @@ def test_event_actions_on_state(): assert sp_handler.event_actions == {"stopPropagation": True} # should NOT affect other references to the handler assert not handler.event_actions + + +def test_event_var_data(): + class S(BaseState): + x: Field[int] = field(0) + + @event + def s(self, value: int): + pass + + # Handler doesn't have any _var_data because it's just a str + handler_var = Var.create(S.s) + assert handler_var._get_all_var_data() is None + + # Ensure spec carries _var_data + spec_var = Var.create(S.s(S.x)) + assert spec_var._get_all_var_data() == S.x._get_all_var_data() + + # Needed to instantiate the EventChain + def _args_spec(value: Var[int]) -> tuple[Var[int]]: + return (value,) + + # Ensure chain carries _var_data + chain_var = Var.create(EventChain(events=[S.s(S.x)], args_spec=_args_spec)) + assert chain_var._get_all_var_data() == S.x._get_all_var_data() diff --git a/tests/test_health_endpoint.py b/tests/units/test_health_endpoint.py similarity index 100% rename from tests/test_health_endpoint.py rename to tests/units/test_health_endpoint.py diff --git a/tests/test_model.py b/tests/units/test_model.py similarity index 100% rename from tests/test_model.py rename to tests/units/test_model.py diff --git a/tests/units/test_page.py b/tests/units/test_page.py new file mode 100644 index 000000000..e1dd70905 --- /dev/null +++ b/tests/units/test_page.py @@ -0,0 +1,79 @@ +from reflex import text +from reflex.config import get_config +from reflex.page import DECORATED_PAGES, get_decorated_pages, page + + +def test_page_decorator(): + def foo_(): + return text("foo") + + assert len(DECORATED_PAGES) == 0 + decorated_foo_ = page()(foo_) + assert decorated_foo_ == foo_ + assert len(DECORATED_PAGES) == 1 + page_data = DECORATED_PAGES.get(get_config().app_name, [])[0][1] + assert page_data == {} + DECORATED_PAGES.clear() + + +def test_page_decorator_with_kwargs(): + def foo_(): + return text("foo") + + def load_foo(): + return [] + + DECORATED_PAGES.clear() + assert len(DECORATED_PAGES) == 0 + decorated_foo_ = page( + route="foo", + title="Foo", + image="foo.png", + description="Foo description", + meta=["foo-meta"], + script_tags=["foo-script"], + on_load=load_foo, + )(foo_) + assert decorated_foo_ == foo_ + assert len(DECORATED_PAGES) == 1 + page_data = DECORATED_PAGES.get(get_config().app_name, [])[0][1] + assert page_data == { + "description": "Foo description", + "image": "foo.png", + "meta": ["foo-meta"], + "on_load": load_foo, + "route": "foo", + "script_tags": ["foo-script"], + "title": "Foo", + } + + DECORATED_PAGES.clear() + + +def test_get_decorated_pages(): + assert get_decorated_pages() == [] + + def foo_(): + return text("foo") + + page()(foo_) + + assert get_decorated_pages() == [] + assert get_decorated_pages(omit_implicit_routes=False) == [{}] + + page(route="foo2")(foo_) + + assert get_decorated_pages() == [{"route": "foo2"}] + assert get_decorated_pages(omit_implicit_routes=False) == [{}, {"route": "foo2"}] + + page(route="foo3", title="Foo3")(foo_) + + assert get_decorated_pages() == [ + {"route": "foo2"}, + {"route": "foo3", "title": "Foo3"}, + ] + assert get_decorated_pages(omit_implicit_routes=False) == [ + {}, + {"route": "foo2"}, + {"route": "foo3", "title": "Foo3"}, + ] diff --git a/tests/test_prerequisites.py b/tests/units/test_prerequisites.py similarity index 100% rename from tests/test_prerequisites.py rename to tests/units/test_prerequisites.py diff --git a/tests/test_route.py b/tests/units/test_route.py similarity index 100% rename from tests/test_route.py rename to tests/units/test_route.py diff --git a/tests/test_sqlalchemy.py b/tests/units/test_sqlalchemy.py similarity index 100% rename from tests/test_sqlalchemy.py rename to tests/units/test_sqlalchemy.py diff --git a/tests/test_state.py b/tests/units/test_state.py similarity index 92% rename from tests/test_state.py rename to tests/units/test_state.py index ba8fc592f..610d69110 100644 --- a/tests/test_state.py +++ b/tests/units/test_state.py @@ -2,16 +2,18 @@ from __future__ import annotations import asyncio import copy +import dataclasses import datetime import functools import json import os import sys from textwrap import dedent -from typing import Any, Callable, Dict, Generator, List, Optional, Union +from typing import Any, AsyncGenerator, Callable, Dict, List, Optional, Union from unittest.mock import AsyncMock, Mock import pytest +import pytest_asyncio from plotly.graph_objects import Figure import reflex as rx @@ -40,9 +42,10 @@ from reflex.state import ( ) from reflex.testing import chdir from reflex.utils import format, prerequisites, types +from reflex.utils.exceptions import SetUndefinedStateVarError from reflex.utils.format import json_dumps -from reflex.vars import BaseVar, ComputedVar, Var -from tests.states.mutation import MutableSQLAModel, MutableTestState +from reflex.vars.base import ComputedVar, Var +from tests.units.states.mutation import MutableSQLAModel, MutableTestState from .states import GenState @@ -58,6 +61,7 @@ formatted_router = { "origin": "", "upgrade": "", "connection": "", + "cookie": "", "pragma": "", "cache_control": "", "user_agent": "", @@ -101,6 +105,7 @@ class TestState(BaseState): complex: Dict[int, Object] = {1: Object(), 2: Object()} fig: Figure = Figure() dt: datetime.datetime = datetime.datetime.fromisoformat("1989-11-09T18:53:00+01:00") + _backend: int = 0 @ComputedVar def sum(self) -> float: @@ -268,11 +273,11 @@ def test_base_class_vars(test_state): continue prop = getattr(cls, field) assert isinstance(prop, Var) - assert prop._var_name.split(".")[-1] == field + assert prop._js_expr.split(".")[-1] == field - assert cls.num1._var_type == int - assert cls.num2._var_type == float - assert cls.key._var_type == str + assert cls.num1._var_type is int + assert cls.num2._var_type is float + assert cls.key._var_type is str def test_computed_class_var(test_state): @@ -282,7 +287,7 @@ def test_computed_class_var(test_state): test_state: A state. """ cls = type(test_state) - vars = [(prop._var_name, prop._var_type) for prop in cls.computed_vars.values()] + vars = [(prop._js_expr, prop._var_type) for prop in cls.computed_vars.values()] assert ("sum", float) in vars assert ("upper", str) in vars @@ -438,26 +443,28 @@ def test_get_substates(): def test_get_name(): """Test getting the name of a state.""" - assert TestState.get_name() == "tests___test_state____test_state" - assert ChildState.get_name() == "tests___test_state____child_state" - assert ChildState2.get_name() == "tests___test_state____child_state2" - assert GrandchildState.get_name() == "tests___test_state____grandchild_state" + assert TestState.get_name() == "tests___units___test_state____test_state" + assert ChildState.get_name() == "tests___units___test_state____child_state" + assert ChildState2.get_name() == "tests___units___test_state____child_state2" + assert ( + GrandchildState.get_name() == "tests___units___test_state____grandchild_state" + ) def test_get_full_name(): """Test getting the full name.""" - assert TestState.get_full_name() == "tests___test_state____test_state" + assert TestState.get_full_name() == "tests___units___test_state____test_state" assert ( ChildState.get_full_name() - == "tests___test_state____test_state.tests___test_state____child_state" + == "tests___units___test_state____test_state.tests___units___test_state____child_state" ) assert ( ChildState2.get_full_name() - == "tests___test_state____test_state.tests___test_state____child_state2" + == "tests___units___test_state____test_state.tests___units___test_state____child_state2" ) assert ( GrandchildState.get_full_name() - == "tests___test_state____test_state.tests___test_state____child_state.tests___test_state____grandchild_state" + == "tests___units___test_state____test_state.tests___units___test_state____child_state.tests___units___test_state____grandchild_state" ) @@ -517,12 +524,10 @@ def test_set_class_var(): """Test setting the var of a class.""" with pytest.raises(AttributeError): TestState.num3 # type: ignore - TestState._set_var( - BaseVar(_var_name="num3", _var_type=int)._var_set_state(TestState) - ) + TestState._set_var(Var(_js_expr="num3", _var_type=int)._var_set_state(TestState)) var = TestState.num3 # type: ignore - assert var._var_name == "num3" - assert var._var_type == int + assert var._js_expr == TestState.get_full_name() + ".num3" + assert var._var_type is int assert var._var_state == TestState.get_full_name() @@ -649,7 +654,12 @@ def test_set_dirty_var(test_state): assert test_state.dirty_vars == set() -def test_set_dirty_substate(test_state, child_state, child_state2, grandchild_state): +def test_set_dirty_substate( + test_state: TestState, + child_state: ChildState, + child_state2: ChildState2, + grandchild_state: GrandchildState, +): """Test changing substate vars marks the value as dirty. Args: @@ -697,6 +707,7 @@ def test_reset(test_state, child_state): # Set some values. test_state.num1 = 1 test_state.num2 = 2 + test_state._backend = 3 child_state.value = "test" # Reset the state. @@ -705,6 +716,7 @@ def test_reset(test_state, child_state): # The values should be reset. assert test_state.num1 == 0 assert test_state.num2 == 3.14 + assert test_state._backend == 0 assert child_state.value == "" expected_dirty_vars = { @@ -720,6 +732,7 @@ def test_reset(test_state, child_state): "map_key", "mapping", "dt", + "_backend", } # The dirty vars should be reset. @@ -860,8 +873,10 @@ def test_get_headers(test_state, router_data, router_data_headers): router_data: The router data fixture. router_data_headers: The expected headers. """ + print(router_data_headers) test_state.router = RouterData(router_data) - assert test_state.router.headers.dict() == { + print(test_state.router.headers) + assert dataclasses.asdict(test_state.router.headers) == { format.to_snake_case(k): v for k, v in router_data_headers.items() } @@ -1275,19 +1290,19 @@ def test_computed_var_depends_on_parent_non_cached(): assert ps.dirty_vars == set() assert cs.dirty_vars == set() - dict1 = ps.dict() + dict1 = json.loads(json_dumps(ps.dict())) assert dict1[ps.get_full_name()] == { "no_cache_v": 1, "router": formatted_router, } assert dict1[cs.get_full_name()] == {"dep_v": 2} - dict2 = ps.dict() + dict2 = json.loads(json_dumps(ps.dict())) assert dict2[ps.get_full_name()] == { "no_cache_v": 3, "router": formatted_router, } assert dict2[cs.get_full_name()] == {"dep_v": 4} - dict3 = ps.dict() + dict3 = json.loads(json_dumps(ps.dict())) assert dict3[ps.get_full_name()] == { "no_cache_v": 5, "router": formatted_router, @@ -1587,8 +1602,10 @@ async def test_state_with_invalid_yield(capsys, mock_app): assert "must only return/yield: None, Events or other EventHandlers" in captured.out -@pytest.fixture(scope="function", params=["in_process", "disk", "redis"]) -def state_manager(request) -> Generator[StateManager, None, None]: +@pytest_asyncio.fixture( + loop_scope="function", scope="function", params=["in_process", "disk", "redis"] +) +async def state_manager(request) -> AsyncGenerator[StateManager, None]: """Instance of state manager parametrized for redis and in-process. Args: @@ -1612,7 +1629,7 @@ def state_manager(request) -> Generator[StateManager, None, None]: yield state_manager if isinstance(state_manager, StateManagerRedis): - asyncio.get_event_loop().run_until_complete(state_manager.close()) + await state_manager.close() @pytest.fixture() @@ -1700,8 +1717,8 @@ async def test_state_manager_contend( assert not state_manager._states_locks[token].locked() -@pytest.fixture(scope="function") -def state_manager_redis() -> Generator[StateManager, None, None]: +@pytest_asyncio.fixture(loop_scope="function", scope="function") +async def state_manager_redis() -> AsyncGenerator[StateManager, None]: """Instance of state manager for redis only. Yields: @@ -1714,7 +1731,7 @@ def state_manager_redis() -> Generator[StateManager, None, None]: yield state_manager - asyncio.get_event_loop().run_until_complete(state_manager.close()) + await state_manager.close() @pytest.fixture() @@ -1874,11 +1891,11 @@ async def test_state_proxy(grandchild_state: GrandchildState, mock_app: rx.App): async with sp: assert sp._self_actx is not None assert sp._self_mutable # proxy is mutable inside context - if isinstance(mock_app.state_manager, StateManagerMemory): + if isinstance(mock_app.state_manager, (StateManagerMemory, StateManagerDisk)): # For in-process store, only one instance of the state exists assert sp.__wrapped__ is grandchild_state else: - # When redis or disk is used, a new+updated instance is assigned to the proxy + # When redis is used, a new+updated instance is assigned to the proxy assert sp.__wrapped__ is not grandchild_state sp.value2 = "42" assert not sp._self_mutable # proxy is not mutable after exiting context @@ -1889,7 +1906,7 @@ async def test_state_proxy(grandchild_state: GrandchildState, mock_app: rx.App): gotten_state = await mock_app.state_manager.get_state( _substate_key(grandchild_state.router.session.client_token, grandchild_state) ) - if isinstance(mock_app.state_manager, StateManagerMemory): + if isinstance(mock_app.state_manager, (StateManagerMemory, StateManagerDisk)): # For in-process store, only one instance of the state exists assert gotten_state is parent_state else: @@ -1903,19 +1920,21 @@ async def test_state_proxy(grandchild_state: GrandchildState, mock_app: rx.App): mock_app.event_namespace.emit.assert_called_once() mcall = mock_app.event_namespace.emit.mock_calls[0] assert mcall.args[0] == str(SocketEvent.EVENT) - assert json.loads(mcall.args[1]) == StateUpdate( - delta={ - parent_state.get_full_name(): { - "upper": "", - "sum": 3.14, - }, - grandchild_state.get_full_name(): { - "value2": "42", - }, - GrandchildState3.get_full_name(): { - "computed": "", - }, - } + assert json.loads(mcall.args[1]) == dataclasses.asdict( + StateUpdate( + delta={ + parent_state.get_full_name(): { + "upper": "", + "sum": 3.14, + }, + grandchild_state.get_full_name(): { + "value2": "42", + }, + GrandchildState3.get_full_name(): { + "computed": "", + }, + } + ) ) assert mcall.kwargs["to"] == grandchild_state.router.session.session_id @@ -2483,7 +2502,10 @@ def test_mutable_copy_vars(mutable_state: MutableTestState, copy_func: Callable) def test_duplicate_substate_class(mocker): + # Neuter pytest escape hatch, because we want to test duplicate detection. mocker.patch("reflex.state.is_testing_env", lambda: False) + # Neuter state handling since these _are_ defined inside a function. + mocker.patch("reflex.state.BaseState._handle_local_def", lambda: None) with pytest.raises(ValueError): class TestState(BaseState): @@ -2511,7 +2533,7 @@ def test_json_dumps_with_mutables(): items: List[Foo] = [Foo()] dict_val = MutableContainsBase().dict() - assert isinstance(dict_val[MutableContainsBase.get_full_name()]["items"][0], dict) + assert isinstance(dict_val[MutableContainsBase.get_full_name()]["items"][0], Foo) val = json_dumps(dict_val) f_items = '[{"tags": ["123", "456"]}]' f_formatted_router = str(formatted_router).replace("'", '"') @@ -2778,6 +2800,9 @@ async def test_preprocess(app_module_mock, token, test_state, expected, mocker): } assert (await state._process(events[1]).__anext__()).delta == exp_is_hydrated(state) + if isinstance(app.state_manager, StateManagerRedis): + await app.state_manager.close() + @pytest.mark.asyncio async def test_preprocess_multiple_load_events(app_module_mock, token, mocker): @@ -2825,6 +2850,9 @@ async def test_preprocess_multiple_load_events(app_module_mock, token, mocker): } assert (await state._process(events[2]).__anext__()).delta == exp_is_hydrated(state) + if isinstance(app.state_manager, StateManagerRedis): + await app.state_manager.close() + @pytest.mark.asyncio async def test_get_state(mock_app: rx.App, token: str): @@ -2910,7 +2938,7 @@ async def test_get_state(mock_app: rx.App, token: str): _substate_key(token, ChildState2) ) assert isinstance(new_test_state, TestState) - if isinstance(mock_app.state_manager, StateManagerMemory): + if isinstance(mock_app.state_manager, (StateManagerMemory, StateManagerDisk)): # In memory, it's the same instance assert new_test_state is test_state test_state._clean() @@ -2920,15 +2948,6 @@ async def test_get_state(mock_app: rx.App, token: str): ChildState2.get_name(), ChildState3.get_name(), ) - elif isinstance(mock_app.state_manager, StateManagerDisk): - # On disk, it's a new instance - assert new_test_state is not test_state - # All substates are available - assert tuple(sorted(new_test_state.substates)) == ( - ChildState.get_name(), - ChildState2.get_name(), - ChildState3.get_name(), - ) else: # With redis, we get a whole new instance assert new_test_state is not test_state @@ -3077,6 +3096,51 @@ def test_potentially_dirty_substates(): assert C1._potentially_dirty_substates() == set() +def test_router_var_dep() -> None: + """Test that router var dependencies are correctly tracked.""" + + class RouterVarParentState(State): + """A parent state for testing router var dependency.""" + + pass + + class RouterVarDepState(RouterVarParentState): + """A state with a router var dependency.""" + + @rx.var(cache=True) + def foo(self) -> str: + return self.router.page.params.get("foo", "") + + foo = RouterVarDepState.computed_vars["foo"] + State._init_var_dependency_dicts() + + assert foo._deps(objclass=RouterVarDepState) == {"router"} + assert RouterVarParentState._potentially_dirty_substates() == {RouterVarDepState} + assert RouterVarParentState._substate_var_dependencies == { + "router": {RouterVarDepState.get_name()} + } + assert RouterVarDepState._computed_var_dependencies == { + "router": {"foo"}, + } + + rx_state = State() + parent_state = RouterVarParentState() + state = RouterVarDepState() + + # link states + rx_state.substates = {RouterVarParentState.get_name(): parent_state} + parent_state.parent_state = rx_state + state.parent_state = parent_state + parent_state.substates = {RouterVarDepState.get_name(): state} + + assert state.dirty_vars == set() + + # Reassign router var + state.router = state.router + assert state.dirty_vars == {"foo", "router"} + assert parent_state.dirty_substates == {RouterVarDepState.get_name()} + + @pytest.mark.asyncio async def test_setvar(mock_app: rx.App, token: str): """Test that setvar works correctly. @@ -3140,6 +3204,7 @@ import reflex as rx config = rx.Config( app_name="project1", redis_url="redis://localhost:6379", + state_manager_mode="redis", {config_items} ) """ @@ -3160,6 +3225,16 @@ class MixinState(State, mixin=True): num: int = 0 _backend: int = 0 + _backend_no_default: dict + + @rx.var(cache=True) + def computed(self) -> str: + """A computed var on mixin state. + + Returns: + A computed value. + """ + return "" class UsesMixinState(MixinState, State): @@ -3168,8 +3243,73 @@ class UsesMixinState(MixinState, State): pass +class ChildUsesMixinState(UsesMixinState): + """A child state that uses the mixin state.""" + + pass + + def test_mixin_state() -> None: """Test that a mixin state works correctly.""" assert "num" in UsesMixinState.base_vars assert "num" in UsesMixinState.vars - assert UsesMixinState.backend_vars == {"_backend": 0} + assert UsesMixinState.backend_vars == {"_backend": 0, "_backend_no_default": {}} + + assert "computed" in UsesMixinState.computed_vars + assert "computed" in UsesMixinState.vars + + assert ( + UsesMixinState(_reflex_internal_init=True)._backend_no_default # type: ignore + is not UsesMixinState.backend_vars["_backend_no_default"] + ) + + +def test_child_mixin_state() -> None: + """Test that mixin vars are only applied to the highest state in the hierarchy.""" + assert "num" in ChildUsesMixinState.inherited_vars + assert "num" not in ChildUsesMixinState.base_vars + + assert "computed" in ChildUsesMixinState.inherited_vars + assert "computed" not in ChildUsesMixinState.computed_vars + + +def test_assignment_to_undeclared_vars(): + """Test that an attribute error is thrown when undeclared vars are set.""" + + class State(BaseState): + val: str + _val: str + __val: str # type: ignore + + def handle_supported_regular_vars(self): + self.val = "no underscore" + self._val = "single leading underscore" + self.__val = "double leading undercore" + + def handle_regular_var(self): + self.num = 5 + + def handle_backend_var(self): + self._num = 5 + + def handle_non_var(self): + self.__num = 5 + + class Substate(State): + def handle_var(self): + self.value = 20 + + state = State() # type: ignore + sub_state = Substate() # type: ignore + + with pytest.raises(SetUndefinedStateVarError): + state.handle_regular_var() + + with pytest.raises(SetUndefinedStateVarError): + sub_state.handle_var() + + with pytest.raises(SetUndefinedStateVarError): + state.handle_backend_var() + + state.handle_supported_regular_vars() + state.handle_non_var() diff --git a/tests/test_state_tree.py b/tests/units/test_state_tree.py similarity index 97% rename from tests/test_state_tree.py rename to tests/units/test_state_tree.py index 7c1e13a91..ebdd877de 100644 --- a/tests/test_state_tree.py +++ b/tests/units/test_state_tree.py @@ -1,9 +1,9 @@ """Specialized test for a larger state tree.""" -import asyncio -from typing import Generator +from typing import AsyncGenerator import pytest +import pytest_asyncio import reflex as rx from reflex.state import BaseState, StateManager, StateManagerRedis, _substate_key @@ -210,8 +210,10 @@ ALWAYS_COMPUTED_DICT_KEYS = [ ] -@pytest.fixture(scope="function") -def state_manager_redis(app_module_mock) -> Generator[StateManager, None, None]: +@pytest_asyncio.fixture(loop_scope="function", scope="function") +async def state_manager_redis( + app_module_mock, +) -> AsyncGenerator[StateManager, None]: """Instance of state manager for redis only. Args: @@ -228,7 +230,7 @@ def state_manager_redis(app_module_mock) -> Generator[StateManager, None, None]: yield state_manager - asyncio.get_event_loop().run_until_complete(state_manager.close()) + await state_manager.close() @pytest.mark.asyncio diff --git a/tests/test_style.py b/tests/units/test_style.py similarity index 97% rename from tests/test_style.py rename to tests/units/test_style.py index 8fa443cdf..e1d652798 100644 --- a/tests/test_style.py +++ b/tests/units/test_style.py @@ -7,17 +7,17 @@ import pytest import reflex as rx from reflex import style from reflex.components.component import evaluate_style_namespaces -from reflex.ivars.base import ImmutableVar, LiteralVar from reflex.style import Style -from reflex.vars import ImmutableVarData, Var, VarData +from reflex.vars import VarData +from reflex.vars.base import LiteralVar, Var test_style = [ ({"a": 1}, {"a": 1}), ({"a": LiteralVar.create("abc")}, {"a": "abc"}), ({"test_case": 1}, {"testCase": 1}), - ({"test_case": {"a": 1}}, {"testCase": {"a": 1}}), - ({":test_case": {"a": 1}}, {":testCase": {"a": 1}}), - ({"::test_case": {"a": 1}}, {"::testCase": {"a": 1}}), + ({"test_case": {"a": 1}}, {"test_case": {"a": 1}}), + ({":test_case": {"a": 1}}, {":test_case": {"a": 1}}), + ({"::test_case": {"a": 1}}, {"::test_case": {"a": 1}}), ( {"::-webkit-scrollbar": {"display": "none"}}, {"::-webkit-scrollbar": {"display": "none"}}, @@ -377,8 +377,8 @@ class StyleState(rx.State): ( {"color": f"dark{StyleState.color}"}, { - "css": ImmutableVar.create_safe( - f'({{ ["color"] : ("dark"+{StyleState.color}) }})' + "css": Var( + _js_expr=f'({{ ["color"] : ("dark"+{StyleState.color}) }})' ).to(Dict[str, str]) }, ), @@ -504,7 +504,7 @@ def test_style_via_component_with_state( comp = rx.el.div(**kwargs) assert ( - ImmutableVarData.merge(comp.style._var_data) + VarData.merge(comp.style._var_data) == expected_get_style["css"]._get_all_var_data() ) # Assert that style values are equal. diff --git a/tests/test_telemetry.py b/tests/units/test_telemetry.py similarity index 96% rename from tests/test_telemetry.py rename to tests/units/test_telemetry.py index a434779d4..25ad91323 100644 --- a/tests/test_telemetry.py +++ b/tests/units/test_telemetry.py @@ -52,4 +52,4 @@ def test_send(mocker, event): telemetry._send(event, telemetry_enabled=True) httpx_post_mock.assert_called_once() - pathlib_path_read_text_mock.assert_called_once() + assert pathlib_path_read_text_mock.call_count == 2 diff --git a/tests/test_testing.py b/tests/units/test_testing.py similarity index 100% rename from tests/test_testing.py rename to tests/units/test_testing.py diff --git a/tests/test_var.py b/tests/units/test_var.py similarity index 57% rename from tests/test_var.py rename to tests/units/test_var.py index ba9cf24c8..a8b4b759d 100644 --- a/tests/test_var.py +++ b/tests/units/test_var.py @@ -1,51 +1,47 @@ import json import math +import sys import typing -from typing import Dict, List, Set, Tuple, Union +from typing import Dict, List, Optional, Set, Tuple, Union, cast import pytest from pandas import DataFrame +import reflex as rx from reflex.base import Base from reflex.constants.base import REFLEX_VAR_CLOSING_TAG, REFLEX_VAR_OPENING_TAG -from reflex.ivars.base import ( - ImmutableVar, +from reflex.state import BaseState +from reflex.utils.exceptions import PrimitiveUnserializableToJSON +from reflex.utils.imports import ImportVar +from reflex.vars import VarData +from reflex.vars.base import ( + ComputedVar, LiteralVar, + Var, + computed_var, var_operation, var_operation_return, ) -from reflex.ivars.function import ArgsFunctionOperation, FunctionStringVar -from reflex.ivars.number import ( +from reflex.vars.function import ArgsFunctionOperation, FunctionStringVar +from reflex.vars.number import ( LiteralBooleanVar, LiteralNumberVar, NumberVar, ) -from reflex.ivars.object import LiteralObjectVar -from reflex.ivars.sequence import ( +from reflex.vars.object import LiteralObjectVar, ObjectVar +from reflex.vars.sequence import ( ArrayVar, ConcatVarOperation, LiteralArrayVar, LiteralStringVar, ) -from reflex.state import BaseState -from reflex.utils.imports import ImportVar -from reflex.vars import ( - BaseVar, - ComputedVar, - ImmutableVarData, - Var, - VarData, - computed_var, -) test_vars = [ - BaseVar(_var_name="prop1", _var_type=int), - BaseVar(_var_name="key", _var_type=str), - BaseVar(_var_name="value", _var_type=str)._var_set_state("state"), - BaseVar(_var_name="local", _var_type=str, _var_is_local=True)._var_set_state( - "state" - ), - BaseVar(_var_name="local2", _var_type=str, _var_is_local=True), + Var(_js_expr="prop1", _var_type=int), + Var(_js_expr="key", _var_type=str), + Var(_js_expr="value", _var_type=str)._var_set_state("state"), + Var(_js_expr="local", _var_type=str)._var_set_state("state"), + Var(_js_expr="local2", _var_type=str), ] @@ -83,6 +79,11 @@ def ChildState(ParentState, TestObj): class ChildState(ParentState): @computed_var def var_without_annotation(self): + """This shadows ParentState.var_without_annotation. + + Returns: + TestObj: Test object. + """ return TestObj return ChildState @@ -93,6 +94,11 @@ def GrandChildState(ChildState, TestObj): class GrandChildState(ChildState): @computed_var def var_without_annotation(self): + """This shadows ChildState.var_without_annotation. + + Returns: + TestObj: Test object. + """ return TestObj return GrandChildState @@ -188,14 +194,14 @@ def test_full_name(prop, expected): prop: The var to test. expected: The expected full name. """ - assert prop._var_full_name == expected + assert str(prop) == expected @pytest.mark.parametrize( "prop,expected", zip( test_vars, - ["{prop1}", "{key}", "{state.value}", "state.local", "local2"], + ["prop1", "key", "state.value", "state.local", "local2"], ), ) def test_str(prop, expected): @@ -211,14 +217,14 @@ def test_str(prop, expected): @pytest.mark.parametrize( "prop,expected", [ - (BaseVar(_var_name="p", _var_type=int), 0), - (BaseVar(_var_name="p", _var_type=float), 0.0), - (BaseVar(_var_name="p", _var_type=str), ""), - (BaseVar(_var_name="p", _var_type=bool), False), - (BaseVar(_var_name="p", _var_type=list), []), - (BaseVar(_var_name="p", _var_type=dict), {}), - (BaseVar(_var_name="p", _var_type=tuple), ()), - (BaseVar(_var_name="p", _var_type=set), set()), + (Var(_js_expr="p", _var_type=int), 0), + (Var(_js_expr="p", _var_type=float), 0.0), + (Var(_js_expr="p", _var_type=str), ""), + (Var(_js_expr="p", _var_type=bool), False), + (Var(_js_expr="p", _var_type=list), []), + (Var(_js_expr="p", _var_type=dict), {}), + (Var(_js_expr="p", _var_type=tuple), ()), + (Var(_js_expr="p", _var_type=set), set()), ], ) def test_default_value(prop, expected): @@ -257,14 +263,14 @@ def test_get_setter(prop, expected): @pytest.mark.parametrize( "value,expected", [ - (None, None), - (1, BaseVar(_var_name="1", _var_type=int, _var_is_local=True)), - ("key", BaseVar(_var_name="key", _var_type=str, _var_is_local=True)), - (3.14, BaseVar(_var_name="3.14", _var_type=float, _var_is_local=True)), - ([1, 2, 3], BaseVar(_var_name="[1, 2, 3]", _var_type=list, _var_is_local=True)), + (None, Var(_js_expr="null", _var_type=None)), + (1, Var(_js_expr="1", _var_type=int)), + ("key", Var(_js_expr='"key"', _var_type=str)), + (3.14, Var(_js_expr="3.14", _var_type=float)), + ([1, 2, 3], Var(_js_expr="[1, 2, 3]", _var_type=List[int])), ( {"a": 1, "b": 2}, - BaseVar(_var_name='{"a": 1, "b": 2}', _var_type=dict, _var_is_local=True), + Var(_js_expr='({ ["a"] : 1, ["b"] : 2 })', _var_type=Dict[str, int]), ), ], ) @@ -275,11 +281,8 @@ def test_create(value, expected): value: The value to create a var from. expected: The expected name of the setter function. """ - prop = Var.create(value) - if value is None: - assert prop == expected - else: - assert prop.equals(expected) # type: ignore + prop = LiteralVar.create(value) + assert prop.equals(expected) # type: ignore def test_create_type_error(): @@ -291,17 +294,11 @@ def test_create_type_error(): value = ErrorType() with pytest.raises(TypeError): - Var.create(value) + LiteralVar.create(value) def v(value) -> Var: - val = ( - Var.create(json.dumps(value), _var_is_string=True, _var_is_local=False) - if isinstance(value, str) - else Var.create(value, _var_is_local=False) - ) - assert val is not None - return val + return LiteralVar.create(value) def test_basic_operations(TestObj): @@ -310,130 +307,65 @@ def test_basic_operations(TestObj): Args: TestObj: The test object. """ - assert str(v(1) == v(2)) == "{((1) === (2))}" - assert str(v(1) != v(2)) == "{((1) !== (2))}" - assert str(v(1) < v(2)) == "{((1) < (2))}" - assert str(v(1) <= v(2)) == "{((1) <= (2))}" - assert str(v(1) > v(2)) == "{((1) > (2))}" - assert str(v(1) >= v(2)) == "{((1) >= (2))}" - assert str(v(1) + v(2)) == "{((1) + (2))}" - assert str(v(1) - v(2)) == "{((1) - (2))}" - assert str(v(1) * v(2)) == "{((1) * (2))}" - assert str(v(1) / v(2)) == "{((1) / (2))}" - assert str(v(1) // v(2)) == "{Math.floor((1) / (2))}" - assert str(v(1) % v(2)) == "{((1) % (2))}" - assert str(v(1) ** v(2)) == "{Math.pow((1) , (2))}" - assert str(v(1) & v(2)) == "{((1) && (2))}" - assert str(v(1) | v(2)) == "{((1) || (2))}" - assert str(v([1, 2, 3])[v(0)]) == "{[1, 2, 3].at(0)}" - assert str(v({"a": 1, "b": 2})["a"]) == '{{"a": 1, "b": 2}["a"]}' - assert str(v("foo") == v("bar")) == '{(("foo") === ("bar"))}' + assert str(v(1) == v(2)) == "(1 === 2)" + assert str(v(1) != v(2)) == "(1 !== 2)" + assert str(LiteralNumberVar.create(1) < 2) == "(1 < 2)" + assert str(LiteralNumberVar.create(1) <= 2) == "(1 <= 2)" + assert str(LiteralNumberVar.create(1) > 2) == "(1 > 2)" + assert str(LiteralNumberVar.create(1) >= 2) == "(1 >= 2)" + assert str(LiteralNumberVar.create(1) + 2) == "(1 + 2)" + assert str(LiteralNumberVar.create(1) - 2) == "(1 - 2)" + assert str(LiteralNumberVar.create(1) * 2) == "(1 * 2)" + assert str(LiteralNumberVar.create(1) / 2) == "(1 / 2)" + assert str(LiteralNumberVar.create(1) // 2) == "Math.floor(1 / 2)" + assert str(LiteralNumberVar.create(1) % 2) == "(1 % 2)" + assert str(LiteralNumberVar.create(1) ** 2) == "(1 ** 2)" + assert str(LiteralNumberVar.create(1) & v(2)) == "(1 && 2)" + assert str(LiteralNumberVar.create(1) | v(2)) == "(1 || 2)" + assert str(LiteralArrayVar.create([1, 2, 3])[0]) == "[1, 2, 3].at(0)" + assert ( + str(LiteralObjectVar.create({"a": 1, "b": 2})["a"]) + == '({ ["a"] : 1, ["b"] : 2 })["a"]' + ) + assert str(v("foo") == v("bar")) == '("foo" === "bar")' + assert str(Var(_js_expr="foo") == Var(_js_expr="bar")) == "(foo === bar)" + assert ( + str(LiteralVar.create("foo") == LiteralVar.create("bar")) == '("foo" === "bar")' + ) + print(Var(_js_expr="foo").to(ObjectVar, TestObj)._var_set_state("state")) assert ( str( - Var.create("foo", _var_is_local=False) - == Var.create("bar", _var_is_local=False) + Var(_js_expr="foo").to(ObjectVar, TestObj)._var_set_state("state").bar + == LiteralVar.create("bar") ) - == "{((foo) === (bar))}" + == '(state.foo["bar"] === "bar")' ) assert ( - str( - BaseVar( - _var_name="foo", _var_type=str, _var_is_string=True, _var_is_local=True - ) - == BaseVar( - _var_name="bar", _var_type=str, _var_is_string=True, _var_is_local=True - ) - ) - == "((`foo`) === (`bar`))" + str(Var(_js_expr="foo").to(ObjectVar, TestObj)._var_set_state("state").bar) + == 'state.foo["bar"]' ) + assert str(abs(LiteralNumberVar.create(1))) == "Math.abs(1)" + assert str(LiteralArrayVar.create([1, 2, 3]).length()) == "[1, 2, 3].length" assert ( - str( - BaseVar( - _var_name="foo", - _var_type=TestObj, - _var_is_string=True, - _var_is_local=False, - ) - ._var_set_state("state") - .bar - == BaseVar( - _var_name="bar", _var_type=str, _var_is_string=True, _var_is_local=True - ) - ) - == "{((state.foo.bar) === (`bar`))}" + str(LiteralArrayVar.create([1, 2]) + LiteralArrayVar.create([3, 4])) + == "[...[1, 2], ...[3, 4]]" ) - assert ( - str(BaseVar(_var_name="foo", _var_type=TestObj)._var_set_state("state").bar) - == "{state.foo.bar}" - ) - assert str(abs(v(1))) == "{Math.abs(1)}" - assert str(v([1, 2, 3]).length()) == "{[1, 2, 3].length}" - assert str(v([1, 2]) + v([3, 4])) == "{spreadArraysOrObjects(([1, 2]) , ([3, 4]))}" # Tests for reverse operation - assert str(v([1, 2, 3]).reverse()) == "{[...[1, 2, 3]].reverse()}" - assert str(v(["1", "2", "3"]).reverse()) == '{[...["1", "2", "3"]].reverse()}' assert ( - str(BaseVar(_var_name="foo", _var_type=list)._var_set_state("state").reverse()) - == "{[...state.foo].reverse()}" + str(LiteralArrayVar.create([1, 2, 3]).reverse()) + == "[1, 2, 3].slice().reverse()" ) assert ( - str(BaseVar(_var_name="foo", _var_type=list).reverse()) - == "{[...foo].reverse()}" - ) - assert str(BaseVar(_var_name="foo", _var_type=str)._type()) == "{typeof foo}" # type: ignore - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() == str) # type: ignore - == "{((typeof foo) === (`string`))}" + str(LiteralArrayVar.create(["1", "2", "3"]).reverse()) + == '["1", "2", "3"].slice().reverse()' ) assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() == str) # type: ignore - == "{((typeof foo) === (`string`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() == int) # type: ignore - == "{((typeof foo) === (`number`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() == list) # type: ignore - == "{((typeof foo) === (`Array`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() == float) # type: ignore - == "{((typeof foo) === (`number`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() == tuple) # type: ignore - == "{((typeof foo) === (`Array`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() == dict) # type: ignore - == "{((typeof foo) === (`Object`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() != str) # type: ignore - == "{((typeof foo) !== (`string`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() != int) # type: ignore - == "{((typeof foo) !== (`number`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() != list) # type: ignore - == "{((typeof foo) !== (`Array`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() != float) # type: ignore - == "{((typeof foo) !== (`number`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() != tuple) # type: ignore - == "{((typeof foo) !== (`Array`))}" - ) - assert ( - str(BaseVar(_var_name="foo", _var_type=str)._type() != dict) # type: ignore - == "{((typeof foo) !== (`Object`))}" + str(Var(_js_expr="foo")._var_set_state("state").to(list).reverse()) + == "state.foo.slice().reverse()" ) + assert str(Var(_js_expr="foo").to(list).reverse()) == "foo.slice().reverse()" + assert str(Var(_js_expr="foo", _var_type=str).js_type()) == "(typeof(foo))" @pytest.mark.parametrize( @@ -442,76 +374,117 @@ def test_basic_operations(TestObj): (v([1, 2, 3]), "[1, 2, 3]"), (v(set([1, 2, 3])), "[1, 2, 3]"), (v(["1", "2", "3"]), '["1", "2", "3"]'), - (BaseVar(_var_name="foo", _var_type=list)._var_set_state("state"), "state.foo"), - (BaseVar(_var_name="foo", _var_type=list), "foo"), + ( + Var(_js_expr="foo")._var_set_state("state").to(list), + "state.foo", + ), + (Var(_js_expr="foo").to(list), "foo"), (v((1, 2, 3)), "[1, 2, 3]"), (v(("1", "2", "3")), '["1", "2", "3"]'), ( - BaseVar(_var_name="foo", _var_type=tuple)._var_set_state("state"), + Var(_js_expr="foo")._var_set_state("state").to(tuple), "state.foo", ), - (BaseVar(_var_name="foo", _var_type=tuple), "foo"), + (Var(_js_expr="foo").to(tuple), "foo"), ], ) def test_list_tuple_contains(var, expected): - assert str(var.contains(1)) == f"{{{expected}.includes(1)}}" - assert str(var.contains("1")) == f'{{{expected}.includes("1")}}' - assert str(var.contains(v(1))) == f"{{{expected}.includes(1)}}" - assert str(var.contains(v("1"))) == f'{{{expected}.includes("1")}}' - other_state_var = BaseVar(_var_name="other", _var_type=str)._var_set_state("state") - other_var = BaseVar(_var_name="other", _var_type=str) - assert str(var.contains(other_state_var)) == f"{{{expected}.includes(state.other)}}" - assert str(var.contains(other_var)) == f"{{{expected}.includes(other)}}" + assert str(var.contains(1)) == f"{expected}.includes(1)" + assert str(var.contains("1")) == f'{expected}.includes("1")' + assert str(var.contains(v(1))) == f"{expected}.includes(1)" + assert str(var.contains(v("1"))) == f'{expected}.includes("1")' + other_state_var = Var(_js_expr="other", _var_type=str)._var_set_state("state") + other_var = Var(_js_expr="other", _var_type=str) + assert str(var.contains(other_state_var)) == f"{expected}.includes(state.other)" + assert str(var.contains(other_var)) == f"{expected}.includes(other)" + + +class Foo(rx.Base): + """Foo class.""" + + bar: int + baz: str + + +class Bar(rx.Base): + """Bar class.""" + + bar: str + baz: str + foo: int + + +@pytest.mark.parametrize( + ("var", "var_type"), + ( + [ + (Var(_js_expr="", _var_type=Foo | Bar).guess_type(), Foo | Bar), + (Var(_js_expr="", _var_type=Foo | Bar).guess_type().bar, Union[int, str]), + ] + if sys.version_info >= (3, 10) + else [] + ) + + [ + (Var(_js_expr="", _var_type=Union[Foo, Bar]).guess_type(), Union[Foo, Bar]), + (Var(_js_expr="", _var_type=Union[Foo, Bar]).guess_type().baz, str), + ( + Var(_js_expr="", _var_type=Union[Foo, Bar]).guess_type().foo, + Union[int, None], + ), + ], +) +def test_var_types(var, var_type): + assert var._var_type == var_type @pytest.mark.parametrize( "var, expected", [ (v("123"), json.dumps("123")), - (BaseVar(_var_name="foo", _var_type=str)._var_set_state("state"), "state.foo"), - (BaseVar(_var_name="foo", _var_type=str), "foo"), + (Var(_js_expr="foo")._var_set_state("state").to(str), "state.foo"), + (Var(_js_expr="foo").to(str), "foo"), ], ) def test_str_contains(var, expected): - assert str(var.contains("1")) == f'{{{expected}.includes("1")}}' - assert str(var.contains(v("1"))) == f'{{{expected}.includes("1")}}' - other_state_var = BaseVar(_var_name="other", _var_type=str)._var_set_state("state") - other_var = BaseVar(_var_name="other", _var_type=str) - assert str(var.contains(other_state_var)) == f"{{{expected}.includes(state.other)}}" - assert str(var.contains(other_var)) == f"{{{expected}.includes(other)}}" + assert str(var.contains("1")) == f'{expected}.includes("1")' + assert str(var.contains(v("1"))) == f'{expected}.includes("1")' + other_state_var = Var(_js_expr="other")._var_set_state("state").to(str) + other_var = Var(_js_expr="other").to(str) + assert str(var.contains(other_state_var)) == f"{expected}.includes(state.other)" + assert str(var.contains(other_var)) == f"{expected}.includes(other)" assert ( - str(var.contains("1", "hello")) == f'{{{expected}.some(e=>e[`hello`]==="1")}}' + str(var.contains("1", "hello")) + == f'{expected}.some(obj => obj["hello"] === "1")' ) @pytest.mark.parametrize( "var, expected", [ - (v({"a": 1, "b": 2}), '{"a": 1, "b": 2}'), - (BaseVar(_var_name="foo", _var_type=dict)._var_set_state("state"), "state.foo"), - (BaseVar(_var_name="foo", _var_type=dict), "foo"), + (v({"a": 1, "b": 2}), '({ ["a"] : 1, ["b"] : 2 })'), + (Var(_js_expr="foo")._var_set_state("state").to(dict), "state.foo"), + (Var(_js_expr="foo").to(dict), "foo"), ], ) def test_dict_contains(var, expected): - assert str(var.contains(1)) == f"{{{expected}.hasOwnProperty(1)}}" - assert str(var.contains("1")) == f'{{{expected}.hasOwnProperty("1")}}' - assert str(var.contains(v(1))) == f"{{{expected}.hasOwnProperty(1)}}" - assert str(var.contains(v("1"))) == f'{{{expected}.hasOwnProperty("1")}}' - other_state_var = BaseVar(_var_name="other", _var_type=str)._var_set_state("state") - other_var = BaseVar(_var_name="other", _var_type=str) + assert str(var.contains(1)) == f"{expected}.hasOwnProperty(1)" + assert str(var.contains("1")) == f'{expected}.hasOwnProperty("1")' + assert str(var.contains(v(1))) == f"{expected}.hasOwnProperty(1)" + assert str(var.contains(v("1"))) == f'{expected}.hasOwnProperty("1")' + other_state_var = Var(_js_expr="other")._var_set_state("state").to(str) + other_var = Var(_js_expr="other").to(str) assert ( - str(var.contains(other_state_var)) - == f"{{{expected}.hasOwnProperty(state.other)}}" + str(var.contains(other_state_var)) == f"{expected}.hasOwnProperty(state.other)" ) - assert str(var.contains(other_var)) == f"{{{expected}.hasOwnProperty(other)}}" + assert str(var.contains(other_var)) == f"{expected}.hasOwnProperty(other)" @pytest.mark.parametrize( "var", [ - BaseVar(_var_name="list", _var_type=List[int]), - BaseVar(_var_name="tuple", _var_type=Tuple[int, int]), - BaseVar(_var_name="str", _var_type=str), + Var(_js_expr="list", _var_type=List[int]).guess_type(), + Var(_js_expr="tuple", _var_type=Tuple[int, int]).guess_type(), + Var(_js_expr="str", _var_type=str).guess_type(), ], ) def test_var_indexing_lists(var): @@ -521,18 +494,21 @@ def test_var_indexing_lists(var): var : The str, list or tuple base var. """ # Test basic indexing. - assert str(var[0]) == f"{{{var._var_name}.at(0)}}" - assert str(var[1]) == f"{{{var._var_name}.at(1)}}" + assert str(var[0]) == f"{var._js_expr}.at(0)" + assert str(var[1]) == f"{var._js_expr}.at(1)" # Test negative indexing. - assert str(var[-1]) == f"{{{var._var_name}.at(-1)}}" + assert str(var[-1]) == f"{var._js_expr}.at(-1)" @pytest.mark.parametrize( "var, type_", [ - (BaseVar(_var_name="list", _var_type=List[int]), [int, int]), - (BaseVar(_var_name="tuple", _var_type=Tuple[int, str]), [int, str]), + (Var(_js_expr="list", _var_type=List[int]).guess_type(), [int, int]), + ( + Var(_js_expr="tuple", _var_type=Tuple[int, str]).guess_type(), + [int, str], + ), ], ) def test_var_indexing_types(var, type_): @@ -543,37 +519,37 @@ def test_var_indexing_types(var, type_): type_ : The type on indexed object. """ - assert var[2]._var_type == type_[0] - assert var[3]._var_type == type_[1] + assert var[0]._var_type == type_[0] + assert var[1]._var_type == type_[1] def test_var_indexing_str(): """Test that we can index into str vars.""" - str_var = BaseVar(_var_name="str", _var_type=str) + str_var = Var(_js_expr="str").to(str) # Test that indexing gives a type of Var[str]. assert isinstance(str_var[0], Var) - assert str_var[0]._var_type == str + assert str_var[0]._var_type is str # Test basic indexing. - assert str(str_var[0]) == "{str.at(0)}" - assert str(str_var[1]) == "{str.at(1)}" + assert str(str_var[0]) == "str.at(0)" + assert str(str_var[1]) == "str.at(1)" # Test negative indexing. - assert str(str_var[-1]) == "{str.at(-1)}" + assert str(str_var[-1]) == "str.at(-1)" @pytest.mark.parametrize( "var", [ - (BaseVar(_var_name="foo", _var_type=int)), - (BaseVar(_var_name="bar", _var_type=float)), + (Var(_js_expr="foo", _var_type=int).guess_type()), + (Var(_js_expr="bar", _var_type=float).guess_type()), ], ) def test_var_replace_with_invalid_kwargs(var): with pytest.raises(TypeError) as excinfo: var._replace(_this_should_fail=True) - assert "Unexpected keyword arguments" in str(excinfo.value) + assert "unexpected keyword argument" in str(excinfo.value) def test_computed_var_replace_with_invalid_kwargs(): @@ -583,65 +559,71 @@ def test_computed_var_replace_with_invalid_kwargs(): with pytest.raises(TypeError) as excinfo: test_var._replace(_random_kwarg=True) - assert "Unexpected keyword arguments" in str(excinfo.value) + assert "Unexpected keyword argument" in str(excinfo.value) @pytest.mark.parametrize( "var, index", [ - (BaseVar(_var_name="lst", _var_type=List[int]), [1, 2]), - (BaseVar(_var_name="lst", _var_type=List[int]), {"name": "dict"}), - (BaseVar(_var_name="lst", _var_type=List[int]), {"set"}), + (Var(_js_expr="lst", _var_type=List[int]).guess_type(), [1, 2]), ( - BaseVar(_var_name="lst", _var_type=List[int]), + Var(_js_expr="lst", _var_type=List[int]).guess_type(), + {"name": "dict"}, + ), + (Var(_js_expr="lst", _var_type=List[int]).guess_type(), {"set"}), + ( + Var(_js_expr="lst", _var_type=List[int]).guess_type(), ( 1, 2, ), ), - (BaseVar(_var_name="lst", _var_type=List[int]), 1.5), - (BaseVar(_var_name="lst", _var_type=List[int]), "str"), + (Var(_js_expr="lst", _var_type=List[int]).guess_type(), 1.5), + (Var(_js_expr="lst", _var_type=List[int]).guess_type(), "str"), ( - BaseVar(_var_name="lst", _var_type=List[int]), - BaseVar(_var_name="string_var", _var_type=str), + Var(_js_expr="lst", _var_type=List[int]).guess_type(), + Var(_js_expr="string_var", _var_type=str).guess_type(), ), ( - BaseVar(_var_name="lst", _var_type=List[int]), - BaseVar(_var_name="float_var", _var_type=float), + Var(_js_expr="lst", _var_type=List[int]).guess_type(), + Var(_js_expr="float_var", _var_type=float).guess_type(), ), ( - BaseVar(_var_name="lst", _var_type=List[int]), - BaseVar(_var_name="list_var", _var_type=List[int]), + Var(_js_expr="lst", _var_type=List[int]).guess_type(), + Var(_js_expr="list_var", _var_type=List[int]).guess_type(), ), ( - BaseVar(_var_name="lst", _var_type=List[int]), - BaseVar(_var_name="set_var", _var_type=Set[str]), + Var(_js_expr="lst", _var_type=List[int]).guess_type(), + Var(_js_expr="set_var", _var_type=Set[str]).guess_type(), ), ( - BaseVar(_var_name="lst", _var_type=List[int]), - BaseVar(_var_name="dict_var", _var_type=Dict[str, str]), + Var(_js_expr="lst", _var_type=List[int]).guess_type(), + Var(_js_expr="dict_var", _var_type=Dict[str, str]).guess_type(), ), - (BaseVar(_var_name="str", _var_type=str), [1, 2]), - (BaseVar(_var_name="lst", _var_type=str), {"name": "dict"}), - (BaseVar(_var_name="lst", _var_type=str), {"set"}), + (Var(_js_expr="str", _var_type=str).guess_type(), [1, 2]), + (Var(_js_expr="lst", _var_type=str).guess_type(), {"name": "dict"}), + (Var(_js_expr="lst", _var_type=str).guess_type(), {"set"}), ( - BaseVar(_var_name="lst", _var_type=str), - BaseVar(_var_name="string_var", _var_type=str), + Var(_js_expr="lst", _var_type=str).guess_type(), + Var(_js_expr="string_var", _var_type=str).guess_type(), ), ( - BaseVar(_var_name="lst", _var_type=str), - BaseVar(_var_name="float_var", _var_type=float), + Var(_js_expr="lst", _var_type=str).guess_type(), + Var(_js_expr="float_var", _var_type=float).guess_type(), ), - (BaseVar(_var_name="str", _var_type=Tuple[str]), [1, 2]), - (BaseVar(_var_name="lst", _var_type=Tuple[str]), {"name": "dict"}), - (BaseVar(_var_name="lst", _var_type=Tuple[str]), {"set"}), + (Var(_js_expr="str", _var_type=Tuple[str]).guess_type(), [1, 2]), ( - BaseVar(_var_name="lst", _var_type=Tuple[str]), - BaseVar(_var_name="string_var", _var_type=str), + Var(_js_expr="lst", _var_type=Tuple[str]).guess_type(), + {"name": "dict"}, + ), + (Var(_js_expr="lst", _var_type=Tuple[str]).guess_type(), {"set"}), + ( + Var(_js_expr="lst", _var_type=Tuple[str]).guess_type(), + Var(_js_expr="string_var", _var_type=str).guess_type(), ), ( - BaseVar(_var_name="lst", _var_type=Tuple[str]), - BaseVar(_var_name="float_var", _var_type=float), + Var(_js_expr="lst", _var_type=Tuple[str]).guess_type(), + Var(_js_expr="float_var", _var_type=float).guess_type(), ), ], ) @@ -659,9 +641,8 @@ def test_var_unsupported_indexing_lists(var, index): @pytest.mark.parametrize( "var", [ - BaseVar(_var_name="lst", _var_type=List[int]), - BaseVar(_var_name="tuple", _var_type=Tuple[int, int]), - BaseVar(_var_name="str", _var_type=str), + Var(_js_expr="lst", _var_type=List[int]).guess_type(), + Var(_js_expr="tuple", _var_type=Tuple[int, int]).guess_type(), ], ) def test_var_list_slicing(var): @@ -670,84 +651,105 @@ def test_var_list_slicing(var): Args: var : The str, list or tuple base var. """ - assert str(var[:1]) == f"{{{var._var_name}.slice(0, 1)}}" - assert str(var[:1]) == f"{{{var._var_name}.slice(0, 1)}}" - assert str(var[:]) == f"{{{var._var_name}.slice(0, undefined)}}" + assert str(var[:1]) == f"{var._js_expr}.slice(undefined, 1)" + assert str(var[1:]) == f"{var._js_expr}.slice(1, undefined)" + assert str(var[:]) == f"{var._js_expr}.slice(undefined, undefined)" + + +def test_str_var_slicing(): + """Test that we can slice into str vars.""" + str_var = Var(_js_expr="str").to(str) + + # Test that slicing gives a type of Var[str]. + assert isinstance(str_var[:1], Var) + assert str_var[:1]._var_type is str + + # Test basic slicing. + assert str(str_var[:1]) == 'str.split("").slice(undefined, 1).join("")' + assert str(str_var[1:]) == 'str.split("").slice(1, undefined).join("")' + assert str(str_var[:]) == 'str.split("").slice(undefined, undefined).join("")' + assert str(str_var[1:2]) == 'str.split("").slice(1, 2).join("")' + + # Test negative slicing. + assert str(str_var[:-1]) == 'str.split("").slice(undefined, -1).join("")' + assert str(str_var[-1:]) == 'str.split("").slice(-1, undefined).join("")' + assert str(str_var[:-2]) == 'str.split("").slice(undefined, -2).join("")' + assert str(str_var[-2:]) == 'str.split("").slice(-2, undefined).join("")' def test_dict_indexing(): """Test that we can index into dict vars.""" - dct = BaseVar(_var_name="dct", _var_type=Dict[str, int]) + dct = Var(_js_expr="dct").to(ObjectVar, Dict[str, str]) # Check correct indexing. - assert str(dct["a"]) == '{dct["a"]}' - assert str(dct["asdf"]) == '{dct["asdf"]}' + assert str(dct["a"]) == 'dct["a"]' + assert str(dct["asdf"]) == 'dct["asdf"]' @pytest.mark.parametrize( "var, index", [ ( - BaseVar(_var_name="dict", _var_type=Dict[str, str]), + Var(_js_expr="dict", _var_type=Dict[str, str]).guess_type(), [1, 2], ), ( - BaseVar(_var_name="dict", _var_type=Dict[str, str]), + Var(_js_expr="dict", _var_type=Dict[str, str]).guess_type(), {"name": "dict"}, ), ( - BaseVar(_var_name="dict", _var_type=Dict[str, str]), + Var(_js_expr="dict", _var_type=Dict[str, str]).guess_type(), {"set"}, ), ( - BaseVar(_var_name="dict", _var_type=Dict[str, str]), + Var(_js_expr="dict", _var_type=Dict[str, str]).guess_type(), ( 1, 2, ), ), ( - BaseVar(_var_name="lst", _var_type=Dict[str, str]), - BaseVar(_var_name="list_var", _var_type=List[int]), + Var(_js_expr="lst", _var_type=Dict[str, str]).guess_type(), + Var(_js_expr="list_var", _var_type=List[int]).guess_type(), ), ( - BaseVar(_var_name="lst", _var_type=Dict[str, str]), - BaseVar(_var_name="set_var", _var_type=Set[str]), + Var(_js_expr="lst", _var_type=Dict[str, str]).guess_type(), + Var(_js_expr="set_var", _var_type=Set[str]).guess_type(), ), ( - BaseVar(_var_name="lst", _var_type=Dict[str, str]), - BaseVar(_var_name="dict_var", _var_type=Dict[str, str]), + Var(_js_expr="lst", _var_type=Dict[str, str]).guess_type(), + Var(_js_expr="dict_var", _var_type=Dict[str, str]).guess_type(), ), ( - BaseVar(_var_name="df", _var_type=DataFrame), + Var(_js_expr="df", _var_type=DataFrame).guess_type(), [1, 2], ), ( - BaseVar(_var_name="df", _var_type=DataFrame), + Var(_js_expr="df", _var_type=DataFrame).guess_type(), {"name": "dict"}, ), ( - BaseVar(_var_name="df", _var_type=DataFrame), + Var(_js_expr="df", _var_type=DataFrame).guess_type(), {"set"}, ), ( - BaseVar(_var_name="df", _var_type=DataFrame), + Var(_js_expr="df", _var_type=DataFrame).guess_type(), ( 1, 2, ), ), ( - BaseVar(_var_name="df", _var_type=DataFrame), - BaseVar(_var_name="list_var", _var_type=List[int]), + Var(_js_expr="df", _var_type=DataFrame).guess_type(), + Var(_js_expr="list_var", _var_type=List[int]).guess_type(), ), ( - BaseVar(_var_name="df", _var_type=DataFrame), - BaseVar(_var_name="set_var", _var_type=Set[str]), + Var(_js_expr="df", _var_type=DataFrame).guess_type(), + Var(_js_expr="set_var", _var_type=Set[str]).guess_type(), ), ( - BaseVar(_var_name="df", _var_type=DataFrame), - BaseVar(_var_name="dict_var", _var_type=Dict[str, str]), + Var(_js_expr="df", _var_type=DataFrame).guess_type(), + Var(_js_expr="dict_var", _var_type=Dict[str, str]).guess_type(), ), ], ) @@ -766,8 +768,6 @@ def test_var_unsupported_indexing_dicts(var, index): "fixture", [ "ParentState", - "ChildState", - "GrandChildState", "StateWithAnyVar", ], ) @@ -789,6 +789,26 @@ def test_computed_var_without_annotation_error(request, fixture): ) +@pytest.mark.parametrize( + "fixture", + [ + "ChildState", + "GrandChildState", + ], +) +def test_shadow_computed_var_error(request: pytest.FixtureRequest, fixture: str): + """Test that a name error is thrown when an attribute of a computed var is + shadowed by another attribute. + + Args: + request: Fixture Request. + fixture: The state fixture. + """ + with pytest.raises(NameError): + state = request.getfixturevalue(fixture) + state.var_without_annotation.foo + + @pytest.mark.parametrize( "fixture", [ @@ -899,8 +919,8 @@ def test_function_var(): manual_addition_func = ArgsFunctionOperation.create( ("a", "b"), { - "args": [ImmutableVar.create_safe("a"), ImmutableVar.create_safe("b")], - "result": ImmutableVar.create_safe("a + b"), + "args": [Var(_js_expr="a"), Var(_js_expr="b")], + "result": Var(_js_expr="a + b"), }, ) assert ( @@ -915,7 +935,7 @@ def test_function_var(): ) create_hello_statement = ArgsFunctionOperation.create( - ("name",), f"Hello, {ImmutableVar.create_safe('name')}!" + ("name",), f"Hello, {Var(_js_expr='name')}!" ) first_name = LiteralStringVar.create("Steven") last_name = LiteralStringVar.create("Universe") @@ -979,6 +999,21 @@ def test_all_number_operations(): ) +@pytest.mark.parametrize( + ("var", "expected"), + [ + (Var.create(False), "false"), + (Var.create(True), "true"), + (Var.create("false"), 'isTrue("false")'), + (Var.create([1, 2, 3]), "isTrue([1, 2, 3])"), + (Var.create({"a": 1, "b": 2}), 'isTrue(({ ["a"] : 1, ["b"] : 2 }))'), + (Var("mysterious_var"), "isTrue(mysterious_var)"), + ], +) +def test_boolify_operations(var, expected): + assert str(var.bool()) == expected + + def test_index_operation(): array_var = LiteralArrayVar.create([1, 2, 3, 4, 5]) assert str(array_var[0]) == "[1, 2, 3, 4, 5].at(0)" @@ -995,6 +1030,22 @@ def test_index_operation(): assert str(array_var[0].to(NumberVar) + 9) == "([1, 2, 3, 4, 5].at(0) + 9)" +@pytest.mark.parametrize( + "var, expected_js", + [ + (Var.create(float("inf")), "Infinity"), + (Var.create(-float("inf")), "-Infinity"), + (Var.create(float("nan")), "NaN"), + ], +) +def test_inf_and_nan(var, expected_js): + assert str(var) == expected_js + assert isinstance(var, NumberVar) + assert isinstance(var, LiteralVar) + with pytest.raises(PrimitiveUnserializableToJSON): + var.json() + + def test_array_operations(): array_var = LiteralArrayVar.create([1, 2, 3, 4, 5]) @@ -1041,6 +1092,29 @@ def test_object_operations(): ) +def test_var_component(): + class ComponentVarState(rx.State): + field_var: rx.Component = rx.text("I am a field var") + + @rx.var + def computed_var(self) -> rx.Component: + return rx.text("I am a computed var") + + def has_eval_react_component(var: Var): + var_data = var._get_all_var_data() + assert var_data is not None + assert any( + any( + imported_object.name == "evalReactComponent" + for imported_object in imported_objects + ) + for _, imported_objects in var_data.imports + ) + + has_eval_react_component(ComponentVarState.field_var) # type: ignore + has_eval_react_component(ComponentVarState.computed_var) + + def test_type_chains(): object_var = LiteralObjectVar.create({"a": 1, "b": 2, "c": 3}) assert (object_var._key_type(), object_var._value_type()) == (str, int) @@ -1079,7 +1153,9 @@ def nested_base(): bar: Boo baz: int - parent_obj = LiteralVar.create(Foo(bar=Boo(foo="bar", bar=5), baz=5)) + parent_obj = LiteralObjectVar.create( + Foo(bar=Boo(foo="bar", bar=5), baz=5).dict(), Foo + ) assert ( str(parent_obj.bar.foo) @@ -1088,7 +1164,7 @@ def nested_base(): def test_retrival(): - var_without_data = ImmutableVar.create("test") + var_without_data = Var(_js_expr="test") assert var_without_data is not None original_var_data = VarData( @@ -1104,8 +1180,8 @@ def test_retrival(): assert REFLEX_VAR_OPENING_TAG in f_string assert REFLEX_VAR_CLOSING_TAG in f_string - result_var_data = Var.create_safe(f_string)._var_data - result_immutable_var_data = ImmutableVar.create_safe(f_string)._var_data + result_var_data = LiteralVar.create(f_string)._get_all_var_data() + result_immutable_var_data = Var(_js_expr=f_string)._var_data assert result_var_data is not None and result_immutable_var_data is not None assert ( result_var_data.state @@ -1114,35 +1190,23 @@ def test_retrival(): ) assert ( result_var_data.imports - == ( - result_immutable_var_data.imports - if isinstance(result_immutable_var_data.imports, dict) - else { - k: list(v) - for k, v in result_immutable_var_data.imports - if k in original_var_data.imports - } - ) + == result_immutable_var_data.imports == original_var_data.imports ) assert ( - list(result_var_data.hooks.keys()) - == ( - list(result_immutable_var_data.hooks.keys()) - if isinstance(result_immutable_var_data.hooks, dict) - else list(result_immutable_var_data.hooks) - ) - == list(original_var_data.hooks.keys()) + tuple(result_var_data.hooks) + == tuple(result_immutable_var_data.hooks) + == tuple(original_var_data.hooks) ) def test_fstring_concat(): - original_var_with_data = Var.create_safe( + original_var_with_data = LiteralVar.create( "imagination", _var_data=VarData(state="fear") ) - immutable_var_with_data = ImmutableVar.create_safe( - "consequences", + immutable_var_with_data = Var( + _js_expr="consequences", _var_data=VarData( imports={ "react": [ImportVar(tag="useRef")], @@ -1160,9 +1224,9 @@ def test_fstring_concat(): ), ) - assert str(string_concat) == '("foo"+imagination+"bar"+consequences+"baz")' + assert str(string_concat) == '("fooimaginationbar"+consequences+"baz")' assert isinstance(string_concat, ConcatVarOperation) - assert string_concat._get_all_var_data() == ImmutableVarData( + assert string_concat._get_all_var_data() == VarData( state="fear", imports={ "react": [ImportVar(tag="useRef")], @@ -1172,17 +1236,22 @@ def test_fstring_concat(): ) +var = Var(_js_expr="var", _var_type=str) +myvar = Var(_js_expr="myvar", _var_type=int)._var_set_state("state") +x = Var(_js_expr="x", _var_type=str) + + @pytest.mark.parametrize( "out, expected", [ - (f"{BaseVar(_var_name='var', _var_type=str)}", "${var}"), + (f"{var}", f"{hash(var)}var"), ( - f"testing f-string with {BaseVar(_var_name='myvar', _var_type=int)._var_set_state('state')}", - 'testing f-string with ${"state": "state", "interpolations": [], "imports": {"/utils/context": [{"tag": "StateContexts", "is_default": false, "alias": null, "install": true, "render": true, "transpile": false}], "react": [{"tag": "useContext", "is_default": false, "alias": null, "install": true, "render": true, "transpile": false}]}, "hooks": {"const state = useContext(StateContexts.state)": null}, "string_length": 13}{state.myvar}', + f"testing f-string with {myvar}", + f"testing f-string with {hash(myvar)}state.myvar", ), ( - f"testing local f-string {BaseVar(_var_name='x', _var_is_local=True, _var_type=str)}", - "testing local f-string x", + f"testing local f-string {x}", + f"testing local f-string {hash(x)}x", ), ], ) @@ -1195,8 +1264,8 @@ def test_fstrings(out, expected): [ ([1], ""), ({"a": 1}, ""), - ([Var.create_safe(1)._var_set_state("foo")], "foo"), - ({"a": Var.create_safe(1)._var_set_state("foo")}, "foo"), + ([LiteralVar.create(1)._var_set_state("foo")], "foo"), + ({"a": LiteralVar.create(1)._var_set_state("foo")}, "foo"), ], ) def test_extract_state_from_container(value, expect_state): @@ -1206,7 +1275,9 @@ def test_extract_state_from_container(value, expect_state): value: The value to create a var from. expect_state: The expected state. """ - assert Var.create_safe(value)._var_state == expect_state + var_data = LiteralVar.create(value)._get_all_var_data() + var_state = var_data.state if var_data else "" + assert var_state == expect_state @pytest.mark.parametrize( @@ -1222,25 +1293,21 @@ def test_fstring_roundtrip(value): Args: value: The value to create a Var from. """ - var = BaseVar.create_safe(value)._var_set_state("state") - rt_var = Var.create_safe(f"{var}") + var = Var(_js_expr=value)._var_set_state("state") + rt_var = LiteralVar.create(f"{var}") assert var._var_state == rt_var._var_state - assert var._var_full_name_needs_state_prefix - assert not rt_var._var_full_name_needs_state_prefix - assert rt_var._var_name == var._var_full_name + assert str(rt_var) == str(var) @pytest.mark.parametrize( "var", [ - BaseVar(_var_name="var", _var_type=int), - BaseVar(_var_name="var", _var_type=float), - BaseVar(_var_name="var", _var_type=str), - BaseVar(_var_name="var", _var_type=bool), - BaseVar(_var_name="var", _var_type=dict), - BaseVar(_var_name="var", _var_type=tuple), - BaseVar(_var_name="var", _var_type=set), - BaseVar(_var_name="var", _var_type=None), + Var(_js_expr="var", _var_type=int).guess_type(), + Var(_js_expr="var", _var_type=float).guess_type(), + Var(_js_expr="var", _var_type=str).guess_type(), + Var(_js_expr="var", _var_type=bool).guess_type(), + Var(_js_expr="var", _var_type=dict).guess_type(), + Var(_js_expr="var", _var_type=None).guess_type(), ], ) def test_unsupported_types_for_reverse(var): @@ -1251,16 +1318,16 @@ def test_unsupported_types_for_reverse(var): """ with pytest.raises(TypeError) as err: var.reverse() - assert err.value.args[0] == f"Cannot reverse non-list var var." + assert err.value.args[0] == f"Cannot reverse non-list var." @pytest.mark.parametrize( "var", [ - BaseVar(_var_name="var", _var_type=int), - BaseVar(_var_name="var", _var_type=float), - BaseVar(_var_name="var", _var_type=bool), - BaseVar(_var_name="var", _var_type=None), + Var(_js_expr="var", _var_type=int).guess_type(), + Var(_js_expr="var", _var_type=float).guess_type(), + Var(_js_expr="var", _var_type=bool).guess_type(), + Var(_js_expr="var", _var_type=None).guess_type(), ], ) def test_unsupported_types_for_contains(var): @@ -1273,34 +1340,34 @@ def test_unsupported_types_for_contains(var): assert var.contains(1) assert ( err.value.args[0] - == f"Var var of type {var._var_type} does not support contains check." + == f"Var of type {var._var_type} does not support contains check." ) @pytest.mark.parametrize( "other", [ - BaseVar(_var_name="other", _var_type=int), - BaseVar(_var_name="other", _var_type=float), - BaseVar(_var_name="other", _var_type=bool), - BaseVar(_var_name="other", _var_type=list), - BaseVar(_var_name="other", _var_type=dict), - BaseVar(_var_name="other", _var_type=tuple), - BaseVar(_var_name="other", _var_type=set), + Var(_js_expr="other", _var_type=int).guess_type(), + Var(_js_expr="other", _var_type=float).guess_type(), + Var(_js_expr="other", _var_type=bool).guess_type(), + Var(_js_expr="other", _var_type=list).guess_type(), + Var(_js_expr="other", _var_type=dict).guess_type(), + Var(_js_expr="other", _var_type=tuple).guess_type(), + Var(_js_expr="other", _var_type=set).guess_type(), ], ) def test_unsupported_types_for_string_contains(other): with pytest.raises(TypeError) as err: - assert BaseVar(_var_name="var", _var_type=str).contains(other) + assert Var(_js_expr="var").to(str).contains(other) assert ( err.value.args[0] - == f"'in ' requires string as left operand, not {other._var_type}" + == f"Unsupported Operand type(s) for contains: ToStringOperation, {type(other).__name__}" ) def test_unsupported_default_contains(): with pytest.raises(TypeError) as err: - assert 1 in BaseVar(_var_name="var", _var_type=str) + assert 1 in Var(_js_expr="var", _var_type=str).guess_type() assert ( err.value.args[0] == "'in' operator not supported for Var types, use Var.contains() instead." @@ -1311,8 +1378,8 @@ def test_unsupported_default_contains(): "operand1_var,operand2_var,operators", [ ( - Var.create(10), - Var.create(5), + LiteralVar.create(10), + LiteralVar.create(5), [ "+", "-", @@ -1330,13 +1397,13 @@ def test_unsupported_default_contains(): ], ), ( - Var.create(10.5), - Var.create(5), + LiteralVar.create(10.5), + LiteralVar.create(5), ["+", "-", "/", "//", "*", "%", "**", ">", "<", "<=", ">="], ), ( - Var.create(5), - Var.create(True), + LiteralVar.create(5), + LiteralVar.create(True), [ "+", "-", @@ -1354,22 +1421,26 @@ def test_unsupported_default_contains(): ], ), ( - Var.create(10.5), - Var.create(5.5), + LiteralVar.create(10.5), + LiteralVar.create(5.5), ["+", "-", "/", "//", "*", "%", "**", ">", "<", "<=", ">="], ), ( - Var.create(10.5), - Var.create(True), + LiteralVar.create(10.5), + LiteralVar.create(True), ["+", "-", "/", "//", "*", "%", "**", ">", "<", "<=", ">="], ), - (Var.create("10"), Var.create("5"), ["+", ">", "<", "<=", ">="]), - (Var.create([10, 20]), Var.create([5, 6]), ["+", ">", "<", "<=", ">="]), - (Var.create([10, 20]), Var.create(5), ["*"]), - (Var.create([10, 20]), Var.create(True), ["*"]), + (LiteralVar.create("10"), LiteralVar.create("5"), ["+", ">", "<", "<=", ">="]), ( - Var.create(True), - Var.create(True), + LiteralVar.create([10, 20]), + LiteralVar.create([5, 6]), + ["+", ">", "<", "<=", ">="], + ), + (LiteralVar.create([10, 20]), LiteralVar.create(5), ["*"]), + (LiteralVar.create([10, 20]), LiteralVar.create(True), ["*"]), + ( + LiteralVar.create(True), + LiteralVar.create(True), [ "+", "-", @@ -1397,16 +1468,28 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s operators: list of supported operators. """ for operator in operators: - operand1_var.operation(op=operator, other=operand2_var) - operand1_var.operation(op=operator, other=operand2_var, flip=True) + print( + "testing", + operator, + "on", + operand1_var, + operand2_var, + " of types", + type(operand1_var), + type(operand2_var), + ) + eval(f"operand1_var {operator} operand2_var") + eval(f"operand2_var {operator} operand1_var") + # operand1_var.operation(op=operator, other=operand2_var) + # operand1_var.operation(op=operator, other=operand2_var, flip=True) @pytest.mark.parametrize( "operand1_var,operand2_var,operators", [ ( - Var.create(10), - Var.create(5), + LiteralVar.create(10), + LiteralVar.create(5), [ "^", "<<", @@ -1414,41 +1497,35 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s ], ), ( - Var.create(10.5), - Var.create(5), + LiteralVar.create(10.5), + LiteralVar.create(5), [ - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create(10.5), - Var.create(True), + LiteralVar.create(10.5), + LiteralVar.create(True), [ - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create(10.5), - Var.create(5.5), + LiteralVar.create(10.5), + LiteralVar.create(5.5), [ - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create("10"), - Var.create("5"), + LiteralVar.create("10"), + LiteralVar.create("5"), [ "-", "/", @@ -1456,16 +1533,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "*", "%", "**", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create([10, 20]), - Var.create([5, 6]), + LiteralVar.create([10, 20]), + LiteralVar.create([5, 6]), [ "-", "/", @@ -1473,16 +1548,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "*", "%", "**", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create([10, 20]), - Var.create(5), + LiteralVar.create([10, 20]), + LiteralVar.create(5), [ "+", "-", @@ -1494,16 +1567,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create([10, 20]), - Var.create(True), + LiteralVar.create([10, 20]), + LiteralVar.create(True), [ "+", "-", @@ -1515,16 +1586,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create([10, 20]), - Var.create("5"), + LiteralVar.create([10, 20]), + LiteralVar.create("5"), [ "+", "-", @@ -1537,16 +1606,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create([10, 20]), - Var.create({"key": "value"}), + LiteralVar.create([10, 20]), + LiteralVar.create({"key": "value"}), [ "+", "-", @@ -1559,16 +1626,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create([10, 20]), - Var.create(5.5), + LiteralVar.create([10, 20]), + LiteralVar.create(5.5), [ "+", "-", @@ -1581,16 +1646,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create({"key": "value"}), - Var.create({"another_key": "another_value"}), + LiteralVar.create({"key": "value"}), + LiteralVar.create({"another_key": "another_value"}), [ "+", "-", @@ -1603,16 +1666,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create({"key": "value"}), - Var.create(5), + LiteralVar.create({"key": "value"}), + LiteralVar.create(5), [ "+", "-", @@ -1625,16 +1686,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create({"key": "value"}), - Var.create(True), + LiteralVar.create({"key": "value"}), + LiteralVar.create(True), [ "+", "-", @@ -1647,16 +1706,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create({"key": "value"}), - Var.create(5.5), + LiteralVar.create({"key": "value"}), + LiteralVar.create(5.5), [ "+", "-", @@ -1669,16 +1726,14 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ( - Var.create({"key": "value"}), - Var.create("5"), + LiteralVar.create({"key": "value"}), + LiteralVar.create("5"), [ "+", "-", @@ -1691,44 +1746,48 @@ def test_valid_var_operations(operand1_var: Var, operand2_var, operators: List[s "<", "<=", ">=", - "|", "^", "<<", ">>", - "&", ], ), ], ) def test_invalid_var_operations(operand1_var: Var, operand2_var, operators: List[str]): for operator in operators: + print(f"testing {operator} on {str(operand1_var)} and {str(operand2_var)}") with pytest.raises(TypeError): - operand1_var.operation(op=operator, other=operand2_var) + print(eval(f"operand1_var {operator} operand2_var")) + # operand1_var.operation(op=operator, other=operand2_var) with pytest.raises(TypeError): - operand1_var.operation(op=operator, other=operand2_var, flip=True) + print(eval(f"operand2_var {operator} operand1_var")) + # operand1_var.operation(op=operator, other=operand2_var, flip=True) @pytest.mark.parametrize( "var, expected", [ - (Var.create("string_value", _var_is_string=True), "`string_value`"), - (Var.create(1), "1"), - (Var.create([1, 2, 3]), "[1, 2, 3]"), - (Var.create({"foo": "bar"}), '{"foo": "bar"}'), + (LiteralVar.create("string_value"), '"string_value"'), + (LiteralVar.create(1), "1"), + (LiteralVar.create([1, 2, 3]), "[1, 2, 3]"), + (LiteralVar.create({"foo": "bar"}), '({ ["foo"] : "bar" })'), ( - Var.create(ATestState.value, _var_is_string=True), + LiteralVar.create(ATestState.value), f"{ATestState.get_full_name()}.value", ), ( LiteralVar.create(f"{ATestState.value} string"), f'({ATestState.get_full_name()}.value+" string")', ), - (Var.create(ATestState.dict_val), f"{ATestState.get_full_name()}.dict_val"), + ( + LiteralVar.create(ATestState.dict_val), + f"{ATestState.get_full_name()}.dict_val", + ), ], ) def test_var_name_unwrapped(var, expected): - assert var._var_name_unwrapped == expected + assert str(var) == expected def cv_fget(state: BaseState) -> int: @@ -1771,3 +1830,24 @@ def test_invalid_computed_var_deps(deps: List): ) def test_var(state) -> int: return 1 + + +def test_to_string_operation(): + class Email(str): ... + + class TestState(BaseState): + optional_email: Optional[Email] = None + email: Email = Email("test@reflex.dev") + + assert ( + str(TestState.optional_email) == f"{TestState.get_full_name()}.optional_email" + ) + my_state = TestState() + assert my_state.optional_email is None + assert my_state.email == "test@reflex.dev" + + assert cast(Var, TestState.email)._var_type == Email + assert cast(Var, TestState.optional_email)._var_type == Optional[Email] + + single_var = Var.create(Email()) + assert single_var._var_type == Email diff --git a/tests/utils/__init__.py b/tests/units/utils/__init__.py similarity index 100% rename from tests/utils/__init__.py rename to tests/units/utils/__init__.py diff --git a/tests/utils/test_format.py b/tests/units/utils/test_format.py similarity index 71% rename from tests/utils/test_format.py rename to tests/units/utils/test_format.py index 4623f0fb2..17485d52e 100644 --- a/tests/utils/test_format.py +++ b/tests/units/utils/test_format.py @@ -1,19 +1,20 @@ from __future__ import annotations import datetime +import json from typing import Any, List import plotly.graph_objects as go import pytest from reflex.components.tags.tag import Tag -from reflex.event import EventChain, EventHandler, EventSpec, FrontendEvent -from reflex.ivars.base import ImmutableVar, LiteralVar +from reflex.event import EventChain, EventHandler, EventSpec, JavascriptInputEvent from reflex.style import Style from reflex.utils import format from reflex.utils.serializers import serialize_figure -from reflex.vars import BaseVar, Var -from tests.test_state import ( +from reflex.vars.base import LiteralVar, Var +from reflex.vars.object import ObjectVar +from tests.units.test_state import ( ChildState, ChildState2, ChildState3, @@ -273,16 +274,12 @@ def test_format_string(input: str, output: str): @pytest.mark.parametrize( "input,output", [ - (Var.create(value="test"), "{`test`}"), - (Var.create(value="test", _var_is_local=True), "{`test`}"), - (Var.create(value="test", _var_is_local=False), "{test}"), - (Var.create(value="test", _var_is_string=True), "{`test`}"), - (Var.create(value="test", _var_is_string=False), "{`test`}"), - (Var.create(value="test", _var_is_local=False, _var_is_string=False), "{test}"), + (LiteralVar.create(value="test"), '"test"'), + (Var(_js_expr="test"), "test"), ], ) def test_format_var(input: Var, output: str): - assert format.format_var(input) == output + assert str(input) == output @pytest.mark.parametrize( @@ -313,110 +310,6 @@ def test_format_route(route: str, format_case: bool, expected: bool): assert format.format_route(route, format_case=format_case) == expected -@pytest.mark.parametrize( - "condition,true_value,false_value,is_prop,expected", - [ - ("cond", "", '""', False, '{isTrue(cond) ? : ""}'), - ("cond", "", "", False, "{isTrue(cond) ? : }"), - ( - "cond", - Var.create_safe(""), - "", - False, - "{isTrue(cond) ? : }", - ), - ( - "cond", - Var.create_safe(""), - Var.create_safe(""), - False, - "{isTrue(cond) ? : }", - ), - ( - "cond", - Var.create_safe("", _var_is_local=False), - Var.create_safe(""), - False, - "{isTrue(cond) ? ${} : }", - ), - ( - "cond", - Var.create_safe("", _var_is_string=True), - Var.create_safe(""), - False, - "{isTrue(cond) ? {``} : }", - ), - ("cond", "", '""', True, 'isTrue(cond) ? `` : `""`'), - ("cond", "", "", True, "isTrue(cond) ? `` : ``"), - ( - "cond", - Var.create_safe(""), - "", - True, - "isTrue(cond) ? : ``", - ), - ( - "cond", - Var.create_safe(""), - Var.create_safe(""), - True, - "isTrue(cond) ? : ", - ), - ( - "cond", - Var.create_safe("", _var_is_local=False), - Var.create_safe(""), - True, - "isTrue(cond) ? : ", - ), - ( - "cond", - Var.create_safe(""), - Var.create_safe("", _var_is_local=False), - True, - "isTrue(cond) ? : ", - ), - ( - "cond", - Var.create_safe("", _var_is_string=True), - Var.create_safe(""), - True, - "isTrue(cond) ? `` : ", - ), - ], -) -def test_format_cond( - condition: str, - true_value: str | Var, - false_value: str | Var, - is_prop: bool, - expected: str, -): - """Test formatting a cond. - - Args: - condition: The condition to check. - true_value: The value to return if the condition is true. - false_value: The value to return if the condition is false. - is_prop: Whether the values are rendered as props or not. - expected: The expected output string. - """ - orig_true_value = ( - true_value._replace() if isinstance(true_value, Var) else Var.create_safe("") - ) - orig_false_value = ( - false_value._replace() if isinstance(false_value, Var) else Var.create_safe("") - ) - - assert format.format_cond(condition, true_value, false_value, is_prop) == expected - - # Ensure the formatting operation didn't change the original Var - if isinstance(true_value, Var): - assert true_value.equals(orig_true_value) - if isinstance(false_value, Var): - assert false_value.equals(orig_false_value) - - @pytest.mark.parametrize( "condition, match_cases, default,expected", [ @@ -440,7 +333,10 @@ def test_format_cond( ], ) def test_format_match( - condition: str, match_cases: List[BaseVar], default: BaseVar, expected: str + condition: str, + match_cases: List[List[Var]], + default: Var, + expected: str, ): """Test formatting a match statement. @@ -457,28 +353,28 @@ def test_format_match( "prop,formatted", [ ("string", '"string"'), - ("{wrapped_string}", "{wrapped_string}"), - (True, "{true}"), - (False, "{false}"), - (123, "{123}"), - (3.14, "{3.14}"), - ([1, 2, 3], "{[1, 2, 3]}"), - (["a", "b", "c"], '{["a", "b", "c"]}'), - ({"a": 1, "b": 2, "c": 3}, '{{"a": 1, "b": 2, "c": 3}}'), - ({"a": 'foo "bar" baz'}, r'{{"a": "foo \"bar\" baz"}}'), + ("{wrapped_string}", '"{wrapped_string}"'), + (True, "true"), + (False, "false"), + (123, "123"), + (3.14, "3.14"), + ([1, 2, 3], "[1, 2, 3]"), + (["a", "b", "c"], '["a", "b", "c"]'), + ({"a": 1, "b": 2, "c": 3}, '({ ["a"] : 1, ["b"] : 2, ["c"] : 3 })'), + ({"a": 'foo "bar" baz'}, r'({ ["a"] : "foo \"bar\" baz" })'), ( { "a": 'foo "{ "bar" }" baz', - "b": BaseVar(_var_name="val", _var_type="str"), + "b": Var(_js_expr="val", _var_type=str).guess_type(), }, - r'{{"a": "foo \"{ \"bar\" }\" baz", "b": val}}', + r'({ ["a"] : "foo \"{ \"bar\" }\" baz", ["b"] : val })', ), ( EventChain( events=[EventSpec(handler=EventHandler(fn=mock_event))], args_spec=lambda: [], ), - '{(...args) => addEvents([Event("mock_event", {})], args, {})}', + '((...args) => ((addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ })))))', ), ( EventChain( @@ -487,18 +383,19 @@ def test_format_match( handler=EventHandler(fn=mock_event), args=( ( - Var.create_safe("arg"), - BaseVar( - _var_name="_e", - _var_type=FrontendEvent, - ).target.value, + Var(_js_expr="arg"), + Var( + _js_expr="_e", + ) + .to(ObjectVar, JavascriptInputEvent) + .target.value, ), ), ) ], args_spec=lambda e: [e.target.value], ), - '{(_e) => addEvents([Event("mock_event", {arg:_e.target.value})], [_e], {})}', + '((_e) => ((addEvents([(Event("mock_event", ({ ["arg"] : _e["target"]["value"] }), ({ })))], [_e], ({ })))))', ), ( EventChain( @@ -506,7 +403,19 @@ def test_format_match( args_spec=lambda: [], event_actions={"stopPropagation": True}, ), - '{(...args) => addEvents([Event("mock_event", {})], args, {"stopPropagation": true})}', + '((...args) => ((addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ ["stopPropagation"] : true })))))', + ), + ( + EventChain( + events=[ + EventSpec( + handler=EventHandler(fn=mock_event), + event_actions={"stopPropagation": True}, + ) + ], + args_spec=lambda: [], + ), + '((...args) => ((addEvents([(Event("mock_event", ({ }), ({ ["stopPropagation"] : true })))], args, ({ })))))', ), ( EventChain( @@ -514,35 +423,41 @@ def test_format_match( args_spec=lambda: [], event_actions={"preventDefault": True}, ), - '{(...args) => addEvents([Event("mock_event", {})], args, {"preventDefault": true})}', + '((...args) => ((addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ ["preventDefault"] : true })))))', ), - ({"a": "red", "b": "blue"}, '{{"a": "red", "b": "blue"}}'), - (BaseVar(_var_name="var", _var_type="int"), "{var}"), + ({"a": "red", "b": "blue"}, '({ ["a"] : "red", ["b"] : "blue" })'), + (Var(_js_expr="var", _var_type=int).guess_type(), "var"), ( - BaseVar( - _var_name="_", + Var( + _js_expr="_", _var_type=Any, - _var_is_local=True, - _var_is_string=False, ), - "{_}", + "_", ), ( - BaseVar(_var_name='state.colors["a"]', _var_type="str"), - '{state.colors["a"]}', + Var(_js_expr='state.colors["a"]', _var_type=str).guess_type(), + 'state.colors["a"]', ), - ({"a": BaseVar(_var_name="val", _var_type="str")}, '{{"a": val}}'), - ({"a": BaseVar(_var_name='"val"', _var_type="str")}, '{{"a": "val"}}'), ( - {"a": BaseVar(_var_name='state.colors["val"]', _var_type="str")}, - '{{"a": state.colors["val"]}}', + {"a": Var(_js_expr="val", _var_type=str).guess_type()}, + '({ ["a"] : val })', + ), + ( + {"a": Var(_js_expr='"val"', _var_type=str).guess_type()}, + '({ ["a"] : "val" })', + ), + ( + {"a": Var(_js_expr='state.colors["val"]', _var_type=str).guess_type()}, + '({ ["a"] : state.colors["val"] })', ), # tricky real-world case from markdown component ( { - "h1": f"{{({{node, ...props}}) => }}" + "h1": Var( + _js_expr=f"(({{node, ...props}}) => )" + ), }, - '{{"h1": ({node, ...props}) => }}', + '({ ["h1"] : (({node, ...props}) => ) })', ), ], ) @@ -553,14 +468,14 @@ def test_format_prop(prop: Var, formatted: str): prop: The prop to test. formatted: The expected formatted value. """ - assert format.format_prop(prop) == formatted + assert format.format_prop(LiteralVar.create(prop)) == formatted @pytest.mark.parametrize( "single_props,key_value_props,output", [ ( - [ImmutableVar.create_safe("...props")], + [Var(_js_expr="{...props}")], {"key": 42}, ["key={42}", "{...props}"], ), @@ -614,40 +529,14 @@ def test_format_event_handler(input, output): @pytest.mark.parametrize( "input,output", [ - (EventSpec(handler=EventHandler(fn=mock_event)), 'Event("mock_event", {})'), + ( + EventSpec(handler=EventHandler(fn=mock_event)), + '(Event("mock_event", ({ }), ({ })))', + ), ], ) def test_format_event(input, output): - assert format.format_event(input) == output - - -@pytest.mark.parametrize( - "input,output", - [ - ( - EventChain( - events=[ - EventSpec(handler=EventHandler(fn=mock_event)), - EventSpec(handler=EventHandler(fn=mock_event)), - ], - args_spec=None, - ), - 'addEvents([Event("mock_event", {}),Event("mock_event", {})])', - ), - ( - EventChain( - events=[ - EventSpec(handler=EventHandler(fn=mock_event)), - EventSpec(handler=EventHandler(fn=mock_event)), - ], - args_spec=lambda e0: [e0], - ), - 'addEvents([Event("mock_event", {}),Event("mock_event", {})])', - ), - ], -) -def test_format_event_chain(input, output): - assert format.format_event_chain(input) == output + assert str(LiteralVar.create(input)) == output @pytest.mark.parametrize( @@ -668,6 +557,7 @@ formatted_router = { "origin": "", "upgrade": "", "connection": "", + "cookie": "", "pragma": "", "cache_control": "", "user_agent": "", @@ -744,7 +634,7 @@ def test_format_state(input, output): input: The state to format. output: The expected formatted state. """ - assert format.format_state(input) == output + assert json.loads(format.json_dumps(input)) == json.loads(format.json_dumps(output)) @pytest.mark.parametrize( @@ -771,29 +661,14 @@ def test_format_ref(input, output): "input,output", [ (("my_array", None), "refs_my_array"), - (("my_array", Var.create(0)), "refs_my_array[0]"), - (("my_array", Var.create(1)), "refs_my_array[1]"), + (("my_array", LiteralVar.create(0)), "refs_my_array[0]"), + (("my_array", LiteralVar.create(1)), "refs_my_array[1]"), ], ) def test_format_array_ref(input, output): assert format.format_array_ref(input[0], input[1]) == output -@pytest.mark.parametrize( - "input,output", - [ - ("/foo", [("foo", "/foo")]), - ("/foo/bar", [("foo", "/foo"), ("bar", "/foo/bar")]), - ( - "/foo/bar/baz", - [("foo", "/foo"), ("bar", "/foo/bar"), ("baz", "/foo/bar/baz")], - ), - ], -) -def test_format_breadcrumbs(input, output): - assert format.format_breadcrumbs(input) == output - - @pytest.mark.parametrize( "input, output", [ diff --git a/tests/utils/test_imports.py b/tests/units/utils/test_imports.py similarity index 88% rename from tests/utils/test_imports.py rename to tests/units/utils/test_imports.py index e9be5c1be..c30d1d85c 100644 --- a/tests/utils/test_imports.py +++ b/tests/units/utils/test_imports.py @@ -54,17 +54,21 @@ def test_import_var(import_var, expected_name): ( {"react": {"Component"}}, {"react": {"Component"}, "react-dom": {"render"}}, - {"react": {"Component"}, "react-dom": {"render"}}, + {"react": {ImportVar("Component")}, "react-dom": {ImportVar("render")}}, ), ( {"react": {"Component"}, "next/image": {"Image"}}, {"react": {"Component"}, "react-dom": {"render"}}, - {"react": {"Component"}, "react-dom": {"render"}, "next/image": {"Image"}}, + { + "react": {ImportVar("Component")}, + "react-dom": {ImportVar("render")}, + "next/image": {ImportVar("Image")}, + }, ), ( {"react": {"Component"}}, {"": {"some/custom.css"}}, - {"react": {"Component"}, "": {"some/custom.css"}}, + {"react": {ImportVar("Component")}, "": {ImportVar("some/custom.css")}}, ), ], ) diff --git a/tests/utils/test_serializers.py b/tests/units/utils/test_serializers.py similarity index 66% rename from tests/utils/test_serializers.py rename to tests/units/utils/test_serializers.py index b516f5eb3..8050470c6 100644 --- a/tests/utils/test_serializers.py +++ b/tests/units/utils/test_serializers.py @@ -1,19 +1,21 @@ import datetime +import json from enum import Enum from pathlib import Path -from typing import Any, Dict, List, Type +from typing import Any, Type import pytest from reflex.base import Base from reflex.components.core.colors import Color from reflex.utils import serializers -from reflex.vars import Var +from reflex.utils.format import json_dumps +from reflex.vars.base import LiteralVar @pytest.mark.parametrize( "type_,expected", - [(str, True), (dict, True), (Dict[int, int], True), (Enum, True)], + [(Enum, True)], ) def test_has_serializer(type_: Type, expected: bool): """Test that has_serializer returns the correct value. @@ -29,20 +31,10 @@ def test_has_serializer(type_: Type, expected: bool): @pytest.mark.parametrize( "type_,expected", [ - (str, serializers.serialize_str), - (list, serializers.serialize_list), - (tuple, serializers.serialize_list), - (set, serializers.serialize_list), - (dict, serializers.serialize_dict), - (List[str], serializers.serialize_list), - (Dict[int, int], serializers.serialize_dict), (datetime.datetime, serializers.serialize_datetime), (datetime.date, serializers.serialize_datetime), (datetime.time, serializers.serialize_datetime), (datetime.timedelta, serializers.serialize_datetime), - (int, serializers.serialize_primitive), - (float, serializers.serialize_primitive), - (bool, serializers.serialize_primitive), (Enum, serializers.serialize_enum), ], ) @@ -104,7 +96,7 @@ class StrEnum(str, Enum): BAR = "bar" -class TestEnum(Enum): +class FooBarEnum(Enum): """A lone enum class.""" FOO = "foo" @@ -133,48 +125,59 @@ class BaseSubclass(Base): "value,expected", [ ("test", "test"), - (1, "1"), - (1.0, "1.0"), - (True, "true"), - (False, "false"), - (None, "null"), - ([1, 2, 3], "[1, 2, 3]"), - ([1, "2", 3.0], '[1, "2", 3.0]'), - ([{"key": 1}, {"key": 2}], '[{"key": 1}, {"key": 2}]'), + (1, 1), + (1.0, 1.0), + (True, True), + (False, False), + (None, None), + ([1, 2, 3], [1, 2, 3]), + ([1, "2", 3.0], [1, "2", 3.0]), + ([{"key": 1}, {"key": 2}], [{"key": 1}, {"key": 2}]), (StrEnum.FOO, "foo"), - ([StrEnum.FOO, StrEnum.BAR], '["foo", "bar"]'), + ([StrEnum.FOO, StrEnum.BAR], ["foo", "bar"]), ( {"key1": [1, 2, 3], "key2": [StrEnum.FOO, StrEnum.BAR]}, - '{"key1": [1, 2, 3], "key2": ["foo", "bar"]}', + { + "key1": [1, 2, 3], + "key2": ["foo", "bar"], + }, ), (EnumWithPrefix.FOO, "prefix_foo"), - ([EnumWithPrefix.FOO, EnumWithPrefix.BAR], '["prefix_foo", "prefix_bar"]'), + ([EnumWithPrefix.FOO, EnumWithPrefix.BAR], ["prefix_foo", "prefix_bar"]), ( {"key1": EnumWithPrefix.FOO, "key2": EnumWithPrefix.BAR}, - '{"key1": "prefix_foo", "key2": "prefix_bar"}', + { + "key1": "prefix_foo", + "key2": "prefix_bar", + }, ), - (TestEnum.FOO, "foo"), - ([TestEnum.FOO, TestEnum.BAR], '["foo", "bar"]'), + (FooBarEnum.FOO, "foo"), + ([FooBarEnum.FOO, FooBarEnum.BAR], ["foo", "bar"]), ( - {"key1": TestEnum.FOO, "key2": TestEnum.BAR}, - '{"key1": "foo", "key2": "bar"}', + {"key1": FooBarEnum.FOO, "key2": FooBarEnum.BAR}, + { + "key1": "foo", + "key2": "bar", + }, ), ( BaseSubclass(ts=datetime.timedelta(1, 1, 1)), - '{"ts": "1 day, 0:00:01.000001"}', + { + "ts": "1 day, 0:00:01.000001", + }, ), ( - [1, Var.create_safe("hi"), Var.create_safe("bye", _var_is_local=False)], - '[1, "hi", bye]', + [1, LiteralVar.create("hi")], + [1, "hi"], ), ( - (1, Var.create_safe("hi"), Var.create_safe("bye", _var_is_local=False)), - '[1, "hi", bye]', + (1, LiteralVar.create("hi")), + [1, "hi"], ), - ({1: 2, 3: 4}, '{"1": 2, "3": 4}'), + ({1: 2, 3: 4}, {1: 2, 3: 4}), ( - {1: Var.create_safe("hi"), 3: Var.create_safe("bye", _var_is_local=False)}, - '{"1": "hi", "3": bye}', + {1: LiteralVar.create("hi")}, + {1: "hi"}, ), (datetime.datetime(2021, 1, 1, 1, 1, 1, 1), "2021-01-01 01:01:01.000001"), (datetime.date(2021, 1, 1), "2021-01-01"), @@ -182,7 +185,7 @@ class BaseSubclass(Base): (datetime.timedelta(1, 1, 1), "1 day, 0:00:01.000001"), ( [datetime.timedelta(1, 1, 1), datetime.timedelta(1, 1, 2)], - '["1 day, 0:00:01.000001", "1 day, 0:00:01.000002"]', + ["1 day, 0:00:01.000001", "1 day, 0:00:01.000002"], ), (Color(color="slate", shade=1), "var(--slate-1)"), (Color(color="orange", shade=1, alpha=True), "var(--orange-a1)"), @@ -197,30 +200,34 @@ def test_serialize(value: Any, expected: str): value: The value to serialize. expected: The expected result. """ - assert serializers.serialize(value) == expected + assert json.loads(json_dumps(value)) == json.loads(json_dumps(expected)) @pytest.mark.parametrize( "value,expected,exp_var_is_string", [ - ("test", "test", False), + ("test", '"test"', False), (1, "1", False), (1.0, "1.0", False), (True, "true", False), (False, "false", False), ([1, 2, 3], "[1, 2, 3]", False), - ([{"key": 1}, {"key": 2}], '[{"key": 1}, {"key": 2}]', False), - (StrEnum.FOO, "foo", False), + ([{"key": 1}, {"key": 2}], '[({ ["key"] : 1 }), ({ ["key"] : 2 })]', False), + (StrEnum.FOO, '"foo"', False), ([StrEnum.FOO, StrEnum.BAR], '["foo", "bar"]', False), ( BaseSubclass(ts=datetime.timedelta(1, 1, 1)), - '{"ts": "1 day, 0:00:01.000001"}', + '({ ["ts"] : "1 day, 0:00:01.000001" })', False, ), - (datetime.datetime(2021, 1, 1, 1, 1, 1, 1), "2021-01-01 01:01:01.000001", True), - (Color(color="slate", shade=1), "var(--slate-1)", True), - (BaseSubclass, "BaseSubclass", True), - (Path("."), ".", True), + ( + datetime.datetime(2021, 1, 1, 1, 1, 1, 1), + '"2021-01-01 01:01:01.000001"', + True, + ), + (Color(color="slate", shade=1), '"var(--slate-1)"', True), + (BaseSubclass, '"BaseSubclass"', True), + (Path("."), '"."', True), ], ) def test_serialize_var_to_str(value: Any, expected: str, exp_var_is_string: bool): @@ -231,6 +238,5 @@ def test_serialize_var_to_str(value: Any, expected: str, exp_var_is_string: bool expected: The expected result. exp_var_is_string: The expected value of _var_is_string. """ - v = Var.create_safe(value) - assert v._var_full_name == expected - assert v._var_is_string == exp_var_is_string + v = LiteralVar.create(value) + assert str(v) == expected diff --git a/tests/utils/test_types.py b/tests/units/utils/test_types.py similarity index 60% rename from tests/utils/test_types.py rename to tests/units/utils/test_types.py index fc9261e04..623aacc1f 100644 --- a/tests/utils/test_types.py +++ b/tests/units/utils/test_types.py @@ -1,4 +1,4 @@ -from typing import Any, List, Literal, Tuple, Union +from typing import Any, Dict, List, Literal, Tuple, Union import pytest @@ -45,3 +45,48 @@ def test_issubclass( cls: types.GenericType, cls_check: types.GenericType, expected: bool ) -> None: assert types._issubclass(cls, cls_check) == expected + + +class CustomDict(dict[str, str]): + """A custom dict with generic arguments.""" + + pass + + +class ChildCustomDict(CustomDict): + """A child of CustomDict.""" + + pass + + +class GenericDict(dict): + """A generic dict with no generic arguments.""" + + pass + + +class ChildGenericDict(GenericDict): + """A child of GenericDict.""" + + pass + + +@pytest.mark.parametrize( + "cls,expected", + [ + (int, False), + (str, False), + (float, False), + (Tuple[int], True), + (List[int], True), + (Union[int, str], True), + (Union[str, int], True), + (Dict[str, int], True), + (CustomDict, True), + (ChildCustomDict, True), + (GenericDict, False), + (ChildGenericDict, False), + ], +) +def test_has_args(cls, expected: bool) -> None: + assert types.has_args(cls) == expected diff --git a/tests/utils/test_utils.py b/tests/units/utils/test_utils.py similarity index 96% rename from tests/utils/test_utils.py rename to tests/units/utils/test_utils.py index e905ff587..81579acc7 100644 --- a/tests/utils/test_utils.py +++ b/tests/units/utils/test_utils.py @@ -18,8 +18,8 @@ from reflex.utils import ( types, ) from reflex.utils import exec as utils_exec -from reflex.utils.serializers import serialize -from reflex.vars import Var +from reflex.utils.exceptions import ReflexError +from reflex.vars.base import Var def mock_event(arg): @@ -117,7 +117,7 @@ def test_remove_existing_bun_installation(mocker): Args: mocker: Pytest mocker. """ - mocker.patch("reflex.utils.prerequisites.os.path.exists", return_value=True) + mocker.patch("reflex.utils.prerequisites.Path.exists", return_value=True) rm = mocker.patch("reflex.utils.prerequisites.path_ops.rm", mocker.Mock()) prerequisites.remove_existing_bun_installation() @@ -458,7 +458,7 @@ def test_bun_install_without_unzip(mocker): mocker: Pytest mocker object. """ mocker.patch("reflex.utils.path_ops.which", return_value=None) - mocker.patch("os.path.exists", return_value=False) + mocker.patch("pathlib.Path.exists", return_value=False) mocker.patch("reflex.utils.prerequisites.constants.IS_WINDOWS", False) with pytest.raises(FileNotFoundError): @@ -476,7 +476,7 @@ def test_bun_install_version(mocker, bun_version): """ mocker.patch("reflex.utils.prerequisites.constants.IS_WINDOWS", False) - mocker.patch("os.path.exists", return_value=True) + mocker.patch("pathlib.Path.exists", return_value=True) mocker.patch( "reflex.utils.prerequisites.get_bun_version", return_value=version.parse(bun_version), @@ -538,11 +538,17 @@ def test_style_prop_with_event_handler_value(callable): callable: The callable function or event handler. """ + import reflex as rx + style = { "color": ( - EventHandler(fn=callable) if type(callable) != EventHandler else callable + EventHandler(fn=callable) + if type(callable) is not EventHandler + else callable ) } - with pytest.raises(TypeError): - serialize(style) # type: ignore + with pytest.raises(ReflexError): + rx.box( + style=style, # type: ignore + ) diff --git a/tests/units/vars/test_base.py b/tests/units/vars/test_base.py new file mode 100644 index 000000000..68bc0c38e --- /dev/null +++ b/tests/units/vars/test_base.py @@ -0,0 +1,49 @@ +from typing import Dict, List, Union + +import pytest + +from reflex.vars.base import figure_out_type + + +class CustomDict(dict[str, str]): + """A custom dict with generic arguments.""" + + pass + + +class ChildCustomDict(CustomDict): + """A child of CustomDict.""" + + pass + + +class GenericDict(dict): + """A generic dict with no generic arguments.""" + + pass + + +class ChildGenericDict(GenericDict): + """A child of GenericDict.""" + + pass + + +@pytest.mark.parametrize( + ("value", "expected"), + [ + (1, int), + (1.0, float), + ("a", str), + ([1, 2, 3], List[int]), + ([1, 2.0, "a"], List[Union[int, float, str]]), + ({"a": 1, "b": 2}, Dict[str, int]), + ({"a": 1, 2: "b"}, Dict[Union[int, str], Union[str, int]]), + (CustomDict(), CustomDict), + (ChildCustomDict(), ChildCustomDict), + (GenericDict({1: 1}), Dict[int, int]), + (ChildGenericDict({1: 1}), Dict[int, int]), + ], +) +def test_figure_out_type(value, expected): + assert figure_out_type(value) == expected