ilikeprograms/Cluckles

Variable Annotation Parse

Closed this issue · 0 comments

One way in which I can see how to compliment issue #4 would be to have some kind of annotation parser.

In the JSDocs for each of the src/BootstrapThemeEditor/* files, they name of the variable is reference with the property doc.

I could write a parser which scans each of these and then associates x bunch of variables with x file. So the jumbotron.js file for example would have the @jumbotron-bg variable.

Then when the @jumbotron-bg variable is changed, update the editor components which have been bound to that variable.

Having the annotation could work as a good way to automatically bind the variables to editor components, without the end user needing to specifically provide the mappings through some options.

Then could just have something like:

<input type="text" data-bsThemeBinding="jumbotron-bg" />  
<input type="color" data-bsThemeBinding="jumbotron-bg" />

Would we still need to have onclick="themeEditor.jumbotron.setBackground('this.value');" then or not ?

Perhaps have themeEditor.jumbotron.setBackground('this.value'); for API to programmatically change the values, or from the JS console etc.

Then have the same method be called when something with the correct data binding has its value changed?

<input type="text" data-bsThemeBinding="jumbotron-bg" data-bsCall="jumbotron.setBackground" data-bsOn="change" />  
<input type="text" data-bsThemeBinding="jumbotron-bg" data-bsCall="jumbotron.setBackground" data-bsOn="change" />

Then by default have it trigger on change?