INIT
CI / build (push) Has been skipped
CI / deploy (push) Successful in 1m11s

This commit is contained in:
eewing
2026-02-18 15:17:47 -06:00
parent e74c106f85
commit ec317eb17c
11532 changed files with 1631690 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
export * from "./is-focus-within.svelte.js";
+1
View File
@@ -0,0 +1 @@
export * from "./is-focus-within.svelte.js";
@@ -0,0 +1,13 @@
import type { MaybeElementGetter } from "../../internal/types.js";
import { type ActiveElementOptions } from "../active-element/active-element.svelte.js";
export interface IsFocusWithinOptions extends ActiveElementOptions {
}
/**
* Tracks whether the focus is within a target element.
* @see {@link https://runed.dev/docs/utilities/is-focus-within}
*/
export declare class IsFocusWithin {
#private;
constructor(node: MaybeElementGetter, options?: IsFocusWithinOptions);
readonly current: boolean;
}
@@ -0,0 +1,20 @@
import { ActiveElement, } from "../active-element/active-element.svelte.js";
import { extract } from "../extract/extract.svelte.js";
/**
* Tracks whether the focus is within a target element.
* @see {@link https://runed.dev/docs/utilities/is-focus-within}
*/
export class IsFocusWithin {
#node;
#activeElement;
constructor(node, options = {}) {
this.#node = node;
this.#activeElement = new ActiveElement(options);
}
current = $derived.by(() => {
const node = extract(this.#node);
if (node == null)
return false;
return node.contains(this.#activeElement.current);
});
}