You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@vaadin/component-base

Package Overview
Dependencies
Maintainers
12
Versions
568
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/component-base - npm Package Compare versions

Comparing version
25.1.0-beta2
to
25.1.0-beta3
+10
-3
custom-elements.json

@@ -100,6 +100,8 @@ {

"name": "i18n",
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
"privacy": "public",
"type": {
"text": "Object"
}
},
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
"attribute": "i18n"
}

@@ -109,3 +111,8 @@ ],

{
"name": "i18n"
"name": "i18n",
"type": {
"text": "Object"
},
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
"fieldName": "i18n"
}

@@ -112,0 +119,0 @@ ],

{
"name": "@vaadin/component-base",
"version": "25.1.0-beta2",
"version": "25.1.0-beta3",
"publishConfig": {

@@ -41,9 +41,9 @@ "access": "public"

"devDependencies": {
"@vaadin/chai-plugins": "25.1.0-beta2",
"@vaadin/test-runner-commands": "25.1.0-beta2",
"@vaadin/chai-plugins": "25.1.0-beta3",
"@vaadin/test-runner-commands": "25.1.0-beta3",
"@vaadin/testing-helpers": "^2.0.0",
"sinon": "^21.0.0"
"sinon": "^21.0.2"
},
"customElements": "custom-elements.json",
"gitHead": "ffbedbae08a5160d13bcd1c6fcaa328df5103a05"
"gitHead": "4251850231a42298fda23b83928da588831cdb5d"
}

@@ -16,3 +16,3 @@ /**

export function defineCustomElement(CustomElement, version = '25.1.0-beta2') {
export function defineCustomElement(CustomElement, version = '25.1.0-beta3') {
Object.defineProperty(CustomElement, 'version', {

@@ -19,0 +19,0 @@ get() {

@@ -44,2 +44,8 @@ /**

return {
// Even though the property is overridden by a custom getter/setter, it needs to be declared here to initialize
// __effectiveI18n properly if the i18n property is set before upgrading the element.
i18n: {
type: Object,
},
/** @private */

@@ -53,6 +59,2 @@ __effectiveI18n: {

static get observedAttributes() {
return [...super.observedAttributes, 'i18n'];
}
constructor() {

@@ -64,14 +66,2 @@ super();

/** @protected */
attributeChangedCallback(name, oldValue, newValue) {
super.attributeChangedCallback(name, oldValue, newValue);
if (name === 'i18n') {
try {
this.i18n = JSON.parse(newValue);
} catch (_) {
// Invalid JSON, ignore
}
}
}
/**

@@ -78,0 +68,0 @@ * The object used to localize this component. To change the default

@@ -336,2 +336,15 @@ /**

/**
* Adjusts the scroll position to compensate for any offset change of a given index.
* @param {number} index - The index whose scroll offset to restore
* @param {number|undefined} offsetBefore - The scroll offset of the index before the change
* @private
*/
__restoreScrollOffset(index, offsetBefore) {
const offsetAfter = this.__getIndexScrollOffset(index);
if (offsetBefore !== undefined && offsetAfter !== undefined) {
this._scrollTop += offsetBefore - offsetAfter;
}
}
get size() {

@@ -386,6 +399,3 @@ return this.__size;

const fviOffsetAfter = this.__getIndexScrollOffset(fvi);
if (fviOffsetBefore !== undefined && fviOffsetAfter !== undefined) {
this._scrollTop += fviOffsetBefore - fviOffsetAfter;
}
this.__restoreScrollOffset(fvi, fviOffsetBefore);
}

@@ -856,9 +866,19 @@

// Lazily capture scroll state before the first offset change,
// so it can be restored afterwards.
let fvi, fviOffsetBefore;
const captureScrollState = () => {
fvi = this.adjustedFirstVisibleIndex;
fviOffsetBefore = this.__getIndexScrollOffset(fvi);
};
// Near start
if (this._scrollTop === 0) {
this._vidxOffset = 0;
if (oldOffset !== this._vidxOffset) {
if (oldOffset !== 0) {
captureScrollState();
this._vidxOffset = 0;
super.scrollToIndex(0);
}
} else if (this.firstVisibleIndex < threshold && this._vidxOffset > 0) {
captureScrollState();
this._vidxOffset -= Math.min(this._vidxOffset, maxShift);

@@ -870,10 +890,16 @@ super.scrollToIndex(this.firstVisibleIndex + (oldOffset - this._vidxOffset));

if (this._scrollTop >= this._maxScrollTop && this._maxScrollTop > 0) {
this._vidxOffset = maxOffset;
if (oldOffset !== this._vidxOffset) {
if (oldOffset !== maxOffset) {
captureScrollState();
this._vidxOffset = maxOffset;
super.scrollToIndex(this._virtualCount - 1);
}
} else if (this.firstVisibleIndex > this._virtualCount - threshold && this._vidxOffset < maxOffset) {
captureScrollState();
this._vidxOffset += Math.min(maxOffset - this._vidxOffset, maxShift);
super.scrollToIndex(this.firstVisibleIndex - (this._vidxOffset - oldOffset));
}
if (fvi !== undefined) {
this.__restoreScrollOffset(fvi, fviOffsetBefore);
}
}

@@ -880,0 +906,0 @@ }