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.60.2 to 0.61.0

dist/builders/calendar/create.d.ts

2

dist/builders/dialog/create.d.ts

@@ -10,4 +10,4 @@ /// <reference types="svelte" />

title: import("svelte/store").Writable<string>;
description: import("svelte/store").Writable<string>;
content: import("svelte/store").Writable<string>;
description: import("svelte/store").Writable<string>;
};

@@ -14,0 +14,0 @@ elements: {

@@ -7,2 +7,7 @@ export * from './accordion/index.js';

export * from './context-menu/index.js';
export * from './calendar/index.js';
export * from './date-field/index.js';
export * from './date-picker/index.js';
export * from './date-range-field/index.js';
export * from './date-range-picker/index.js';
export * from './dialog/index.js';

@@ -18,2 +23,3 @@ export * from './dropdown-menu/index.js';

export * from './radio-group/index.js';
export * from './range-calendar/index.js';
export * from './select/index.js';

@@ -20,0 +26,0 @@ export * from './separator/index.js';

@@ -7,2 +7,7 @@ export * from './accordion/index.js';

export * from './context-menu/index.js';
export * from './calendar/index.js';
export * from './date-field/index.js';
export * from './date-picker/index.js';
export * from './date-range-field/index.js';
export * from './date-range-picker/index.js';
export * from './dialog/index.js';

@@ -18,2 +23,3 @@ export * from './dropdown-menu/index.js';

export * from './radio-group/index.js';
export * from './range-calendar/index.js';
export * from './select/index.js';

@@ -20,0 +26,0 @@ export * from './separator/index.js';

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

closeFocus: import("svelte/store").Writable<import("../../internal/helpers/index.js").FocusProp | undefined>;
disableFocusTrap: import("svelte/store").Writable<boolean>;
openFocus: import("svelte/store").Writable<import("../../internal/helpers/index.js").FocusProp | undefined>;
disableFocusTrap: import("svelte/store").Writable<boolean>;
};
};

@@ -1,6 +0,5 @@

import { addMeltEventListener, builder, createElHelpers, derivedVisible, effect, getPortalDestination, handleFocus, isBrowser, isHTMLElement, kbd, noop, omit, overridable, removeScroll, styleToString, toWritableStores, } from '../../internal/helpers/index.js';
import { addMeltEventListener, builder, createElHelpers, derivedVisible, effect, getPortalDestination, handleFocus, isBrowser, isHTMLElement, kbd, noop, omit, overridable, removeScroll, styleToString, toWritableStores, executeCallbacks, } from '../../internal/helpers/index.js';
import { usePopper } from '../../internal/actions/index.js';
import { onMount, tick } from 'svelte';
import { get, writable } from 'svelte/store';
import { executeCallbacks } from '../../internal/helpers/callbacks.js';
import { generateIds } from '../../internal/helpers/id';

@@ -153,5 +152,9 @@ const defaults = {

action: (node) => {
const unsub = executeCallbacks(addMeltEventListener(node, 'click', () => {
const unsub = executeCallbacks(addMeltEventListener(node, 'click', (e) => {
if (e.defaultPrevented)
return;
handleClose();
}), addMeltEventListener(node, 'keydown', (e) => {
if (e.defaultPrevented)
return;
if (e.key !== kbd.ENTER && e.key !== kbd.SPACE)

@@ -158,0 +161,0 @@ return;

import type { GroupedEvents, MeltComponentEvents } from '../../internal/types.js';
export declare const popoverEvents: {
trigger: readonly ["click", "keydown"];
close: readonly ["click", "keydown"];
readonly trigger: readonly ["click", "keydown"];
readonly close: readonly ["click", "keydown"];
};
export type PopoverEvents = GroupedEvents<typeof popoverEvents>;
export type PopoverComponentEvents = MeltComponentEvents<PopoverEvents>;

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

export declare function wrapArray<T>(array: T[], startIndex: number): T[];
/**
* Toggles an item in an array. If the item is already in the array,
* it is removed. Otherwise, it is added.
* @param item The item to toggle.
* @param array The array to toggle the item in.
* @returns The updated array with the item toggled.
* @template T The type of the items in the array.
* @example ```typescript
* const arr = [1, 2, 3];
* const newArr = toggle(2, arr);
* // newArr = [1, 3]
* ```
*/
export declare function toggle<T>(item: T, array: T[], compare?: (itemA: T, itemB: T) => boolean): T[];
/**
* Splits an array into chunks of a given size.
* @param arr The array to split.
* @param size The size of each chunk.
* @returns An array of arrays, where each sub-array has `size` elements from the original array.
* @example ```ts
* const arr = [1, 2, 3, 4, 5, 6, 7, 8];
* const chunks = chunk(arr, 3);
* // chunks = [[1, 2, 3], [4, 5, 6], [7, 8]]
* ```
*/
export declare function chunk<T>(arr: T[], size: number): T[][];
/**
* Checks if the given index is valid for the given array.
*
* @param index - The index to check
* @param arr - The array to check
*/
export declare function isValidIndex(index: number, arr: unknown[]): boolean;

@@ -76,2 +76,15 @@ import { dequal as deepEqual } from 'dequal';

}
/**
* Toggles an item in an array. If the item is already in the array,
* it is removed. Otherwise, it is added.
* @param item The item to toggle.
* @param array The array to toggle the item in.
* @returns The updated array with the item toggled.
* @template T The type of the items in the array.
* @example ```typescript
* const arr = [1, 2, 3];
* const newArr = toggle(2, arr);
* // newArr = [1, 3]
* ```
*/
export function toggle(item, array, compare = deepEqual) {

@@ -87,1 +100,28 @@ const itemIdx = array.findIndex((innerItem) => compare(innerItem, item));

}
/**
* Splits an array into chunks of a given size.
* @param arr The array to split.
* @param size The size of each chunk.
* @returns An array of arrays, where each sub-array has `size` elements from the original array.
* @example ```ts
* const arr = [1, 2, 3, 4, 5, 6, 7, 8];
* const chunks = chunk(arr, 3);
* // chunks = [[1, 2, 3], [4, 5, 6], [7, 8]]
* ```
*/
export function chunk(arr, size) {
const result = [];
for (let i = 0; i < arr.length; i += size) {
result.push(arr.slice(i, i + size));
}
return result;
}
/**
* Checks if the given index is valid for the given array.
*
* @param index - The index to check
* @param arr - The array to check
*/
export function isValidIndex(index, arr) {
return index >= 0 && index < arr.length;
}

@@ -13,1 +13,3 @@ export declare const isBrowser: boolean;

export declare function isContentEditable(element: unknown): element is HTMLElement;
export declare function isNull(value: unknown): value is null;
export declare function isNumberString(value: string): boolean;

@@ -40,1 +40,9 @@ export const isBrowser = typeof document !== 'undefined';

}
export function isNull(value) {
return value === null;
}
export function isNumberString(value) {
if (isNaN(parseInt(value)))
return false;
return true;
}

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

ASTERISK: string;
A: string;
P: string;
};

@@ -42,0 +44,0 @@ /** Key sets for navigation within lists, such as select, menu, and combobox. */

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

ASTERISK: '*',
A: 'a',
P: 'p',
};

@@ -42,0 +44,0 @@ /** Key sets for navigation within lists, such as select, menu, and combobox. */

@@ -48,2 +48,5 @@ import type { ActionReturn } from 'svelte/action';

};
export type InternalCustomEvents<Events extends keyof HTMLElementEventMap> = {
[K in Events as K]?: K extends keyof HTMLElementEventMap ? EventHandler<HTMLElementEventMap[K]> : never;
};
type ElementEvents<T> = T extends ReadonlyArray<infer U> ? U : never;

@@ -59,2 +62,5 @@ export type GroupedEvents<T> = {

] extends [true] ? IfTrue : [TrueOrFalse] extends [false] ? IfFalse : IfNeither;
export type RenameProperties<T, NewNames extends Partial<Record<keyof T, string>>> = Expand<{
[K in keyof T as K extends keyof NewNames ? NewNames[K] extends PropertyKey ? NewNames[K] : K : K]: T[K];
}>;
export {};
/**
* Exports that are shared between multiple builders
* can be exported here to prevent conflicts.
* When types or functions are shared between multiple builders
* with the expectation that they will be exported for users to
* use, they should be exported from this file to prevent conflicts
* with other builders that may export the same types or functions.
*/
import type { Granularity, Matcher, DateRange, Month } from '../internal/helpers/date';
import type { FocusProp, FocusTarget } from '../internal/helpers/index.js';
export type { FocusProp, FocusTarget };
export type { Granularity, FocusProp, FocusTarget, Matcher, DateRange, Month };
{
"name": "@melt-ui/svelte",
"version": "0.60.2",
"version": "0.61.0",
"license": "MIT",

@@ -43,2 +43,3 @@ "repository": "github:melt-ui/melt-ui",

"@floating-ui/dom": "^1.4.5",
"@internationalized/date": "^3.5.0",
"dequal": "^2.0.3",

@@ -86,3 +87,3 @@ "focus-trap": "^7.5.2",

"eslint-config-prettier": "^8.9.0",
"eslint-plugin-storybook": "^0.6.13",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-svelte": "^2.33.0",

@@ -113,3 +114,3 @@ "fathom-client": "^3.5.0",

"shiki-es": "^0.14.0",
"storybook": "^7.3.2",
"storybook": "^7.4.6",
"svelte": "^4.0.0",

@@ -116,0 +117,0 @@ "svelte-action-balancer": "^1.0.4",

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