Skip to content

Commit

Permalink
Merge pull request #11 from svecosystem/fix-lint
Browse files Browse the repository at this point in the history
fix lint
  • Loading branch information
TGlide authored Apr 22, 2024
2 parents b5c7fae + eb8b48d commit e6b2b5e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { isBrowser } from "$lib/internal/utils/browser.js";


/**
* Returns a reactive value that is equal to `document.activeElement`.
* It automatically listens for changes, keeping the reference up to date.
*
* @export
* @returns {{ value: Readonly<Element | null> }}
* @returns an object with a reactive value `value` that is equal to `document.activeElement`, or `null`
* if there's no active element.
*/
export function useActiveElement(): { value: Readonly<Element | null> } {
const activeElement = $state({ value: isBrowser() ? document.activeElement : null });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,21 @@ type Options = {
box?: "content-box" | "border-box";
};



/**
* Returns a reactive value holding the size of `node`.
*
*
* Accepts an `options` object with the following properties:
* - `initialSize`: The initial size of the element. Defaults to `{ width: 0, height: 0 }`.
* - `box`: The box model to use. Can be either `"content-box"` or `"border-box"`. Defaults to `"border-box"`.
*
*
* @returns an object with `width` and `height` properties.
*/
export function useElementSize(
_node: ValueOrGetter<HTMLElement | undefined>,
options: Options = {
box: "border-box",
}
): { width: number; height: number; } {
): { width: number; height: number } {
const node = boxed(_node);
const size = $state({
width: options.initialSize?.width ?? 0,
Expand Down
4 changes: 2 additions & 2 deletions sites/docs/content/functions/use-active-element.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { UseActiveElementDemo } from '$lib/components/demos';
</script>
<p>
Currently active element:
{activeElement.value?.localName ?? 'No active element found'}
Currently active element:
{activeElement.value?.localName ?? "No active element found"}
</p>
```
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
bind:this={el}
class="h-[200px] min-h-[100px] w-[300px] min-w-[200px] resize rounded-md bg-muted p-4"
value={text}
/>
></textarea>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class="fixed bottom-0 left-0 right-0 z-[70] mt-24 flex max-h-[96%] flex-col rounded-t-[10px] bg-background"
>
<div class="max-h-[96%] flex-1 overflow-y-auto rounded-t-[10px] bg-card p-4">
<div class="mx-auto mb-8 h-1.5 w-12 flex-shrink-0 rounded-full bg-primary/20" />
<div class="mx-auto mb-8 h-1.5 w-12 flex-shrink-0 rounded-full bg-primary/20"></div>
<div class="mx-auto max-w-md">
<Drawer.Title class="sr-only mb-4 font-medium">Navigation</Drawer.Title>
<nav>
Expand Down
2 changes: 1 addition & 1 deletion sites/docs/src/lib/components/ui/skeleton/skeleton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
export { className as class };
</script>

<div class={cn("animate-pulse rounded-md bg-muted", className)} {...$$restProps} />
<div class={cn("animate-pulse rounded-md bg-muted", className)} {...$$restProps}></div>
2 changes: 1 addition & 1 deletion sites/docs/src/lib/components/ui/textarea/textarea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
on:paste
on:input
{...$$restProps}
/>
></textarea>

0 comments on commit e6b2b5e

Please sign in to comment.