@glasshome/ui 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createSignal as r, onMount as a, onCleanup as c } from "solid-js";
2
- import { c as w } from "./utils-eGXXUFl7.js";
2
+ import { c as w } from "./utils-TrrhThB-.js";
3
3
  const n = 768;
4
4
  function d() {
5
5
  const [i, e] = r(void 0);
@@ -0,0 +1,2 @@
1
+ export declare function hasNoDragAncestor(target: Element | null, root: Element): boolean;
2
+ export declare function shouldDrag(target: Element | null, root: Element, dy: number, dx: number): boolean;
@@ -0,0 +1,30 @@
1
+ import { type Component, type ComponentProps, type JSX, type ParentComponent } from "solid-js";
2
+ import { type InitialFocus } from "./focus-trap";
3
+ interface BottomSheetRootProps {
4
+ open?: boolean;
5
+ defaultOpen?: boolean;
6
+ onOpenChange?: (open: boolean) => void;
7
+ dismissible?: boolean;
8
+ children: JSX.Element;
9
+ }
10
+ declare const BottomSheet: ParentComponent<BottomSheetRootProps>;
11
+ declare const BottomSheetTrigger: ParentComponent<ComponentProps<"button">>;
12
+ interface BottomSheetPortalProps {
13
+ children: JSX.Element;
14
+ mount?: Node;
15
+ }
16
+ declare const BottomSheetPortal: Component<BottomSheetPortalProps>;
17
+ declare const BottomSheetOverlay: Component<ComponentProps<"div">>;
18
+ interface BottomSheetContentProps extends ComponentProps<"div"> {
19
+ initialFocus?: InitialFocus;
20
+ ariaLabel?: string;
21
+ }
22
+ declare const BottomSheetContent: ParentComponent<BottomSheetContentProps>;
23
+ declare const BottomSheetHandle: Component<ComponentProps<"div">>;
24
+ declare const BottomSheetHeader: Component<ComponentProps<"div">>;
25
+ declare const BottomSheetTitle: Component<ComponentProps<"h2">>;
26
+ declare const BottomSheetDescription: Component<ComponentProps<"p">>;
27
+ declare const BottomSheetBody: Component<ComponentProps<"div">>;
28
+ declare const BottomSheetFooter: Component<ComponentProps<"div">>;
29
+ declare const BottomSheetClose: ParentComponent<ComponentProps<"button">>;
30
+ export { BottomSheet, BottomSheetBody, BottomSheetClose, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHandle, BottomSheetHeader, BottomSheetOverlay, BottomSheetPortal, BottomSheetTitle, BottomSheetTrigger, };
@@ -0,0 +1,9 @@
1
+ export declare const EASE = "cubic-bezier(0.32, 0.72, 0, 1)";
2
+ export declare const TRANSITION_MS = 500;
3
+ export declare const TRANSITION_CSS = "transform 500ms cubic-bezier(0.32, 0.72, 0, 1), opacity 500ms cubic-bezier(0.32, 0.72, 0, 1)";
4
+ export declare const DEAD_ZONE_PX = 6;
5
+ export declare const CLOSE_DISTANCE_RATIO = 0.4;
6
+ export declare const CLOSE_VELOCITY_PX_PER_MS = 0.5;
7
+ export declare const VELOCITY_WINDOW_MS = 100;
8
+ export declare const VELOCITY_PROJECTION_MS = 200;
9
+ export declare const Z_BASE = 40;
@@ -0,0 +1,12 @@
1
+ import type { SheetState } from "./state-machine";
2
+ interface DragHandle {
3
+ destroy: () => void;
4
+ }
5
+ interface DragOptions {
6
+ el: HTMLDivElement;
7
+ getState: () => SheetState;
8
+ setState: (s: SheetState) => void;
9
+ requestClose: () => void;
10
+ }
11
+ export declare function attachDrag(opts: DragOptions): DragHandle;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ export type InitialFocus = "container" | "first" | ((root: HTMLElement) => HTMLElement | null);
2
+ interface TrapHandle {
3
+ release: () => void;
4
+ }
5
+ export declare function trapFocus(root: HTMLElement, initial?: InitialFocus): TrapHandle;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ export { BottomSheet, BottomSheetBody, BottomSheetClose, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHandle, BottomSheetHeader, BottomSheetOverlay, BottomSheetPortal, BottomSheetTitle, BottomSheetTrigger, } from "./bottom-sheet";
2
+ export type { SheetState } from "./state-machine";
@@ -0,0 +1,4 @@
1
+ export interface KeyboardWatchHandle {
2
+ destroy: () => void;
3
+ }
4
+ export declare function watchKeyboard(el: HTMLElement): KeyboardWatchHandle;
@@ -0,0 +1,2 @@
1
+ export declare function acquireScrollLock(): void;
2
+ export declare function releaseScrollLock(): void;
@@ -0,0 +1,3 @@
1
+ export type SheetState = "closed" | "opening" | "open" | "pressing" | "dragging" | "snapping" | "closing";
2
+ export declare function canTransition(from: SheetState, to: SheetState): boolean;
3
+ export declare function assertTransition(from: SheetState, to: SheetState): void;
@@ -0,0 +1,7 @@
1
+ export declare class VelocityTracker {
2
+ private samples;
3
+ reset(): void;
4
+ add(y: number, t: number): void;
5
+ /** Weighted velocity over the last VELOCITY_WINDOW_MS, in px/ms. */
6
+ compute(now: number): number;
7
+ }
@@ -5,6 +5,7 @@ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent,
5
5
  export { AspectRatio } from "./aspect-ratio";
6
6
  export { Avatar, AvatarFallback, AvatarImage } from "./avatar";
7
7
  export { Badge, badgeVariants } from "./badge";
8
+ export { BottomSheet, BottomSheetBody, BottomSheetClose, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHandle, BottomSheetHeader, BottomSheetOverlay, BottomSheetPortal, BottomSheetTitle, BottomSheetTrigger, } from "./bottom-sheet";
8
9
  export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "./breadcrumb";
9
10
  export { Button, buttonVariants } from "./button";
10
11
  export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, } from "./button-group";