New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/utils

Package Overview
Dependencies
Maintainers
0
Versions
925
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/utils - npm Package Compare versions

Comparing version 3.0.0-nightly-c78b24831-250206 to 3.0.0-nightly-c8fdba56e-250225

2

dist/constants.main.js

@@ -8,3 +8,2 @@

$parcel$export(module.exports, "FOCUS_EVENT", () => $a0850d0add29d276$export$831c820ad60f9d12);
$parcel$export(module.exports, "UPDATE_ACTIVEDESCENDANT", () => $a0850d0add29d276$export$9db568f6321ad9dc);
/*

@@ -23,5 +22,4 @@ * Copyright 2024 Adobe. All rights reserved.

const $a0850d0add29d276$export$831c820ad60f9d12 = 'react-aria-focus';
const $a0850d0add29d276$export$9db568f6321ad9dc = 'react-aria-update-activedescendant';
//# sourceMappingURL=constants.main.js.map

3

dist/constants.module.js

@@ -14,6 +14,5 @@ /*

const $5671b20cf9b562b2$export$831c820ad60f9d12 = 'react-aria-focus';
const $5671b20cf9b562b2$export$9db568f6321ad9dc = 'react-aria-update-activedescendant';
export {$5671b20cf9b562b2$export$447a38995de2c711 as CLEAR_FOCUS_EVENT, $5671b20cf9b562b2$export$831c820ad60f9d12 as FOCUS_EVENT, $5671b20cf9b562b2$export$9db568f6321ad9dc as UPDATE_ACTIVEDESCENDANT};
export {$5671b20cf9b562b2$export$447a38995de2c711 as CLEAR_FOCUS_EVENT, $5671b20cf9b562b2$export$831c820ad60f9d12 as FOCUS_EVENT};
//# sourceMappingURL=constants.module.js.map

@@ -111,3 +111,2 @@ var $8c61827343eed941$exports = require("./useId.main.js");

$parcel$export(module.exports, "FOCUS_EVENT", () => $a0850d0add29d276$exports.FOCUS_EVENT);
$parcel$export(module.exports, "UPDATE_ACTIVEDESCENDANT", () => $a0850d0add29d276$exports.UPDATE_ACTIVEDESCENDANT);
$parcel$export(module.exports, "isCtrlKeyPressed", () => $2308dc377e184bb0$exports.isCtrlKeyPressed);

@@ -114,0 +113,0 @@ $parcel$export(module.exports, "useEnterAnimation", () => $5bd06107f98811f5$exports.useEnterAnimation);

@@ -29,8 +29,8 @@ var $1e2191638e54f613$exports = require("./chain.main.js");

function $f847cd1382ea7cd4$export$9d1611c77c2fe928(...args) {
// Start with a base clone of the last argument. This is a lot faster than starting
// Start with a base clone of the first argument. This is a lot faster than starting
// with an empty object and adding properties as we go.
let result = {
...args[args.length - 1]
...args[0]
};
for(let i = args.length - 2; i >= 0; i--){
for(let i = 1; i < args.length; i++){
let props = args[i];

@@ -42,6 +42,6 @@ for(let key in props){

if (typeof a === 'function' && typeof b === 'function' && // This is a lot faster than a regex.
key[0] === 'o' && key[1] === 'n' && key.charCodeAt(2) >= /* 'A' */ 65 && key.charCodeAt(2) <= /* 'Z' */ 90) result[key] = (0, $1e2191638e54f613$exports.chain)(b, a);
else if ((key === 'className' || key === 'UNSAFE_className') && typeof a === 'string' && typeof b === 'string') result[key] = (0, ($parcel$interopDefault($eVrjB$clsx)))(b, a);
else if (key === 'id' && a && b) result.id = (0, $8c61827343eed941$exports.mergeIds)(b, a);
else if (a === undefined) result[key] = b;
key[0] === 'o' && key[1] === 'n' && key.charCodeAt(2) >= /* 'A' */ 65 && key.charCodeAt(2) <= /* 'Z' */ 90) result[key] = (0, $1e2191638e54f613$exports.chain)(a, b);
else if ((key === 'className' || key === 'UNSAFE_className') && typeof a === 'string' && typeof b === 'string') result[key] = (0, ($parcel$interopDefault($eVrjB$clsx)))(a, b);
else if (key === 'id' && a && b) result.id = (0, $8c61827343eed941$exports.mergeIds)(a, b);
else result[key] = b !== undefined ? b : a;
}

@@ -48,0 +48,0 @@ }

@@ -19,8 +19,8 @@ import {chain as $ff5963eb1fccf552$export$e08e3b67e392101e} from "./chain.module.js";

function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
// Start with a base clone of the last argument. This is a lot faster than starting
// Start with a base clone of the first argument. This is a lot faster than starting
// with an empty object and adding properties as we go.
let result = {
...args[args.length - 1]
...args[0]
};
for(let i = args.length - 2; i >= 0; i--){
for(let i = 1; i < args.length; i++){
let props = args[i];

@@ -32,6 +32,6 @@ for(let key in props){

if (typeof a === 'function' && typeof b === 'function' && // This is a lot faster than a regex.
key[0] === 'o' && key[1] === 'n' && key.charCodeAt(2) >= /* 'A' */ 65 && key.charCodeAt(2) <= /* 'Z' */ 90) result[key] = (0, $ff5963eb1fccf552$export$e08e3b67e392101e)(b, a);
else if ((key === 'className' || key === 'UNSAFE_className') && typeof a === 'string' && typeof b === 'string') result[key] = (0, $7jXr9$clsx)(b, a);
else if (key === 'id' && a && b) result.id = (0, $bdb11010cef70236$export$cd8c9cb68f842629)(b, a);
else if (a === undefined) result[key] = b;
key[0] === 'o' && key[1] === 'n' && key.charCodeAt(2) >= /* 'A' */ 65 && key.charCodeAt(2) <= /* 'Z' */ 90) result[key] = (0, $ff5963eb1fccf552$export$e08e3b67e392101e)(a, b);
else if ((key === 'className' || key === 'UNSAFE_className') && typeof a === 'string' && typeof b === 'string') result[key] = (0, $7jXr9$clsx)(a, b);
else if (key === 'id' && a && b) result.id = (0, $bdb11010cef70236$export$cd8c9cb68f842629)(a, b);
else result[key] = b !== undefined ? b : a;
}

@@ -38,0 +38,0 @@ }

@@ -37,3 +37,3 @@ import {mergeIds as $bdb11010cef70236$export$cd8c9cb68f842629, useId as $bdb11010cef70236$export$f680877a34711e37, useSlotId as $bdb11010cef70236$export$b4cc09c592e8fdb8} from "./useId.module.js";

import {inertValue as $cdc5a6778b766db2$export$a9d04c5684123369} from "./inertValue.module.js";
import {CLEAR_FOCUS_EVENT as $5671b20cf9b562b2$export$447a38995de2c711, FOCUS_EVENT as $5671b20cf9b562b2$export$831c820ad60f9d12, UPDATE_ACTIVEDESCENDANT as $5671b20cf9b562b2$export$9db568f6321ad9dc} from "./constants.module.js";
import {CLEAR_FOCUS_EVENT as $5671b20cf9b562b2$export$447a38995de2c711, FOCUS_EVENT as $5671b20cf9b562b2$export$831c820ad60f9d12} from "./constants.module.js";
import {isCtrlKeyPressed as $21f1aa98acb08317$export$16792effe837dba3} from "./keyboard.module.js";

@@ -97,3 +97,3 @@ import {useEnterAnimation as $d3f049242431219c$export$6d3443f2c48bfc20, useExitAnimation as $d3f049242431219c$export$45fda7c47f93fd48} from "./animation.module.js";

export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId, $ff5963eb1fccf552$export$e08e3b67e392101e as chain, $dfc540311bf7f109$export$4d0f8be8b12a7ef6 as createShadowTreeWalker, $dfc540311bf7f109$export$63eb3ababa9c55c4 as ShadowTreeWalker, $d4ee10de306f2510$export$cd4e5573fbe2b576 as getActiveElement, $d4ee10de306f2510$export$e58f029f0fbfdb29 as getEventTarget, $d4ee10de306f2510$export$4282f70798064fe0 as nodeContains, $431fbd86ca7dc216$export$b204af158042fbac as getOwnerDocument, $431fbd86ca7dc216$export$f21a1ffae260145a as getOwnerWindow, $431fbd86ca7dc216$export$af51f0f06c0f328a as isShadowRoot, $3ef42575df84b30b$export$9d1611c77c2fe928 as mergeProps, $5dc95899b306f630$export$c9058316764c140e as mergeRefs, $65484d02dcb7eb3e$export$457c3d6518dd4c6f as filterDOMProps, $7215afc6de606d6b$export$de79e2c695e052f3 as focusWithoutScrolling, $ab71dadb03a6fb2e$export$622cea445a1c5b7d as getOffset, $ea8dcbcb9ea1b556$export$95185d699e05d4d7 as openLink, $ea8dcbcb9ea1b556$export$51437d503373d223 as getSyntheticLinkProps, $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6 as useSyntheticLinkProps, $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb as RouterProvider, $ea8dcbcb9ea1b556$export$efa8c9099e530235 as shouldClientNavigate, $ea8dcbcb9ea1b556$export$9a302a45f65d0572 as useRouter, $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 as useLinkProps, $bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition, $9cc09df9fd7676be$export$7bbed75feba39706 as useDrag1D, $03deb23ff14920c4$export$4eaf04e54aa8eed6 as useGlobalListeners, $313b98861ee5dd6c$export$d6875122194c7b44 as useLabels, $df56164dff5785e2$export$4338b53315abf666 as useObjectRef, $4f58c5f72bcf79f7$export$496315a1608d9602 as useUpdateEffect, $ca9b37712f007381$export$72ef708ab07251f1 as useUpdateLayoutEffect, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as useLayoutEffect, $9daab02d461809db$export$683480f191c0e3ea as useResizeObserver, $e7801be82b4b2a53$export$4debdb1a3f0fa79e as useSyncRef, $62d8ded9296f3872$export$cfa2225e87938781 as getScrollParent, $a40c673dc9f6d9c7$export$94ed1c92c7beeb22 as getScrollParents, $cc38e7bd3fc7b213$export$2bb74740c4e19def as isScrollable, $5df64b3807dc15ee$export$d699905dd57c73ca as useViewportSize, $ef06256079686ba0$export$f8aeda7b10753fa1 as useDescription, $c87311424ea30a05$export$9ac100e40613ea10 as isMac, $c87311424ea30a05$export$186c6964ca17d99 as isIPhone, $c87311424ea30a05$export$7bef049ce92e4224 as isIPad, $c87311424ea30a05$export$fedb369cb70207f1 as isIOS, $c87311424ea30a05$export$e1865c3bedcd822b as isAppleDevice, $c87311424ea30a05$export$78551043582a6a98 as isWebKit, $c87311424ea30a05$export$6446a186d09e379e as isChrome, $c87311424ea30a05$export$a11b0059900ceec8 as isAndroid, $c87311424ea30a05$export$b7d78993b74f766d as isFirefox, $e9faafb641e167db$export$90fc3a17d93f704c as useEvent, $1dbecbe27a04f9af$export$14d238f342723f25 as useValueEffect, $2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport, $4507461a1b870123$re_export$clamp as clamp, $4507461a1b870123$re_export$snapValueToStep as snapValueToStep, $6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent, $8ae05eaa5c114e9c$export$7f54fc3180508a52 as useEffectEvent, $5a387cc49350e6db$export$722debc0e56fea39 as useDeepMemo, $99facab73266f662$export$5add1d006293d136 as useFormReset, $26f7f3da73fcd9d6$export$7717c92ee915373e as useLoadMore, $cdc5a6778b766db2$export$a9d04c5684123369 as inertValue, $5671b20cf9b562b2$export$447a38995de2c711 as CLEAR_FOCUS_EVENT, $5671b20cf9b562b2$export$831c820ad60f9d12 as FOCUS_EVENT, $5671b20cf9b562b2$export$9db568f6321ad9dc as UPDATE_ACTIVEDESCENDANT, $21f1aa98acb08317$export$16792effe837dba3 as isCtrlKeyPressed, $d3f049242431219c$export$6d3443f2c48bfc20 as useEnterAnimation, $d3f049242431219c$export$45fda7c47f93fd48 as useExitAnimation, $b4b717babfbb907b$export$4c063cf1350e6fed as isFocusable, $b4b717babfbb907b$export$bebd5a1431fec25d as isTabbable};
export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId, $ff5963eb1fccf552$export$e08e3b67e392101e as chain, $dfc540311bf7f109$export$4d0f8be8b12a7ef6 as createShadowTreeWalker, $dfc540311bf7f109$export$63eb3ababa9c55c4 as ShadowTreeWalker, $d4ee10de306f2510$export$cd4e5573fbe2b576 as getActiveElement, $d4ee10de306f2510$export$e58f029f0fbfdb29 as getEventTarget, $d4ee10de306f2510$export$4282f70798064fe0 as nodeContains, $431fbd86ca7dc216$export$b204af158042fbac as getOwnerDocument, $431fbd86ca7dc216$export$f21a1ffae260145a as getOwnerWindow, $431fbd86ca7dc216$export$af51f0f06c0f328a as isShadowRoot, $3ef42575df84b30b$export$9d1611c77c2fe928 as mergeProps, $5dc95899b306f630$export$c9058316764c140e as mergeRefs, $65484d02dcb7eb3e$export$457c3d6518dd4c6f as filterDOMProps, $7215afc6de606d6b$export$de79e2c695e052f3 as focusWithoutScrolling, $ab71dadb03a6fb2e$export$622cea445a1c5b7d as getOffset, $ea8dcbcb9ea1b556$export$95185d699e05d4d7 as openLink, $ea8dcbcb9ea1b556$export$51437d503373d223 as getSyntheticLinkProps, $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6 as useSyntheticLinkProps, $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb as RouterProvider, $ea8dcbcb9ea1b556$export$efa8c9099e530235 as shouldClientNavigate, $ea8dcbcb9ea1b556$export$9a302a45f65d0572 as useRouter, $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 as useLinkProps, $bbed8b41f857bcc0$export$24490316f764c430 as runAfterTransition, $9cc09df9fd7676be$export$7bbed75feba39706 as useDrag1D, $03deb23ff14920c4$export$4eaf04e54aa8eed6 as useGlobalListeners, $313b98861ee5dd6c$export$d6875122194c7b44 as useLabels, $df56164dff5785e2$export$4338b53315abf666 as useObjectRef, $4f58c5f72bcf79f7$export$496315a1608d9602 as useUpdateEffect, $ca9b37712f007381$export$72ef708ab07251f1 as useUpdateLayoutEffect, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as useLayoutEffect, $9daab02d461809db$export$683480f191c0e3ea as useResizeObserver, $e7801be82b4b2a53$export$4debdb1a3f0fa79e as useSyncRef, $62d8ded9296f3872$export$cfa2225e87938781 as getScrollParent, $a40c673dc9f6d9c7$export$94ed1c92c7beeb22 as getScrollParents, $cc38e7bd3fc7b213$export$2bb74740c4e19def as isScrollable, $5df64b3807dc15ee$export$d699905dd57c73ca as useViewportSize, $ef06256079686ba0$export$f8aeda7b10753fa1 as useDescription, $c87311424ea30a05$export$9ac100e40613ea10 as isMac, $c87311424ea30a05$export$186c6964ca17d99 as isIPhone, $c87311424ea30a05$export$7bef049ce92e4224 as isIPad, $c87311424ea30a05$export$fedb369cb70207f1 as isIOS, $c87311424ea30a05$export$e1865c3bedcd822b as isAppleDevice, $c87311424ea30a05$export$78551043582a6a98 as isWebKit, $c87311424ea30a05$export$6446a186d09e379e as isChrome, $c87311424ea30a05$export$a11b0059900ceec8 as isAndroid, $c87311424ea30a05$export$b7d78993b74f766d as isFirefox, $e9faafb641e167db$export$90fc3a17d93f704c as useEvent, $1dbecbe27a04f9af$export$14d238f342723f25 as useValueEffect, $2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport, $4507461a1b870123$re_export$clamp as clamp, $4507461a1b870123$re_export$snapValueToStep as snapValueToStep, $6a7db85432448f7f$export$60278871457622de as isVirtualClick, $6a7db85432448f7f$export$29bf1b5f2c56cf63 as isVirtualPointerEvent, $8ae05eaa5c114e9c$export$7f54fc3180508a52 as useEffectEvent, $5a387cc49350e6db$export$722debc0e56fea39 as useDeepMemo, $99facab73266f662$export$5add1d006293d136 as useFormReset, $26f7f3da73fcd9d6$export$7717c92ee915373e as useLoadMore, $cdc5a6778b766db2$export$a9d04c5684123369 as inertValue, $5671b20cf9b562b2$export$447a38995de2c711 as CLEAR_FOCUS_EVENT, $5671b20cf9b562b2$export$831c820ad60f9d12 as FOCUS_EVENT, $21f1aa98acb08317$export$16792effe837dba3 as isCtrlKeyPressed, $d3f049242431219c$export$6d3443f2c48bfc20 as useEnterAnimation, $d3f049242431219c$export$45fda7c47f93fd48 as useExitAnimation, $b4b717babfbb907b$export$4c063cf1350e6fed as isFocusable, $b4b717babfbb907b$export$bebd5a1431fec25d as isTabbable};
//# sourceMappingURL=module.js.map

@@ -278,3 +278,2 @@ import React, { ForwardedRef, MutableRefObject, ReactNode, HTMLAttributes, EffectCallback, Dispatch, RefObject as _RefObject1 } from "react";

export const FOCUS_EVENT = "react-aria-focus";
export const UPDATE_ACTIVEDESCENDANT = "react-aria-update-activedescendant";
interface Event {

@@ -281,0 +280,0 @@ altKey: boolean;

@@ -30,3 +30,9 @@ var $78605a5d7424e31b$exports = require("./useLayoutEffect.main.js");

let $8c61827343eed941$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
let $8c61827343eed941$var$idsUpdaterMap = new Map();
let $8c61827343eed941$export$d41a04c74483c6ef = new Map();
// This allows us to clean up the idsUpdaterMap when the id is no longer used.
// Map is a strong reference, so unused ids wouldn't be cleaned up otherwise.
// This can happen in suspended components where mount/unmount is not called.
let $8c61827343eed941$var$registry = new FinalizationRegistry((heldValue)=>{
$8c61827343eed941$export$d41a04c74483c6ef.delete(heldValue);
});
function $8c61827343eed941$export$f680877a34711e37(defaultId) {

@@ -36,14 +42,10 @@ let [value, setValue] = (0, $dG5aF$react.useState)(defaultId);

let res = (0, $dG5aF$reactariassr.useSSRSafeId)(value);
let updateValue = (0, $dG5aF$react.useCallback)((val)=>{
nextId.current = val;
}, []);
let cleanupRef = (0, $dG5aF$react.useRef)(null);
$8c61827343eed941$var$registry.register(cleanupRef, res);
if ($8c61827343eed941$var$canUseDOM) {
// TS not smart enough to know that `has` means the value exists
if ($8c61827343eed941$var$idsUpdaterMap.has(res) && !$8c61827343eed941$var$idsUpdaterMap.get(res).includes(updateValue)) $8c61827343eed941$var$idsUpdaterMap.set(res, [
...$8c61827343eed941$var$idsUpdaterMap.get(res),
updateValue
const cacheIdRef = $8c61827343eed941$export$d41a04c74483c6ef.get(res);
if (cacheIdRef && !cacheIdRef.includes(nextId)) cacheIdRef.push(nextId);
else $8c61827343eed941$export$d41a04c74483c6ef.set(res, [
nextId
]);
else $8c61827343eed941$var$idsUpdaterMap.set(res, [
updateValue
]);
}

@@ -53,3 +55,6 @@ (0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{

return ()=>{
$8c61827343eed941$var$idsUpdaterMap.delete(r);
// In Suspense, the cleanup function may be not called
// when it is though, also remove it from the finalization registry.
$8c61827343eed941$var$registry.unregister(cleanupRef);
$8c61827343eed941$export$d41a04c74483c6ef.delete(r);
};

@@ -72,10 +77,10 @@ }, [

if (idA === idB) return idA;
let setIdsA = $8c61827343eed941$var$idsUpdaterMap.get(idA);
let setIdsA = $8c61827343eed941$export$d41a04c74483c6ef.get(idA);
if (setIdsA) {
setIdsA.forEach((fn)=>fn(idB));
setIdsA.forEach((ref)=>ref.current = idB);
return idB;
}
let setIdsB = $8c61827343eed941$var$idsUpdaterMap.get(idB);
let setIdsB = $8c61827343eed941$export$d41a04c74483c6ef.get(idB);
if (setIdsB) {
setIdsB.forEach((fn)=>fn(idA));
setIdsB.forEach((ref)=>ref.current = idA);
return idA;

@@ -82,0 +87,0 @@ }

import {useLayoutEffect as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c} from "./useLayoutEffect.module.js";
import {useValueEffect as $1dbecbe27a04f9af$export$14d238f342723f25} from "./useValueEffect.module.js";
import {useState as $eKkEp$useState, useRef as $eKkEp$useRef, useCallback as $eKkEp$useCallback, useEffect as $eKkEp$useEffect} from "react";
import {useState as $eKkEp$useState, useRef as $eKkEp$useRef, useEffect as $eKkEp$useEffect, useCallback as $eKkEp$useCallback} from "react";
import {useSSRSafeId as $eKkEp$useSSRSafeId} from "@react-aria/ssr";

@@ -22,3 +22,9 @@

let $bdb11010cef70236$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
let $bdb11010cef70236$var$idsUpdaterMap = new Map();
let $bdb11010cef70236$export$d41a04c74483c6ef = new Map();
// This allows us to clean up the idsUpdaterMap when the id is no longer used.
// Map is a strong reference, so unused ids wouldn't be cleaned up otherwise.
// This can happen in suspended components where mount/unmount is not called.
let $bdb11010cef70236$var$registry = new FinalizationRegistry((heldValue)=>{
$bdb11010cef70236$export$d41a04c74483c6ef.delete(heldValue);
});
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {

@@ -28,14 +34,10 @@ let [value, setValue] = (0, $eKkEp$useState)(defaultId);

let res = (0, $eKkEp$useSSRSafeId)(value);
let updateValue = (0, $eKkEp$useCallback)((val)=>{
nextId.current = val;
}, []);
let cleanupRef = (0, $eKkEp$useRef)(null);
$bdb11010cef70236$var$registry.register(cleanupRef, res);
if ($bdb11010cef70236$var$canUseDOM) {
// TS not smart enough to know that `has` means the value exists
if ($bdb11010cef70236$var$idsUpdaterMap.has(res) && !$bdb11010cef70236$var$idsUpdaterMap.get(res).includes(updateValue)) $bdb11010cef70236$var$idsUpdaterMap.set(res, [
...$bdb11010cef70236$var$idsUpdaterMap.get(res),
updateValue
const cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef.get(res);
if (cacheIdRef && !cacheIdRef.includes(nextId)) cacheIdRef.push(nextId);
else $bdb11010cef70236$export$d41a04c74483c6ef.set(res, [
nextId
]);
else $bdb11010cef70236$var$idsUpdaterMap.set(res, [
updateValue
]);
}

@@ -45,3 +47,6 @@ (0, $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c)(()=>{

return ()=>{
$bdb11010cef70236$var$idsUpdaterMap.delete(r);
// In Suspense, the cleanup function may be not called
// when it is though, also remove it from the finalization registry.
$bdb11010cef70236$var$registry.unregister(cleanupRef);
$bdb11010cef70236$export$d41a04c74483c6ef.delete(r);
};

@@ -64,10 +69,10 @@ }, [

if (idA === idB) return idA;
let setIdsA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef.get(idA);
if (setIdsA) {
setIdsA.forEach((fn)=>fn(idB));
setIdsA.forEach((ref)=>ref.current = idB);
return idB;
}
let setIdsB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef.get(idB);
if (setIdsB) {
setIdsB.forEach((fn)=>fn(idA));
setIdsB.forEach((ref)=>ref.current = idA);
return idA;

@@ -98,3 +103,3 @@ }

export {$bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId};
export {$bdb11010cef70236$export$d41a04c74483c6ef as idsUpdaterMap, $bdb11010cef70236$export$f680877a34711e37 as useId, $bdb11010cef70236$export$cd8c9cb68f842629 as mergeIds, $bdb11010cef70236$export$b4cc09c592e8fdb8 as useSlotId};
//# sourceMappingURL=useId.module.js.map
{
"name": "@react-aria/utils",
"version": "3.0.0-nightly-c78b24831-250206",
"version": "3.0.0-nightly-c8fdba56e-250225",
"description": "Spectrum UI components in React",

@@ -25,6 +25,6 @@ "license": "Apache-2.0",

"dependencies": {
"@react-aria/ssr": "3.0.0-nightly-c78b24831-250206",
"@react-stately/flags": "3.0.0-nightly-c78b24831-250206",
"@react-stately/utils": "3.0.0-nightly-c78b24831-250206",
"@react-types/shared": "3.0.0-nightly-c78b24831-250206",
"@react-aria/ssr": "3.0.0-nightly-c8fdba56e-250225",
"@react-stately/flags": "3.0.0-nightly-c8fdba56e-250225",
"@react-stately/utils": "3.0.0-nightly-c8fdba56e-250225",
"@react-types/shared": "3.0.0-nightly-c8fdba56e-250225",
"@swc/helpers": "^0.5.0",

@@ -31,0 +31,0 @@ "clsx": "^2.0.0"

@@ -16,2 +16,1 @@ /*

export const FOCUS_EVENT = 'react-aria-focus';
export const UPDATE_ACTIVEDESCENDANT = 'react-aria-update-activedescendant';

@@ -49,5 +49,5 @@ /*

export {inertValue} from './inertValue';
export {CLEAR_FOCUS_EVENT, FOCUS_EVENT, UPDATE_ACTIVEDESCENDANT} from './constants';
export {CLEAR_FOCUS_EVENT, FOCUS_EVENT} from './constants';
export {isCtrlKeyPressed} from './keyboard';
export {useEnterAnimation, useExitAnimation} from './animation';
export {isFocusable, isTabbable} from './isFocusable';

@@ -26,3 +26,3 @@ /*

type NullToObject<T> = T extends (null | undefined) ? {} : T;
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;

@@ -38,6 +38,6 @@

export function mergeProps<T extends PropsArg[]>(...args: T): UnionToIntersection<TupleTypes<T>> {
// Start with a base clone of the last argument. This is a lot faster than starting
// Start with a base clone of the first argument. This is a lot faster than starting
// with an empty object and adding properties as we go.
let result: Props = {...args[args.length - 1]};
for (let i = args.length - 2; i >= 0; i--) {
let result: Props = {...args[0]};
for (let i = 1; i < args.length; i++) {
let props = args[i];

@@ -58,3 +58,3 @@ for (let key in props) {

) {
result[key] = chain(b, a);
result[key] = chain(a, b);

@@ -67,8 +67,8 @@ // Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check

) {
result[key] = clsx(b, a);
result[key] = clsx(a, b);
} else if (key === 'id' && a && b) {
result.id = mergeIds(b, a);
result.id = mergeIds(a, b);
// Override others
} else if (a === undefined) {
result[key] = b;
} else {
result[key] = b !== undefined ? b : a;
}

@@ -75,0 +75,0 @@ }

@@ -25,3 +25,9 @@ /*

let idsUpdaterMap: Map<string, Array<(v: string) => void>> = new Map();
export let idsUpdaterMap: Map<string, { current: string | null }[]> = new Map();
// This allows us to clean up the idsUpdaterMap when the id is no longer used.
// Map is a strong reference, so unused ids wouldn't be cleaned up otherwise.
// This can happen in suspended components where mount/unmount is not called.
let registry = new FinalizationRegistry<string>((heldValue) => {
idsUpdaterMap.delete(heldValue);
});

@@ -37,13 +43,12 @@ /**

let res = useSSRSafeId(value);
let cleanupRef = useRef(null);
let updateValue = useCallback((val) => {
nextId.current = val;
}, []);
registry.register(cleanupRef, res);
if (canUseDOM) {
// TS not smart enough to know that `has` means the value exists
if (idsUpdaterMap.has(res) && !idsUpdaterMap.get(res)!.includes(updateValue)) {
idsUpdaterMap.set(res, [...idsUpdaterMap.get(res)!, updateValue]);
const cacheIdRef = idsUpdaterMap.get(res);
if (cacheIdRef && !cacheIdRef.includes(nextId)) {
cacheIdRef.push(nextId);
} else {
idsUpdaterMap.set(res, [updateValue]);
idsUpdaterMap.set(res, [nextId]);
}

@@ -55,2 +60,5 @@ }

return () => {
// In Suspense, the cleanup function may be not called
// when it is though, also remove it from the finalization registry.
registry.unregister(cleanupRef);
idsUpdaterMap.delete(r);

@@ -85,3 +93,3 @@ };

if (setIdsA) {
setIdsA.forEach(fn => fn(idB));
setIdsA.forEach(ref => (ref.current = idB));
return idB;

@@ -92,3 +100,3 @@ }

if (setIdsB) {
setIdsB.forEach(fn => fn(idA));
setIdsB.forEach((ref) => (ref.current = idA));
return idA;

@@ -95,0 +103,0 @@ }

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc