Closed adaburrows closed 6 months ago
Due to the other work towards #97 & #102, we now have the supporting types and new block-renderer and derived components.
Once https://github.com/neighbour-hoods/sensemaker-lite/issues/73 is done along with #109, #110, #111:
New Applet Interface
Here's a simple skeleton of an example.
Resource renderers and full blocks need to have a specific access to their resources' cells. This means that when they are created and shown they should be given access to their cell directly. The profile store seems like a decent read-only delegate, so we can keep it. The Sensemaker store however may need some thinking about going forward, but for now since apps are responsible for creating contexts until our next release, we can keep this as is. However, as time goes on, we should create affordances to create restricted delegates/proxies to the Sensemaker store.
The OutputAssessmentDisplayDelegate could in theory be a Svelte store, since that implements almost the same interface. I think wrapping a derived Svelte store may be the most flexible way of implementing this. However, if we don't need to allow custom assessment display widgets, this is unnecessary.
The delegate objects will be a plain object conforming to the above interfaces with each method being a closure created in a privileged scope with access to the whole sensemaker. Each specific function will be created to only work with the current resource eh and dimension eh. This provides a cleaner interface for apps instead of emitting an event with the value to be written. It is also slightly more secure, because it means only values that could be chosen by clicking on a button in the UI will be written to the sensemaker instead of any value that could be emitted by a child element.
The existing interface needs to be revised so that the dimensions and methods are decoupled from the component itself. We also need to take into consideration the range of the possible computations given a particular input range (for integers, assume INF = MAXINT):
This means that we can't have pairs that operate on a given set of dimensions unless the computation between input and output is AVG. Otherwise the output range is divergent compared to the input range.
Example:
Also, since the configuration could be completely assigned from scratch by the CA, the required fields on the applet config will be reduced: