TexteaInc / funix

Building web apps without manually creating widgets
http://funix.io
MIT License
102 stars 11 forks source link

Future: widgets with parameters as tuples #59

Closed forrestbao closed 1 year ago

forrestbao commented 1 year ago

Currently we are dealing with only one widget with parameters, which are sliders. In the future, it's every likely many other widgets will have parameters, such as textareas which have attributes like number of lines or width.

Hence, we need a solution to parametrize widgets.

Below is the brainstorming result of me and Yazawazi tonight.

@funix(
    widgets = {
         "x":("slider", 
               {
                "start" : 10,
                "end"   : 100,
                "step"   : 4
               }
            )
    }
)
def bar(x:int) -> int:
    return x=1

@funix(
    widgets = {"x": ["sheet", ("slider", {"start":10, "end":100, "step":4})]}
)
def f(x: List[int]) -> List[int]:
    return x
Yazawazi commented 1 year ago

Done in https://github.com/TexteaInc/funix/commit/5863e08d31eb995ee8621fd0c5d03647d4e8ccd5