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

@melt-ui/svelte

Package Overview
Dependencies
Maintainers
1
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@melt-ui/svelte - npm Package Compare versions

Comparing version 0.26.2 to 0.26.3

65

dist/builders/tooltip/create.js

@@ -24,12 +24,11 @@ import { addEventListener, builder, createElHelpers, effect, executeCallbacks, generateId, makeHullFromElements, noop, omit, pointInPolygon, styleToString, } from '../../internal/helpers';

};
let openTimeout = null;
let closeTimeout = null;
let timeout = null;
let clickedTrigger = false;
const openTooltip = () => {
const $options = get(options);
if (openTimeout) {
window.clearTimeout(openTimeout);
openTimeout = null;
if (timeout) {
window.clearTimeout(timeout);
timeout = null;
}
openTimeout = window.setTimeout(() => {
timeout = window.setTimeout(() => {
open.set(true);

@@ -40,7 +39,9 @@ }, $options.openDelay);

const $options = get(options);
if (closeTimeout) {
window.clearTimeout(closeTimeout);
closeTimeout = null;
if (timeout) {
window.clearTimeout(timeout);
timeout = null;
}
closeTimeout = window.setTimeout(() => {
if (isBlur && isMouseInTooltipArea)
return;
timeout = window.setTimeout(() => {
open.set(false);

@@ -65,14 +66,16 @@ if (isBlur)

clickedTrigger = true;
if (openTimeout) {
window.clearTimeout(openTimeout);
openTimeout = null;
if (timeout) {
window.clearTimeout(timeout);
timeout = null;
}
}), addEventListener(node, 'pointerover', (e) => {
}), addEventListener(node, 'pointerenter', (e) => {
if (e.pointerType === 'touch')
return;
openTooltip();
}), addEventListener(node, 'pointerleave', () => {
if (openTimeout) {
window.clearTimeout(openTimeout);
openTimeout = null;
}), addEventListener(node, 'pointerleave', (e) => {
if (e.pointerType === 'touch')
return;
if (timeout) {
window.clearTimeout(timeout);
timeout = null;
}

@@ -85,10 +88,6 @@ }), addEventListener(node, 'focus', () => {

if (e.key === 'Escape') {
if (openTimeout) {
window.clearTimeout(openTimeout);
openTimeout = null;
if (timeout) {
window.clearTimeout(timeout);
timeout = null;
}
if (closeTimeout) {
window.clearTimeout(closeTimeout);
closeTimeout = null;
}
open.set(false);

@@ -134,3 +133,3 @@ }

});
unsub = executeCallbacks(addEventListener(node, 'mouseover', openTooltip), portalReturn && portalReturn.destroy ? portalReturn.destroy : noop, unsubOpen);
unsub = executeCallbacks(addEventListener(node, 'pointerenter', openTooltip), addEventListener(node, 'pointerdown', openTooltip), portalReturn && portalReturn.destroy ? portalReturn.destroy : noop, unsubOpen);
return {

@@ -155,2 +154,3 @@ destroy() {

});
let isMouseInTooltipArea = false;
effect(open, ($open) => {

@@ -160,3 +160,3 @@ if ($open) {

const triggerEl = document.getElementById(ids.trigger);
if (!triggerEl || (document.activeElement === triggerEl && !clickedTrigger))
if (!triggerEl)
return;

@@ -167,11 +167,12 @@ const contentEl = document.getElementById(ids.content);

const polygon = makeHullFromElements([triggerEl, contentEl]);
const isMouseInTooltipArea = pointInPolygon({
isMouseInTooltipArea = pointInPolygon({
x: e.clientX,
y: e.clientY,
}, polygon);
if (isMouseInTooltipArea) {
closeTimeout = null;
return;
if (isMouseInTooltipArea || (document.activeElement === triggerEl && !clickedTrigger)) {
openTooltip();
}
closeTooltip();
else {
closeTooltip();
}
}));

@@ -178,0 +179,0 @@ }

{
"name": "@melt-ui/svelte",
"version": "0.26.2",
"version": "0.26.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "exports": {

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