init commit

This commit is contained in:
rxliuli
2025-11-04 05:03:50 +08:00
commit bce557cc2d
1396 changed files with 172991 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();
}
},
};
}