import { getTabbableNodes } from './utils/DOMutils'; import { getAllAffectedNodes } from './utils/all-affected'; import { isGuard, isNotAGuard } from './utils/is'; import { getTopCommonParent } from './utils/parenting'; /** * return list of focusable elements inside a given top node * @deprecated use {@link getFocusableIn}. Yep, there is typo in the function name */ export var getFocusabledIn = function (topNode) { var entries = getAllAffectedNodes(topNode).filter(isNotAGuard); var commonParent = getTopCommonParent(topNode, topNode, entries); var visibilityCache = new Map(); var outerNodes = getTabbableNodes([commonParent], visibilityCache, true); var innerElements = getTabbableNodes(entries, visibilityCache) .filter(function (_a) { var node = _a.node; return isNotAGuard(node); }) .map(function (_a) { var node = _a.node; return node; }); return outerNodes.map(function (_a) { var node = _a.node, index = _a.index; return ({ node: node, index: index, lockItem: innerElements.indexOf(node) >= 0, guard: isGuard(node), }); }); }; /** * return list of focusable elements inside a given top node */ export var getFocusableIn = getFocusabledIn;