what about this?
var olModel = new ObservableList()
var olWidget = observableWidget('#list_id', function (item) {
return '<div id='+item.id+'>'+item.text+'</div>'
})
var remoteList = new RemoteList()
stream.pipe(remoteList).pipe(stream) //probably
//something like this?
sync(remoteList, olModel)
sync(olModel, olWidget)
lets just suppose that is the interface. what does sync look like?
add
and remove
are easy, but move is more complicated.
you can use Array#spilce
to represent all 3
(though, move is represented as a new insert)
one of the problems here is that there is a disjoin between Arrays, and HTMLElements which are a linked list. This is a benefit with crdt, actually because it has more linked list style behaviour (like pushing an item twice adds it to the end of the list, instead of duplicating it)
linked list behaviour is much easier to make concurrent updates to. but we don't have a Listish implementation that is separate to crdt, currently...
but it could be cleaner to approach it like that, rather building the List model into crdt.
@dominictarr https://github.com/Raynos/element-list https://github.com/Raynos/splice-stream
As you mentioned move & sorting is harder and not quite implemented yet.
But you can create an ElementList which you can pipe elements into