@zag-js/utils
Advanced tools
Comparing version 0.0.0-dev-20220510084727 to 0.0.0-dev-20220603082742
@@ -17,2 +17,3 @@ export declare const isDev: () => boolean; | ||
export declare const isFunction: (v: any) => v is Function; | ||
export declare const hasProp: <T extends string>(obj: any, prop: T) => obj is Record<T, any>; | ||
export declare const supportsPointerEvent: () => boolean; | ||
@@ -23,6 +24,10 @@ export declare const supportsTouchEvent: () => boolean; | ||
export declare const isTouchEvent: (v: any) => v is TouchEvent; | ||
export declare const isLeftClick: (v: MouseEvent | PointerEvent) => boolean; | ||
export declare const isRightClick: (v: MouseEvent | PointerEvent) => boolean; | ||
export declare const isLeftClick: (v: { | ||
button: number; | ||
}) => boolean; | ||
export declare const isRightClick: (v: { | ||
button: number; | ||
}) => boolean; | ||
export declare const isModifiedEvent: (v: Pick<KeyboardEvent, "ctrlKey" | "metaKey" | "altKey">) => boolean; | ||
export declare const isCtrlKey: (v: KeyboardEvent) => boolean; | ||
export declare const isCtrlKey: (v: Pick<KeyboardEvent, "ctrlKey" | "metaKey">) => boolean; | ||
//# sourceMappingURL=guard.d.ts.map |
@@ -30,2 +30,3 @@ var __defProp = Object.defineProperty; | ||
has: () => has, | ||
hasProp: () => hasProp, | ||
invariant: () => invariant, | ||
@@ -175,3 +176,3 @@ isApple: () => isApple, | ||
var isDev = () => void 0 !== "production"; | ||
var isDom = () => !!(typeof window !== "undefined"); | ||
var isDom = () => typeof window !== "undefined"; | ||
var isMac = () => platform(/^Mac/); | ||
@@ -191,7 +192,8 @@ var isIPhone = () => platform(/^iPhone/); | ||
var isFunction = (v) => typeof v === "function"; | ||
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop); | ||
var supportsPointerEvent = () => isDom() && window.onpointerdown === null; | ||
var supportsTouchEvent = () => isDom() && window.ontouchstart === null; | ||
var supportsMouseEvent = () => isDom() && window.onmousedown === null; | ||
var isMouseEvent = (v) => isObject(v) && "button" in v; | ||
var isTouchEvent = (v) => isObject(v) && "touches" in v; | ||
var isMouseEvent = (v) => isObject(v) && hasProp(v, "button"); | ||
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches"); | ||
var isLeftClick = (v) => v.button === 0; | ||
@@ -198,0 +200,0 @@ var isRightClick = (v) => v.button === 2; |
{ | ||
"name": "@zag-js/utils", | ||
"version": "0.0.0-dev-20220510084727", | ||
"version": "0.0.0-dev-20220603082742", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
40574
466