-
#4687
8ecf3c03
Thanks @alanbuzek! - Fix a null pointer exception when virtulizer component is destroyed and then recreated again quickly. -
Updated dependencies [
feccc1ba
]:
- #4564
6b4b45ff
Thanks @IMinchev64! - Guard top-levelwindow
withtypeof
check so that importing the code will not throw when imported in non-browser environments without a globalwindow
defined. Note, this on its own will not server render items inside the virtualizer, but it will no longer error when attempting to do so.
- #4427
a19a60b8
Thanks @pdesoyres-cc! - Now correctly include/support/method-interception.js
and/support/resize-observer-errors.js
artifacts to the published package. Previously these were listed in the package exports but not actually included with the npm published package.
-
#4375
449bc281
Thanks @graynorton! - Fix issue where virtualizer didn't render children when slotted into a position:fixed ancestor (#4346) -
Updated dependencies [
bf551b5b
,949a5467
,c7922a0c
,839ca0f8
]:
- #4355
21c9faf5
Thanks @graynorton! - Fix masonry layout bug (new failure case for #3815)
-
#4291
81806d4c
Thanks @graynorton! - Update version range for lit dependency to include Lit 2 and 3 -
#4233
f84963d8
Thanks @steverep! - Guard against layout updates or re-observing when disconnected (fixes #4182, #3831)
-
Updated dependencies:
- #4130
d7bd030b
Thanks @graynorton! - Fix bug affecting position: fixed scrollers (#4125)
-
#4039
456c83be
Thanks @alanbuzek! - Removed unnecessary evaluation triggering strict linter error.
- #3976
3cf98cd8
Thanks @Westbrook! - Fixes #3904 "Clipping parents include ancestors ofposition: fixed
element"
-
#3909
feded34b
Thanks @chrispaterson! - Refactored and refurbished ScrollerController attach/detach code in effort to reduce potential memory leaks due to held instance references. -
#3892
f5b2013d
- Changed accessor and iterator code to support ES5 compilation. -
#3929
c3672fca
- Added new support utilities for dealing with ResizeObserver loop limit exceeded errors.
-
#3877
4418bed5
- Converted a benign innerHTML assignment to textContent. -
#3874
d32eec70
- Fix #3873: visibilityChange event not fired if other state (e.g. range) hasn't also changed
-
#3819
f0c8336a
- Fix #3815: Masonry: size and range bugs when the last item placed isn't the one extending the furthest -
#3708
a1f8c345
- [@lit-labs/virtualizer]: handle uninitialized layout in _childrenSizeChanged
- #3624
e51ff229
- ResizeObserver polyfill is no longer automatically loaded. If you target older browsers without native ResizeObserver support, see the docs for guidance on manual polyfill loading.
- #3609
54046b0b
- RangeChangedEvent and VisibilityChangedEvent both no longer bubble up. Listeners for these events must be placed on the lit-virtualizer or virtualize directive's host element.
-
#3624
e51ff229
- Additional fix for #3481: Error when immediately re-rendering; initialization code significantly simplified
-
#3519
393e30cf
- Fix #3481: Error when immediately re-rendering -
#3519
393e30cf
- Fix #3518: New layoutComplete promise created instead of using existing one -
#3525
0b67553d
- Fix #3493: Doesn't update on scroll when a clipping ancestor is in Shadow DOM -
#3527
feb2494d
- Added missing "events.js.map" sourcemap file.
NOTE: As of this release, virtualizer is moving away from 0.x-based versioning to signify prereleases and adopting standard SemVer major/minor/patch semantics. The fact that this release is numbered 1.0 has no special significance.
- #3183
fd7d86a5
- Significantly overhaul scrolling implementation
- Make smooth scrolling work as seamlessly as possible
- Make the API for scrolling to a virtualizer child element more like the corresponding native API
- Add a
pin
option to layouts: declaratively specify scroll position relative to a given child element
- Make
<lit-virtualizer>
use thevirtualize()
directive under the hood, restoring original factoring and reducing duplication - Standardize on one way to specify layout (factory function + config object), removing support for older (mostly never documented) options
- Add
layoutComplete
promise that resolves when virtualizer thinks it is done with a layout / render cycle (intended primarily for testing purposes) - Fix #3290: Export virtualizerRef symbol
- Fix #3491: keyFunction based on index doesn't work properly
- Fix #3492: Grid layout scrollSize calculated incorrectly when padding doesn't match gap
- Significantly overhaul scrolling implementation
-
- Add experimental masonry layout (API and behavior subject to change)
- Fix #3342: Gap miscalculation in grid base layout
-
#3501
3262c80f
- Fix #3498: Scrolling to element with 'nearest' option differs from native behavior
-
#3430
412b05e7
- Added an events.js module to enable exporting of RangeChangedEvent and VisibilityChangedEvent classes -
#3424
005c68fa
- Fix #3400: Calculates size incorrectly when a scrolling ancestor has padding -
#3501
3262c80f
- Fix #3243: DOM update doesn't successfully complete under some circumstances -
#3489
f5065f52
- Added a shim for deprecated scrollToIndex API, to be removed in a future version -
Updated dependencies [
b152db29
]:
-
#3133
36db238c
- The virtualize directive will now correctly re-render children when data stored outside the items array has changed.
-
The
scroll
directive has been renamed tovirtualize
. Note that the<lit-virtualizer>
element remains the recommended way to use virtualizer in most cases; the directive exists primarily for developers who are using Lit'slit-html
templating system standalone and don't need theLitElement
base class elsewhere in their project. -
By default, a virtualizer instance is no longer itself a scroller; rather, it is a block-level container that:
- Determines its own size by calculating or estimating the total size of all of its children (both those that are currently in the DOM and those that are not)
- Adds and removes children from the DOM as the visible portion of the virtualizer changes (i.e., when any of its containing ancestors, including the window, is scrolled, resized, etc.).
If you want to make a
<lit-virtualizer>
element into a scroller, you can do so by adding thescroller
attribute; likewise, you can setscroller: true
if you're using thevirtualize
directive.As a result of this change, the
scrollTarget
property / attribute is no longer needed and has been removed. -
In
0.5
and0.6
, it was necessary to explicitly specify a layout. In0.7
, we revert to the behavior from earlier versions: if you don't specify a layout, the default layout (previously calledLayout1d
, now calledflow
—see below) will be used (and loaded dynamically as needed). -
The lineup of layouts has been updated and cleaned up. The default layout, previously called
Layout1d
, is now calledflow
. The previous, rudimentary grid layouts have been replaced with a single, newgrid
layout with some options to control its behavior. TheLayout1dFlex
layout has been renamed toflexWrap
and remains a work in progress, not yet fully usable (though getting close). -
The syntax for specifying layouts has changed; rather than providing a layout constructor (e.g.,
FlowLayout
) or a configuration object containing the required type property (e.g.{type: FlowLayout, direction: ‘horizontal’}
), you now import a layout as a function and call that function (passing it an optional configuration object as desired). For example:<lit-virtualizer .layout=${flow({ direction: ‘horizontal’ }) ></lit-virtualizer>
-
The
spacing
property of the default layout (which has been present since the earliest releases but never documented) has been removed. Setting margins on the child elements you render is the way to control spacing. This margin-based method was already supported and recommended / demonstrated in previous versions, but has been improved in0.7
with basic support for margin-collapsing: margins set explicitly on child elements will now be collapsed, but any margins on elements contained within child elements are not considered. If you were relying on the previous (non-collapsing) behavior, you may need to adjust existing style rules. -
In another return to pre-
0.5
behavior, thevisibilityChanged
andrangeChanged
events are no longerCustomEvent
s, so you’ll access their properties directly from the event object, not from under adetails
property. Additionally, these event objects no longer contain both range and visibility information; rather,visibilityChanged
reports only visibility changes andrangeChanged
reports only range changes. Both event objects have just two properties:first
andlast
. -
Inline API docs are still minimal, but types for
<lit-virtualizer>
, thevirtualize
directive and the various layouts are essentially correct and complete, so typeahead / autocomplete should work if your editor has these features. -
Exports from the
@lit-labs/virtualizer
packaged are now restricted by an export map. If you have been importing from any modules not intended to be part of the current public API (or if we have inadvertently left something out of the map), things may break—please file issues as needed. -
The LitVirtualizer class has been extracted into a separate file (
LitVirtualizer.js
) so that, if necessary, it can be imported without registering the<lit-virtualizer>
custom element as a side effect.
- Scrolling issue on iOS (#54)
- Incorrect index passed to
renderItem()
function (#109) - Undocumented change: doesn't work unless layout is explicitly specified (#103)
- Runtime error when rendering after the number of items is reduced (#111)
The following are also believed to be fixed, but didn't have specific repro cases to test against so require confirmation:
- Scroll listeners on
window
not removed (#55) - Doesn't always reflow when items change (#75)
- Hangs / freezes when switching between virtualizer instances (#105)
- Scrolling issue under certain circumstances when
items
array changes (#108)
- Extracted LitVirtualizer class to be imported without side-effects
- Runtime error when rendering after the number of items is reduced (#111)
-
The
scroll
directive has been renamed tovirtualize
. Note that the<lit-virtualizer>
element remains the recommended way to use virtualizer in most cases; the directive exists primarily for developers who are using Lit'slit-html
templating system standalone and don't need theLitElement
base class elsewhere in their project. -
By default, a virtualizer instance is no longer itself a scroller; rather, it is a block-level container that:
- Determines its own size by calculating or estimating the total size of all of its children (both those that are currently in the DOM and those that are not)
- Adds and removes children from the DOM as the visible portion of the virtualizer changes (i.e., when any of its containing ancestors, including the window, is scrolled, resized, etc.).
If you want to make a
<lit-virtualizer>
element into a scroller, you can do so by adding thescroller
attribute; likewise, you can setscroller: true
if you're using thevirtualize
directive.As a result of this change, the
scrollTarget
property / attribute is no longer needed and has been removed. -
In
0.5
and0.6
, it was necessary to explicitly specify a layout. In0.7
, we revert to the behavior from earlier versions: if you don't specify a layout, the default layout (previously calledLayout1d
, now calledflow
—see below) will be used (and loaded dynamically as needed). -
The lineup of layouts has been updated and cleaned up. The default layout, previously called
Layout1d
, is now calledflow
. The previous, rudimentary grid layouts have been replaced with a single, newgrid
layout with some options to control its behavior. TheLayout1dFlex
layout has been renamed toflexWrap
and remains a work in progress, not yet fully usable (though getting close). -
The syntax for specifying layouts has changed; rather than providing a layout constructor (e.g.,
FlowLayout
) or a configuration object containing the required type property (e.g.{type: FlowLayout, direction: ‘horizontal’}
), you now import a layout as a function and call that function (passing it an optional configuration object as desired). For example:<lit-virtualizer .layout=${flow({ direction: ‘horizontal’ }) ></lit-virtualizer>
-
The
spacing
property of the default layout (which has been present since the earliest releases but never documented) has been removed. Setting margins on the child elements you render is the way to control spacing. This margin-based method was already supported and recommended / demonstrated in previous versions, but has been improved in0.7
with basic support for margin-collapsing: margins set explicitly on child elements will now be collapsed, but any margins on elements contained within child elements are not considered. If you were relying on the previous (non-collapsing) behavior, you may need to adjust existing style rules. -
In another return to pre-
0.5
behavior, thevisibilityChanged
andrangeChanged
events are no longerCustomEvent
s, so you’ll access their properties directly from the event object, not from under adetails
property. Additionally, these event objects no longer contain both range and visibility information; rather,visibilityChanged
reports only visibility changes andrangeChanged
reports only range changes. Both event objects have just two properties:first
andlast
. -
Inline API docs are still minimal, but types for
<lit-virtualizer>
, thevirtualize
directive and the various layouts are essentially correct and complete, so typeahead / autocomplete should work if your editor has these features. -
Exports from the
@lit-labs/virtualizer
packaged are now restricted by an export map. If you have been importing from any modules not intended to be part of the current public API (or if we have inadvertently left something out of the map), things may break—please file issues as needed.
- Scrolling issue on iOS (#54)
- Incorrect index passed to
renderItem()
function (#109) - Undocumented change: doesn't work unless layout is explicitly specified (#103)
The following are also believed to be fixed, but didn't have specific repro cases to test against so require confirmation:
- Scroll listeners on
window
not removed (#55) - Doesn't always reflow when items change (#75)
- Hangs / freezes when switching between virtualizer instances (#105)
- Scrolling issue under certain circumstances when
items
array changes (#108)
- This is a stopgap release to unblock migrations to Lit 2.0
- In the near future:
- Source will move to the Lit monorepo
- Subsequent releases will likely be as
@lit-labs/virtualizer
- Migrated to Lit 2.x
- Significant refactoring
- Now emits custom events, access data from
detail
object
- Support for older browsers (IE11, legacy Edge)
- Benchmarking support (subject to change)
- Work-in-progress grid layouts, not ready for use
- Appended
.js
to all local imports. - Capitalized
Layout
import in Layout1dBase.
- Rollup plugins moved to dev dependencies.
- Bumped rollup-plugin-terser version.
- Type declarations.
- lit-html and LitElement versions.
firstVisible
andlastVisible
onRangeChangeEvent
.
scrollToIndex
method on<lit-virtualizer>
.scrollToIndex
configuration option onscroll
directive.
- Renamed API option
template
torenderItem
.
- Initial prerelease.