Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/component-base

Package Overview
Dependencies
Maintainers
12
Versions
402
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 23.2.0-beta2 to 23.2.0-beta3

4

package.json
{
"name": "@vaadin/component-base",
"version": "23.2.0-beta2",
"version": "23.2.0-beta3",
"publishConfig": {

@@ -45,3 +45,3 @@ "access": "public"

},
"gitHead": "42864949ade7e573ac534a64ecdd97fab32a87fc"
"gitHead": "3389e7d2dd4c94c6354817d4dc8c8d2db48c7137"
}

@@ -15,1 +15,12 @@ /**

export function getAncestorRootNodes(node: Node): Node[];
/**
* Adds a value to an attribute containing space-delimited values.
*/
export function addValueToAttribute(element: HTMLElement, attr: string, value: string): void;
/**
* Removes a value from an attribute containing space-delimited values.
* If the value is the last one, the whole attribute is removed.
*/
export function removeValueFromAttribute(element: HTMLElement, attr: string, value: string): void;

@@ -42,1 +42,52 @@ /**

}
/**
* @param {string} value
* @return {Set<string>}
*/
function deserializeAttributeValue(value) {
if (!value) {
return new Set();
}
return new Set(value.split(' '));
}
/**
* @param {Set<string>} values
* @return {string}
*/
function serializeAttributeValue(values) {
return [...values].join(' ');
}
/**
* Adds a value to an attribute containing space-delimited values.
*
* @param {HTMLElement} element
* @param {string} attr
* @param {string} value
*/
export function addValueToAttribute(element, attr, value) {
const values = deserializeAttributeValue(element.getAttribute(attr));
values.add(value);
element.setAttribute(attr, serializeAttributeValue(values));
}
/**
* Removes a value from an attribute containing space-delimited values.
* If the value is the last one, the whole attribute is removed.
*
* @param {HTMLElement} element
* @param {string} attr
* @param {string} value
*/
export function removeValueFromAttribute(element, attr, value) {
const values = deserializeAttributeValue(element.getAttribute(attr));
values.delete(value);
if (values.size === 0) {
element.removeAttribute(attr);
return;
}
element.setAttribute(attr, serializeAttributeValue(values));
}

@@ -42,3 +42,3 @@ /**

static get version() {
return '23.2.0-beta2';
return '23.2.0-beta3';
}

@@ -45,0 +45,0 @@

@@ -7,25 +7,4 @@ /**

import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
import { isKeyboardActive } from './focus-utils.js';
// We consider the keyboard to be active if the window has received a keydown
// event since the last mousedown event.
let keyboardActive = false;
// Listen for top-level keydown and mousedown events.
// Use capture phase so we detect events even if they're handled.
window.addEventListener(
'keydown',
() => {
keyboardActive = true;
},
{ capture: true },
);
window.addEventListener(
'mousedown',
() => {
keyboardActive = false;
},
{ capture: true },
);
/**

@@ -44,3 +23,3 @@ * A mixin to handle `focused` and `focus-ring` attributes based on focus.

get _keyboardActive() {
return keyboardActive;
return isKeyboardActive();
}

@@ -47,0 +26,0 @@

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

/**
* Returns true if the window has received a keydown
* event since the last mousedown event.
*/
export declare function isKeyboardActive(): boolean;
/**
* Returns true if the element is hidden, false otherwise.

@@ -10,0 +16,0 @@ *

@@ -7,3 +7,35 @@ /**

// We consider the keyboard to be active if the window has received a keydown
// event since the last mousedown event.
let keyboardActive = false;
// Listen for top-level keydown and mousedown events.
// Use capture phase so we detect events even if they're handled.
window.addEventListener(
'keydown',
() => {
keyboardActive = true;
},
{ capture: true },
);
window.addEventListener(
'mousedown',
() => {
keyboardActive = false;
},
{ capture: true },
);
/**
* Returns true if the window has received a keydown
* event since the last mousedown event.
*
* @return {boolean}
*/
export function isKeyboardActive() {
return keyboardActive;
}
/**
* Returns true if the element is hidden directly with `display: none` or `visibility: hidden`,

@@ -10,0 +42,0 @@ * false otherwise.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc