Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@vaadin/component-base

Package Overview
Dependencies
Maintainers
12
Versions
597
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.2.0-alpha10
to
25.2.0-alpha11
+1
-4
custom-elements.json

@@ -107,3 +107,3 @@ {

"kind": "mixin",
"description": "A mixin that allows to set partial I18N properties.",
"description": "A mixin that allows to set partial I18N properties.\n\nSubclasses provide their default values by overriding the\n`defaultI18n` static getter:\n\n```js\nstatic get defaultI18n() {\n return { foo: 'Foo', bar: 'Bar' };\n}\n```",
"name": "I18nMixin",

@@ -134,5 +134,2 @@ "members": [

{
"name": "defaultI18n"
},
{
"name": "superClass"

@@ -139,0 +136,0 @@ }

+4
-4
{
"name": "@vaadin/component-base",
"version": "25.2.0-alpha10",
"version": "25.2.0-alpha11",
"publishConfig": {

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

"devDependencies": {
"@vaadin/chai-plugins": "25.2.0-alpha10",
"@vaadin/test-runner-commands": "25.2.0-alpha10",
"@vaadin/chai-plugins": "25.2.0-alpha11",
"@vaadin/test-runner-commands": "25.2.0-alpha11",
"@vaadin/testing-helpers": "^2.0.0",

@@ -48,3 +48,3 @@ "sinon": "^21.0.2"

"customElements": "custom-elements.json",
"gitHead": "1303b6a3eeecb44a9d26f2b53cb56d9e906febdf"
"gitHead": "fdc37e932709f95491a027aeb2090911cb7528c6"
}

@@ -6,3 +6,2 @@ /**

*/
import type { ReactiveController } from 'lit';
import type { Cache } from './cache.js';

@@ -27,6 +26,3 @@ import type { getFlatIndexByPath, getFlatIndexContext, getItemContext } from './helpers.js';

*/
export class DataProviderController<
TItem,
TDataProviderParams extends Record<string, unknown>,
> implements ReactiveController {
export class DataProviderController<TItem, TDataProviderParams extends Record<string, unknown>> extends EventTarget {
/**

@@ -99,6 +95,2 @@ * The controller host element.

hostConnected(): void;
hostDisconnected(): void;
/**

@@ -105,0 +97,0 @@ * Whether the root cache or any of its decendant caches have pending requests.

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

export function defineCustomElement(CustomElement, version = '25.2.0-alpha10') {
export function defineCustomElement(CustomElement, version = '25.2.0-alpha11') {
Object.defineProperty(CustomElement, 'version', {

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

@@ -10,4 +10,2 @@ /**

* A mixin to delegate properties and attributes to a target element.
*
* @polymerMixin
*/

@@ -14,0 +12,0 @@ const DelegateStateMixinImplementation = (superclass) => {

@@ -36,4 +36,2 @@ /**

* A mixin to handle `dir` attribute based on the one set on the `<html>` element.
*
* @polymerMixin
*/

@@ -40,0 +38,0 @@ export const DirMixin = (superClass) =>

@@ -34,6 +34,2 @@ /**

/**
* @polymerMixin
* @mixes DirMixin
*/
export const ElementMixin = (superClass) =>

@@ -40,0 +36,0 @@ class VaadinElementMixin extends DirMixin(superClass) {

@@ -124,3 +124,3 @@ /**

// Allow undefined for testing events
let buttons = ev.buttons === undefined ? 1 : ev.buttons;
let buttons = ev.buttons ?? 1;
if (ev instanceof window.MouseEvent && !MOUSE_HAS_BUTTONS) {

@@ -133,3 +133,3 @@ buttons = MOUSE_WHICH_TO_BUTTONS[ev.which] || 0;

// Allow undefined for testing events
const button = ev.button === undefined ? 0 : ev.button;
const button = ev.button ?? 0;
// Ev.button is 0 in mousedown/mouseup/click for left button activation

@@ -136,0 +136,0 @@ return button === 0;

@@ -11,4 +11,3 @@ /**

*/
export declare function I18nMixin<I, T extends Constructor<HTMLElement>>(
defaultI18n: I,
export declare function I18nMixin<T extends Constructor<HTMLElement>, I = unknown>(
superclass: T,

@@ -15,0 +14,0 @@ ): Constructor<I18nMixinClass<I>> & T;

@@ -38,5 +38,12 @@ /**

*
* @polymerMixin
* Subclasses provide their default values by overriding the
* `defaultI18n` static getter:
*
* ```js
* static get defaultI18n() {
* return { foo: 'Foo', bar: 'Bar' };
* }
* ```
*/
export const I18nMixin = (defaultI18n, superClass) =>
export const I18nMixin = (superClass) =>
class I18nMixinClass extends superClass {

@@ -59,6 +66,16 @@ static get properties() {

/**
* Default I18N values. Must be overridden by subclasses with actual defaults.
*
* @protected
* @return {Object}
*/
static get defaultI18n() {
return {};
}
constructor() {
super();
this.i18n = deepMerge({}, defaultI18n);
this.i18n = deepMerge({}, this.constructor.defaultI18n);
}

@@ -85,4 +102,4 @@

this.__customI18n = value;
this.__effectiveI18n = deepMerge({}, defaultI18n, this.__customI18n);
this.__effectiveI18n = deepMerge({}, this.constructor.defaultI18n, this.__customI18n);
}
};

@@ -10,4 +10,2 @@ /**

* by setting the `overlayClass` property or `overlay-class` attribute.
*
* @polymerMixin
*/

@@ -14,0 +12,0 @@ export const OverlayClassMixin = (superclass) =>

@@ -29,4 +29,2 @@ /**

* A mixin that uses a ResizeObserver to listen to host size changes.
*
* @polymerMixin
*/

@@ -33,0 +31,0 @@ const ResizeMixinImplementation = (superclass) =>

@@ -12,9 +12,9 @@ /**

constructor(slot, callback, forceInitial) {
/** @type HTMLSlotElement */
/** @type {HTMLSlotElement} */
this.slot = slot;
/** @type Function */
/** @type {Function} */
this.callback = callback;
/** @type boolean */
/** @type {boolean} */
this.forceInitial = forceInitial;

@@ -21,0 +21,0 @@

@@ -42,4 +42,2 @@ /**

* This is useful e.g. to hide native `<input type="number">` controls.
*
* @polymerMixin
*/

@@ -46,0 +44,0 @@ const SlotStylesMixinImplementation = (superclass) =>

@@ -26,2 +26,4 @@ /**

export class TooltipController extends SlotController {
constructor(host: HTMLElement);
/**

@@ -28,0 +30,0 @@ * An HTML element for linking with the tooltip overlay

@@ -518,7 +518,15 @@ /**

__getFocusedElement(visibleElements = this.__getVisibleElements()) {
return visibleElements.find(
(element) =>
element.contains(this.elementsContainer.getRootNode().activeElement) ||
element.contains(this.scrollTarget.getRootNode().activeElement),
);
// `document.activeElement` retargets to the outermost shadow host when
// focus lives in a nested shadow tree. Descend through nested shadow
// roots' `activeElement`s to reach the real focused node, then walk up
// the flattened tree (via `assignedSlot`/`parentNode`/`host`) until a
// visible row is reached.
let node = document.activeElement;
while (node?.shadowRoot?.activeElement) {
node = node.shadowRoot.activeElement;
}
while (node && !visibleElements.includes(node)) {
node = node.assignedSlot || node.parentNode || node.host;
}
return node;
}

@@ -525,0 +533,0 @@