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.18.4 to 0.19.0

24

dist/builders/dialog/create.js
import { createFocusTrap, usePortal } from '../../internal/actions';
import { addEventListener, builder, createElHelpers, effect, generateId, isBrowser, noop, sleep, styleToString, } from '../../internal/helpers';
import { addEventListener, builder, createElHelpers, effect, generateId, isBrowser, last, noop, sleep, styleToString, } from '../../internal/helpers';
import { removeScroll } from '../../internal/helpers/scroll';

@@ -12,2 +12,3 @@ import { get, writable } from 'svelte/store';

};
const openDialogIds = writable([]);
export function createDialog(args = {}) {

@@ -23,2 +24,13 @@ const withDefaults = { ...defaults, ...args };

const open = writable(false);
effect([open], ([$open]) => {
// Prevent double clicks from closing multiple dialogs
sleep(100).then(() => {
if ($open) {
openDialogIds.update((prev) => [...prev, ids.content]);
}
else {
openDialogIds.update((prev) => prev.filter((id) => id !== ids.content));
}
});
});
const trigger = builder(name('trigger'), {

@@ -79,4 +91,7 @@ stores: open,

e.preventDefault();
e.stopImmediatePropagation();
const $options = get(options);
if ($options.closeOnOutsideClick) {
const $openDialogIds = get(openDialogIds);
const isLast = last($openDialogIds) === ids.content;
if ($options.closeOnOutsideClick && isLast) {
open.set(false);

@@ -132,5 +147,6 @@ }

});
effect([open, options], ([$open, $options]) => {
effect([open, options, openDialogIds], ([$open, $options, $openDialogIds]) => {
const unsubs = [];
if ($options.closeOnEscape && $open) {
const isLast = last($openDialogIds) === ids.content;
if ($options.closeOnEscape && $open && isLast) {
unsubs.push(addEventListener(document, 'keydown', (e) => {

@@ -137,0 +153,0 @@ if (e.key === 'Escape') {

2

package.json
{
"name": "@melt-ui/svelte",
"version": "0.18.4",
"version": "0.19.0",
"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