@react-aria/utils
Advanced tools
Comparing version 3.0.0-nightly.2937 to 3.0.0-nightly.2942
@@ -34,32 +34,39 @@ | ||
} | ||
function $9e20cff0af27e8cc$export$9ac100e40613ea10() { | ||
function $9e20cff0af27e8cc$var$cached(fn) { | ||
let res = null; | ||
return ()=>{ | ||
if (res == null) res = fn(); | ||
return res; | ||
}; | ||
} | ||
const $9e20cff0af27e8cc$export$9ac100e40613ea10 = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$var$testPlatform(/^Mac/i); | ||
} | ||
function $9e20cff0af27e8cc$export$186c6964ca17d99() { | ||
}); | ||
const $9e20cff0af27e8cc$export$186c6964ca17d99 = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$var$testPlatform(/^iPhone/i); | ||
} | ||
function $9e20cff0af27e8cc$export$7bef049ce92e4224() { | ||
}); | ||
const $9e20cff0af27e8cc$export$7bef049ce92e4224 = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support. | ||
$9e20cff0af27e8cc$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1; | ||
} | ||
function $9e20cff0af27e8cc$export$fedb369cb70207f1() { | ||
}); | ||
const $9e20cff0af27e8cc$export$fedb369cb70207f1 = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$export$186c6964ca17d99() || $9e20cff0af27e8cc$export$7bef049ce92e4224(); | ||
} | ||
function $9e20cff0af27e8cc$export$e1865c3bedcd822b() { | ||
}); | ||
const $9e20cff0af27e8cc$export$e1865c3bedcd822b = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$export$9ac100e40613ea10() || $9e20cff0af27e8cc$export$fedb369cb70207f1(); | ||
} | ||
function $9e20cff0af27e8cc$export$78551043582a6a98() { | ||
}); | ||
const $9e20cff0af27e8cc$export$78551043582a6a98 = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$var$testUserAgent(/AppleWebKit/i) && !$9e20cff0af27e8cc$export$6446a186d09e379e(); | ||
} | ||
function $9e20cff0af27e8cc$export$6446a186d09e379e() { | ||
}); | ||
const $9e20cff0af27e8cc$export$6446a186d09e379e = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$var$testUserAgent(/Chrome/i); | ||
} | ||
function $9e20cff0af27e8cc$export$a11b0059900ceec8() { | ||
}); | ||
const $9e20cff0af27e8cc$export$a11b0059900ceec8 = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$var$testUserAgent(/Android/i); | ||
} | ||
function $9e20cff0af27e8cc$export$b7d78993b74f766d() { | ||
}); | ||
const $9e20cff0af27e8cc$export$b7d78993b74f766d = $9e20cff0af27e8cc$var$cached(function() { | ||
return $9e20cff0af27e8cc$var$testUserAgent(/Firefox/i); | ||
} | ||
}); | ||
//# sourceMappingURL=platform.main.js.map |
@@ -20,30 +20,37 @@ /* | ||
} | ||
function $c87311424ea30a05$export$9ac100e40613ea10() { | ||
function $c87311424ea30a05$var$cached(fn) { | ||
let res = null; | ||
return ()=>{ | ||
if (res == null) res = fn(); | ||
return res; | ||
}; | ||
} | ||
const $c87311424ea30a05$export$9ac100e40613ea10 = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$var$testPlatform(/^Mac/i); | ||
} | ||
function $c87311424ea30a05$export$186c6964ca17d99() { | ||
}); | ||
const $c87311424ea30a05$export$186c6964ca17d99 = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$var$testPlatform(/^iPhone/i); | ||
} | ||
function $c87311424ea30a05$export$7bef049ce92e4224() { | ||
}); | ||
const $c87311424ea30a05$export$7bef049ce92e4224 = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support. | ||
$c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1; | ||
} | ||
function $c87311424ea30a05$export$fedb369cb70207f1() { | ||
}); | ||
const $c87311424ea30a05$export$fedb369cb70207f1 = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224(); | ||
} | ||
function $c87311424ea30a05$export$e1865c3bedcd822b() { | ||
}); | ||
const $c87311424ea30a05$export$e1865c3bedcd822b = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1(); | ||
} | ||
function $c87311424ea30a05$export$78551043582a6a98() { | ||
}); | ||
const $c87311424ea30a05$export$78551043582a6a98 = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e(); | ||
} | ||
function $c87311424ea30a05$export$6446a186d09e379e() { | ||
}); | ||
const $c87311424ea30a05$export$6446a186d09e379e = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$var$testUserAgent(/Chrome/i); | ||
} | ||
function $c87311424ea30a05$export$a11b0059900ceec8() { | ||
}); | ||
const $c87311424ea30a05$export$a11b0059900ceec8 = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$var$testUserAgent(/Android/i); | ||
} | ||
function $c87311424ea30a05$export$b7d78993b74f766d() { | ||
}); | ||
const $c87311424ea30a05$export$b7d78993b74f766d = $c87311424ea30a05$var$cached(function() { | ||
return $c87311424ea30a05$var$testUserAgent(/Firefox/i); | ||
} | ||
}); | ||
@@ -50,0 +57,0 @@ |
@@ -69,11 +69,11 @@ import React, { ForwardedRef, MutableRefObject, ReactNode, HTMLAttributes, EffectCallback, RefObject, Dispatch } from "react"; | ||
export function getOffset(element: any, reverse: any, orientation?: string): any; | ||
export function isMac(): boolean; | ||
export function isIPhone(): boolean; | ||
export function isIPad(): boolean; | ||
export function isIOS(): boolean; | ||
export function isAppleDevice(): boolean; | ||
export function isWebKit(): boolean; | ||
export function isChrome(): any; | ||
export function isAndroid(): any; | ||
export function isFirefox(): any; | ||
export const isMac: () => boolean; | ||
export const isIPhone: () => boolean; | ||
export const isIPad: () => boolean; | ||
export const isIOS: () => boolean; | ||
export const isAppleDevice: () => boolean; | ||
export const isWebKit: () => boolean; | ||
export const isChrome: () => boolean; | ||
export const isAndroid: () => boolean; | ||
export const isFirefox: () => boolean; | ||
interface Router { | ||
@@ -178,3 +178,3 @@ isNative: boolean; | ||
export function useEffectEvent<T extends Function>(fn?: T): T; | ||
export function useEvent<K extends keyof GlobalEventHandlersEventMap>(ref: RefObject<EventTarget>, event: K, handler?: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; | ||
export function useEvent<K extends keyof GlobalEventHandlersEventMap>(ref: RefObject<EventTarget>, event: K | (string & {}), handler?: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; | ||
type SetValueAction<S> = (prev: S) => Generator<any, void, unknown>; | ||
@@ -181,0 +181,0 @@ export function useValueEffect<S>(defaultValue: S | (() => S)): [S, Dispatch<SetValueAction<S>>]; |
{ | ||
"name": "@react-aria/utils", | ||
"version": "3.0.0-nightly.2937+02f242f41", | ||
"version": "3.0.0-nightly.2942+8577c4d8b", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,5 +25,5 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/ssr": "3.9.5-nightly.4649+02f242f41", | ||
"@react-stately/utils": "3.0.0-nightly.2937+02f242f41", | ||
"@react-types/shared": "3.0.0-nightly.2937+02f242f41", | ||
"@react-aria/ssr": "3.9.5-nightly.4654+8577c4d8b", | ||
"@react-stately/utils": "3.0.0-nightly.2942+8577c4d8b", | ||
"@react-types/shared": "3.0.0-nightly.2942+8577c4d8b", | ||
"@swc/helpers": "^0.5.0", | ||
@@ -38,3 +38,3 @@ "clsx": "^2.0.0" | ||
}, | ||
"gitHead": "02f242f41f0347b3f11e50b019c197127b7d0a08" | ||
"gitHead": "8577c4d8bed1f37db3c840f230e844fd877d084a" | ||
} |
@@ -29,38 +29,52 @@ /* | ||
export function isMac() { | ||
return testPlatform(/^Mac/i); | ||
function cached(fn: () => boolean) { | ||
if (process.env.NODE_ENV === 'test') { | ||
return fn; | ||
} | ||
let res: boolean | null = null; | ||
return () => { | ||
if (res == null) { | ||
res = fn(); | ||
} | ||
return res; | ||
}; | ||
} | ||
export function isIPhone() { | ||
export const isMac = cached(function () { | ||
return testPlatform(/^Mac/i); | ||
}); | ||
export const isIPhone = cached(function () { | ||
return testPlatform(/^iPhone/i); | ||
} | ||
}); | ||
export function isIPad() { | ||
export const isIPad = cached(function () { | ||
return testPlatform(/^iPad/i) || | ||
// iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support. | ||
(isMac() && navigator.maxTouchPoints > 1); | ||
} | ||
}); | ||
export function isIOS() { | ||
export const isIOS = cached(function () { | ||
return isIPhone() || isIPad(); | ||
} | ||
}); | ||
export function isAppleDevice() { | ||
export const isAppleDevice = cached(function () { | ||
return isMac() || isIOS(); | ||
} | ||
}); | ||
export function isWebKit() { | ||
export const isWebKit = cached(function () { | ||
return testUserAgent(/AppleWebKit/i) && !isChrome(); | ||
} | ||
}); | ||
export function isChrome() { | ||
export const isChrome = cached(function () { | ||
return testUserAgent(/Chrome/i); | ||
} | ||
}); | ||
export function isAndroid() { | ||
export const isAndroid = cached(function () { | ||
return testUserAgent(/Android/i); | ||
} | ||
}); | ||
export function isFirefox() { | ||
export const isFirefox = cached(function () { | ||
return testUserAgent(/Firefox/i); | ||
} | ||
}); |
@@ -18,3 +18,3 @@ /* | ||
ref: RefObject<EventTarget>, | ||
event: K, | ||
event: K | (string & {}), | ||
handler?: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any, | ||
@@ -21,0 +21,0 @@ options?: boolean | AddEventListenerOptions |
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
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
536463
6194