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.51.1 to 0.52.0

3

dist/builders/accordion/create.d.ts

@@ -6,2 +6,5 @@ /// <reference types="svelte" />

export declare const createAccordion: <Multiple extends boolean = false>(props?: CreateAccordionProps<Multiple> | undefined) => {
ids: {
root: string;
};
elements: {

@@ -8,0 +11,0 @@ root: import("../../internal/helpers/index.js").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, import("svelte/action").Action<any, any, Record<never, any>>, () => {

@@ -188,2 +188,3 @@ import { addMeltEventListener, builder, createElHelpers, executeCallbacks, generateId, getElementByMeltId, isHTMLElement, kbd, omit, overridable, styleToString, toWritableStores, disabledAttr, } from '../../internal/helpers/index.js';

return {
ids,
elements: {

@@ -190,0 +191,0 @@ root,

@@ -15,2 +15,7 @@ /// <reference types="svelte" />

export declare function createCombobox<Value, Multiple extends boolean = false, S extends ComboboxSelected<Multiple, Value> = ComboboxSelected<Multiple, Value>>(props?: CreateComboboxProps<Value, Multiple, S>): {
ids: {
input: string;
menu: string;
label: string;
};
elements: {

@@ -17,0 +22,0 @@ input: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[{

@@ -519,2 +519,3 @@ import { useEscapeKeydown, usePopper } from '../../internal/actions/index.js';

return {
ids,
elements: {

@@ -521,0 +522,0 @@ input,

@@ -61,2 +61,6 @@ /// <reference types="svelte" />

createSubmenu: (args?: import("../menu/types.js")._CreateSubmenuProps | undefined) => {
ids: {
menu: string;
trigger: string;
};
elements: {

@@ -63,0 +67,0 @@ subTrigger: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[import("svelte/store").Writable<boolean>, import("svelte/store").Writable<boolean>], (node: HTMLElement) => MeltActionReturn<"click" | "focusin" | "focusout" | "keydown" | "pointerleave" | "pointermove">, ([$subOpen, $disabled]: [boolean, boolean]) => {

14

dist/builders/context-menu/create.js

@@ -31,3 +31,3 @@ import { usePopper } from '../../internal/actions/index.js';

const prevFocusable = writable(null);
const { item, createCheckboxItem, arrow, createSubmenu, createMenuRadioGroup, rootIds, separator, handleTypeaheadSearch, group, groupLabel, } = createMenuBuilder({
const { item, createCheckboxItem, arrow, createSubmenu, createMenuRadioGroup, ids, separator, handleTypeaheadSearch, group, groupLabel, } = createMenuBuilder({
rootOpen,

@@ -62,7 +62,7 @@ rootActiveTrigger,

return;
if (target.id === rootIds.trigger && isLeftClick(e)) {
if (target.id === ids.trigger && isLeftClick(e)) {
rootOpen.set(false);
return;
}
if (target.id !== rootIds.trigger && !target.closest(selector())) {
if (target.id !== ids.trigger && !target.closest(selector())) {
rootOpen.set(false);

@@ -86,4 +86,4 @@ }

}),
id: rootIds.menu,
'aria-labelledby': rootIds.trigger,
id: ids.menu,
'aria-labelledby': ids.trigger,
'data-state': $isVisible ? 'open' : 'closed',

@@ -169,6 +169,6 @@ 'data-portal': $portal ? '' : undefined,

return {
'aria-controls': rootIds.menu,
'aria-controls': ids.menu,
'aria-expanded': $rootOpen,
'data-state': $rootOpen ? 'open' : 'closed',
id: rootIds.trigger,
id: ids.trigger,
style: styleToString({

@@ -175,0 +175,0 @@ WebkitTouchCallout: 'none',

@@ -6,2 +6,8 @@ /// <reference types="svelte" />

export declare function createDialog(props?: CreateDialogProps): {
ids: {
content: string;
title: string;
description: string;
trigger: string;
};
elements: {

@@ -8,0 +14,0 @@ content: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[import("svelte/store").Readable<boolean>], (node: HTMLElement) => {

@@ -266,2 +266,3 @@ import { createFocusTrap, useClickOutside, useEscapeKeydown, usePortal, } from '../../internal/actions/index.js';

return {
ids,
elements: {

@@ -268,0 +269,0 @@ content,

@@ -80,2 +80,6 @@ /// <reference types="svelte" />

createSubmenu: (args?: import("../menu/types.js")._CreateSubmenuProps | undefined) => {
ids: {
menu: string;
trigger: string;
};
elements: {

@@ -82,0 +86,0 @@ subTrigger: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[import("svelte/store").Writable<boolean>, import("svelte/store").Writable<boolean>], (node: HTMLElement) => import("../../internal/types.js").MeltActionReturn<"click" | "focusin" | "focusout" | "keydown" | "pointerleave" | "pointermove">, ([$subOpen, $disabled]: [boolean, boolean]) => {

@@ -7,2 +7,6 @@ /// <reference types="svelte" />

export declare function createLinkPreview(props?: CreateLinkPreviewProps): {
ids: {
content: string;
trigger: string;
};
elements: {

@@ -9,0 +13,0 @@ trigger: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[{

@@ -27,2 +27,4 @@ import { usePopper } from '../../internal/actions/index.js';

const activeTrigger = writable(null);
// type OpenReason = 'pointer' | 'focus';
// const openReason = writable<null | OpenReason>(null);
const options = toWritableStores(withDefaults);

@@ -206,4 +208,6 @@ const { openDelay, closeDelay, positioning, arrowSize, closeOnOutsideClick, forceVisible, portal, closeOnEscape, } = options;

effect([open], ([$open]) => {
if (!isBrowser || !$open)
if (!isBrowser || !$open) {
hasSelection.set(false);
return;
}
const handlePointerUp = () => {

@@ -232,2 +236,3 @@ containSelection.set(false);

return {
ids,
elements: {

@@ -234,0 +239,0 @@ trigger,

@@ -9,2 +9,6 @@ /// <reference types="svelte" />

export declare function createMenuBuilder(opts: _MenuBuilderOptions): {
ids: {
menu: string;
trigger: string;
};
trigger: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[Writable<boolean>], (node: HTMLElement) => MeltActionReturn<MenuEvents['trigger']>, ([$rootOpen]: [boolean]) => {

@@ -83,2 +87,6 @@ readonly 'aria-controls': string;

createSubmenu: (args?: _CreateSubmenuProps) => {
ids: {
menu: string;
trigger: string;
};
elements: {

@@ -166,6 +174,2 @@ subTrigger: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[Writable<boolean>, Writable<boolean>], (node: HTMLElement) => MeltActionReturn<MenuEvents['subTrigger']>, ([$subOpen, $disabled]: [boolean, boolean]) => {

}, "separator">;
rootIds: {
menu: string;
trigger: string;
};
handleTypeaheadSearch: (key: string, items: HTMLElement[]) => void;

@@ -172,0 +176,0 @@ };

@@ -842,2 +842,3 @@ import { createSeparator } from '../index.js';

return {
ids: subIds,
elements: {

@@ -1092,2 +1093,3 @@ subTrigger,

return {
ids: rootIds,
trigger: rootTrigger,

@@ -1105,3 +1107,2 @@ menu: rootMenu,

separator,
rootIds,
handleTypeaheadSearch,

@@ -1108,0 +1109,0 @@ };

@@ -7,2 +7,5 @@ /// <reference types="svelte" />

export declare function createMenubar(props?: CreateMenubarProps): {
ids: {
menubar: string;
};
elements: {

@@ -22,2 +25,5 @@ menubar: import("../../internal/helpers/index.js").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, (node: HTMLElement) => {

createMenu: (props?: CreateMenubarMenuProps) => {
ids: {
menubar: string;
};
elements: {

@@ -95,2 +101,6 @@ menu: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[import("svelte/store").Readable<boolean>, import("svelte/store").Writable<string | HTMLElement | null | undefined>], (node: HTMLElement) => MeltActionReturn<MenubarEvents['menu']>, ([$isVisible, $portal]: [boolean, string | HTMLElement | null | undefined]) => {

createSubmenu: (args?: import("../menu/types.js")._CreateSubmenuProps | undefined) => {
ids: {
menu: string;
trigger: string;
};
elements: {

@@ -97,0 +107,0 @@ subTrigger: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[import("svelte/store").Writable<boolean>, import("svelte/store").Writable<boolean>], (node: HTMLElement) => MeltActionReturn<"click" | "focusin" | "focusout" | "keydown" | "pointerleave" | "pointermove">, ([$subOpen, $disabled]: [boolean, boolean]) => {

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

let scrollRemoved = false;
const rootIds = {
const ids = {
menubar: generateId(),

@@ -32,3 +32,3 @@ };

'data-orientation': 'horizontal',
id: rootIds.menubar,
id: ids.menubar,
};

@@ -93,6 +93,6 @@ },

}),
id: m.rootIds.menu,
'aria-labelledby': m.rootIds.trigger,
id: m.ids.menu,
'aria-labelledby': m.ids.trigger,
'data-state': $isVisible ? 'open' : 'closed',
'data-melt-scope': rootIds.menubar,
'data-melt-scope': ids.menubar,
'data-portal': $portal ? '' : undefined,

@@ -118,3 +118,3 @@ tabindex: -1,

const target = e.target;
const menubarEl = document.getElementById(rootIds.menubar);
const menubarEl = document.getElementById(ids.menubar);
if (!menubarEl || !isElement(target))

@@ -185,6 +185,6 @@ return false;

return {
'aria-controls': m.rootIds.menu,
'aria-controls': m.ids.menu,
'aria-expanded': $rootOpen,
'data-state': $rootOpen ? 'open' : 'closed',
id: m.rootIds.trigger,
id: m.ids.trigger,
'aria-haspopup': 'menu',

@@ -197,3 +197,3 @@ 'data-orientation': 'horizontal',

applyAttrsIfDisabled(node);
const menubarEl = document.getElementById(rootIds.menubar);
const menubarEl = document.getElementById(ids.menubar);
if (!menubarEl)

@@ -255,3 +255,3 @@ return {};

rootOpen.set(true);
activeMenu.set(m.rootIds.menu);
activeMenu.set(m.ids.menu);
rootActiveTrigger.set(triggerEl);

@@ -275,3 +275,3 @@ }

rootActiveTrigger.set(triggerEl);
activeMenu.set(m.rootIds.menu);
activeMenu.set(m.ids.menu);
}

@@ -287,6 +287,6 @@ else {

return;
if ($activeMenu === m.rootIds.menu) {
if ($activeMenu === m.ids.menu) {
if (get(rootOpen))
return;
const triggerEl = document.getElementById(m.rootIds.trigger);
const triggerEl = document.getElementById(m.ids.trigger);
if (!triggerEl)

@@ -299,7 +299,7 @@ return;

}
if ($activeMenu !== m.rootIds.menu) {
if ($activeMenu !== m.ids.menu) {
if (!isBrowser)
return;
if (get(rootOpen)) {
const triggerEl = document.getElementById(m.rootIds.trigger);
const triggerEl = document.getElementById(m.ids.trigger);
if (!triggerEl)

@@ -317,6 +317,6 @@ return;

return;
const triggerEl = document.getElementById(m.rootIds.trigger);
const triggerEl = document.getElementById(m.ids.trigger);
if (!triggerEl)
return;
if (!$rootOpen && get(activeMenu) === m.rootIds.menu) {
if (!$rootOpen && get(activeMenu) === m.ids.menu) {
rootActiveTrigger.set(null);

@@ -335,3 +335,3 @@ activeMenu.set('');

return;
const triggerEl = document.getElementById(m.rootIds.trigger);
const triggerEl = document.getElementById(m.ids.trigger);
if (isHTMLElement(triggerEl) && get(rootOpen)) {

@@ -342,2 +342,3 @@ rootActiveTrigger.set(triggerEl);

return {
ids,
elements: {

@@ -390,3 +391,3 @@ menu,

// Index of the currently focused item in the candidate nodes array
const menubarEl = document.getElementById(rootIds.menubar);
const menubarEl = document.getElementById(ids.menubar);
if (!isHTMLElement(menubarEl))

@@ -479,3 +480,3 @@ return;

return;
const menubarEl = document.getElementById(rootIds.menubar);
const menubarEl = document.getElementById(ids.menubar);
if (!menubarEl)

@@ -531,2 +532,3 @@ return;

return {
ids: ids,
elements: {

@@ -533,0 +535,0 @@ menubar,

@@ -6,2 +6,5 @@ /// <reference types="svelte" />

export declare function createPinInput(props?: CreatePinInputProps): {
ids: {
root: string;
};
elements: {

@@ -8,0 +11,0 @@ root: import("../../internal/helpers/index.js").ExplicitBuilderReturn<{

@@ -201,2 +201,3 @@ import { addMeltEventListener, builder, createElHelpers, disabledAttr, executeCallbacks, generateId, isBrowser, isHTMLElement, isHTMLInputElement, last, next, omit, overridable, prev, styleToString, toWritableStores, } from '../../internal/helpers/index.js';

return {
ids,
elements: {

@@ -203,0 +204,0 @@ root,

@@ -6,2 +6,6 @@ /// <reference types="svelte" />

export declare function createPopover(args?: CreatePopoverProps): {
ids: {
content: string;
trigger: string;
};
elements: {

@@ -8,0 +12,0 @@ trigger: import("../../internal/helpers/index.js").ExplicitBuilderReturn<{

@@ -187,2 +187,3 @@ import { addMeltEventListener, builder, createElHelpers, derivedVisible, effect, generateId, getPortalDestination, isBrowser, isHTMLElement, kbd, noop, omit, overridable, removeScroll, styleToString, toWritableStores, } from '../../internal/helpers/index.js';

return {
ids,
elements: {

@@ -189,0 +190,0 @@ trigger,

@@ -6,2 +6,7 @@ /// <reference types="svelte" />

export declare function createSelect<Value = unknown, Multiple extends boolean = false, S extends SelectSelected<Multiple, Value> = SelectSelected<Multiple, Value>>(props?: CreateSelectProps<Value, Multiple, S>): {
ids: {
menu: string;
trigger: string;
label: string;
};
elements: {

@@ -8,0 +13,0 @@ menu: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[import("svelte/store").Readable<boolean>, import("svelte/store").Writable<string | HTMLElement | null | undefined>], (node: HTMLElement) => MeltActionReturn<SelectEvents['menu']>, ([$isVisible, $portal]: [boolean, string | HTMLElement | null | undefined]) => {

@@ -586,2 +586,3 @@ import { createLabel, createSeparator } from '../index.js';

return {
ids,
elements: {

@@ -588,0 +589,0 @@ menu,

@@ -6,5 +6,9 @@ /// <reference types="svelte" />

export declare const createSlider: (props?: CreateSliderProps) => {
ids: {
root: string;
};
elements: {
root: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[import("svelte/store").Writable<boolean>, import("svelte/store").Writable<"horizontal" | "vertical">], import("svelte/action").Action<any, any, Record<never, any>>, ([$disabled, $orientation]: [boolean, "horizontal" | "vertical"]) => {
disabled: boolean | undefined;
'aria-disabled': string | undefined;
'data-orientation': "horizontal" | "vertical";

@@ -11,0 +15,0 @@ style: string | undefined;

@@ -1,2 +0,2 @@

import { addEventListener, addMeltEventListener, builder, createElHelpers, disabledAttr, effect, executeCallbacks, generateId, getElementByMeltId, isBrowser, isHTMLElement, kbd, omit, overridable, styleToString, toWritableStores, } from '../../internal/helpers/index.js';
import { addEventListener, addMeltEventListener, ariaDisabledAttr, builder, createElHelpers, disabledAttr, effect, executeCallbacks, generateId, getElementByMeltId, isBrowser, isHTMLElement, kbd, omit, overridable, styleToString, toWritableStores, } from '../../internal/helpers/index.js';
import { add, sub, div, mul } from './helpers.js';

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

disabled: disabledAttr($disabled),
'aria-disabled': ariaDisabledAttr($disabled),
'data-orientation': $orientation,

@@ -356,2 +357,3 @@ style: $disabled ? undefined : 'touch-action: none;',

return {
ids,
elements: {

@@ -358,0 +360,0 @@ root,

@@ -6,2 +6,6 @@ /// <reference types="svelte" />

export declare function createTagsInput(props?: CreateTagsInputProps): {
ids: {
root: string;
input: string;
};
elements: {

@@ -8,0 +12,0 @@ root: import("../../internal/helpers/index.js").ExplicitBuilderReturn<import("svelte/store").Writable<boolean>, (node: HTMLElement) => MeltActionReturn<TagsInputEvents['root']>, ($disabled: boolean) => {

@@ -643,2 +643,3 @@ import { builder, createElHelpers, effect, executeCallbacks, generateId, getElementByMeltId, isBrowser, isHTMLElement, kbd, omit, overridable, styleToString, toWritableStores, addMeltEventListener, disabledAttr, } from '../../internal/helpers/index.js';

return {
ids,
elements: {

@@ -645,0 +646,0 @@ root,

@@ -7,2 +7,6 @@ /// <reference types="svelte" />

export declare function createTooltip(props?: CreateTooltipProps): {
ids: {
readonly content: string;
readonly trigger: string;
};
elements: {

@@ -9,0 +13,0 @@ trigger: import("../../internal/helpers/index.js").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, (node: HTMLElement) => MeltActionReturn<TooltipEvents['trigger']>, () => {

@@ -86,2 +86,11 @@ import { addEventListener, addMeltEventListener, builder, createElHelpers, effect, executeCallbacks, generateId, getPortalDestination, isBrowser, isTouch, kbd, makeHullFromElements, noop, omit, overridable, pointInPolygon, styleToString, toWritableStores, } from '../../internal/helpers/index.js';

action: (node) => {
const keydownHandler = (e) => {
if (get(closeOnEscape) && e.key === kbd.ESCAPE) {
if (openTimeout) {
window.clearTimeout(openTimeout);
openTimeout = null;
}
open.set(false);
}
};
const unsub = executeCallbacks(addMeltEventListener(node, 'pointerdown', () => {

@@ -112,11 +121,3 @@ const $closeOnPointerDown = get(closeOnPointerDown);

openTooltip('focus');
}), addMeltEventListener(node, 'blur', () => closeTooltip(true)), addMeltEventListener(node, 'keydown', (e) => {
if (get(closeOnEscape) && e.key === kbd.ESCAPE) {
if (openTimeout) {
window.clearTimeout(openTimeout);
openTimeout = null;
}
open.set(false);
}
}));
}), addMeltEventListener(node, 'blur', () => closeTooltip(true)), addMeltEventListener(node, 'keydown', keydownHandler), addEventListener(document, 'keydown', keydownHandler));
return {

@@ -192,6 +193,11 @@ destroy: unsub,

effect(open, ($open) => {
if (!$open)
const currentGroup = get(group);
if (currentGroup === undefined || currentGroup === false) {
return;
const groupValue = get(group);
if (groupValue === undefined || groupValue === false) {
}
if (!$open) {
if (groupMap.get(currentGroup) === open) {
// Tooltip is no longer open
groupMap.delete(currentGroup);
}
return;

@@ -201,5 +207,5 @@ }

// and set this tooltip as the open one.
const currentOpen = groupMap.get(groupValue);
const currentOpen = groupMap.get(currentGroup);
currentOpen?.set(false);
groupMap.set(groupValue, open);
groupMap.set(currentGroup, open);
});

@@ -231,2 +237,3 @@ effect([open, openReason], ([$open, $openReason]) => {

return {
ids,
elements: {

@@ -233,0 +240,0 @@ trigger,

@@ -7,2 +7,5 @@ /// <reference types="svelte" />

export declare function createTreeView(args?: CreateTreeViewProps): {
ids: {
tree: string;
};
elements: {

@@ -9,0 +12,0 @@ tree: import("../../internal/helpers").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, import("svelte/action").Action<any, any, Record<never, any>>, () => {

@@ -42,3 +42,3 @@ import { addMeltEventListener, builder, createElHelpers, executeCallbacks, generateId, getElementByMeltId, isHTMLElement, isHidden, isLetter, kbd, last, overridable, styleToString, } from '../../internal/helpers';

});
const rootIds = {
const ids = {
tree: generateId(),

@@ -50,3 +50,3 @@ };

role: 'tree',
'data-melt-id': rootIds.tree,
'data-melt-id': ids.tree,
};

@@ -93,3 +93,3 @@ },

}
const rootEl = getElementByMeltId(rootIds.tree);
const rootEl = getElementByMeltId(ids.tree);
if (!rootEl || !isHTMLElement(node) || node.getAttribute('role') !== 'treeitem') {

@@ -248,3 +248,3 @@ return;

let items = [];
const rootEl = getElementByMeltId(rootIds.tree);
const rootEl = getElementByMeltId(ids.tree);
if (!rootEl)

@@ -284,2 +284,3 @@ return items;

return {
ids,
elements: {

@@ -286,0 +287,0 @@ tree: rootTree,

export declare function disabledAttr(disabled: boolean | undefined): true | undefined;
export declare function ariaDisabledAttr(disabled: boolean | undefined): "true" | undefined;
export function disabledAttr(disabled) {
return disabled ? true : undefined;
}
export function ariaDisabledAttr(disabled) {
return disabled ? 'true' : undefined;
}
{
"name": "@melt-ui/svelte",
"version": "0.51.1",
"version": "0.52.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": "github:melt-ui/melt-ui",

@@ -7,7 +7,9 @@ <h1 align="center">

[![](https://img.shields.io/npm/v/@melt-ui/svelte?style=flat-square)](https://www.npmjs.com/package/@melt-ui/svelte)
[![](https://img.shields.io/github/actions/workflow/status/melt-ui/melt-ui/ci.yaml?style=flat-square)](https://github.com/melt-ui/melt-ui/actions/workflows/ci.yaml)
![](https://img.shields.io/github/license/melt-ui/melt-ui?style=flat-square)
[![](https://dcbadge.vercel.app/api/server/2QDjZkYunf?style=flat-square)](https://discord.gg/2QDjZkYunf)
[![](https://img.shields.io/npm/v/@melt-ui/svelte?style=flat)](https://www.npmjs.com/package/@melt-ui/svelte)
![npm](https://img.shields.io/npm/dw/%40melt-ui%2Fsvelte?style=flat&color=orange)
[![](https://img.shields.io/github/actions/workflow/status/melt-ui/melt-ui/ci.yaml?style=flat)](https://github.com/melt-ui/melt-ui/actions/workflows/ci.yaml)
![](https://img.shields.io/github/license/melt-ui/melt-ui?style=flat)
[![](https://dcbadge.vercel.app/api/server/2QDjZkYunf?style=flat)](https://discord.gg/2QDjZkYunf)
## About

@@ -14,0 +16,0 @@

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