chore: initial import

This commit is contained in:
minhducdz99
2025-11-05 18:03:41 +07:00
commit dce325141e
1397 changed files with 173048 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
export default function focusNode(
node: HTMLElement,
focusedIndex: number | null,
) {
const nodeIndex = Number(node.getAttribute('data-index'));
// Handle the initial focus when applicable
if (nodeIndex === focusedIndex) {
node.focus();
}
return {
update(newFocusedIndex) {
if (nodeIndex === newFocusedIndex) {
node.focus();
}
},
};
}