@vaadin/component-base 25.0.0-alpha3 → 25.0.0-alpha5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "25.0.0-alpha3",
3
+ "version": "25.0.0-alpha5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,10 +38,10 @@
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "25.0.0-alpha3",
42
- "@vaadin/test-runner-commands": "25.0.0-alpha3",
41
+ "@vaadin/chai-plugins": "25.0.0-alpha5",
42
+ "@vaadin/test-runner-commands": "25.0.0-alpha5",
43
43
  "@vaadin/testing-helpers": "^2.0.0",
44
44
  "sinon": "^18.0.0"
45
45
  },
46
- "gitHead": "8367dd20a47f53ca5589ad349a8e286ec2673055"
46
+ "gitHead": "7dc87bb2a3cae81ed53259fa10b58f990d50c6fd"
47
47
  }
@@ -33,6 +33,3 @@ export const isTouch = (() => {
33
33
  return false;
34
34
  }
35
35
  })();
36
-
37
- export const supportsAdoptingStyleSheets =
38
- window.ShadowRoot && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;
@@ -58,14 +58,6 @@ export class Cache<TItem> {
58
58
  */
59
59
  get flatSize(): number;
60
60
 
61
- /**
62
- * The total number of items, including items from expanded sub-caches.
63
- *
64
- * @protected
65
- * @deprecated since 24.3 and will be removed in Vaadin 25.
66
- */
67
- get effectiveSize(): number;
68
-
69
61
  constructor(
70
62
  context: CacheContext<TItem>,
71
63
  pageSize: number,
@@ -113,34 +105,4 @@ export class Cache<TItem> {
113
105
  * of an item in the `items` array.
114
106
  */
115
107
  getFlatIndex(index: number): number;
116
-
117
- /**
118
- * @deprecated since 24.3 and will be removed in Vaadin 25.
119
- */
120
- getItemForIndex(index: number): TItem | undefined;
121
-
122
- /**
123
- * @deprecated since 24.3 and will be removed in Vaadin 25.
124
- */
125
- getCacheAndIndex(index: number): { cache: Cache<TItem>; scaledIndex: number };
126
-
127
- /**
128
- * @deprecated since 24.3 and will be removed in Vaadin 25.
129
- */
130
- updateSize(): void;
131
-
132
- /**
133
- * @deprecated since 24.3 and will be removed in Vaadin 25.
134
- */
135
- ensureSubCacheForScaledIndex(scaledIndex: number): void;
136
-
137
- /**
138
- * @deprecated since 24.3 and will be removed in Vaadin 25.
139
- */
140
- get grid(): HTMLElement;
141
-
142
- /**
143
- * @deprecated since 24.3 and will be removed in Vaadin 25.
144
- */
145
- get itemCaches(): object;
146
108
  }
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { getFlatIndexContext } from './helpers.js';
7
6
 
8
7
  /**
9
8
  * A class that stores items with their associated sub-caches.
@@ -124,19 +123,6 @@ export class Cache {
124
123
  return this.__flatSize;
125
124
  }
126
125
 
127
- /**
128
- * The total number of items, including items from expanded sub-caches.
129
- *
130
- * @protected
131
- * @deprecated since 24.3 and will be removed in Vaadin 25.
132
- */
133
- get effectiveSize() {
134
- console.warn(
135
- '<vaadin-grid> The `effectiveSize` property of ItemCache is deprecated and will be removed in Vaadin 25.',
136
- );
137
- return this.flatSize;
138
- }
139
-
140
126
  /**
141
127
  * The number of items.
142
128
  *
@@ -261,66 +247,4 @@ export class Cache {
261
247
  return clampedIndex > index ? prev + subCache.flatSize : prev;
262
248
  }, clampedIndex);
263
249
  }
264
-
265
- /**
266
- * @deprecated since 24.3 and will be removed in Vaadin 25.
267
- */
268
- getItemForIndex(index) {
269
- console.warn(
270
- '<vaadin-grid> The `getItemForIndex` method of ItemCache is deprecated and will be removed in Vaadin 25.',
271
- );
272
- const { item } = getFlatIndexContext(this, index);
273
- return item;
274
- }
275
-
276
- /**
277
- * @deprecated since 24.3 and will be removed in Vaadin 25.
278
- */
279
- getCacheAndIndex(index) {
280
- console.warn(
281
- '<vaadin-grid> The `getCacheAndIndex` method of ItemCache is deprecated and will be removed in Vaadin 25.',
282
- );
283
- const { cache, index: scaledIndex } = getFlatIndexContext(this, index);
284
- return { cache, scaledIndex };
285
- }
286
-
287
- /**
288
- * @deprecated since 24.3 and will be removed in Vaadin 25.
289
- */
290
- updateSize() {
291
- console.warn('<vaadin-grid> The `updateSize` method of ItemCache is deprecated and will be removed in Vaadin 25.');
292
- this.recalculateFlatSize();
293
- }
294
-
295
- /**
296
- * @deprecated since 24.3 and will be removed in Vaadin 25.
297
- */
298
- ensureSubCacheForScaledIndex(scaledIndex) {
299
- console.warn(
300
- '<vaadin-grid> The `ensureSubCacheForScaledIndex` method of ItemCache is deprecated and will be removed in Vaadin 25.',
301
- );
302
-
303
- if (!this.getSubCache(scaledIndex)) {
304
- const subCache = this.createSubCache(scaledIndex);
305
- this.context.__controller.__loadCachePage(subCache, 0);
306
- }
307
- }
308
-
309
- /**
310
- * @deprecated since 24.3 and will be removed in Vaadin 25.
311
- */
312
- get grid() {
313
- console.warn('<vaadin-grid> The `grid` property of ItemCache is deprecated and will be removed in Vaadin 25.');
314
- return this.context.__controller.host;
315
- }
316
-
317
- /**
318
- * @deprecated since 24.3 and will be removed in Vaadin 25.
319
- */
320
- get itemCaches() {
321
- console.warn(
322
- '<vaadin-grid> The `itemCaches` property of ItemCache is deprecated and will be removed in Vaadin 25.',
323
- );
324
- return this.__subCacheByIndex;
325
- }
326
250
  }
@@ -100,8 +100,6 @@ export class DataProviderController extends EventTarget {
100
100
  return {
101
101
  isExpanded: this.isExpanded,
102
102
  placeholder: this.placeholder,
103
- // The controller instance is needed to ensure deprecated cache methods work.
104
- __controller: this,
105
103
  };
106
104
  }
107
105
 
package/src/define.js CHANGED
@@ -13,7 +13,7 @@ function dashToCamelCase(dash) {
13
13
 
14
14
  const experimentalMap = {};
15
15
 
16
- export function defineCustomElement(CustomElement, version = '25.0.0-alpha3') {
16
+ export function defineCustomElement(CustomElement, version = '25.0.0-alpha5') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
package/src/gestures.js CHANGED
@@ -58,7 +58,6 @@ function isMouseEvent(name) {
58
58
  return MOUSE_EVENTS.indexOf(name) > -1;
59
59
  }
60
60
 
61
- /* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
62
61
  // check for passive event listeners
63
62
  let supportsPassive = false;
64
63
  (function () {
@@ -347,7 +347,6 @@ export const ironList = {
347
347
  ith = this._physicalEnd;
348
348
  offsetContent = bottom - scrollBottom;
349
349
  }
350
- // eslint-disable-next-line no-constant-condition
351
350
  while (true) {
352
351
  physicalItemHeight = this._getPhysicalSizeIncrement(ith);
353
352
  offsetContent -= physicalItemHeight;
@@ -599,6 +599,24 @@ export class IronListAdapter {
599
599
  }
600
600
  }
601
601
 
602
+ /** @override */
603
+ _resizeHandler() {
604
+ super._resizeHandler();
605
+
606
+ // Fixes an issue where the new items are not created on scroll target resize when the scroll position is around the end.
607
+ // See https://github.com/vaadin/flow-components/issues/7307
608
+ const lastIndexVisible = this.adjustedLastVisibleIndex === this.size - 1;
609
+ const emptySpace = this._physicalTop - this._scrollPosition;
610
+ if (lastIndexVisible && emptySpace > 0) {
611
+ const idxAdjustment = Math.ceil(emptySpace / this._physicalAverage);
612
+ this._virtualStart = Math.max(0, this._virtualStart - idxAdjustment);
613
+ this._physicalStart = Math.max(0, this._physicalStart - idxAdjustment);
614
+ // Scroll to end for smoother resize
615
+ super.scrollToIndex(this._virtualCount - 1);
616
+ this.scrollTarget.scrollTop = this.scrollTarget.scrollHeight - this.scrollTarget.clientHeight;
617
+ }
618
+ }
619
+
602
620
  /**
603
621
  * Work around an iron-list issue with invalid item positioning.
604
622
  * See https://github.com/vaadin/flow-components/issues/4306
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
1
6
  import { IronListAdapter } from './virtualizer-iron-list-adapter.js';
2
7
 
3
8
  export class Virtualizer {