I prefer to think more heavily in streams.
A sequence is a stream of splice commands. A listWidget is a writable splicestream. A crdt Sequence is a readable splice stream.
SpliceStream works incredibly well if all your add / remove / move commands manipulate delta streams. I.e. the list interpretation of the splice stream is a list of delta streams.
The only issue with both splicestream and deltastream is initial synchronization of data. I need to think about that more
var SpliceStream = require("splice-stream")
// Seq is a splice stream
var stream = crdtSeq.createStream()
// List widget is a splice stream
// Every Time a splice event comes in with order changes for a crdt row
// Then either it's move or a new ItemWidget is created for that row
// Item widget is a delta stream
var widget = ListWidget(ItemWidget)
// Go!
stream.pipe(widget)
function ListWidget(ItemWidget) {
var stream = SpliceStream()
, splicer = stream.createSplicer()
, ul = document.createElement("ul")
splicer.on("add", function (row) {
var widget = ItemWidget()
widget.appendTo(ul)
row.createStream().pipe(widget)
})
...
}