@html-next/vertical-collection 1.0.0-beta.9 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +76 -0
- package/CHANGELOG.md +13 -0
- package/README.md +30 -48
- package/RELEASE.md +60 -0
- package/addon/-debug/edge-visualization/debug-mixin.js +5 -9
- package/addon/-debug/edge-visualization/visualization.js +2 -2
- package/addon/-private/data-view/elements/occluded-content.js +84 -0
- package/addon/-private/data-view/{container.js → elements/viewport-container.js} +5 -5
- package/addon/-private/data-view/{virtual-component.js → elements/virtual-component.js} +15 -13
- package/addon/-private/data-view/radar/dynamic-radar.js +4 -5
- package/addon/-private/data-view/radar/radar.js +90 -31
- package/addon/-private/data-view/utils/mutation-checkers.js +29 -0
- package/addon/-private/data-view/utils/scroll-handler.js +1 -3
- package/addon/-private/data-view/utils/supports-passive.js +1 -0
- package/addon/-private/data-view/viewport-container.js +70 -0
- package/addon/-private/ember-internals/identity.js +1 -5
- package/addon/-private/ember-internals/key-for-item.js +1 -5
- package/addon/-private/index.js +1 -1
- package/addon/-private/utils/document-shim.js +1 -0
- package/addon/components/vertical-collection/component.js +31 -84
- package/addon/components/vertical-collection/template.hbs +2 -2
- package/addon/styles/app.css +7 -6
- package/app/components/vertical-collection.js +1 -1
- package/app/initializers/debug.js +1 -1
- package/config/ember-cli-toolbelts.json +1 -5
- package/config/environment.js +0 -1
- package/index.js +45 -41
- package/package.json +96 -64
- package/.npmignore +0 -16
- package/app/initializers/vertical-collection-legacy-compat.js +0 -14
- package/config/changelog.js +0 -23
- package/config/release.js +0 -19
- package/yarn.lock +0 -6533
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: Vertical Collection CI
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
name: Run Tests
|
|
9
|
+
runs-on: ubuntu-18.04
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout
|
|
13
|
+
uses: actions/checkout@v2
|
|
14
|
+
|
|
15
|
+
- name: Use Node 12
|
|
16
|
+
uses: actions/setup-node@v2-beta
|
|
17
|
+
with:
|
|
18
|
+
node-version: 12.x
|
|
19
|
+
|
|
20
|
+
- name: Node Modules Cache
|
|
21
|
+
uses: actions/cache@v2
|
|
22
|
+
with:
|
|
23
|
+
path: '**/node_modules'
|
|
24
|
+
key: ci-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
25
|
+
|
|
26
|
+
- name: Install Dependencies
|
|
27
|
+
run: yarn install --frozen-lockfile
|
|
28
|
+
|
|
29
|
+
- name: Lint
|
|
30
|
+
run: yarn lint
|
|
31
|
+
|
|
32
|
+
- name: Run Tests
|
|
33
|
+
run: yarn test:ember
|
|
34
|
+
env:
|
|
35
|
+
CI: true
|
|
36
|
+
|
|
37
|
+
test-ember-try:
|
|
38
|
+
name: Run Tests
|
|
39
|
+
runs-on: ubuntu-18.04
|
|
40
|
+
strategy:
|
|
41
|
+
matrix:
|
|
42
|
+
ember-version:
|
|
43
|
+
[
|
|
44
|
+
ember-lts-2.8,
|
|
45
|
+
ember-lts-2.12,
|
|
46
|
+
ember-lts-2.18,
|
|
47
|
+
ember-lts-3.4,
|
|
48
|
+
ember-lts-3.8,
|
|
49
|
+
ember-lts-3.12,
|
|
50
|
+
ember-lts-3.16,
|
|
51
|
+
ember-lts-3.20,
|
|
52
|
+
ember-release,
|
|
53
|
+
ember-beta,
|
|
54
|
+
ember-canary,
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
steps:
|
|
58
|
+
- name: Checkout
|
|
59
|
+
uses: actions/checkout@v2
|
|
60
|
+
|
|
61
|
+
- name: Use Node 12
|
|
62
|
+
uses: actions/setup-node@v2-beta
|
|
63
|
+
with:
|
|
64
|
+
node-version: 12.x
|
|
65
|
+
|
|
66
|
+
- name: Node Modules Cache
|
|
67
|
+
uses: actions/cache@v2
|
|
68
|
+
with:
|
|
69
|
+
path: '**/node_modules'
|
|
70
|
+
key: ci-yarn-${{ matrix.ember-version }}-${{ hashFiles('**/yarn.lock') }}
|
|
71
|
+
|
|
72
|
+
- name: Install
|
|
73
|
+
run: yarn install --frozen-lockfile --ignore-engines
|
|
74
|
+
|
|
75
|
+
- name: Run Tests
|
|
76
|
+
run: node_modules/.bin/ember try:one ${{ matrix.ember-version }} --skip-cleanup
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
## v2.0.1 (2021-12-07)
|
|
5
|
+
|
|
6
|
+
#### :bug: Bug Fix
|
|
7
|
+
* [#322](https://github.com/html-next/vertical-collection/pull/322) Remove comma in selector list in css ([@CubeSquared](https://github.com/CubeSquared))
|
|
8
|
+
|
|
9
|
+
#### :house: Internal
|
|
10
|
+
* [#336](https://github.com/html-next/vertical-collection/pull/336) Add rwjblue release-it setup ([@rwwagner90](https://github.com/rwwagner90))
|
|
11
|
+
|
|
12
|
+
#### Committers: 2
|
|
13
|
+
- Matthew Jacobs ([@CubeSquared](https://github.com/CubeSquared))
|
|
14
|
+
- Robert Wagner ([@rwwagner90](https://github.com/rwwagner90))
|
|
15
|
+
|
|
16
|
+
|
|
4
17
|
## 0.5.5
|
|
5
18
|
|
|
6
19
|
### Pull Requests
|
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
vertical-collection
|
|
2
|
-
|
|
1
|
+
# vertical-collection
|
|
2
|
+
|
|
3
|
+
[](https://greenkeeper.io/)
|
|
3
4
|
|
|
4
5
|
[](https://travis-ci.org/html-next/vertical-collection)
|
|
5
6
|
|
|
@@ -13,14 +14,13 @@ component for performant lists and `svelte renders` to match a core belief:
|
|
|
13
14
|
#### TL;DR svelte render: the fewer things you need to render, the faster your renders will be.
|
|
14
15
|
|
|
15
16
|
Your web page is a universe, your viewport is the scene. Much like you wouldn't expect a video game to render
|
|
16
|
-
out-of-scene content, your application should smartly cull the content it doesn't need to care about.
|
|
17
|
+
out-of-scene content, your application should smartly cull the content it doesn't need to care about. Trimming
|
|
17
18
|
excess content lets the browser perform both initial renders and re-renders at far higher frame-rates, as the only
|
|
18
19
|
content it needs to focus on for layout is the content the user can see.
|
|
19
20
|
|
|
20
21
|
`vertical-collection` augments your existing app, it doesn't ask you to rewrite layouts or logic in order to use it.
|
|
21
22
|
It will try its best to allow you to keep the conventions, structures, and layouts you want.
|
|
22
23
|
|
|
23
|
-
|
|
24
24
|
## Install
|
|
25
25
|
|
|
26
26
|
```bash
|
|
@@ -39,10 +39,10 @@ ember install @html-next/vertical-collection
|
|
|
39
39
|
renderAll=false
|
|
40
40
|
renderFromLast=false
|
|
41
41
|
idForFirstItem=idForFirstItem
|
|
42
|
-
firstReached=firstReached
|
|
43
|
-
lastReached=lastReached
|
|
44
|
-
|
|
45
|
-
lastVisibleChanged=lastVisibleChanged
|
|
42
|
+
firstReached=(action firstReached)
|
|
43
|
+
lastReached=(action lastReached)
|
|
44
|
+
firstVisibleChanged=(action firstVisibleChanged)
|
|
45
|
+
lastVisibleChanged=(action lastVisibleChanged)
|
|
46
46
|
as |item i|}}
|
|
47
47
|
<li>
|
|
48
48
|
{{item.number}} {{i}}
|
|
@@ -57,15 +57,19 @@ ember install @html-next/vertical-collection
|
|
|
57
57
|
`lastReached`- Triggered when scroll reaches the last element in the collection
|
|
58
58
|
|
|
59
59
|
`firstVisibleChanged` - Triggered when the first element in the viewport changes
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
`lastVisibleChanged` - Triggered when the last element in the viewport changes
|
|
62
62
|
|
|
63
|
-
## Support
|
|
63
|
+
## Support Matrix
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
| `vertical-collection` version | Supported Ember versions |
|
|
66
|
+
| ----------------------------- | ------------------------ |
|
|
67
|
+
| `^v1.0.0` | `v1.12.0 - v3.8.0` |
|
|
68
|
+
| `^v2.0.0` | `v2.8.0+` |
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
## Support, Questions, Collaboration
|
|
68
71
|
|
|
72
|
+
Join the [Ember community on Discord](https://discord.gg/zT3asNS)
|
|
69
73
|
|
|
70
74
|
## Features
|
|
71
75
|
|
|
@@ -75,10 +79,10 @@ Infinite scroll that remains performant even for very long lists is easily achie
|
|
|
75
79
|
with the [`vertical-collection`](http://html-next.github.io/vertical-collection/#/settings).
|
|
76
80
|
It works via a scrollable div or scrollable body.
|
|
77
81
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
- [bi-directional scrollable div](http://html-next.github.io/vertical-collection/#/examples/infinite-scroll)
|
|
83
|
+
- [scrollable body](http://html-next.github.io/vertical-collection/#/examples/scrollable-body)
|
|
84
|
+
- [dynamic content sizes](http://html-next.github.io/vertical-collection/#/examples/flexible-layout)
|
|
85
|
+
- [as a table](http://html-next.github.io/vertical-collection/#/examples/dbmon)
|
|
82
86
|
|
|
83
87
|
### Svelte Everything
|
|
84
88
|
|
|
@@ -93,46 +97,24 @@ If it can be trimmer, smoke-and-mirrors likes to trim it.
|
|
|
93
97
|
[](https://david-dm.org/html-next/vertical-collection#info=devDependencies)
|
|
94
98
|
[](https://coveralls.io/github/html-next/vertical-collection?branch=master)
|
|
95
99
|
|
|
96
|
-
|
|
97
100
|
## Documentation
|
|
98
101
|
|
|
99
102
|
For updated documentation and demos see [http://html-next.github.io/vertical-collection/](http://html-next.github.io/vertical-collection/)
|
|
100
103
|
|
|
101
104
|
## Contributing
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
- PR against `develop` (default branch).
|
|
108
|
-
|
|
109
|
-
### Commits
|
|
110
|
-
|
|
111
|
-
Angular Style commit messages have the full form:
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
<type>(<scope>): <title>
|
|
115
|
-
|
|
116
|
-
<body>
|
|
117
|
-
|
|
118
|
-
<footer>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
But the abbreviated form (below) is acceptable and often preferred.
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
<type>(<scope>): <title>
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Examples:
|
|
128
|
-
|
|
129
|
-
- chore(deps): bump deps in package.json and bower.json
|
|
130
|
-
- docs(component): document the `fast-action` component
|
|
106
|
+
- Open an Issue for discussion first if you're unsure a feature/fix is wanted.
|
|
107
|
+
- Branch off of `master` (default branch)
|
|
108
|
+
- Use descriptive branch names (e.g. `<type>/<short-description>`)
|
|
109
|
+
- PR against `master` (default branch).
|
|
131
110
|
|
|
111
|
+
### Testing
|
|
132
112
|
|
|
113
|
+
Make sure you register the test waiter from [ember-raf-scheduler](https://github.com/html-next/ember-raf-scheduler). So `ember-test-helpers`'s `wait` is aware of the scheduled updates.
|
|
133
114
|
|
|
134
|
-
|
|
115
|
+
An example can be found [here](https://github.com/html-next/vertical-collection/blob/master/tests/test-helper.js#L2)
|
|
135
116
|
|
|
136
|
-
|
|
117
|
+
License
|
|
118
|
+
------------------------------------------------------------------------------
|
|
137
119
|
|
|
138
|
-
|
|
120
|
+
This project is licensed under the [MIT License](LICENSE.md).
|
package/RELEASE.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
Releases are mostly automated using
|
|
4
|
+
[release-it](https://github.com/release-it/release-it/) and
|
|
5
|
+
[lerna-changelog](https://github.com/lerna/lerna-changelog/).
|
|
6
|
+
|
|
7
|
+
## Preparation
|
|
8
|
+
|
|
9
|
+
Since the majority of the actual release process is automated, the primary
|
|
10
|
+
remaining task prior to releasing is confirming that all pull requests that
|
|
11
|
+
have been merged since the last release have been labeled with the appropriate
|
|
12
|
+
`lerna-changelog` labels and the titles have been updated to ensure they
|
|
13
|
+
represent something that would make sense to our users. Some great information
|
|
14
|
+
on why this is important can be found at
|
|
15
|
+
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
|
|
16
|
+
guiding principle here is that changelogs are for humans, not machines.
|
|
17
|
+
|
|
18
|
+
When reviewing merged PR's the labels to be used are:
|
|
19
|
+
|
|
20
|
+
* breaking - Used when the PR is considered a breaking change.
|
|
21
|
+
* enhancement - Used when the PR adds a new feature or enhancement.
|
|
22
|
+
* bug - Used when the PR fixes a bug included in a previous release.
|
|
23
|
+
* documentation - Used when the PR adds or updates documentation.
|
|
24
|
+
* internal - Used for internal changes that still require a mention in the
|
|
25
|
+
changelog/release notes.
|
|
26
|
+
|
|
27
|
+
## Release
|
|
28
|
+
|
|
29
|
+
Once the prep work is completed, the actual release is straight forward:
|
|
30
|
+
|
|
31
|
+
* First, ensure that you have installed your projects dependencies:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
yarn install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
* Second, ensure that you have obtained a
|
|
38
|
+
[GitHub personal access token][generate-token] with the `repo` scope (no
|
|
39
|
+
other permissions are needed). Make sure the token is available as the
|
|
40
|
+
`GITHUB_AUTH` environment variable.
|
|
41
|
+
|
|
42
|
+
For instance:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
export GITHUB_AUTH=abc123def456
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
|
|
49
|
+
|
|
50
|
+
* And last (but not least 😁) do your release.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
npx release-it
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
[release-it](https://github.com/release-it/release-it/) manages the actual
|
|
57
|
+
release process. It will prompt you to to choose the version number after which
|
|
58
|
+
you will have the chance to hand tweak the changelog to be used (for the
|
|
59
|
+
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
|
|
60
|
+
pushing the tag and commits, etc.
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { assert } from '@ember/debug';
|
|
2
|
+
import Mixin from '@ember/object/mixin';
|
|
2
3
|
import Visualization from './visualization';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
assert,
|
|
7
|
-
Mixin
|
|
8
|
-
} = Ember;
|
|
4
|
+
import { ViewportContainer } from '../../-private';
|
|
9
5
|
|
|
10
6
|
import {
|
|
11
7
|
styleIsOneOf,
|
|
@@ -37,7 +33,7 @@ export default Mixin.create({
|
|
|
37
33
|
let styles;
|
|
38
34
|
|
|
39
35
|
// check telescope
|
|
40
|
-
if (radar.scrollContainer !==
|
|
36
|
+
if (radar.scrollContainer !== ViewportContainer) {
|
|
41
37
|
styles = window.getComputedStyle(radar.scrollContainer);
|
|
42
38
|
} else {
|
|
43
39
|
styles = window.getComputedStyle(document.body);
|
|
@@ -48,7 +44,7 @@ export default Mixin.create({
|
|
|
48
44
|
assert(`scrollContainer must define height or max-height`, hasStyleWithNonZeroValue(styles, 'height') || hasStyleWithNonZeroValue(styles, 'max-height'));
|
|
49
45
|
|
|
50
46
|
// conditional perf check for non-body scrolling
|
|
51
|
-
if (radar.scrollContainer !==
|
|
47
|
+
if (radar.scrollContainer !== ViewportContainer) {
|
|
52
48
|
assert(`scrollContainer must define overflow-y`, hasStyleValue(styles, 'overflow-y', 'scroll') || hasStyleValue(styles, 'overflow', 'scroll'));
|
|
53
49
|
}
|
|
54
50
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* global document */
|
|
2
|
-
import {
|
|
2
|
+
import { ViewportContainer } from '../../-private';
|
|
3
3
|
|
|
4
4
|
function applyVerticalStyles(element, geography) {
|
|
5
5
|
element.style.height = `${geography.height}px`;
|
|
@@ -44,7 +44,7 @@ export default class Visualization {
|
|
|
44
44
|
this.container.style.height = `${_scrollContainer.getBoundingClientRect().height}px`;
|
|
45
45
|
|
|
46
46
|
applyVerticalStyles(this.scrollContainer, _scrollContainer.getBoundingClientRect());
|
|
47
|
-
applyVerticalStyles(this.screen,
|
|
47
|
+
applyVerticalStyles(this.screen, ViewportContainer.getBoundingClientRect());
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
makeSatellite() {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { set } from '@ember/object';
|
|
2
|
+
import { DEBUG } from '@glimmer/env';
|
|
3
|
+
import { IS_GLIMMER_2, gte as emberVersionGTE } from 'ember-compatibility-helpers';
|
|
4
|
+
|
|
5
|
+
import document from '../../utils/document-shim';
|
|
6
|
+
|
|
7
|
+
let OC_IDENTITY = 0;
|
|
8
|
+
|
|
9
|
+
export default class OccludedContent {
|
|
10
|
+
constructor(tagName) {
|
|
11
|
+
this.id = `OC-${OC_IDENTITY++}`;
|
|
12
|
+
this.isOccludedContent = true;
|
|
13
|
+
|
|
14
|
+
// We check to see if the document exists in Fastboot. Since RAF won't run in
|
|
15
|
+
// Fastboot, we'll never have to use these text nodes for measurements, so they
|
|
16
|
+
// can be empty
|
|
17
|
+
if (document !== undefined) {
|
|
18
|
+
this.element = document.createElement(tagName);
|
|
19
|
+
this.element.className += 'occluded-content';
|
|
20
|
+
|
|
21
|
+
this.upperBound = document.createTextNode('');
|
|
22
|
+
this.lowerBound = document.createTextNode('');
|
|
23
|
+
} else {
|
|
24
|
+
this.element = null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
this.isOccludedContent = true;
|
|
28
|
+
this.rendered = false;
|
|
29
|
+
|
|
30
|
+
if (!emberVersionGTE('3.0.0')) {
|
|
31
|
+
// In older versions of Ember, binding anything on an object in the template
|
|
32
|
+
// adds observers which creates __ember_meta__
|
|
33
|
+
this.__ember_meta__ = null; // eslint-disable-line camelcase
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (DEBUG) {
|
|
37
|
+
Object.preventExtensions(this);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getBoundingClientRect() {
|
|
42
|
+
if (this.element !== null) {
|
|
43
|
+
return this.element.getBoundingClientRect();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
addEventListener(event, listener) {
|
|
48
|
+
if (this.element !== null) {
|
|
49
|
+
this.element.addEventListener(event, listener);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
removeEventListener(event, listener) {
|
|
54
|
+
if (this.element !== null) {
|
|
55
|
+
this.element.removeEventListener(event, listener);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get realUpperBound() {
|
|
60
|
+
return IS_GLIMMER_2 ? this.upperBound : this.upperBound.previousSibling;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get realLowerBound() {
|
|
64
|
+
return IS_GLIMMER_2 ? this.lowerBound : this.lowerBound.nextSibling;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get parentNode() {
|
|
68
|
+
return this.element !== null ? this.element.parentNode : null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get style() {
|
|
72
|
+
return this.element !== null ? this.element.style : {};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
set innerHTML(value) {
|
|
76
|
+
if (this.element !== null) {
|
|
77
|
+
this.element.innerHTML = value;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
destroy() {
|
|
82
|
+
set(this, 'element', null);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* to access and set the scrollTop and scrollLeft properties.
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
|
-
export function
|
|
15
|
+
export function ViewportContainer() {
|
|
16
16
|
|
|
17
17
|
// A bug occurs in Chrome when we reload the browser at a lower
|
|
18
18
|
// scrollTop, window.scrollY becomes stuck on a single value.
|
|
@@ -48,15 +48,15 @@ export function Container() {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
ViewportContainer.prototype.addEventListener = function addEventListener(event, handler, options) {
|
|
52
52
|
return window.addEventListener(event, handler, options);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
ViewportContainer.prototype.removeEventListener = function addEventListener(event, handler, options) {
|
|
56
56
|
return window.removeEventListener(event, handler, options);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
ViewportContainer.prototype.getBoundingClientRect = function getBoundingClientRect() {
|
|
60
60
|
return {
|
|
61
61
|
height: window.innerHeight,
|
|
62
62
|
width: window.innerWidth,
|
|
@@ -67,4 +67,4 @@ Container.prototype.getBoundingClientRect = function getBoundingClientRect() {
|
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export default new
|
|
70
|
+
export default new ViewportContainer();
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { set } from '@ember/object';
|
|
2
2
|
import { assert } from '@ember/debug';
|
|
3
3
|
import { DEBUG } from '@glimmer/env';
|
|
4
|
+
import { IS_GLIMMER_2, gte as emberVersionGTE } from 'ember-compatibility-helpers';
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
const { set } = Ember;
|
|
6
|
+
import document from '../../utils/document-shim';
|
|
8
7
|
|
|
9
8
|
let VC_IDENTITY = 0;
|
|
10
9
|
|
|
11
10
|
export default class VirtualComponent {
|
|
12
11
|
constructor(content = null, index = null) {
|
|
13
|
-
this.id = VC_IDENTITY
|
|
12
|
+
this.id = `VC-${VC_IDENTITY++}`;
|
|
14
13
|
|
|
15
14
|
this.content = content;
|
|
16
15
|
this.index = index;
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
// We check to see if the document exists in Fastboot. Since RAF won't run in
|
|
18
|
+
// Fastboot, we'll never have to use these text nodes for measurements, so they
|
|
19
|
+
// can be empty
|
|
20
|
+
this.upperBound = document !== undefined ? document.createTextNode('') : null;
|
|
21
|
+
this.lowerBound = document !== undefined ? document.createTextNode('') : null;
|
|
21
22
|
|
|
22
23
|
this.rendered = false;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
if (!emberVersionGTE('3.0.0')) {
|
|
26
|
+
// In older versions of Ember, binding anything on an object in the template
|
|
27
|
+
// adds observers which creates __ember_meta__
|
|
28
|
+
this.__ember_meta__ = null; // eslint-disable-line camelcase
|
|
29
|
+
}
|
|
27
30
|
|
|
28
|
-
if (DEBUG
|
|
31
|
+
if (DEBUG) {
|
|
29
32
|
Object.preventExtensions(this);
|
|
30
33
|
}
|
|
31
34
|
}
|
|
@@ -83,7 +86,6 @@ export default class VirtualComponent {
|
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
destroy() {
|
|
86
|
-
set(this, 'element', null);
|
|
87
89
|
set(this, 'upperBound', null);
|
|
88
90
|
set(this, 'lowerBound', null);
|
|
89
91
|
set(this, 'content', null);
|
|
@@ -32,14 +32,14 @@ export default class DynamicRadar extends Radar {
|
|
|
32
32
|
this.skipList = null;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
scheduleUpdate() {
|
|
35
|
+
scheduleUpdate(didUpdateItems) {
|
|
36
36
|
// Cancel incremental render check, since we'll be remeasuring anyways
|
|
37
37
|
if (this._nextIncrementalRender !== null) {
|
|
38
38
|
this._nextIncrementalRender.cancel();
|
|
39
39
|
this._nextIncrementalRender = null;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
super.scheduleUpdate();
|
|
42
|
+
super.scheduleUpdate(didUpdateItems);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
afterUpdate() {
|
|
@@ -156,6 +156,7 @@ export default class DynamicRadar extends Radar {
|
|
|
156
156
|
lastItemIndex
|
|
157
157
|
} = this;
|
|
158
158
|
|
|
159
|
+
this._updateConstants();
|
|
159
160
|
this._measure();
|
|
160
161
|
|
|
161
162
|
// These indexes could change after the measurement, and in the incremental render
|
|
@@ -273,9 +274,7 @@ export default class DynamicRadar extends Radar {
|
|
|
273
274
|
reset() {
|
|
274
275
|
super.reset();
|
|
275
276
|
|
|
276
|
-
|
|
277
|
-
this.skipList.reset(this.totalItems);
|
|
278
|
-
}
|
|
277
|
+
this.skipList.reset(this.totalItems);
|
|
279
278
|
}
|
|
280
279
|
|
|
281
280
|
/*
|