@zag-js/interact-outside
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -1,2 +0,2 @@ | ||
declare type InteractOutsideHandlers = { | ||
type InteractOutsideHandlers = { | ||
onPointerDownOutside?: (event: PointerDownOutsideEvent) => void; | ||
@@ -6,6 +6,6 @@ onFocusOutside?: (event: FocusOutsideEvent) => void; | ||
}; | ||
declare type InteractOutsideOptions = InteractOutsideHandlers & { | ||
type InteractOutsideOptions = InteractOutsideHandlers & { | ||
exclude?: (target: HTMLElement) => boolean; | ||
}; | ||
declare type EventDetails<T> = { | ||
type EventDetails<T> = { | ||
originalEvent: T; | ||
@@ -15,7 +15,7 @@ contextmenu: boolean; | ||
}; | ||
declare type PointerDownOutsideEvent = CustomEvent<EventDetails<PointerEvent>>; | ||
declare type FocusOutsideEvent = CustomEvent<EventDetails<FocusEvent>>; | ||
declare type InteractOutsideEvent = PointerDownOutsideEvent | FocusOutsideEvent; | ||
type PointerDownOutsideEvent = CustomEvent<EventDetails<PointerEvent>>; | ||
type FocusOutsideEvent = CustomEvent<EventDetails<FocusEvent>>; | ||
type InteractOutsideEvent = PointerDownOutsideEvent | FocusOutsideEvent; | ||
declare function trackInteractOutside(node: HTMLElement | null, options: InteractOutsideOptions): (() => void) | undefined; | ||
export { FocusOutsideEvent, InteractOutsideEvent, InteractOutsideHandlers, InteractOutsideOptions, PointerDownOutsideEvent, trackInteractOutside }; |
@@ -27,3 +27,3 @@ "use strict"; | ||
// ../dom/dist/index.mjs | ||
// ../core/src/functions.ts | ||
var runIfFn = (v, ...a) => { | ||
@@ -33,3 +33,12 @@ const res = typeof v === "function" ? v(...a) : v; | ||
}; | ||
var callAll = (...fns) => (...a) => { | ||
fns.forEach(function(fn) { | ||
fn == null ? void 0 : fn(...a); | ||
}); | ||
}; | ||
// ../core/src/guard.ts | ||
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop); | ||
// ../dom/src/platform.ts | ||
var isDom = () => typeof window !== "undefined"; | ||
@@ -44,2 +53,4 @@ function getPlatform() { | ||
var isMac = () => pt(/^Mac/) && !isTouchDevice; | ||
// ../dom/src/query.ts | ||
function isDocument(el) { | ||
@@ -80,2 +91,4 @@ return el.nodeType === Node.DOCUMENT_NODE; | ||
} | ||
// ../dom/src/event.ts | ||
var isContextMenuEvent = (e) => { | ||
@@ -85,2 +98,4 @@ return e.button === 2 || isCtrlKey(e) && e.button === 0; | ||
var isCtrlKey = (v) => isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey; | ||
// ../dom/src/fire-event.ts | ||
function fireCustomEvent(el, type, init) { | ||
@@ -93,2 +108,4 @@ if (!el) | ||
} | ||
// ../dom/src/focusable.ts | ||
var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type"; | ||
@@ -100,2 +117,4 @@ function isFocusable(element) { | ||
} | ||
// ../dom/src/listener.ts | ||
var isRef = (v) => hasProp(v, "current"); | ||
@@ -110,9 +129,2 @@ function addDomEvent(target, eventName, handler, options) { | ||
// ../core/dist/index.mjs | ||
var callAll = (...fns) => (...a) => { | ||
fns.forEach(function(fn) { | ||
fn == null ? void 0 : fn(...a); | ||
}); | ||
}; | ||
// src/index.ts | ||
@@ -119,0 +131,0 @@ var POINTER_OUTSIDE_EVENT = "pointerdown.outside"; |
{ | ||
"name": "@zag-js/interact-outside", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Track interations or focus outside an element", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"keywords": [ | ||
@@ -22,4 +19,5 @@ "js", | ||
"devDependencies": { | ||
"@zag-js/dom-utils": "0.2.0", | ||
"@zag-js/utils": "0.2.0" | ||
"clean-package": "2.2.0", | ||
"@zag-js/dom-utils": "0.2.2", | ||
"@zag-js/utils": "0.3.2" | ||
}, | ||
@@ -32,6 +30,18 @@ "publishConfig": { | ||
}, | ||
"clean-package": "../../../clean-package.config.json", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"scripts": { | ||
"build-fast": "tsup src/index.ts --format=esm,cjs", | ||
"build-fast": "tsup src", | ||
"start": "pnpm build --watch", | ||
"build": "tsup src/index.ts --format=esm,cjs --dts", | ||
"build": "tsup src --dts", | ||
"test": "jest --config ../../../jest.config.js --rootDir tests", | ||
@@ -38,0 +48,0 @@ "lint": "eslint src --ext .ts,.tsx", |
Sorry, the diff of this file is not supported yet
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
16280
381
3