Metadata-Version: 2.4
Name: rc-tui
Version: 0.1.0
Summary: High-performance React-inspired TUI library for Python
Author-email: Pomilon <pomilon@proton.me>
License: MIT License
        
        Copyright (c) 2026 Pomilon
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pybind11>=2.12.0
Requires-Dist: pyfiglet>=0.8.post1
Requires-Dist: tree-sitter<0.24.0,>=0.22.0
Requires-Dist: tree-sitter-python<0.24.0,>=0.22.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: twine>=5.0.0; extra == "dev"
Dynamic: license-file

# RC-TUI

RC-TUI is a modern, high-performance Terminal User Interface (TUI) library for Python, inspired by React. It features a hooks-based state management system, efficient virtualization for large datasets, and a powerful rendering engine with support for advanced widgets.

## Features

- React-Inspired Hooks: Use useState, useEffect, useMemo, useCallback, and useRef to manage component state and lifecycle.
- Efficient Virtualization: Render lists with thousands of items smoothly using the VirtualList widget.
- Advanced Widgets:
  - Table: Sortable columns and dynamic data rendering.
  - Tabs: Intuitive tab-based navigation.
  - Inputs & Textareas: Full keyboard support with focus management.
  - Progress Bars & Switches: Highly customizable visual indicators.
- Native Performance: Core rendering and layout logic designed for speed and responsiveness.
- Developer Inspector: Toggle with F12 to inspect the UI tree, dimensions, and styling in real-time.

## Installation

```bash
pip install rctui # package available soon!
```

## Building from Source

RC-TUI uses a C++ core for high-performance rendering. To build it from source, you'll need a C++17 compiler and CMake.

```bash
# Clone the repository
git clone https://github.com/Pomilon/RC-TUI.git
cd RC-TUI

# Install the package in editable mode
pip install -e .
```

## Quick Start

```python
from rctui import App, Box, Text, Button, useState

def MyComponent(props):
    count, set_count = useState(0)
    
    return Box(
        flex_direction="column",
        align_items="center",
        justify_content="center",
        children=[
            Text(f"Count: {count}", fg=(0, 255, 255)),
            Button("Increment", on_click=lambda: set_count(count + 1), bg=(0, 128, 0))
        ]
    )

app = App(MyComponent)
app.run()
```

## Advanced Usage

### Virtualized List

```python
from rctui import VirtualList, Text

items = [{"id": i, "name": f"Item {i}"} for i in range(1000)]

def render_item(item, index):
    return Text(f"Row {index}: {item['name']}")

# Inside a component:
VirtualList(
    items=items,
    render_item=render_item,
    item_height=1
)
```

### Hooks

```python
from rctui import useState, useEffect
import threading
import time

def Timer(props):
    seconds, set_seconds = useState(0)
    
    def effect():
        running = True
        def loop():
            while running:
                time.sleep(1)
                set_seconds(s => s + 1)
        
        t = threading.Thread(target=loop, daemon=True)
        t.start()
        
        return lambda: setattr(running, False) # Cleanup function
        
    useEffect(effect, [])
    
    return Text(f"Elapsed: {seconds}s")
```

## Developer Tools

Press F12 while the app is running to enable the Hover Inspector. Hover over any element to see its type, coordinates, and bounding box.

## License

MIT - Copyright (c) 2026 Pomilon
