//#region src/event-utils.d.ts /** * Event utilities for common event handling patterns * * These utilities are tree-shakeable - only import what you use. * * @example * import { getTargetValue, getDataId, stopEvent } from "@luna_ui/luna/event-utils"; * * on=events().input(fn(e) { * const value = getTargetValue(e); * setValue(value); * }) */ /** * Get value from input/textarea/select element */ declare function getTargetValue(e: Event): string; /** * Get checked state from checkbox/radio input */ declare function getTargetChecked(e: Event): boolean; /** * Get selected index from select element */ declare function getSelectedIndex(e: Event): number; /** * Get client position (relative to viewport) from mouse/pointer/touch event */ declare function getClientPos(e: MouseEvent | PointerEvent | TouchEvent): { x: number; y: number; }; /** * Get offset position (relative to target element) from mouse/pointer event */ declare function getOffsetPos(e: MouseEvent | PointerEvent): { x: number; y: number; }; /** * Get page position (relative to document) from mouse/pointer/touch event */ declare function getPagePos(e: MouseEvent | PointerEvent | TouchEvent): { x: number; y: number; }; /** * Get movement delta from mouse/pointer event */ declare function getMovement(e: MouseEvent | PointerEvent): { dx: number; dy: number; }; /** * Get data attribute from event target or closest ancestor */ declare function getDataAttr(e: Event, key: string): string | null; /** * Get data-id from closest ancestor (common pattern for list items) */ declare function getDataId(e: Event): string | null; /** * Get all data attributes from event target as object */ declare function getDataset(e: Event): DOMStringMap; /** * Check if event target matches a CSS selector */ declare function matchesSelector(e: Event, selector: string): boolean; /** * Get closest ancestor matching selector from event target */ declare function getClosest(e: Event, selector: string): T | null; /** * Prevent default behavior */ declare function preventDefault(e: Event): void; /** * Stop event propagation */ declare function stopPropagation(e: Event): void; /** * Prevent default and stop propagation (convenience) */ declare function stopEvent(e: Event): void; /** * Check if IME is composing (for input/keyboard events) * Use this to avoid handling partial IME input */ declare function isComposing(e: Event): boolean; /** * Check if modifier key is pressed */ declare function hasModifier(e: KeyboardEvent | MouseEvent, modifier: "ctrl" | "alt" | "shift" | "meta"): boolean; /** * Check if Cmd (Mac) or Ctrl (Windows/Linux) is pressed */ declare function hasCmdOrCtrl(e: KeyboardEvent | MouseEvent): boolean; /** * Get keyboard key with normalized names */ declare function getKey(e: KeyboardEvent): string; /** * Check if Enter key was pressed (outside IME composition) */ declare function isEnterKey(e: KeyboardEvent): boolean; /** * Check if Escape key was pressed */ declare function isEscapeKey(e: KeyboardEvent): boolean; /** * Get wheel delta (normalized across browsers) */ declare function getWheelDelta(e: WheelEvent): { deltaX: number; deltaY: number; deltaZ: number; }; /** * Get which mouse button was pressed * 0 = primary (left), 1 = auxiliary (middle), 2 = secondary (right) */ declare function getButton(e: MouseEvent): number; /** * Check if primary (left) mouse button was pressed */ declare function isPrimaryButton(e: MouseEvent): boolean; /** * Check if secondary (right) mouse button was pressed */ declare function isSecondaryButton(e: MouseEvent): boolean; /** * Get files from drag event */ declare function getDroppedFiles(e: DragEvent): FileList | null; /** * Get text data from drag/clipboard event */ declare function getTextData(e: DragEvent | ClipboardEvent): string; //#endregion export { isSecondaryButton as C, stopPropagation as D, stopEvent as E, isPrimaryButton as S, preventDefault as T, hasCmdOrCtrl as _, getDataId as a, isEnterKey as b, getKey as c, getPagePos as d, getSelectedIndex as f, getWheelDelta as g, getTextData as h, getDataAttr as i, getMovement as l, getTargetValue as m, getClientPos as n, getDataset as o, getTargetChecked as p, getClosest as r, getDroppedFiles as s, getButton as t, getOffsetPos as u, hasModifier as v, matchesSelector as w, isEscapeKey as x, isComposing as y };