Skip to content

CalziniDesign.md

Noah Gibbs edited this page Oct 19, 2023 · 1 revision

Design for Calzini Components and Updates

Initially, Calzini ("socks" in Italian) was just the Scarpe-Webview HTML rendering extracted into a library that could be overridden to "reskin" it.

The first override of that type was Tiranti ("bootstraps"), to render Scarpe using Bootstrap widgets. The progress drawable in Bootstrap showed a weakness of how Calzini was written: it handles initial rendering, but not later updates. The problem with that is that you don't know exactly how various properties will be rendered. For instance, a Progress drawable can use an HTML "progress" tag, or two or more divs, or something else entirely. It's not particularly clear how to do later updates to the HTML if you don't know exactly how it was rendered initially. Accessibility (e.g. ARIA fields, which can be repetitive) can make this more difficult too -- there's often more than one place to update the DOM for a single property, and it's not always a simple text replace. A progress fraction of 0.75 could be rendered as 0.75 in one place and "75%" elsewhere, and need to be updated in both places.

Calzini was initially not stateful. It was a very simple renderer that took drawable names and properties and rendered HTML from them. But that makes updates more difficult. Also, initially Calzini could just return HTML -- very simple, very portable. But to do updates, we would need a more complex format for changes. Do you change the innerHTML or outerHTML of specific DOM elements? Can you re-render the div for a Flow without re-rendering the contents? Should we store enough state to re-render the contents? These are not questions with just a single obvious answer.

Make it More Stateful

One option is to have Calzini use instance vars and generally make it more stateful, like pre-Calzini rendering but with a module mixed in. That avoids passing in redundant data. Maybe it can call an update method to re-render? That makes Calzini a lot less hands-off, but that's probably necessary to handle updates.

How to Express Updates?

We have ElementWrangler for updates. But, like, that's a kind of terrible output format for testing. But do we return an array of updates or something?

Clone this wiki locally