@melt-ui/svelte
Advanced tools
Comparing version 0.62.0 to 0.62.1
@@ -143,3 +143,2 @@ /// <reference types="svelte" /> | ||
positioning: import("svelte/store").Writable<import("../../internal/actions/index.js").FloatingConfig | { | ||
/** Action and attributes for the text input. */ | ||
placement: "bottom"; | ||
@@ -146,0 +145,0 @@ sameWidth: true; |
import { usePopper } from '../../internal/actions/index.js'; | ||
import { addMeltEventListener, builder, createElHelpers, derivedVisible, effect, executeCallbacks, getPortalDestination, getTabbableNodes, isBrowser, isElement, isFocusVisible, isHTMLElement, isTouch, noop, overridable, sleep, styleToString, toWritableStores, } from '../../internal/helpers/index.js'; | ||
import { onMount } from 'svelte'; | ||
import { safeOnMount } from '../../internal/helpers/lifecycle'; | ||
import { derived, get, writable } from 'svelte/store'; | ||
@@ -200,3 +200,3 @@ import { generateIds } from '../../internal/helpers/id'; | ||
}); | ||
onMount(() => { | ||
safeOnMount(() => { | ||
const triggerEl = document.getElementById(get(ids.trigger)); | ||
@@ -203,0 +203,0 @@ if (!triggerEl) |
import { useEscapeKeydown, usePopper } from '../../internal/actions/index.js'; | ||
import { FIRST_LAST_KEYS, addHighlight, addMeltEventListener, back, builder, createClickOutsideIgnore, createElHelpers, createTypeaheadSearch, derivedVisible, disabledAttr, effect, executeCallbacks, forward, generateId, getOptions, getPortalDestination, hiddenInputAttrs, isBrowser, isElement, isElementDisabled, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, kbd, last, next, noop, omit, overridable, prev, removeHighlight, removeScroll, styleToString, toWritableStores, toggle, } from '../../internal/helpers/index.js'; | ||
import { safeOnMount } from '../../internal/helpers/lifecycle'; | ||
import { dequal as deepEqual } from 'dequal'; | ||
import { onMount, tick } from 'svelte'; | ||
import { tick } from 'svelte'; | ||
import { derived, get, writable } from 'svelte/store'; | ||
@@ -483,3 +484,3 @@ import { generateIds } from '../../internal/helpers/id'; | ||
/* ------------------- */ | ||
onMount(() => { | ||
safeOnMount(() => { | ||
if (!isBrowser) | ||
@@ -486,0 +487,0 @@ return; |
@@ -5,3 +5,3 @@ /// <reference types="svelte" /> | ||
import type { MenuEvents } from './events.js'; | ||
import type { _CheckboxItemProps, _CreateRadioGroupProps, _CreateSubmenuProps, _MenuBuilderOptions, _RadioItemProps, Selector } from './types.js'; | ||
import type { Selector, _CheckboxItemProps, _CreateRadioGroupProps, _CreateSubmenuProps, _MenuBuilderOptions, _RadioItemProps } from './types.js'; | ||
export declare const SUB_OPEN_KEYS: Record<TextDirection, string[]>; | ||
@@ -8,0 +8,0 @@ export declare const SUB_CLOSE_KEYS: Record<TextDirection, string[]>; |
import { createSeparator } from '../index.js'; | ||
import { usePopper } from '../../internal/actions/index.js'; | ||
import { FIRST_LAST_KEYS, SELECTION_KEYS, addEventListener, addHighlight, addMeltEventListener, builder, createElHelpers, createTypeaheadSearch, derivedVisible, derivedWithUnsubscribe, disabledAttr, effect, executeCallbacks, generateIds, getNextFocusable, getPortalDestination, getPreviousFocusable, handleFocus, handleRovingFocus, isBrowser, isElementDisabled, isHTMLElement, kbd, noop, omit, overridable, removeHighlight, removeScroll, sleep, styleToString, toWritableStores, } from '../../internal/helpers/index.js'; | ||
import { onMount, tick } from 'svelte'; | ||
import { tick } from 'svelte'; | ||
import { derived, get, writable } from 'svelte/store'; | ||
import { safeOnMount } from '../../internal/helpers/lifecycle.js'; | ||
export const SUB_OPEN_KEYS = { | ||
@@ -503,3 +504,3 @@ ltr: [...SELECTION_KEYS, kbd.ARROW_RIGHT], | ||
const subIds = toWritableStores({ ...generateIds(menuIdParts), ...withDefaults.ids }); | ||
onMount(() => { | ||
safeOnMount(() => { | ||
/** | ||
@@ -857,3 +858,3 @@ * Set active trigger on mount to handle controlled/forceVisible | ||
}; | ||
onMount(() => { | ||
safeOnMount(() => { | ||
/** | ||
@@ -860,0 +861,0 @@ * We need to set the active trigger on mount to cover the |
/// <reference types="svelte" /> | ||
import { noop } from '../../internal/helpers/index.js'; | ||
import type { MeltActionReturn } from '../../internal/types.js'; | ||
import type { MenubarEvents } from './events.js'; | ||
import type { CreateMenubarMenuProps, CreateMenubarProps } from './types.js'; | ||
import type { MenubarEvents } from './events.js'; | ||
export declare const menubarIdParts: readonly ["menubar"]; | ||
@@ -75,3 +75,3 @@ export type MenubarIdParts = typeof menubarIdParts; | ||
builders: { | ||
createCheckboxItem: (props?: import("../menu/types.js")._CheckboxItemProps | undefined) => { | ||
createCheckboxItem: (props?: import("../menu/types")._CheckboxItemProps | undefined) => { | ||
elements: { | ||
@@ -102,3 +102,3 @@ checkboxItem: import("../../internal/helpers/index.js").ExplicitBuilderReturn<[{ | ||
}; | ||
createSubmenu: (args?: import("../menu/types.js")._CreateSubmenuProps | undefined) => { | ||
createSubmenu: (args?: import("../menu/types")._CreateSubmenuProps | undefined) => { | ||
ids: { | ||
@@ -164,3 +164,3 @@ menu: import("svelte/store").Writable<string>; | ||
}; | ||
createMenuRadioGroup: (args?: import("../menu/types.js")._CreateRadioGroupProps) => { | ||
createMenuRadioGroup: (args?: import("../menu/types")._CreateRadioGroupProps) => { | ||
elements: { | ||
@@ -174,3 +174,3 @@ radioGroup: import("../../internal/helpers/index.js").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, import("svelte/action").Action<any, any, Record<never, any>>, () => { | ||
subscribe(this: void, run: import("svelte/store").Subscriber<string | null>, invalidate?: import("svelte/store").Invalidator<string | null> | undefined): import("svelte/store").Unsubscriber; | ||
}], (node: HTMLElement) => MeltActionReturn<"click" | "focusin" | "focusout" | "keydown" | "pointerdown" | "pointerleave" | "pointermove">, ([$value]: [string | null]) => (itemProps: import("../menu/types.js")._RadioItemProps) => { | ||
}], (node: HTMLElement) => MeltActionReturn<"click" | "focusin" | "focusout" | "keydown" | "pointerdown" | "pointerleave" | "pointermove">, ([$value]: [string | null]) => (itemProps: import("../menu/types")._RadioItemProps) => { | ||
disabled: boolean; | ||
@@ -177,0 +177,0 @@ role: string; |
@@ -0,8 +1,9 @@ | ||
import { usePopper } from '../../internal/actions/index.js'; | ||
import { FIRST_LAST_KEYS, SELECTION_KEYS, addEventListener, addHighlight, addMeltEventListener, builder, createElHelpers, derivedVisible, effect, executeCallbacks, getNextFocusable, getPortalDestination, getPreviousFocusable, handleRovingFocus, isBrowser, isElement, isHTMLElement, kbd, noop, removeHighlight, removeScroll, styleToString, toWritableStores, } from '../../internal/helpers/index.js'; | ||
import { safeOnDestroy, safeOnMount } from '../../internal/helpers/lifecycle.js'; | ||
import { tick } from 'svelte'; | ||
import { get, writable } from 'svelte/store'; | ||
import { generateIds } from '../../internal/helpers/id'; | ||
import { omit } from '../../internal/helpers/object'; | ||
import { applyAttrsIfDisabled, createMenuBuilder, getMenuItems, handleMenuNavigation, handleTabNavigation, } from '../menu/index.js'; | ||
import { executeCallbacks, isHTMLElement, addEventListener, kbd, SELECTION_KEYS, FIRST_LAST_KEYS, handleRovingFocus, effect, styleToString, noop, isBrowser, getNextFocusable, getPreviousFocusable, builder, createElHelpers, toWritableStores, removeHighlight, addHighlight, derivedVisible, addMeltEventListener, getPortalDestination, removeScroll, isElement, } from '../../internal/helpers/index.js'; | ||
import { onDestroy, onMount, tick } from 'svelte'; | ||
import { usePopper } from '../../internal/actions/index.js'; | ||
import { omit } from '../../internal/helpers/object'; | ||
import { generateIds } from '../../internal/helpers/id'; | ||
const MENUBAR_NAV_KEYS = [kbd.ARROW_LEFT, kbd.ARROW_RIGHT, kbd.HOME, kbd.END]; | ||
@@ -323,3 +324,3 @@ const { name } = createElHelpers('menubar'); | ||
}); | ||
onMount(() => { | ||
safeOnMount(() => { | ||
if (!isBrowser) | ||
@@ -466,3 +467,3 @@ return; | ||
/* --------------------*/ | ||
onMount(() => { | ||
safeOnMount(() => { | ||
if (!isBrowser) | ||
@@ -517,3 +518,3 @@ return; | ||
}); | ||
onDestroy(() => { | ||
safeOnDestroy(() => { | ||
unsubs.forEach((unsub) => unsub()); | ||
@@ -520,0 +521,0 @@ }); |
@@ -1,4 +0,5 @@ | ||
import { addMeltEventListener, builder, createElHelpers, derivedVisible, effect, getPortalDestination, handleFocus, isBrowser, isHTMLElement, kbd, noop, omit, overridable, removeScroll, styleToString, toWritableStores, executeCallbacks, } from '../../internal/helpers/index.js'; | ||
import { addMeltEventListener, builder, createElHelpers, derivedVisible, effect, executeCallbacks, getPortalDestination, handleFocus, isBrowser, isHTMLElement, kbd, noop, omit, overridable, removeScroll, styleToString, toWritableStores, } from '../../internal/helpers/index.js'; | ||
import { usePopper } from '../../internal/actions/index.js'; | ||
import { onMount, tick } from 'svelte'; | ||
import { safeOnMount } from '../../internal/helpers/lifecycle.js'; | ||
import { tick } from 'svelte'; | ||
import { get, writable } from 'svelte/store'; | ||
@@ -32,3 +33,3 @@ import { generateIds } from '../../internal/helpers/id'; | ||
const ids = toWritableStores({ ...generateIds(popoverIdParts), ...withDefaults.ids }); | ||
onMount(() => { | ||
safeOnMount(() => { | ||
activeTrigger.set(document.getElementById(get(ids.trigger))); | ||
@@ -35,0 +36,0 @@ }); |
import { addEventListener, addMeltEventListener, builder, createElHelpers, disabledAttr, effect, executeCallbacks, getDirectionalKeys, getElemDirection, hiddenInputAttrs, isHTMLElement, kbd, omit, overridable, toWritableStores, } from '../../internal/helpers/index.js'; | ||
import { onMount } from 'svelte'; | ||
import { safeOnMount } from '../../internal/helpers/lifecycle.js'; | ||
import { derived, get, writable } from 'svelte/store'; | ||
@@ -24,3 +24,3 @@ const defaults = { | ||
}; | ||
onMount(() => { | ||
safeOnMount(() => { | ||
return addEventListener(document, 'focus', (e) => { | ||
@@ -27,0 +27,0 @@ const focusedItem = e.target; |
import { addMeltEventListener, builder, createElHelpers, executeCallbacks, } from '../../internal/helpers'; | ||
import { dequal } from 'dequal'; | ||
import { onMount } from 'svelte'; | ||
import { derived, get, writable } from 'svelte/store'; | ||
import { safeOnMount } from '../../internal/helpers/lifecycle'; | ||
const defaults = { | ||
@@ -241,3 +241,3 @@ exclude: ['h1'], | ||
} | ||
onMount(() => { | ||
safeOnMount(() => { | ||
elementTarget = document.querySelector(selector); | ||
@@ -244,0 +244,0 @@ if (!elementTarget) |
@@ -62,2 +62,3 @@ import { createFocusTrap, useClickOutside, useEscapeKeydown, useFloating, usePortal, } from '../index.js'; | ||
} | ||
// @ts-expect-error - This works and is correct, but TS doesn't like it | ||
const unsubscribe = executeCallbacks(...callbacks); | ||
@@ -64,0 +65,0 @@ return { |
@@ -1,3 +0,3 @@ | ||
import { onDestroy } from 'svelte'; | ||
import { derived } from 'svelte/store'; | ||
import { safeOnDestroy } from '../lifecycle'; | ||
/** | ||
@@ -28,3 +28,3 @@ * A utility function that creates a derived store that automatically | ||
}); | ||
onDestroy(unsubscribe); | ||
safeOnDestroy(unsubscribe); | ||
const subscribe = (...args) => { | ||
@@ -31,0 +31,0 @@ const unsub = derivedStore.subscribe(...args); |
@@ -1,2 +0,2 @@ | ||
import { onDestroy } from 'svelte'; | ||
import { safeOnDestroy } from '../lifecycle'; | ||
import { derivedWithUnsubscribe } from './derivedWithUnsubscribe'; | ||
@@ -27,4 +27,4 @@ /** | ||
// Automatically unsubscribe the effect when the component is destroyed | ||
onDestroy(unsub); | ||
safeOnDestroy(unsub); | ||
return unsub; | ||
} |
{ | ||
"name": "@melt-ui/svelte", | ||
"version": "0.62.0", | ||
"version": "0.62.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "github:melt-ui/melt-ui", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1012684
444
22901