Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
/ TeaLeaf Public

TeaLeaf is a web framework. with Server Side Rendering and Declarative UI

Notifications You must be signed in to change notification settings

Az107/TeaLeaf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TeaLeaf 🍃☕✨

SSE framework for python

TeaLeaf is a Python web framework designed to work seamlessly with HTeaPot. It provides a declarative and reactive approach to building web applications, inspired by SwiftUI. TeaLeaf allows you to create server-side rendered (SSR) applications

Features 🔧

There are the actual and planed features

  • Server-Side Rendering (SSR): Generate HTML on the server for improved performance.
  • Declarative UI: Define your UI using a simple function-based syntax.
  • Session managment: TeaLeaf keep and handle data for sessions autmatically.
  • WSGI and API Handling: Serve dynamic content and interact with APIs.
  • SuperStore: A built-in store system that generates CRUD endpoints for data management.
  • Scoped Styling: Components can define their styles, which are automatically scoped and injected.
  • Reactivity: Automatically update components using SSE.
  • Component-Based Architecture: Reusable components for structuring your application.
  • Hydration Support: Enable dynamic updates without full-page reloads.

Installation 📦

TeaLeaf is still in development and not yet available as a package. You can clone the repository and integrate it into your project manually.

# Clone the repository
git clone https://github.com/your-repo/tealeaf.git

# Navigate to the project folder
cd tealeaf

Usage 🚀

Defining a Page

from TeaLeaf.WSGI import WSGI
from tealeaf.Html.Elements import body, h1, p, Button
app = WSGI()

app.route("/")
def index():
    return body(
        h1("Welcome to TeaLeaf!"),
        p("A simple and reactive Python web framework."),
        Button("Click me")
    )

Using SuperStore 🗄️

app = WSGI()
SuperStore(app)
todo_store = Store()
todo_store.create(id="todo",data=[])


app.route("/todos")
def todos():
    return body(
        script(todo_store.do.js()),
        h1("TO-DO tasks"),
        [h3(c) for c in todo_store.read("todo")],
        div(
            textInput().id("new-todo"),
            button("Create").attr(
                onclick=todo_store.do.Update(
                    "todo",
                    Dom("#new-todo")
                )),
        ).row()
    )

Roadmap 🛤️

Contributing 🤝

Contributions are welcome! Feel free to submit issues or pull requests to improve TeaLeaf.

License 📜

eaLeaf is released under the MIT License.

About

TeaLeaf is a web framework. with Server Side Rendering and Declarative UI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published