@zag-js/pressable
Advanced tools
Comparing version 0.0.0-dev-20220707125149 to 0.0.0-dev-20220714091855
@@ -1,2 +0,2 @@ | ||
export declare type PressableOptions = { | ||
declare type PressableOptions = { | ||
preventFocusOnPress?: boolean; | ||
@@ -6,2 +6,4 @@ shouldCancelOnPointerExit?: boolean; | ||
}; | ||
export declare function trackPressable(el: HTMLElement | null, options: PressableOptions): () => void; | ||
declare function trackPressable(el: HTMLElement | null, options: PressableOptions): (() => void) | undefined; | ||
export { PressableOptions, trackPressable }; |
@@ -27,15 +27,11 @@ "use strict"; | ||
// ../core/dist/index.mjs | ||
// ../dom/dist/index.mjs | ||
var runIfFn = (v, ...a) => { | ||
const res = typeof v === "function" ? v(...a) : v; | ||
return res != null ? res : void 0; | ||
return res ?? void 0; | ||
}; | ||
var callAll = (...fns) => (...a) => { | ||
fns.forEach(function(fn) { | ||
fn == null ? void 0 : fn(...a); | ||
}); | ||
}; | ||
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop); | ||
// ../dom/src/query.ts | ||
function isDocument(el) { | ||
return el.nodeType === Node.DOCUMENT_NODE; | ||
} | ||
function isWindow(value) { | ||
@@ -45,6 +41,7 @@ return (value == null ? void 0 : value.toString()) === "[object Window]"; | ||
function getDocument(el) { | ||
var _a; | ||
if (isWindow(el)) | ||
return el.document; | ||
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document; | ||
if (isDocument(el)) | ||
return el; | ||
return (el == null ? void 0 : el.ownerDocument) ?? document; | ||
} | ||
@@ -62,4 +59,2 @@ function contains(parent, child) { | ||
}; | ||
// ../dom/src/event.ts | ||
function isVirtualPointerEvent(event) { | ||
@@ -71,4 +66,2 @@ return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse"; | ||
} | ||
// ../dom/src/listener.ts | ||
var isRef = (v) => hasProp(v, "current"); | ||
@@ -83,2 +76,9 @@ 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 | ||
@@ -156,1 +156,5 @@ function trackPressable(el, options) { | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
trackPressable | ||
}); |
{ | ||
"name": "@zag-js/pressable", | ||
"version": "0.0.0-dev-20220707125149", | ||
"version": "0.0.0-dev-20220714091855", | ||
"description": "Handling press interactions across mouse, touch, keyboard, and screen readers.", | ||
@@ -21,10 +21,5 @@ "keywords": [ | ||
], | ||
"scripts": { | ||
"build:fast": "yarn zag build", | ||
"start": "yarn zag build --watch", | ||
"build": "yarn zag build --prod", | ||
"test": "jest --config ../../../jest.config.js --rootDir tests", | ||
"lint": "eslint src --ext .ts,.tsx", | ||
"test:ci": "yarn test --ci --runInBand --updateSnapshot", | ||
"test:watch": "yarn test --watchAll" | ||
"devDependencies": { | ||
"@zag-js/dom-utils": "0.0.0-dev-20220714091855", | ||
"@zag-js/utils": "0.0.0-dev-20220714091855" | ||
}, | ||
@@ -36,3 +31,12 @@ "publishConfig": { | ||
"url": "https://github.com/chakra-ui/zag/issues" | ||
}, | ||
"scripts": { | ||
"build-fast": "tsup src/index.ts --format=esm,cjs", | ||
"start": "pnpm build --watch", | ||
"build": "tsup src/index.ts --format=esm,cjs --dts", | ||
"test": "jest --config ../../../jest.config.js --rootDir tests", | ||
"lint": "eslint src --ext .ts,.tsx", | ||
"test-ci": "pnpm test --ci --runInBand -u", | ||
"test-watch": "pnpm test --watchAll" | ||
} | ||
} | ||
} |
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
11662
6
282
2