@html-next/vertical-collection 3.1.0 → 4.0.0-beta.0

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.
@@ -7,7 +7,7 @@ jobs:
7
7
  test:
8
8
  name: Run Tests
9
9
  runs-on: ubuntu-latest
10
- timeout-minutes: 8
10
+ timeout-minutes: 12
11
11
 
12
12
  steps:
13
13
  - name: Checkout
@@ -30,31 +30,31 @@ jobs:
30
30
  - name: Lint
31
31
  run: yarn lint
32
32
 
33
+ - name: Run Build
34
+ run: . bin/restore-env.sh && yarn run ember build
35
+
33
36
  - name: Run Tests
34
- run: bin/run-tests-with-retry.sh
35
- env:
36
- CI: true
37
+ uses: nick-fields/retry@v2
38
+ with:
39
+ timeout_minutes: 2
40
+ max_attempts: 5
41
+ command: . bin/restore-env.sh && CI=true yarn run ember test --path=dist
37
42
 
38
43
  test-ember-try:
39
44
  name: Run Tests
40
45
  runs-on: ubuntu-latest
41
- timeout-minutes: 15
46
+ timeout-minutes: 12
42
47
 
43
48
  strategy:
44
49
  fail-fast: false
45
50
  matrix:
46
51
  ember-version:
47
52
  [
48
- ember-lts-2.18,
49
- ember-lts-3.4,
50
- ember-lts-3.8,
51
53
  ember-lts-3.12,
52
54
  ember-lts-3.16,
53
55
  ember-lts-3.20,
54
- ember-lts-3.24,
55
56
  ember-lts-3.28,
56
57
  ember-lts-4.4,
57
- ember-4.5,
58
58
  ember-release,
59
59
  ember-beta,
60
60
  ember-canary,
@@ -91,5 +91,12 @@ jobs:
91
91
  if: steps.cache-npm.outputs.cache-hit != 'true'
92
92
  run: node_modules/.bin/ember try:one ${{ matrix.ember-version }} --skip-cleanup --- bin/stash-env.sh
93
93
 
94
+ - name: Run Build
95
+ run: . bin/restore-env.sh && yarn run ember build
96
+
94
97
  - name: Run Tests
95
- run: . bin/restore-env.sh && bin/run-tests-with-retry.sh
98
+ uses: nick-fields/retry@v2
99
+ with:
100
+ timeout_minutes: 2
101
+ max_attempts: 5
102
+ command: . bin/restore-env.sh && CI=true yarn run ember test --path=dist
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@ Changelog
2
2
  =========
3
3
 
4
4
 
5
+ ## v4.0.0-beta.0 (2022-08-28)
6
+
7
+ * Drop support for Ember versions prior to 3.12
8
+ * Drop support for Ember CLI 2.x
9
+ * Adopt native getters
10
+ * Adopt angle bracket invocation
11
+ * Drop positional param argument for `item`
12
+
13
+
5
14
  ## v3.1.0 (2022-08-04)
6
15
 
7
16
  #### :rocket: Enhancement
package/README.md CHANGED
@@ -30,24 +30,24 @@ ember install @html-next/vertical-collection
30
30
  ## Usage
31
31
 
32
32
  ```htmlbars
33
- {{#vertical-collection
34
- items
35
- tagName='ul'
36
- estimateHeight=50
37
- staticHeight=false
38
- bufferSize=1
39
- renderAll=false
40
- renderFromLast=false
41
- idForFirstItem=idForFirstItem
42
- firstReached=(action firstReached)
43
- lastReached=(action lastReached)
44
- firstVisibleChanged=(action firstVisibleChanged)
45
- lastVisibleChanged=(action lastVisibleChanged)
46
- as |item i|}}
33
+ <VerticalCollection
34
+ @items={{items}}
35
+ @tagName="ul"
36
+ @estimateHeight={{50}}
37
+ @staticHeight={{false}}
38
+ @bufferSize={{1}}
39
+ @renderAll={{false}}
40
+ @renderFromLast={{false}}
41
+ @idForFirstItem={{idForFirstItem}}
42
+ @firstReached={{firstReachedCallback}}
43
+ @lastReached={{lastReachedCallback}}
44
+ @firstVisibleChanged={{firstVisibleChangedCallback}}
45
+ @lastVisibleChanged={{lastVisibleChangedCallback}}
46
+ as |item i|>
47
47
  <li>
48
48
  {{item.number}} {{i}}
49
49
  </li>
50
- {{/vertical-collection}}
50
+ </VerticalCollection>
51
51
  ```
52
52
 
53
53
  ### Actions
@@ -67,6 +67,7 @@ ember install @html-next/vertical-collection
67
67
  | `^v1.x.x` | `v1.12.0 - v3.8.x` | `?` |
68
68
  | `^v2.x.x` | `v2.8.0 - v3.26.x` | `v12 - ?` |
69
69
  | `^v3.x.x` | `v2.18.0+` | `v14+` |
70
+ | `^v4.x.x` | `v3.12.0+` | `v14+` |
70
71
 
71
72
  ## Support, Questions, Collaboration
72
73
 
@@ -25,7 +25,7 @@ export default Mixin.create({
25
25
  },
26
26
 
27
27
  detectIssuesWithCSS() {
28
- if (this.get('debugCSS') === false) {
28
+ if (this.debugCSS === false) {
29
29
  return;
30
30
  }
31
31
 
@@ -55,7 +55,7 @@ export default Mixin.create({
55
55
  assert(`itemContainer must define position`, styleIsOneOf(styles, 'position', ['static', 'relative', 'absolute']));
56
56
 
57
57
  // check item defaults
58
- assert(`You must supply at least one item to the collection to debug it's CSS.`, this.get('items.length'));
58
+ assert(`You must supply at least one item to the collection to debug it's CSS.`, this.items.length);
59
59
 
60
60
  let element = radar._itemContainer.firstElementChild;
61
61
 
@@ -66,7 +66,7 @@ export default Mixin.create({
66
66
  },
67
67
 
68
68
  updateVisualization() {
69
- if (this.get('debugVis') === false) {
69
+ if (this.debugVis === false) {
70
70
  if (this.__visualization !== null) {
71
71
  console.info('tearing down existing visualization'); // eslint-disable-line no-console
72
72
  this.__visualization.destroy();
@@ -1,6 +1,5 @@
1
1
  import { set } from '@ember/object';
2
2
  import { DEBUG } from '@glimmer/env';
3
- import { IS_GLIMMER_2, gte as emberVersionGTE } from 'ember-compatibility-helpers';
4
3
 
5
4
  import document from '../../utils/document-shim';
6
5
 
@@ -27,12 +26,6 @@ export default class OccludedContent {
27
26
  this.isOccludedContent = true;
28
27
  this.rendered = false;
29
28
 
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
29
  if (DEBUG) {
37
30
  Object.preventExtensions(this);
38
31
  }
@@ -57,11 +50,11 @@ export default class OccludedContent {
57
50
  }
58
51
 
59
52
  get realUpperBound() {
60
- return IS_GLIMMER_2 ? this.upperBound : this.upperBound.previousSibling;
53
+ return this.upperBound;
61
54
  }
62
55
 
63
56
  get realLowerBound() {
64
- return IS_GLIMMER_2 ? this.lowerBound : this.lowerBound.nextSibling;
57
+ return this.lowerBound;
65
58
  }
66
59
 
67
60
  get parentNode() {
@@ -1,7 +1,6 @@
1
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';
5
4
 
6
5
  import document from '../../utils/document-shim';
7
6
 
@@ -22,23 +21,17 @@ export default class VirtualComponent {
22
21
 
23
22
  this.rendered = false;
24
23
 
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
- }
30
-
31
24
  if (DEBUG) {
32
25
  Object.preventExtensions(this);
33
26
  }
34
27
  }
35
28
 
36
29
  get realUpperBound() {
37
- return IS_GLIMMER_2 ? this.upperBound : this.upperBound.previousSibling;
30
+ return this.upperBound;
38
31
  }
39
32
 
40
33
  get realLowerBound() {
41
- return IS_GLIMMER_2 ? this.lowerBound : this.lowerBound.nextSibling;
34
+ return this.lowerBound;
42
35
  }
43
36
 
44
37
  getBoundingClientRect() {
@@ -579,7 +579,7 @@ export default class Radar {
579
579
  if (component.rendered === true) {
580
580
  insertRangeBefore(_itemContainer, relativeNode, component.realUpperBound, component.realLowerBound);
581
581
  } else {
582
- virtualComponents.insertAt(virtualComponents.get('length') - 1, component);
582
+ virtualComponents.insertAt(virtualComponents.length - 1, component);
583
583
  component.rendered = true;
584
584
 
585
585
  // shouldRecycle=false breaks UI when scrolling the elements fast.
@@ -620,7 +620,7 @@ export default class Radar {
620
620
  if (component.rendered === true) {
621
621
  insertRangeBefore(_itemContainer, relativeNode, component.realUpperBound, component.realLowerBound);
622
622
  } else {
623
- virtualComponents.insertAt(virtualComponents.get('length') - 1, component);
623
+ virtualComponents.insertAt(virtualComponents.length - 1, component);
624
624
  component.rendered = true;
625
625
 
626
626
  // Components that are both new and prepended still need to be rendered at the end because Glimmer.
@@ -43,7 +43,7 @@ const VerticalCollection = Component.extend({
43
43
 
44
44
  /**
45
45
  * List of objects to svelte-render.
46
- * Can be called like `{{#vertical-collection <items-array>}}`, since it's the first positional parameter of this component.
46
+ * Can be called like `<VerticalCollection @items={{itemsArray}} />`.
47
47
  *
48
48
  * @property items
49
49
  * @type Array
@@ -155,12 +155,12 @@ const VerticalCollection = Component.extend({
155
155
  virtualComponents: computed('items.[]', 'renderAll', 'estimateHeight', 'bufferSize', function() {
156
156
  const { _radar } = this;
157
157
 
158
- const items = this.get('items');
158
+ const items = this.items;
159
159
 
160
160
  _radar.items = items === null || items === undefined ? [] : items;
161
- _radar.estimateHeight = this.get('estimateHeight');
162
- _radar.renderAll = this.get('renderAll');
163
- _radar.bufferSize = this.get('bufferSize');
161
+ _radar.estimateHeight = this.estimateHeight;
162
+ _radar.renderAll = this.renderAll;
163
+ _radar.bufferSize = this.bufferSize;
164
164
 
165
165
  _radar.scheduleUpdate(true);
166
166
 
@@ -179,8 +179,8 @@ const VerticalCollection = Component.extend({
179
179
  this._nextSendActions = null;
180
180
 
181
181
  run(() => {
182
- const items = this.get('items');
183
- const keyPath = this.get('key');
182
+ const items = this.items;
183
+ const keyPath = this.key;
184
184
 
185
185
  this._scheduledActions.forEach(([action, index]) => {
186
186
  const item = objectAt(items, index);
@@ -228,7 +228,7 @@ const VerticalCollection = Component.extend({
228
228
  willDestroy() {
229
229
  this.token.cancel();
230
230
  this._radar.destroy();
231
- let registerAPI = this.get('registerAPI');
231
+ let registerAPI = this.registerAPI;
232
232
  if (registerAPI) {
233
233
  registerAPI(null);
234
234
  }
@@ -241,19 +241,20 @@ const VerticalCollection = Component.extend({
241
241
  this.token = new Token();
242
242
  const RadarClass = this.staticHeight ? StaticRadar : DynamicRadar;
243
243
 
244
- const items = this.get('items') || [];
245
-
246
- const bufferSize = this.get('bufferSize');
247
- const containerSelector = this.get('containerSelector');
248
- const estimateHeight = this.get('estimateHeight');
249
- const initialRenderCount = this.get('initialRenderCount');
250
- const renderAll = this.get('renderAll');
251
- const renderFromLast = this.get('renderFromLast');
252
- const shouldRecycle = this.get('shouldRecycle');
253
- const occlusionTagName = this.get('occlusionTagName');
254
-
255
- const idForFirstItem = this.get('idForFirstItem');
256
- const key = this.get('key');
244
+ const items = this.items || [];
245
+
246
+ const {
247
+ bufferSize,
248
+ containerSelector,
249
+ estimateHeight,
250
+ initialRenderCount,
251
+ renderAll,
252
+ renderFromLast,
253
+ shouldRecycle,
254
+ occlusionTagName,
255
+ idForFirstItem,
256
+ key
257
+ } = this;
257
258
 
258
259
  const startingIndex = calculateStartingIndex(items, idForFirstItem, key, renderFromLast);
259
260
 
@@ -309,18 +310,18 @@ const VerticalCollection = Component.extend({
309
310
 
310
311
  Template:
311
312
 
312
- {{vertical-collection registerAPI=(action "registerAPI")}}
313
+ <VerticalCollection @registerAPI={{action "registerAPI"}} />
313
314
 
314
315
  Component:
315
316
 
316
- export default Component.extend({
317
+ export default Component.extend({
317
318
  actions: {
318
319
  registerAPI(api) {
319
320
  this.set('collectionAPI', api);
320
321
  }
321
322
  },
322
323
  scrollToItem() {
323
- let collectionAPI = this.get('collectionAPI');
324
+ let collectionAPI = this.collectionAPI;
324
325
  collectionAPI.scrollToItem(index);
325
326
  }
326
327
  });
@@ -342,10 +343,6 @@ const VerticalCollection = Component.extend({
342
343
  }
343
344
  });
344
345
 
345
- VerticalCollection.reopenClass({
346
- positionalParams: ['items']
347
- });
348
-
349
346
  function calculateStartingIndex(items, idForFirstItem, key, renderFromLast) {
350
347
  const totalItems = get(items, 'length');
351
348
 
@@ -366,4 +363,4 @@ function calculateStartingIndex(items, idForFirstItem, key, renderFromLast) {
366
363
  return startingIndex;
367
364
  }
368
365
 
369
- export default VerticalCollection;
366
+ export default VerticalCollection;
@@ -18,10 +18,7 @@ function retry {
18
18
  sleep 1
19
19
  fi
20
20
  done
21
- if [[ $retval -ne 0 ]] && [[ $attempt -gt 4 ]]; then
22
- # Something is fubar, go ahead and exit
23
- exit $retval
24
- fi
21
+ exit $retval
25
22
  }
26
23
 
27
24
  yarn run ember build && retry yarn run ember test --path=dist
package/index.js CHANGED
@@ -23,13 +23,7 @@ module.exports = {
23
23
  },
24
24
 
25
25
  getOutputDirForVersion() {
26
- let VersionChecker = require('ember-cli-version-checker');
27
- let checker = new VersionChecker(this);
28
- let emberCli = checker.for('ember-cli', 'npm');
29
-
30
- let requiresModulesDir = emberCli.satisfies('< 3.0.0');
31
-
32
- return requiresModulesDir ? 'modules' : '';
26
+ return '';
33
27
  },
34
28
 
35
29
  // Borrowed from ember-cli-babel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-next/vertical-collection",
3
- "version": "3.1.0",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "infinite-scroll, done right. done.",
5
5
  "keywords": [
6
6
  "occlusion",
@@ -52,22 +52,21 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "babel6-plugin-strip-class-callcheck": "^6.0.0",
55
- "broccoli-funnel": "^2.0.2",
56
- "broccoli-merge-trees": "^3.0.1",
57
- "broccoli-rollup": "^4.1.1",
55
+ "broccoli-funnel": "^3.0.8",
56
+ "broccoli-merge-trees": "^4.2.0",
57
+ "broccoli-rollup": "^5.0.0",
58
58
  "ember-cli-babel": "^7.12.0",
59
- "ember-cli-htmlbars": "^5.0.0",
60
- "ember-cli-version-checker": "^3.1.3",
61
- "ember-compatibility-helpers": "^1.2.1",
59
+ "ember-cli-htmlbars": "^6.0.0",
60
+ "ember-cli-version-checker": "^5.1.2",
62
61
  "ember-raf-scheduler": "^0.3.0"
63
62
  },
64
63
  "devDependencies": {
65
64
  "@ember/optional-features": "^2.0.0",
66
- "@ember/test-helpers": "^2.4.0",
65
+ "@ember/test-helpers": "^2.8.1",
67
66
  "babel-eslint": "^10.1.0",
68
67
  "bootstrap": "~3.3.5",
69
68
  "broccoli-asset-rev": "^3.0.0",
70
- "ember-auto-import": "^2.0.0",
69
+ "ember-auto-import": "^2.4.2",
71
70
  "ember-cli": "~3.28.0",
72
71
  "ember-cli-dependency-checker": "^3.2.0",
73
72
  "ember-cli-eslint": "^5.1.0",
@@ -82,17 +81,17 @@
82
81
  "ember-export-application-global": "^2.0.1",
83
82
  "ember-load-initializers": "^2.1.2",
84
83
  "ember-perf-timeline": "^2.0.0",
85
- "ember-qunit": "^5.0.0",
84
+ "ember-qunit": "^5.1.5",
86
85
  "ember-resolver": "^8.0.2",
87
86
  "ember-source": "~3.12.0",
88
87
  "ember-source-channel-url": "^3.0.0",
89
- "ember-try": "^1.4.0",
88
+ "ember-try": "^2.0.0",
90
89
  "eslint": "^7.32.0",
91
90
  "eslint-plugin-ember": "^6.7.1",
92
91
  "eslint-plugin-node": "^9.1.0",
93
92
  "loader.js": "^4.7.0",
94
93
  "npm-run-all": "^4.1.5",
95
- "qunit": "^2.0.0",
94
+ "qunit": "^2.19.1",
96
95
  "qunit-dom": "^1.0.0",
97
96
  "release-it": "^14.2.1",
98
97
  "release-it-lerna-changelog": "^3.1.0",