nbrugger-tgm / reactj

A reactive ui lib for easy MVC
LaTeX Project Public License v1.3c
10 stars 0 forks source link

[Feature] Introduce Binding DSL #42

Closed nbrugger-tgm closed 2 years ago

nbrugger-tgm commented 3 years ago

Why introducing now?

It is a breaking change as the API will be completely different, and as the switch to V4 (modularization) already contains many major changes and reworks it is better to release now than later.

What would the DSL (Domain Specific Language) look like?

Not specified yet, something like

public createBindings(ReactiveBinder<Person> binder){
    binder.call(textfield::setText).with(Person::getName);
    binder.call(Person::setName).with(textfield::getText).when(textChanges(textfield));

    //or
    binder.bind(textfield::setText).to(convert(Person::getAge).with(Integer::toString));

    //binder
    binder.set(textfield:setText).to(Person::getName);
}

Operations

Concept : Lists

(Most likely needs an internal diff operation)

binder.list(Person::getAddresses)
    .onAdd(addressPanel::add)
    .onRemove(addressPanel::remove)
    .useComponent(AddressView::new)

Further requirements

nbrugger-tgm commented 3 years ago

Grammer/syntax design:

binding_dsl

The white triangles are the entry points

nbrugger-tgm commented 3 years ago

Progress

The DSL syntax has changed quite a bit

All functionality is implemented

Missing

nbrugger-tgm commented 3 years ago

Status update

https://github.com/nbrugger-tgm/reactj/pull/49#issuecomment-945280768

nbrugger-tgm commented 3 years ago

Blocked by #53

nbrugger-tgm commented 3 years ago

Requirement

All "nodes" of the DSL should be extenable/expandable by users so new methods may be added by 3rd party code.

handled in #53

nbrugger-tgm commented 2 years ago

With completion of #53 and #44 #54 a big leap was done.

The DSL is completed and implemented for all modules, the missing thigs that will be implemented in #49 are