-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple design from controller #488
Comments
I created some examples an put them on gist: Once downloaded you can put them in @MattiasNilsson can you please check this out and give me our opinions? |
@Messj1 It looks great! Go ahead with it, what is the next step you plan to do with this? |
@MattiasNilsson Good question ... I think the goal should be to simplify the whole HTML handling in a structural way. In fact i don't know what would be better, to have a listening or a callable system. Maybe both 🤪 Any comment is welcome! Next stepsThere are generated HTML files from the server and some CSS which handle the look and feel. Data exchangingSo next step would be to declare the listening data flow respectively data exchange. simple state binding with local storage save and restore: <input type="checkbox" data-gui-datatype="input" data-gui-persist="local" name="wizzard.plugins" /> simple class toggle: <div data-gui-datatype="bind" data-gui-name="screenloading" data-gui-class="toogleClassname">
</div> simple attribute (open, disabled, checked, selected) toggle: <details data-gui-datatype="input" data-gui-attribute="open">
</details> Or something more complex example with component involved <!-- listening component state -->
<input type="checkbox" data-gui-datatype="bind" data-gui-component="D3IndentedTree" name="isSearchRunning" />
<!-- listening event and call component -->
<input type="text" data-gui-datatype="input" data-gui-component="D3IndentedTree" name="treeFilter" /> Maybe some structure like this data-gui: {
//indicates an data exchange element
"datatype": {
"default": null
"value": ["bind", "input"]
},
//component which is used to call and fetch data
"component": {
"default": "GUI",
"value": ["GUI", "Editor", "D3IndentedTree"]
},
//Name of action, variable or persist key
"name": {
"default": element is input? input.name
"value": *
},
//saves the "return" value in the selected storage. if no return save the getter
"persist": {
"default": null
"value": ["local", "session", "server"]
},
//toggle the CSS class
"class": {
"default": null
"value": "*",
"condition": [
"return" value is boolean,
]
},
} DataBinderAfterward
So maybe there is also an Factory involved to get the right GUIThe binding could be done in 3 ways as followed:
// @module Typo3/CMS/FrontendEditing/GUI
init: function() {
...
this.findAndBindData();
}
// inline
GUI.appendData(dataHandler);
<input onclick="GUI.handleData" /> At least there would be much less code in GUI. |
@Messj1 Great idea, right now all is interconnected. |
@MattiasNilsson Yes, that is the reason why it is currently not testable. It is also (k)im possible to extend.
I split into several categories to show how they should work independently:
Hint: the What do we win with all this heavy load bootstrap: 👀
I see no problem to make this changes without breaking anything because we are able to implement 2 By the way we should also replace the javascript Maybe something like <div data-gui-datatype="trigger" data-gui-component="CE" data-gui-name="dragAndDrop">
...
</div> Any feedback is welcome 😉 |
@Messj1 The only thing I can add is awesome! Just go ahead with it :) |
@Messj1 This is just something I have had in my head before. So cool! Which tool are you using for this? Just curious :) |
@MattiasNilsson Yeah, cause I used to base structure of already existing components. So names are already known. 😉 I use diagrams.net. Previously known as draw.io. I use only the simplest functions. There are plenty of nice functions like the native |
@Messj1 Thanks for all the nice work! 👍 |
@MattiasNilsson found some small time slice to implement a simple prototype. Can you please have a look on it? There is following structure:
I also added Storybook Test
I'm insecure what would be better:
I think solution 1. would lead to create a DataHandler for every Component. This gives us an extra portion flexibility but i guess this is mostly not needed. Would love to hear from you. edit on 2021-03-25: added a show case branch an made git pages of this issue |
@Messj1 I think solution 1 is the best to go with. Then it feels more organised :) |
Hi
As part of improve code quality #432 and to improve extend ability there should be more separation of design and frontend-editing functionality.
I see following wrong dependencies flow:
FrontendEditing should use FrontendEditing.GUI since it is part of an process and GUI is the controller
FrontendEditing.GUI has to be simply a controller. So no animation at all since it can not know the template.
In my opinion we should not attache events on server generated templates.
The frontend editing GUI appearance should be part of the design or else you can only change color 😒
So what should GUI be?
It is used as
Initialize frontend editing an configure them
Of courseGUI has to deal with data but in a predefined way configurable with identifiers
So it has to contain only bootstrap code and base composition logic code
What should be part of design
Everything that is generated on the server. So if it has to communicate we have to use
id
attribute because it should be unique or else it is to unclear what to do in GUI.So as a good example lets have look at a simple slide and open problem.
checkbox hack
So we could use a good old classic hack to save and transfer the state (usable in GUI with
t3-frontend-editing__right-bar
as id)Also possible to use radio instead of checkbox to get an real accordion 😉
details
andsummary
elementsGood old
details
elements have the advanced, that the have anopen
attribute which indicate open or close.separate javascript based widgets
There are plenty technologies for js based widgets.
From Web Components to attached function calls.
From scripts to suits.
Conclusion
GUI should have different strategies to fetch data from the attached bindings like:
checked
attributselected
attributdata
attributopen
attributAt least there should be the opportunity to write an own editor and use only the base logic from frontend editing to transfer and handle data.
I would love to see an different frontend editing GUI implementation.
Any opinions?
The text was updated successfully, but these errors were encountered: