@codefast/ui 0.9.2 → 0.10.0

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.
Files changed (188) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +3 -0
  3. package/dist/components/accordion.js +1 -1
  4. package/dist/components/alert-dialog.d.ts +1 -1
  5. package/dist/components/alert-dialog.js +2 -2
  6. package/dist/components/alert.d.ts +1 -1
  7. package/dist/components/alert.js +2 -2
  8. package/dist/components/attachment.d.ts +2 -2
  9. package/dist/components/attachment.js +3 -3
  10. package/dist/components/avatar.js +1 -1
  11. package/dist/components/badge.d.ts +1 -1
  12. package/dist/components/badge.js +1 -1
  13. package/dist/components/breadcrumb.js +3 -3
  14. package/dist/components/bubble.d.ts +1 -1
  15. package/dist/components/bubble.js +2 -2
  16. package/dist/components/button-group.d.ts +2 -2
  17. package/dist/components/button-group.js +3 -3
  18. package/dist/components/button.d.ts +1 -1
  19. package/dist/components/button.js +1 -1
  20. package/dist/components/calendar.d.ts +1 -1
  21. package/dist/components/calendar.js +3 -3
  22. package/dist/components/card.js +1 -1
  23. package/dist/components/carousel.d.ts +1 -1
  24. package/dist/components/carousel.js +17 -26
  25. package/dist/components/chart.js +1 -1
  26. package/dist/components/checkbox-cards.d.ts +1 -1
  27. package/dist/components/checkbox-cards.js +3 -3
  28. package/dist/components/checkbox-group.d.ts +1 -1
  29. package/dist/components/checkbox-group.js +2 -2
  30. package/dist/components/checkbox.js +1 -1
  31. package/dist/components/command.d.ts +8 -2
  32. package/dist/components/command.js +5 -5
  33. package/dist/components/context-menu.js +1 -1
  34. package/dist/components/dialog.d.ts +14 -2
  35. package/dist/components/dialog.js +6 -6
  36. package/dist/components/drawer.d.ts +2 -2
  37. package/dist/components/drawer.js +2 -2
  38. package/dist/components/dropdown-menu.js +1 -1
  39. package/dist/components/empty.d.ts +1 -1
  40. package/dist/components/empty.js +2 -2
  41. package/dist/components/field.d.ts +2 -2
  42. package/dist/components/field.js +4 -4
  43. package/dist/components/form.js +2 -2
  44. package/dist/components/hover-card.js +1 -1
  45. package/dist/components/input-group.d.ts +4 -4
  46. package/dist/components/input-group.js +5 -5
  47. package/dist/components/input-number.d.ts +2 -2
  48. package/dist/components/input-number.js +6 -6
  49. package/dist/components/input-otp.js +1 -1
  50. package/dist/components/input-password.d.ts +16 -3
  51. package/dist/components/input-password.js +3 -3
  52. package/dist/components/input-search.d.ts +8 -2
  53. package/dist/components/input-search.js +3 -3
  54. package/dist/components/input.js +1 -1
  55. package/dist/components/item.d.ts +2 -2
  56. package/dist/components/item.js +3 -3
  57. package/dist/components/kbd.js +1 -1
  58. package/dist/components/label.js +1 -1
  59. package/dist/components/marker.d.ts +1 -1
  60. package/dist/components/marker.js +2 -2
  61. package/dist/components/menubar.js +1 -1
  62. package/dist/components/message-scroller.d.ts +3 -3
  63. package/dist/components/message-scroller.js +3 -3
  64. package/dist/components/message.js +1 -1
  65. package/dist/components/native-select.js +1 -1
  66. package/dist/components/navigation-menu.js +2 -2
  67. package/dist/components/pagination.d.ts +2 -2
  68. package/dist/components/pagination.js +3 -3
  69. package/dist/components/popover.js +1 -1
  70. package/dist/components/progress-circle.d.ts +2 -2
  71. package/dist/components/progress-circle.js +3 -3
  72. package/dist/components/progress.d.ts +6 -1
  73. package/dist/components/progress.js +12 -4
  74. package/dist/components/radio-cards.js +2 -2
  75. package/dist/components/radio-group.js +1 -1
  76. package/dist/components/radio.js +1 -1
  77. package/dist/components/resizable.js +1 -1
  78. package/dist/components/scroll-area.d.ts +1 -1
  79. package/dist/components/scroll-area.js +2 -2
  80. package/dist/components/select.js +1 -1
  81. package/dist/components/separator.d.ts +1 -1
  82. package/dist/components/separator.js +2 -2
  83. package/dist/components/sheet.d.ts +9 -3
  84. package/dist/components/sheet.js +5 -5
  85. package/dist/components/sidebar.d.ts +19 -7
  86. package/dist/components/sidebar.js +66 -32
  87. package/dist/components/skeleton.js +1 -1
  88. package/dist/components/slider.js +1 -1
  89. package/dist/components/spinner.js +1 -1
  90. package/dist/components/switch.js +1 -1
  91. package/dist/components/table.js +1 -1
  92. package/dist/components/tabs.d.ts +1 -1
  93. package/dist/components/tabs.js +2 -2
  94. package/dist/components/textarea.js +1 -1
  95. package/dist/components/toggle-group.d.ts +2 -2
  96. package/dist/components/toggle-group.js +2 -2
  97. package/dist/components/toggle.d.ts +1 -1
  98. package/dist/components/toggle.js +1 -1
  99. package/dist/components/tooltip.js +1 -1
  100. package/dist/hooks/use-is-mobile.js +1 -1
  101. package/dist/hooks/use-media-query.d.ts +3 -3
  102. package/dist/hooks/use-media-query.js +15 -32
  103. package/dist/hooks/use-message-scroller-commands.d.ts +2 -2
  104. package/dist/hooks/use-message-scroller-commands.js +2 -2
  105. package/dist/hooks/use-message-scroller-controller.d.ts +2 -2
  106. package/dist/hooks/use-message-scroller-controller.js +4 -4
  107. package/dist/hooks/use-message-scroller-refs.d.ts +1 -1
  108. package/dist/hooks/use-message-scroller-refs.js +3 -3
  109. package/dist/index.d.ts +180 -180
  110. package/dist/index.js +93 -93
  111. package/dist/lib/message-scroller/geometry.d.ts +1 -1
  112. package/dist/lib/message-scroller/geometry.js +1 -1
  113. package/dist/lib/message-scroller/stores.d.ts +1 -1
  114. package/dist/lib/message-scroller/stores.js +1 -1
  115. package/dist/lib/message-scroller/types.d.ts +1 -1
  116. package/dist/primitives/input-number.d.ts +6 -6
  117. package/dist/primitives/input-number.js +6 -6
  118. package/dist/primitives/message-scroller.d.ts +6 -6
  119. package/dist/primitives/message-scroller.js +3 -3
  120. package/dist/variants/alert.d.ts +1 -1
  121. package/dist/variants/alert.js +1 -1
  122. package/dist/variants/attachment.d.ts +1 -1
  123. package/dist/variants/attachment.js +1 -1
  124. package/dist/variants/badge.d.ts +1 -1
  125. package/dist/variants/badge.js +1 -1
  126. package/dist/variants/bubble.d.ts +1 -1
  127. package/dist/variants/bubble.js +1 -1
  128. package/dist/variants/button-group.d.ts +1 -1
  129. package/dist/variants/button-group.js +1 -1
  130. package/dist/variants/button.d.ts +1 -1
  131. package/dist/variants/button.js +1 -1
  132. package/dist/variants/empty.d.ts +1 -1
  133. package/dist/variants/empty.js +1 -1
  134. package/dist/variants/field.d.ts +1 -1
  135. package/dist/variants/field.js +1 -1
  136. package/dist/variants/input-group.d.ts +1 -1
  137. package/dist/variants/input-group.js +1 -1
  138. package/dist/variants/item.d.ts +1 -1
  139. package/dist/variants/item.js +1 -1
  140. package/dist/variants/marker.d.ts +1 -1
  141. package/dist/variants/marker.js +1 -1
  142. package/dist/variants/navigation-menu.d.ts +1 -1
  143. package/dist/variants/navigation-menu.js +1 -1
  144. package/dist/variants/progress-circle.d.ts +1 -1
  145. package/dist/variants/progress-circle.js +1 -1
  146. package/dist/variants/scroll-area.d.ts +1 -1
  147. package/dist/variants/scroll-area.js +1 -1
  148. package/dist/variants/separator.d.ts +1 -1
  149. package/dist/variants/separator.js +1 -1
  150. package/dist/variants/sheet.d.ts +1 -1
  151. package/dist/variants/sheet.js +1 -1
  152. package/dist/variants/sidebar.d.ts +1 -1
  153. package/dist/variants/sidebar.js +1 -1
  154. package/dist/variants/tabs.d.ts +1 -1
  155. package/dist/variants/tabs.js +1 -1
  156. package/dist/variants/toggle.d.ts +1 -1
  157. package/dist/variants/toggle.js +1 -1
  158. package/package.json +8 -7
  159. package/src/css/foundation/base.css +68 -0
  160. package/src/css/foundation/motion.css +65 -0
  161. package/src/css/foundation/source.css +14 -0
  162. package/src/css/foundation/tokens.css +83 -0
  163. package/src/css/foundation/utilities.css +451 -0
  164. package/src/css/foundation/variants.css +121 -0
  165. package/src/css/preset.css +14 -0
  166. package/src/css/style.css +11 -0
  167. package/src/css/themes/amber.css +105 -0
  168. package/src/css/themes/blue.css +105 -0
  169. package/src/css/themes/cyan.css +105 -0
  170. package/src/css/themes/emerald.css +105 -0
  171. package/src/css/themes/fuchsia.css +105 -0
  172. package/src/css/themes/gray.css +105 -0
  173. package/src/css/themes/green.css +105 -0
  174. package/src/css/themes/indigo.css +105 -0
  175. package/src/css/themes/lime.css +105 -0
  176. package/src/css/themes/neutral.css +105 -0
  177. package/src/css/themes/orange.css +105 -0
  178. package/src/css/themes/pink.css +105 -0
  179. package/src/css/themes/purple.css +105 -0
  180. package/src/css/themes/red.css +105 -0
  181. package/src/css/themes/rose.css +105 -0
  182. package/src/css/themes/sky.css +105 -0
  183. package/src/css/themes/slate.css +105 -0
  184. package/src/css/themes/stone.css +105 -0
  185. package/src/css/themes/teal.css +105 -0
  186. package/src/css/themes/violet.css +105 -0
  187. package/src/css/themes/yellow.css +105 -0
  188. package/src/css/themes/zinc.css +105 -0
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as SeparatorPrimitive from "radix-ui/separator";
3
- import { cn } from "#/lib/utils";
4
- import { separatorVariants } from "#/variants/separator";
3
+ import { cn } from "#lib/utils";
4
+ import { separatorVariants } from "#variants/separator";
5
5
  /**
6
6
  * @since 0.3.16-canary.0
7
7
  */
@@ -1,7 +1,7 @@
1
1
  import * as SheetPrimitive from "radix-ui/dialog";
2
2
  import type { ComponentProps, JSX } from "react";
3
- import type { ButtonVariants } from "#/variants/button";
4
- import type { SheetContentVariants } from "#/variants/sheet";
3
+ import type { ButtonVariants } from "#variants/button";
4
+ import type { SheetContentVariants } from "#variants/sheet";
5
5
  /**
6
6
  * @since 0.3.16-canary.0
7
7
  */
@@ -22,12 +22,18 @@ declare function SheetTrigger({ ...props }: SheetTriggerProps): JSX.Element;
22
22
  * @since 0.3.16-canary.0
23
23
  */
24
24
  interface SheetContentProps extends ComponentProps<typeof SheetPrimitive.Content>, SheetContentVariants {
25
+ /**
26
+ * The accessible name of the built-in close button.
27
+ *
28
+ * @defaultValue `"Close"`
29
+ */
30
+ closeLabel?: string | undefined;
25
31
  showCloseButton?: boolean;
26
32
  }
27
33
  /**
28
34
  * @since 0.3.16-canary.0
29
35
  */
30
- declare function SheetContent({ children, className, showCloseButton, side, ...props }: SheetContentProps): JSX.Element;
36
+ declare function SheetContent({ children, className, closeLabel, showCloseButton, side, ...props }: SheetContentProps): JSX.Element;
31
37
  /**
32
38
  * @since 0.3.16-canary.0
33
39
  */
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { XIcon } from "lucide-react";
3
3
  import * as SheetPrimitive from "radix-ui/dialog";
4
- import { cn } from "#/lib/utils";
5
- import { buttonVariants } from "#/variants/button";
6
- import { sheetContentVariants } from "#/variants/sheet";
4
+ import { cn } from "#lib/utils";
5
+ import { buttonVariants } from "#variants/button";
6
+ import { sheetContentVariants } from "#variants/sheet";
7
7
  /**
8
8
  * @since 0.3.16-canary.0
9
9
  */
@@ -19,12 +19,12 @@ function SheetTrigger({ ...props }) {
19
19
  /**
20
20
  * @since 0.3.16-canary.0
21
21
  */
22
- function SheetContent({ children, className, showCloseButton = true, side = "right", ...props }) {
22
+ function SheetContent({ children, className, closeLabel = "Close", showCloseButton = true, side = "right", ...props }) {
23
23
  return (_jsxs(SheetPrimitive.Portal, { "data-slot": "sheet-portal", children: [_jsx(SheetPrimitive.Overlay, { className: "fixed inset-0 z-50 bg-black/10 ease-gentle supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:animation-duration-panel-in data-open:fade-in-0 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-panel-out data-closed:fade-out-0", "data-slot": "sheet-overlay" }), _jsxs(SheetPrimitive.Content, { className: sheetContentVariants({ className, side }), "data-side": side, "data-slot": "sheet-content", ...props, children: [children, showCloseButton ? (_jsxs(SheetPrimitive.Close, { className: buttonVariants({
24
24
  className: "absolute top-3 inset-e-3",
25
25
  size: "icon-sm",
26
26
  variant: "ghost",
27
- }), "data-slot": "sheet-close", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] })) : null] })] }));
27
+ }), "data-slot": "sheet-close", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: closeLabel })] })) : null] })] }));
28
28
  }
29
29
  /**
30
30
  * @since 0.3.16-canary.0
@@ -1,9 +1,9 @@
1
1
  import type { ComponentProps, Dispatch, JSX, SetStateAction } from "react";
2
- import { Button } from "#/components/button";
3
- import { Input } from "#/components/input";
4
- import { Separator } from "#/components/separator";
5
- import { TooltipContent } from "#/components/tooltip";
6
- import type { SidebarMenuButtonVariants } from "#/variants/sidebar";
2
+ import { Button } from "#components/button";
3
+ import { Input } from "#components/input";
4
+ import { Separator } from "#components/separator";
5
+ import { TooltipContent } from "#components/tooltip";
6
+ import type { SidebarMenuButtonVariants } from "#variants/sidebar";
7
7
  interface SidebarContextValue {
8
8
  isMobile: boolean;
9
9
  open: boolean;
@@ -27,23 +27,35 @@ interface SidebarProviderProps extends ComponentProps<"div"> {
27
27
  defaultOpen?: boolean;
28
28
  onOpenChange?: (open: boolean) => void;
29
29
  open?: boolean;
30
+ /**
31
+ * The key that toggles the sidebar together with ⌘ or Ctrl, or `false` for no shortcut.
32
+ *
33
+ * @defaultValue `"b"`
34
+ */
35
+ shortcutKey?: string | false | undefined;
30
36
  }
31
37
  /**
32
38
  * @since 0.3.16-canary.0
33
39
  */
34
- declare function SidebarProvider({ children, className, defaultOpen, onOpenChange: setOpenProperty, open: openProperty, style, ...props }: SidebarProviderProps): JSX.Element;
40
+ declare function SidebarProvider({ children, className, defaultOpen, onOpenChange: setOpenProperty, open: openProperty, shortcutKey, style, ...props }: SidebarProviderProps): JSX.Element;
35
41
  /**
36
42
  * @since 0.3.16-canary.0
37
43
  */
38
44
  interface SidebarProps extends ComponentProps<"div"> {
39
45
  collapsible?: "icon" | "none" | "offcanvas";
46
+ /**
47
+ * The accessible name of the sheet the sidebar opens as on narrow screens.
48
+ *
49
+ * @defaultValue `"Sidebar"`
50
+ */
51
+ mobileTitle?: string | undefined;
40
52
  side?: "left" | "right";
41
53
  variant?: "floating" | "inset" | "sidebar";
42
54
  }
43
55
  /**
44
56
  * @since 0.3.16-canary.0
45
57
  */
46
- declare function Sidebar({ children, className, collapsible, side, variant, ...props }: SidebarProps): JSX.Element;
58
+ declare function Sidebar({ children, className, collapsible, mobileTitle, side, variant, ...props }: SidebarProps): JSX.Element;
47
59
  /**
48
60
  * @since 0.3.16-canary.0
49
61
  */
@@ -2,22 +2,24 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { PanelLeftIcon } from "lucide-react";
3
3
  import { Context } from "radix-ui/internal";
4
4
  import * as Slot from "radix-ui/slot";
5
- import { useCallback, useEffect, useId, useState } from "react";
6
- import { Button } from "#/components/button";
7
- import { Input } from "#/components/input";
8
- import { Separator } from "#/components/separator";
9
- import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "#/components/sheet";
10
- import { Skeleton } from "#/components/skeleton";
11
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "#/components/tooltip";
12
- import { useIsMobile } from "#/hooks/use-is-mobile";
13
- import { cn } from "#/lib/utils";
14
- import { sidebarMenuButtonVariants } from "#/variants/sidebar";
5
+ import { useCallback, useEffect, useEffectEvent, useId, useState } from "react";
6
+ import { Button } from "#components/button";
7
+ import { Input } from "#components/input";
8
+ import { Separator } from "#components/separator";
9
+ import { Sheet, SheetContent, SheetHeader, SheetTitle } from "#components/sheet";
10
+ import { Skeleton } from "#components/skeleton";
11
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "#components/tooltip";
12
+ import { useMediaQuery } from "#hooks/use-media-query";
13
+ import { cn } from "#lib/utils";
14
+ import { sidebarMenuButtonVariants } from "#variants/sidebar";
15
15
  const SIDEBAR_COOKIE_NAME = "sidebar_state";
16
16
  const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
17
17
  const SIDEBAR_WIDTH = "16rem";
18
18
  const SIDEBAR_WIDTH_MOBILE = "18rem";
19
19
  const SIDEBAR_WIDTH_ICON = "3.0625rem";
20
- const SIDEBAR_KEYBOARD_SHORTCUT = "b";
20
+ const SIDEBAR_SHORTCUT_KEY = "b";
21
+ // The preset's `--breakpoint-sidebar` default, for a page that has not loaded the preset.
22
+ const SIDEBAR_BREAKPOINT_FALLBACK = "48rem";
21
23
  // ── Context: SidebarProvider ─────────────────────────────────────────────────────────────────────────────────────────
22
24
  const SIDEBAR_PROVIDER_NAME = "SidebarProvider";
23
25
  const [SidebarContextProvider, useSidebarContext] = Context.createContext(SIDEBAR_PROVIDER_NAME);
@@ -31,8 +33,8 @@ const useSidebar = useSidebarContext;
31
33
  /**
32
34
  * @since 0.3.16-canary.0
33
35
  */
34
- function SidebarProvider({ children, className, defaultOpen = true, onOpenChange: setOpenProperty, open: openProperty, style, ...props }) {
35
- const isMobile = useIsMobile();
36
+ function SidebarProvider({ children, className, defaultOpen = true, onOpenChange: setOpenProperty, open: openProperty, shortcutKey = SIDEBAR_SHORTCUT_KEY, style, ...props }) {
37
+ const isMobile = useIsBelowSidebarBreakpoint();
36
38
  const [openMobile, setOpenMobile] = useState(false);
37
39
  // This is the internal state of the sidebar.
38
40
  // We use openProp and setOpenProp for control from outside the component.
@@ -58,19 +60,24 @@ function SidebarProvider({ children, className, defaultOpen = true, onOpenChange
58
60
  setOpen((currentValue) => !currentValue);
59
61
  }
60
62
  }, [isMobile, setOpen]);
63
+ // Reads the latest state through an Effect Event, so the listener stays registered across toggles and, with several
64
+ // providers mounted, the first one keeps the key while the rest see it already handled.
65
+ const onShortcutKeyDown = useEffectEvent((event) => {
66
+ if (shortcutKey !== false && isSidebarShortcut(event, shortcutKey)) {
67
+ event.preventDefault();
68
+ toggleSidebar();
69
+ }
70
+ });
61
71
  // Adds a keyboard shortcut to toggle the sidebar.
62
72
  useEffect(() => {
63
- const handleKeyDown = (event) => {
64
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
65
- event.preventDefault();
66
- toggleSidebar();
67
- }
68
- };
69
- window.addEventListener("keydown", handleKeyDown);
73
+ if (shortcutKey === false) {
74
+ return;
75
+ }
76
+ window.addEventListener("keydown", onShortcutKeyDown);
70
77
  return () => {
71
- window.removeEventListener("keydown", handleKeyDown);
78
+ window.removeEventListener("keydown", onShortcutKeyDown);
72
79
  };
73
- }, [toggleSidebar]);
80
+ }, [shortcutKey]);
74
81
  // We add a state so that we can do data-state="expanded" or "collapsed".
75
82
  // This makes it easier to style the sidebar with Tailwind classes.
76
83
  const state = open ? "expanded" : "collapsed";
@@ -85,19 +92,19 @@ const SIDEBAR_NAME = "Sidebar";
85
92
  /**
86
93
  * @since 0.3.16-canary.0
87
94
  */
88
- function Sidebar({ children, className, collapsible = "offcanvas", side = "left", variant = "sidebar", ...props }) {
95
+ function Sidebar({ children, className, collapsible = "offcanvas", mobileTitle = "Sidebar", side = "left", variant = "sidebar", ...props }) {
89
96
  const { isMobile, openMobile, setOpenMobile, state } = useSidebar(SIDEBAR_NAME);
90
97
  if (collapsible === "none") {
91
98
  return (_jsx("div", { className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className), "data-slot": "sidebar", ...props, children: children }));
92
99
  }
93
100
  if (isMobile) {
94
- return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsxs(SheetContent, { className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", "data-mobile": "true", "data-sidebar": "sidebar", "data-slot": "sidebar", side: side, style: {
101
+ return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsxs(SheetContent, { "aria-describedby": undefined, className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", "data-mobile": "true", "data-sidebar": "sidebar", "data-slot": "sidebar", side: side, style: {
95
102
  "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
96
- }, children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: "Sidebar" }), _jsx(SheetDescription, { children: "Displays the mobile sidebar." })] }), _jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) }));
103
+ }, children: [_jsx(SheetHeader, { className: "sr-only", children: _jsx(SheetTitle, { children: mobileTitle }) }), _jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) }));
97
104
  }
98
- return (_jsxs("div", { className: cn("group peer hidden text-sidebar-foreground md:block", className), "data-collapsible": state === "collapsed" ? collapsible : "", "data-side": side, "data-slot": "sidebar", "data-state": state, "data-variant": variant, children: [_jsx("div", { className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-gentle group-data-[collapsible=offcanvas]:w-0 group-data-side-right:rotate-180", variant === "floating" || variant === "inset"
105
+ return (_jsxs("div", { className: cn("group peer hidden text-sidebar-foreground sidebar:block", className), "data-collapsible": state === "collapsed" ? collapsible : "", "data-side": side, "data-slot": "sidebar", "data-state": state, "data-variant": variant, children: [_jsx("div", { className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-gentle group-data-[collapsible=offcanvas]:w-0 group-data-side-right:rotate-180", variant === "floating" || variant === "inset"
99
106
  ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
100
- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"), "data-slot": "sidebar-gap" }), _jsx("div", { className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-gentle md:flex data-side-right:right-0 data-side-right:group-data-[collapsible=offcanvas]:-right-(--sidebar-width) data-side-left:left-0 data-side-left:group-data-[collapsible=offcanvas]:-left-(--sidebar-width)", variant === "floating" || variant === "inset"
107
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"), "data-slot": "sidebar-gap" }), _jsx("div", { className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-gentle sidebar:flex data-side-right:right-0 data-side-right:group-data-[collapsible=offcanvas]:-right-(--sidebar-width) data-side-left:left-0 data-side-left:group-data-[collapsible=offcanvas]:-left-(--sidebar-width)", variant === "floating" || variant === "inset"
101
108
  ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
102
109
  : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-side-right:border-l group-data-side-left:border-r", className), "data-side": side, "data-slot": "sidebar-container", ...props, children: _jsx("div", { className: "flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border", "data-sidebar": "sidebar", "data-slot": "sidebar-inner", children: children }) })] }));
103
110
  }
@@ -120,13 +127,13 @@ const SIDEBAR_RAIL_NAME = "SidebarRail";
120
127
  */
121
128
  function SidebarRail({ className, ...props }) {
122
129
  const { toggleSidebar } = useSidebar(SIDEBAR_RAIL_NAME);
123
- return (_jsx("button", { className: cn("absolute inset-y-0 z-20 hidden w-4 transition-all ease-gentle group-data-[collapsible=offcanvas]:translate-x-0 group-data-side-right:left-0 group-data-side-left:-right-4 after:absolute after:inset-y-0 after:inset-s-1/2 after:w-0.5 group-data-[collapsible=offcanvas]:after:start-full hover:group-data-[collapsible=offcanvas]:bg-sidebar hover:after:bg-sidebar-border in-data-side-right:cursor-e-resize in-data-side-left:cursor-w-resize sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2 rtl:group-data-[collapsible=offcanvas]:translate-x-0 rtl:in-data-side-right:cursor-w-resize rtl:in-data-side-left:cursor-e-resize [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=left][data-state=collapsed]_&]:cursor-e-resize rtl:[[data-side=left][data-state=collapsed]_&]:cursor-w-resize [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 [[data-side=right][data-state=collapsed]_&]:cursor-w-resize rtl:[[data-side=right][data-state=collapsed]_&]:cursor-e-resize", className), "data-sidebar": "rail", "data-slot": "sidebar-rail", title: "Toggle Sidebar", type: "button", onClick: toggleSidebar, ...props }));
130
+ return (_jsx("button", { className: cn("absolute inset-y-0 z-20 hidden w-4 transition-all ease-gentle group-data-[collapsible=offcanvas]:translate-x-0 group-data-side-right:left-0 group-data-side-left:-right-4 after:absolute after:inset-y-0 after:inset-s-1/2 after:w-0.5 group-data-[collapsible=offcanvas]:after:start-full hover:group-data-[collapsible=offcanvas]:bg-sidebar hover:after:bg-sidebar-border in-data-side-right:cursor-e-resize in-data-side-left:cursor-w-resize sidebar:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2 rtl:group-data-[collapsible=offcanvas]:translate-x-0 rtl:in-data-side-right:cursor-w-resize rtl:in-data-side-left:cursor-e-resize [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=left][data-state=collapsed]_&]:cursor-e-resize rtl:[[data-side=left][data-state=collapsed]_&]:cursor-w-resize [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 [[data-side=right][data-state=collapsed]_&]:cursor-w-resize rtl:[[data-side=right][data-state=collapsed]_&]:cursor-e-resize", className), "data-sidebar": "rail", "data-slot": "sidebar-rail", title: "Toggle Sidebar", type: "button", onClick: toggleSidebar, ...props }));
124
131
  }
125
132
  /**
126
133
  * @since 0.3.16-canary.0
127
134
  */
128
135
  function SidebarInset({ className, ...props }) {
129
- return (_jsx("main", { className: cn("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-collapsed:ms-2", className), "data-slot": "sidebar-inset", ...props }));
136
+ return (_jsx("main", { className: cn("relative flex w-full flex-1 flex-col bg-background sidebar:peer-data-[variant=inset]:m-2 sidebar:peer-data-[variant=inset]:ms-0 sidebar:peer-data-[variant=inset]:rounded-xl sidebar:peer-data-[variant=inset]:shadow-sm sidebar:peer-data-[variant=inset]:peer-data-collapsed:ms-2", className), "data-slot": "sidebar-inset", ...props }));
130
137
  }
131
138
  /**
132
139
  * @since 0.3.16-canary.0
@@ -176,7 +183,7 @@ function SidebarGroupLabel({ asChild = false, className, ...props }) {
176
183
  */
177
184
  function SidebarGroupAction({ asChild = false, className, ...props }) {
178
185
  const Component = asChild ? Slot.Root : "button";
179
- return (_jsx(Component, { className: cn("absolute inset-e-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", className), "data-sidebar": "group-action", "data-slot": "sidebar-group-action", ...props }));
186
+ return (_jsx(Component, { className: cn("absolute inset-e-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 sidebar:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", className), "data-sidebar": "group-action", "data-slot": "sidebar-group-action", ...props }));
180
187
  }
181
188
  /**
182
189
  * @since 0.3.16-canary.0
@@ -220,8 +227,8 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
220
227
  */
221
228
  function SidebarMenuAction({ asChild = false, className, showOnHover = false, ...props }) {
222
229
  const Component = asChild ? Slot.Root : "button";
223
- return (_jsx(Component, { className: cn("absolute inset-e-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", showOnHover &&
224
- "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0", className), "data-sidebar": "menu-action", "data-slot": "sidebar-menu-action", ...props }));
230
+ return (_jsx(Component, { className: cn("absolute inset-e-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 sidebar:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", showOnHover &&
231
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 sidebar:opacity-0", className), "data-sidebar": "menu-action", "data-slot": "sidebar-menu-action", ...props }));
225
232
  }
226
233
  /**
227
234
  * @since 0.3.16-canary.0
@@ -263,5 +270,32 @@ function SidebarMenuSubButton({ asChild = false, className, isActive = false, si
263
270
  const Component = asChild ? Slot.Root : "a";
264
271
  return (_jsx(Component, { className: cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs rtl:translate-x-px data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", className), "data-active": isActive, "data-sidebar": "menu-sub-button", "data-size": size, "data-slot": "sidebar-menu-sub-button", ...props }));
265
272
  }
273
+ // ── Helpers ──────────────────────────────────────────────────────────────────────────────────────────────────────────
274
+ // The sheet takes over below the preset's `sidebar:` breakpoint, so JS matches the value that CSS resolved.
275
+ function useIsBelowSidebarBreakpoint() {
276
+ const [breakpoint] = useState(readSidebarBreakpoint);
277
+ return useMediaQuery(`(width < ${breakpoint})`);
278
+ }
279
+ function readSidebarBreakpoint() {
280
+ if (typeof document === "undefined") {
281
+ return SIDEBAR_BREAKPOINT_FALLBACK;
282
+ }
283
+ const breakpoint = getComputedStyle(document.documentElement).getPropertyValue("--sidebar-breakpoint").trim();
284
+ return breakpoint === "" ? SIDEBAR_BREAKPOINT_FALLBACK : breakpoint;
285
+ }
286
+ // Leaves the key to a handler that already took it, to an IME mid-composition, and to fields where it edits text.
287
+ function isSidebarShortcut(event, shortcutKey) {
288
+ if (event.defaultPrevented ||
289
+ event.isComposing ||
290
+ event.repeat ||
291
+ event.altKey ||
292
+ event.shiftKey ||
293
+ !(event.metaKey || event.ctrlKey) ||
294
+ event.key.toLowerCase() !== shortcutKey.toLowerCase()) {
295
+ return false;
296
+ }
297
+ const target = event.composedPath()[0];
298
+ return !(target instanceof HTMLElement && (target.isContentEditable || target.matches("input, select, textarea")));
299
+ }
266
300
  // ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
267
301
  export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "#/lib/utils";
2
+ import { cn } from "#lib/utils";
3
3
  /**
4
4
  * @since 0.3.16-canary.0
5
5
  */
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as SliderPrimitive from "radix-ui/slider";
3
3
  import { useMemo } from "react";
4
- import { cn } from "#/lib/utils";
4
+ import { cn } from "#lib/utils";
5
5
  /**
6
6
  * @since 0.3.16-canary.0
7
7
  */
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as VisuallyHidden from "radix-ui/visually-hidden";
3
- import { cn } from "#/lib/utils";
3
+ import { cn } from "#lib/utils";
4
4
  // ── Component: Spinner ───────────────────────────────────────────────────────────────────────────────────────────────
5
5
  const SPINNER_COUNT = 8;
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as SwitchPrimitives from "radix-ui/switch";
3
- import { cn } from "#/lib/utils";
3
+ import { cn } from "#lib/utils";
4
4
  /**
5
5
  * @since 0.3.16-canary.0
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "#/lib/utils";
2
+ import { cn } from "#lib/utils";
3
3
  /**
4
4
  * @since 0.3.16-canary.0
5
5
  */
@@ -1,6 +1,6 @@
1
1
  import * as TabsPrimitive from "radix-ui/tabs";
2
2
  import type { ComponentProps, JSX } from "react";
3
- import type { TabsListVariants } from "#/variants/tabs";
3
+ import type { TabsListVariants } from "#variants/tabs";
4
4
  /**
5
5
  * @since 0.3.16-canary.0
6
6
  */
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as TabsPrimitive from "radix-ui/tabs";
3
- import { cn } from "#/lib/utils";
4
- import { tabsListVariants } from "#/variants/tabs";
3
+ import { cn } from "#lib/utils";
4
+ import { tabsListVariants } from "#variants/tabs";
5
5
  /**
6
6
  * @since 0.3.16-canary.0
7
7
  */
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "#/lib/utils";
2
+ import { cn } from "#lib/utils";
3
3
  /**
4
4
  * @since 0.3.16-canary.0
5
5
  */
@@ -1,8 +1,8 @@
1
1
  import { Context } from "radix-ui/internal";
2
2
  import * as ToggleGroupPrimitive from "radix-ui/toggle-group";
3
3
  import type { ComponentProps, JSX } from "react";
4
- import type { VariantProps } from "#/lib/utils";
5
- import { toggleVariants } from "#/variants/toggle";
4
+ import type { VariantProps } from "#lib/utils";
5
+ import { toggleVariants } from "#variants/toggle";
6
6
  type ScopedProps<P> = P & {
7
7
  __scopeToggleGroup?: Context.Scope;
8
8
  };
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Context } from "radix-ui/internal";
3
3
  import * as ToggleGroupPrimitive from "radix-ui/toggle-group";
4
- import { cn } from "#/lib/utils";
5
- import { toggleVariants } from "#/variants/toggle";
4
+ import { cn } from "#lib/utils";
5
+ import { toggleVariants } from "#variants/toggle";
6
6
  // ── Context: ToggleGroup ─────────────────────────────────────────────────────────────────────────────────────────────
7
7
  const TOGGLE_GROUP_NAME = "ToggleGroup";
8
8
  const [createToggleGroupContext] = Context.createContextScope(TOGGLE_GROUP_NAME, [
@@ -1,6 +1,6 @@
1
1
  import * as TogglePrimitive from "radix-ui/toggle";
2
2
  import type { ComponentProps, JSX } from "react";
3
- import type { ToggleVariants } from "#/variants/toggle";
3
+ import type { ToggleVariants } from "#variants/toggle";
4
4
  /**
5
5
  * @since 0.3.16-canary.0
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as TogglePrimitive from "radix-ui/toggle";
3
- import { toggleVariants } from "#/variants/toggle";
3
+ import { toggleVariants } from "#variants/toggle";
4
4
  /**
5
5
  * @since 0.3.16-canary.0
6
6
  */
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as TooltipPrimitive from "radix-ui/tooltip";
3
- import { cn } from "#/lib/utils";
3
+ import { cn } from "#lib/utils";
4
4
  /**
5
5
  * @since 0.3.16-canary.0
6
6
  */
@@ -1,4 +1,4 @@
1
- import { useMediaQuery } from "#/hooks/use-media-query";
1
+ import { useMediaQuery } from "#hooks/use-media-query";
2
2
  /**
3
3
  * Determines whether the current viewport should be treated as mobile.
4
4
  *
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Subscribe to a CSS media query and receive its match state.
2
+ * Subscribes to a CSS media query and returns whether it matches.
3
3
  *
4
- * Evaluates the query immediately (when supported) and updates on changes
5
- * via an event listener.
4
+ * Reports `false` during SSR and hydration, so the first client render matches the server markup, then the live
5
+ * match state, updating whenever the query flips.
6
6
  *
7
7
  * @param query - A valid media query string (e.g., "(max-width: 768px)").
8
8
  * @returns true when the media query currently matches; otherwise false.
@@ -1,9 +1,9 @@
1
- import { useEffect, useState } from "react";
1
+ import { useCallback, useSyncExternalStore } from "react";
2
2
  /**
3
- * Subscribe to a CSS media query and receive its match state.
3
+ * Subscribes to a CSS media query and returns whether it matches.
4
4
  *
5
- * Evaluates the query immediately (when supported) and updates on changes
6
- * via an event listener.
5
+ * Reports `false` during SSR and hydration, so the first client render matches the server markup, then the live
6
+ * match state, updating whenever the query flips.
7
7
  *
8
8
  * @param query - A valid media query string (e.g., "(max-width: 768px)").
9
9
  * @returns true when the media query currently matches; otherwise false.
@@ -16,39 +16,22 @@ import { useEffect, useState } from "react";
16
16
  * @since 0.3.16-canary.0
17
17
  */
18
18
  export function useMediaQuery(query) {
19
- /**
20
- * State to store whether the query matches.
21
- * The initial value is calculated based on the current window state.
22
- */
23
- const [matches, setMatches] = useState(() => {
24
- // Ensure initial state matches current media query status
25
- if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
26
- return window.matchMedia(query).matches;
19
+ const subscribe = useCallback((onChange) => {
20
+ if (!canMatchMedia()) {
21
+ return () => { };
27
22
  }
28
- return false;
29
- });
30
- useEffect(() => {
31
- // Only run in a browser environment where matchMedia is available
32
- if (typeof window === "undefined") {
33
- return;
34
- }
35
- /**
36
- * MediaQueryList to evaluate and observe the provided query.
37
- */
38
23
  const mediaQueryList = window.matchMedia(query);
39
- /**
40
- * Update state when the media query status changes.
41
- */
42
- const onChange = (event) => {
43
- setMatches(event.matches);
44
- };
45
24
  mediaQueryList.addEventListener("change", onChange);
46
- /**
47
- * Removes the event listener on unmount or when the query changes.
48
- */
49
25
  return () => {
50
26
  mediaQueryList.removeEventListener("change", onChange);
51
27
  };
52
28
  }, [query]);
53
- return matches;
29
+ const getSnapshot = useCallback(() => canMatchMedia() && window.matchMedia(query).matches, [query]);
30
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
31
+ }
32
+ function getServerSnapshot() {
33
+ return false;
34
+ }
35
+ function canMatchMedia() {
36
+ return typeof window !== "undefined" && typeof window.matchMedia === "function";
54
37
  }
@@ -1,5 +1,5 @@
1
- import type { MessageScrollerRefs } from "#/hooks/use-message-scroller-refs";
2
- import type { MessageScrollerScrollOptions } from "#/lib/message-scroller/types";
1
+ import type { MessageScrollerRefs } from "#hooks/use-message-scroller-refs";
2
+ import type { MessageScrollerScrollOptions } from "#lib/message-scroller/types";
3
3
  /**
4
4
  * Imperative scroll primitives, split from the controller so the move mechanics
5
5
  * live apart from the policy that decides when to run them. Each command resolves
@@ -1,8 +1,8 @@
1
1
  // Callbacks read from stable refs; omitting them from deps is intentional and keeps identities stable.
2
2
  /* oxlint-disable react-hooks/exhaustive-deps */
3
3
  import { useCallback } from "react";
4
- import { getElementScrollTop, getElementViewportTop, getMaxScrollTop, getTailSpacerHeight, } from "#/lib/message-scroller/geometry";
5
- import { AUTOSCROLLING_CLEAR_DELAY, SCROLL_POSITION_EPSILON } from "#/lib/message-scroller/types";
4
+ import { getElementScrollTop, getElementViewportTop, getMaxScrollTop, getTailSpacerHeight, } from "#lib/message-scroller/geometry";
5
+ import { AUTOSCROLLING_CLEAR_DELAY, SCROLL_POSITION_EPSILON } from "#lib/message-scroller/types";
6
6
  /**
7
7
  * Imperative scroll primitives, split from the controller so the move mechanics
8
8
  * live apart from the policy that decides when to run them. Each command resolves
@@ -1,5 +1,5 @@
1
- import type { MessageScrollerRefs } from "#/hooks/use-message-scroller-refs";
2
- import type { MessageScrollerContextValue, MessageScrollerProviderProps, MessageScrollerRegisterMessage } from "#/lib/message-scroller/types";
1
+ import type { MessageScrollerRefs } from "#hooks/use-message-scroller-refs";
2
+ import type { MessageScrollerContextValue, MessageScrollerProviderProps, MessageScrollerRegisterMessage } from "#lib/message-scroller/types";
3
3
  /**
4
4
  * Orchestrator hook. Decides when to scroll and delegates the moves to
5
5
  * useMessageScrollerCommands; state and visibility commits are coalesced on a
@@ -1,10 +1,10 @@
1
1
  // Callbacks read from stable refs; omitting them from deps is intentional and keeps identities stable.
2
2
  /* oxlint-disable react-hooks/exhaustive-deps */
3
3
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";
4
- import { useMessageScrollerCommands } from "#/hooks/use-message-scroller-commands";
5
- import { useMessageScrollerRefs } from "#/hooks/use-message-scroller-refs";
6
- import { getContentBottom, getElementTop, getElementViewportTop, getFirstVisibleMessageItem, getFlexGap, getLastScrollAnchor, getMessageScrollerItems, getMessageScrollerScrollable, getMessageScrollerVisibilityState, getNewScrollAnchor, getUnanchoredScrollAnchor, hasMultipleNewScrollAnchors, } from "#/lib/message-scroller/geometry";
7
- import { DEFAULT_SCROLL_EDGE_THRESHOLD, DEFAULT_SCROLL_MARGIN, DEFAULT_SCROLL_PREVIOUS_ITEM_PEEK, EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE, SCROLL_POSITION_EPSILON, } from "#/lib/message-scroller/types";
4
+ import { useMessageScrollerCommands } from "#hooks/use-message-scroller-commands";
5
+ import { useMessageScrollerRefs } from "#hooks/use-message-scroller-refs";
6
+ import { getContentBottom, getElementTop, getElementViewportTop, getFirstVisibleMessageItem, getFlexGap, getLastScrollAnchor, getMessageScrollerItems, getMessageScrollerScrollable, getMessageScrollerVisibilityState, getNewScrollAnchor, getUnanchoredScrollAnchor, hasMultipleNewScrollAnchors, } from "#lib/message-scroller/geometry";
7
+ import { DEFAULT_SCROLL_EDGE_THRESHOLD, DEFAULT_SCROLL_MARGIN, DEFAULT_SCROLL_PREVIOUS_ITEM_PEEK, EMPTY_MESSAGE_SCROLLER_VISIBILITY_STATE, SCROLL_POSITION_EPSILON, } from "#lib/message-scroller/types";
8
8
  // Builds a ref callback that stores the node and runs onMount once it attaches.
9
9
  function useElementRef(elementRef, onMount) {
10
10
  return useCallback((element) => {
@@ -1,5 +1,5 @@
1
1
  import type { RefObject } from "react";
2
- import type { MessageScrollerMode, MessageScrollerScrollable, MessageScrollerScrollOptions, MessageScrollerStore, MessageScrollerVisibilityStore } from "#/lib/message-scroller/types";
2
+ import type { MessageScrollerMode, MessageScrollerScrollable, MessageScrollerScrollOptions, MessageScrollerStore, MessageScrollerVisibilityStore } from "#lib/message-scroller/types";
3
3
  /**
4
4
  * Shared mutable ref bag for one MessageScroller, closed over by both the
5
5
  * controller and the commands so writes are visible across them without prop
@@ -1,7 +1,7 @@
1
1
  import { useRef, useState } from "react";
2
- import { useLatest } from "#/hooks/use-latest";
3
- import { areScrollStatesEqual, createMessageScrollerStore, createMessageScrollerVisibilityStore, } from "#/lib/message-scroller/stores";
4
- import { EMPTY_MESSAGE_SCROLLER_SCROLLABLE } from "#/lib/message-scroller/types";
2
+ import { useLatest } from "#hooks/use-latest";
3
+ import { areScrollStatesEqual, createMessageScrollerStore, createMessageScrollerVisibilityStore, } from "#lib/message-scroller/stores";
4
+ import { EMPTY_MESSAGE_SCROLLER_SCROLLABLE } from "#lib/message-scroller/types";
5
5
  /**
6
6
  * Builds the per-instance ref bag: the two external stores constructed once, and
7
7
  * the latest prop values mirrored onto refs at commit so callbacks stay stable.