PolymerLabs/uni-virtualizer

Prototype and evaluate alternative approach to renderer integration

Closed this issue · 1 comments

Much of the functionality provided by the VirtualRepeater base class, while critical in a vanilla HTML / JS scenario, is of limited utility when virtualizer is paired with a rendering library like lit-html.

It should be possible to factor things so that this functionality is omitted when not needed, instead relying on whatever rendering library is used. This should significantly reduce code size. Another benefit to this factoring should be that integration with different rendering libraries becomes much simpler, as the coupling will be looser.

Rough idea: Separate the scroller and layout implementations from the underlying repeater implementation. When used in this way, virtualizer itself won't directly manage rendering at all. It will just emit events with range and position information that are consumed by external rendering code.

Demo: Show one or more of the virtualizer demos running with the refactored approach, show how app code is affected, share findings (e.g. any implications on perf, ergonomics, etc.)

Alternative implementation complete, all existing examples converted.

  • Virtualization performance appears to be essentially the same (as hoped / expected)
  • API for consumers of lit-virtualizer unaffected
  • Implementation is considerably simpler and smaller (though haven't yet quantified)

Next step: clean up the new implementation, remove the old, prepare to merge to master