@vaadin/component-base
Advanced tools
Comparing version
{ | ||
"name": "@vaadin/component-base", | ||
"version": "24.7.0-alpha1", | ||
"version": "24.7.0-alpha10", | ||
"publishConfig": { | ||
@@ -41,7 +41,8 @@ "access": "public" | ||
"devDependencies": { | ||
"@vaadin/chai-plugins": "24.7.0-alpha1", | ||
"@vaadin/testing-helpers": "^1.0.0", | ||
"@vaadin/chai-plugins": "24.7.0-alpha10", | ||
"@vaadin/test-runner-commands": "24.7.0-alpha10", | ||
"@vaadin/testing-helpers": "^1.1.0", | ||
"sinon": "^18.0.0" | ||
}, | ||
"gitHead": "04be941c9a7b659871c97f31b9cc3ffd7528087b" | ||
"gitHead": "c0f8933df2a6a40648d3fb9cfbae6bbf86a8aa90" | ||
} |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -16,3 +16,3 @@ */ | ||
export function defineCustomElement(CustomElement, version = '24.7.0-alpha1') { | ||
export function defineCustomElement(CustomElement, version = '24.7.0-alpha10') { | ||
Object.defineProperty(CustomElement, 'version', { | ||
@@ -19,0 +19,0 @@ get() { |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
@@ -586,3 +586,2 @@ /** | ||
const t = _findOriginalTarget(e); | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
const self = this; | ||
@@ -698,3 +697,2 @@ const movefn = (e) => { | ||
const t = _findOriginalTarget(e); | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
const self = this; | ||
@@ -701,0 +699,0 @@ const movefn = (e) => { |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2023 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2023 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2023 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2023 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2023 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2023 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2023 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2023 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { dedupeMixin } from '@open-wc/dedupe-mixin'; | ||
import { notEqual } from 'lit'; | ||
import { get, set } from './path-utils.js'; | ||
@@ -54,3 +55,3 @@ | ||
if (options.reflectToAttribute) { | ||
if (options && options.reflectToAttribute) { | ||
options.reflect = true; | ||
@@ -105,8 +106,11 @@ } | ||
const oldValue = this[name]; | ||
this[key] = value; | ||
this.requestUpdate(name, oldValue, options); | ||
// Enforce synchronous update | ||
if (this.hasUpdated) { | ||
this.performUpdate(); | ||
if (notEqual(value, oldValue)) { | ||
this[key] = value; | ||
this.requestUpdate(name, oldValue, options); | ||
// Enforce synchronous update | ||
if (this.hasUpdated) { | ||
this.performUpdate(); | ||
} | ||
} | ||
@@ -120,3 +124,3 @@ }, | ||
if (options.readOnly) { | ||
const setter = defaultDescriptor.set; | ||
const setter = result.set; | ||
@@ -127,6 +131,2 @@ this.addCheckedInitializer((instance) => { | ||
setter.call(instance, value); | ||
if (options.sync) { | ||
this.performUpdate(); | ||
} | ||
}; | ||
@@ -136,3 +136,3 @@ }); | ||
result = { | ||
get: defaultDescriptor.get, | ||
get: result.get, | ||
set() { | ||
@@ -193,3 +193,3 @@ // Do nothing, property is read-only. | ||
this.getOrCreateMap('__complexObservers').set(assignComputedMethod, observer.observerProps); | ||
this.getOrCreateMap('__computedObservers').set(assignComputedMethod, observer.observerProps); | ||
} | ||
@@ -204,2 +204,8 @@ | ||
static get polylitConfig() { | ||
return { | ||
asyncFirstRender: false, | ||
}; | ||
} | ||
constructor() { | ||
@@ -224,2 +230,7 @@ super(); | ||
} | ||
const { polylitConfig } = this.constructor; | ||
if (!this.hasUpdated && !polylitConfig.asyncFirstRender) { | ||
this.performUpdate(); | ||
} | ||
} | ||
@@ -246,2 +257,9 @@ | ||
/** @protected */ | ||
willUpdate(props) { | ||
if (this.constructor.__computedObservers) { | ||
this.__runComplexObservers(props, this.constructor.__computedObservers); | ||
} | ||
} | ||
/** @protected */ | ||
updated(props) { | ||
@@ -248,0 +266,0 @@ const wasReadyInvoked = this.__isReadyInvoked; |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -11,2 +11,6 @@ */ | ||
entries.forEach((entry) => { | ||
if (!entry.target.isConnected) { | ||
return; | ||
} | ||
// Notify child resizables, if any | ||
@@ -13,0 +17,0 @@ if (entry.target.resizables) { |
/** | ||
* @license | ||
* Copyright (c) 2022 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2022 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2022 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2022 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2023 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2023 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2023 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2023 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2022 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2022 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2022 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2022 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2023 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2023 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2023 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2023 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* Copyright (c) 2021 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
/* eslint-disable @typescript-eslint/member-ordering */ | ||
// https://github.com/vaadin/eslint-config-vaadin/issues/33 | ||
import { animationFrame, microTask, timeOut } from './async.js'; | ||
@@ -55,2 +53,16 @@ import { isSafari } from './browser-utils.js'; | ||
const attachObserver = new ResizeObserver(([{ contentRect }]) => { | ||
const isHidden = contentRect.width === 0 && contentRect.height === 0; | ||
if (!isHidden && this.__scrollTargetHidden && this.scrollTarget.scrollTop !== this._scrollPosition) { | ||
// When removing element from DOM, its scroll position is lost and | ||
// virtualizer doesn't re-render when adding it to the DOM again. | ||
// Restore scroll position when the scroll target becomes visible, | ||
// which is the case e.g. when virtualizer is used inside a dialog. | ||
this.scrollTarget.scrollTop = this._scrollPosition; | ||
} | ||
this.__scrollTargetHidden = isHidden; | ||
}); | ||
attachObserver.observe(this.scrollTarget); | ||
this._scrollLineHeight = this._getScrollLineHeight(); | ||
@@ -57,0 +69,0 @@ this.scrollTarget.addEventListener('wheel', (e) => this.__onWheel(e)); |
225804
1.96%66
3.13%6663
2.07%4
33.33%