Skip to content

Commit

Permalink
Added interaction interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugos68 committed Apr 30, 2024
1 parent 6ca9f67 commit 3bb6980
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/hooks/useHover/index.svelte.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Floating } from '../useFloating/index.svelte.js';
import type { Interaction } from '../useInteractions/index.svelte.js';

interface DelayOptions {
/**
Expand Down Expand Up @@ -46,7 +47,7 @@ interface HoverOptions {
move?: boolean;
}

class Hover {
class Hover implements Interaction {
readonly #floating: Floating;
readonly #options: HoverOptions;
readonly #enabled = $derived.by(() => this.#options.enabled ?? true);
Expand Down
8 changes: 8 additions & 0 deletions src/lib/hooks/useInteractions/index.svelte.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { HTMLAttributes } from 'svelte/elements';

interface Interaction {
reference: HTMLAttributes<HTMLElement>;
floating: HTMLAttributes<HTMLElement>;
}

export { type Interaction };

0 comments on commit 3bb6980

Please sign in to comment.