I’m looking for a way to get the previous value of a cell which calls a string literal function (such as in https://beta.observablehq.com/@mbostock/graphviz), in the called function, without having to pass it as an argument.
We don’t override this for function cells, because it has an existing meaning in the language, and because function cells are values. I think what you’re looking for is something like this fork - you can use the bind, call, and apply methods to set the this context of a function from its caller, and you can use that technique to pass the caller’s this value to the callee. Here are examples of the various ways to do that. That said, I may have misread your question - let me know if this isn’t the precise intent.
Got it - that’s going to be a bit tricky to fix for the general case - one option is to do something like this - close over the div and graphviz instance so that transitions are possible. Downside, of course - and probably why you didn’t already do this - is that this wouldn’t automatically support multiple instances.