Skip to content

Commit

Permalink
remove el from Pending_Button props in favor of an exported `focu…
Browse files Browse the repository at this point in the history
…s` method (#29)
  • Loading branch information
ryanatkn authored Jun 11, 2024
1 parent 8d09b38 commit 5fab7a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-onions-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ryanatkn/fuz': minor
---

remove `el` from `Pending_Button` props in favor of an exported `focus` method
16 changes: 4 additions & 12 deletions src/lib/Pending_Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,13 @@
children: Snippet;
}
let {
pending, // eslint-disable-line prefer-const
onclick, // eslint-disable-line prefer-const
running, // eslint-disable-line prefer-const
title, // eslint-disable-line prefer-const
disabled, // eslint-disable-line prefer-const
attrs, // eslint-disable-line prefer-const
el = $bindable(),
children, // eslint-disable-line prefer-const
}: Props = $props();
const {pending, onclick, running, title, disabled, attrs, children}: Props = $props();
el; // TODO @see https://github.com/sveltejs/language-tools/issues/2268
let el: HTMLButtonElement | undefined; // intentionally not reactive
export const focus = (options?: FocusOptions | undefined): void => el?.focus(options);
// TODO maybe this shouldn't disable? just visually look disabled, maybe with `.disabled`?
// TODO cancelable?
</script>

<button
Expand Down
2 changes: 2 additions & 0 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import adapter from '@sveltejs/adapter-static';
/** @type {import('@sveltejs/kit').Config} */
export default {
preprocess: [vitePreprocess()],
// TODO enable
// compilerOptions: {runes: true},
// TODO ideally this would use the default but it conflicts with ctrl+shift+c in Chrome,
// but it's strange to me that I'm resetting it to what the Mac default is
vitePlugin: {inspector: {toggleKeyCombo: 'meta-shift'}}, // docs: https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/inspector.md
Expand Down

0 comments on commit 5fab7a5

Please sign in to comment.