diff --git a/package.json b/package.json index 70280a9..027e651 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "module": "index.ts", "main": "index.ts", "exports": { + "./util": { + "types": "./util.ts", + "svelte": "./util.ts" + }, "./complete": { "types": "./complete.ts", "svelte": "./complete.ts" diff --git a/util.ts b/util.ts new file mode 100644 index 0000000..0a40718 --- /dev/null +++ b/util.ts @@ -0,0 +1,9 @@ +import type { Action } from 'svelte/action'; + +/** + * Focuses the given HTML element. + * @param node - The HTML element to focus. + */ +export const focus: Action = (node) => { + node.focus(); +};