@justanarthur/modo-ui 2.4.0 → 2.6.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 (62) hide show
  1. package/blocks/desktop-shell/index.tsx +3 -2
  2. package/components/data-display/diff/index.tsx +5 -4
  3. package/components/data-display/markdown/index.tsx +6 -6
  4. package/components/navigation/sidebar/index.tsx +48 -1
  5. package/components/navigation/tabs/list.tsx +1 -5
  6. package/dist/blocks/desktop-shell/index.js +5 -5
  7. package/dist/blocks/sidebar-app/index.js +6 -6
  8. package/dist/components/containers/accordion/index.js +2 -2
  9. package/dist/components/containers/card/index.js +2 -2
  10. package/dist/components/data-display/diff/index.d.ts +2 -1
  11. package/dist/components/data-display/diff/index.js +3 -2
  12. package/dist/components/data-display/markdown/index.js +5 -5
  13. package/dist/components/data-display/table/index.js +2 -2
  14. package/dist/components/inputs/combobox/index.js +3 -2
  15. package/dist/components/inputs/search/index.js +4 -3
  16. package/dist/components/inputs/select/index.js +3 -2
  17. package/dist/components/inputs/textarea/index.js +3 -3
  18. package/dist/components/navigation/breadcrumb/index.js +4 -4
  19. package/dist/components/navigation/sidebar/index.js +3 -3
  20. package/dist/components/navigation/tabs/index.js +1 -1
  21. package/dist/components/overlays/command/index.js +3 -2
  22. package/dist/components/overlays/context-menu/index.js +4 -4
  23. package/dist/components/overlays/dropdown/index.js +3 -3
  24. package/dist/docs/index.js +4 -4
  25. package/dist/index.d.ts +15 -7
  26. package/dist/index.js +22 -22
  27. package/dist/lib/use-autosize-textarea.d.ts +6 -4
  28. package/dist/lib/use-autosize-textarea.js +1 -1
  29. package/dist/primitives/content/code/index.d.ts +3 -1
  30. package/dist/primitives/content/code/index.js +3 -2
  31. package/dist/primitives/layout/resizable/index.js +1 -1
  32. package/dist/primitives/layout/scroll-area/index.d.ts +4 -1
  33. package/dist/primitives/layout/scroll-area/index.js +2 -1
  34. package/dist/shared/{components-8xe4h118.js → components-3fg6vabb.js} +1 -4
  35. package/dist/shared/{components-esy5nsvc.js → components-5fet4gqt.js} +71 -7
  36. package/dist/shared/{components-y4gsk1jt.js → components-60tf8tfa.js} +10 -6
  37. package/dist/shared/components-7v6ncqfc.js +80 -0
  38. package/dist/shared/{components-sh8j39z3.js → components-8swhfkqn.js} +1 -1
  39. package/dist/shared/{components-pwsqp2np.js → components-94vd4ck1.js} +1 -1
  40. package/dist/shared/{components-rgdspnth.js → components-9c3m65ft.js} +1 -1
  41. package/dist/shared/{components-xq8j9c2f.js → components-a8bcq2yc.js} +1 -1
  42. package/dist/shared/{components-cc9kfhkb.js → components-bkg1k36x.js} +46 -11
  43. package/dist/shared/{components-qmkfpcw0.js → components-faym1xm6.js} +1 -1
  44. package/dist/shared/{components-gr82tz50.js → components-fbs2602j.js} +4 -3
  45. package/dist/shared/{components-ypxst3cn.js → components-ftvy33w9.js} +1 -1
  46. package/dist/shared/{components-0bvxny7s.js → components-hhwv5mcm.js} +5 -4
  47. package/dist/shared/{components-pw6gzev8.js → components-s0c8gngv.js} +6 -6
  48. package/dist/shared/{components-fv9y76b0.js → components-swh0v27s.js} +4 -2
  49. package/dist/shared/{components-s0megs1g.js → components-whfr55xn.js} +3 -3
  50. package/dist/shared/{components-greka6z2.js → components-z6wx8fzj.js} +1 -1
  51. package/dist/shared/{components-hjdv4y8d.js → components-zjeh9zk2.js} +1 -1
  52. package/dist/styles.css +2 -1
  53. package/lib/use-autosize-textarea.ts +65 -18
  54. package/package.json +6 -1
  55. package/primitives/content/code/index.tsx +11 -6
  56. package/primitives/layout/resizable/index.tsx +15 -6
  57. package/primitives/layout/scroll-area/examples.mdx +16 -0
  58. package/primitives/layout/scroll-area/index.tsx +89 -9
  59. package/dist/shared/components-vpkh6j83.js +0 -42
  60. /package/dist/shared/{components-v1zzr668.js → components-arg4h26d.js} +0 -0
  61. /package/dist/shared/{components-0ep66sg9.js → components-dx8f797z.js} +0 -0
  62. /package/dist/shared/{components-rtwfh1gc.js → components-fzmjcn38.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1397,7 +1397,8 @@ type Element_12xgc9 = JSX_1kxb9["Element"];
1397
1397
  * added line is tinted with the success hue and each removed line with the
1398
1398
  * error hue, as tinted text on a wash rather than a solid fill; hunk headers
1399
1399
  * sit on the hover overlay. With a `path` the header counts the change
1400
- * (`+12 −3`). Long lines scroll sideways under a fading edge, or with
1400
+ * (`+12 −3`). Long lines scroll sideways under a fading edge (on the
1401
+ * platform's scrollbar, as Code does), or with
1401
1402
  * `wrap` break under their own text while the gutter holds still, and the
1402
1403
  * frame lifts one surface step above whatever holds it, as Code does.
1403
1404
  *
@@ -6117,10 +6118,12 @@ interface AutosizeRows {
6117
6118
  }
6118
6119
  /**
6119
6120
  * Sizes the textarea to its content between `minRows` and `maxRows`, then
6120
- * scrolls. It measures before paint whenever `deps` change (pass the value
6121
- * and anything else that changes the text's height, such as the size step),
6122
- * and again when the textarea's width changes. Returns the measure, for a
6123
- * caller that changes the content outside React.
6121
+ * scrolls. Where the browser supports `field-sizing: content`, the box sizes
6122
+ * itself between a `min-height` and `max-height` in line units. Elsewhere it
6123
+ * measures before paint whenever `deps` change (pass the value and anything
6124
+ * else that changes the text's height, such as the size step), and when the
6125
+ * textarea's width changes. Returns the measure, for a caller that changes
6126
+ * the content outside React.
6124
6127
  */
6125
6128
  declare function useAutosizeTextarea(ref: RefObject16<HTMLTextAreaElement | null>, { minRows, maxRows }: AutosizeRows, deps: DependencyList): () => void;
6126
6129
  type SetState<
@@ -6149,7 +6152,9 @@ type Element_12xgc52 = JSX_1kxb52["Element"];
6149
6152
  *
6150
6153
  * sugar-high tokenizes; each token type takes a `--syntax-*` token from
6151
6154
  * tokens/colors.css, so code follows light and dark like everything else.
6152
- * Long lines scroll sideways under a fading edge instead of wrapping. It is
6155
+ * Long lines scroll sideways under a fading edge instead of wrapping, on the
6156
+ * platform's own scrollbar (ScrollArea's `native`), so hundreds of blocks
6157
+ * cost nothing while their column resizes. It is
6153
6158
  * also the docs chrome's Code slot: every example's source and every fenced
6154
6159
  * block on these pages renders through it.
6155
6160
  *
@@ -6272,6 +6277,8 @@ interface ScrollAreaProps extends ComponentPropsWithoutRef15<"div"> {
6272
6277
  viewportClassName?: string;
6273
6278
  /** Which axes get scrollbars. Defaults to `"vertical"`. */
6274
6279
  orientation?: Orientation;
6280
+ /** Native overflow scrolling with the platform's own scrollbar (an overlay one on macOS), as on touch: no observers and no re-render on resize, for scrollers that come by the hundred, such as code blocks. Defaults to `false`. */
6281
+ native?: boolean;
6275
6282
  /** Classes for the outer container — set the height/width constraint here. */
6276
6283
  className?: string;
6277
6284
  /** The scrolling content. Give it an intrinsic size (`w-max`, `whitespace-nowrap`) to overflow horizontally. */
@@ -6292,7 +6299,8 @@ type ScrollAreaComponent = ForwardRefExoticComponent20<ScrollAreaProps & RefAttr
6292
6299
  * goes on the inner scrolling viewport, where the `scroll-fade` (or
6293
6300
  * `scroll-fade-x`) utility dissolves the edges that have more to scroll. On
6294
6301
  * touch-primary devices the whole thing steps aside for native overflow
6295
- * scrolling. Built on Base UI's ScrollArea; scrollbar machinery adapted from
6302
+ * scrolling, and `native` does the same anywhere: the fade stays (it is
6303
+ * CSS), the drawn thumb gives way to the platform's. Built on Base UI's ScrollArea; scrollbar machinery adapted from
6296
6304
  * Lina (https://lina.sameer.sh).
6297
6305
  *
6298
6306
  * Statics:
package/dist/index.js CHANGED
@@ -34,13 +34,14 @@ import {
34
34
  import {
35
35
  useControllableState2
36
36
  } from "./shared/components-wwd093xg.js";
37
+ import"./shared/components-v2j3jx89.js";
37
38
  import {
38
39
  useTouchPrimary2
39
40
  } from "./shared/components-6f5pyzb2.js";
40
41
  import {
41
42
  ScrollArea2,
42
43
  ScrollBar2
43
- } from "./shared/components-esy5nsvc.js";
44
+ } from "./shared/components-5fet4gqt.js";
44
45
  import"./shared/components-pva1wj1r.js";
45
46
  import {
46
47
  useMorph2
@@ -93,7 +94,6 @@ import {
93
94
  FluidHoverHighlight2
94
95
  } from "./shared/components-9b2m90st.js";
95
96
  import"./shared/components-5wykqxph.js";
96
- import"./shared/components-v2j3jx89.js";
97
97
  import {
98
98
  SidebarSelection2,
99
99
  SIDEBAR_COOKIE_NAME2,
@@ -131,7 +131,7 @@ import {
131
131
  SidebarRail2,
132
132
  Sidebar2,
133
133
  SidebarContent2
134
- } from "./shared/components-cc9kfhkb.js";
134
+ } from "./shared/components-bkg1k36x.js";
135
135
  import"./shared/components-2myjk2zf.js";
136
136
  import"./shared/components-y09nr7fe.js";
137
137
  import {
@@ -151,10 +151,10 @@ import {
151
151
  ResizablePanel2,
152
152
  ResizableHandle2,
153
153
  Resizable2
154
- } from "./shared/components-gr82tz50.js";
154
+ } from "./shared/components-fbs2602j.js";
155
155
  import {
156
156
  DesktopShell2
157
- } from "./shared/components-0bvxny7s.js";
157
+ } from "./shared/components-hhwv5mcm.js";
158
158
  import {
159
159
  ShellCard2
160
160
  } from "./shared/components-hh1g7r3t.js";
@@ -185,12 +185,12 @@ import {
185
185
  DropdownTrigger2,
186
186
  DropdownContent2,
187
187
  DropdownSeparator2
188
- } from "./shared/components-pwsqp2np.js";
188
+ } from "./shared/components-94vd4ck1.js";
189
189
  import {
190
190
  SidebarInsetTopbar2,
191
191
  SidebarSearchField2,
192
192
  SidebarApp2
193
- } from "./shared/components-s0megs1g.js";
193
+ } from "./shared/components-whfr55xn.js";
194
194
  import"./shared/components-j3q9kaps.js";
195
195
  import {
196
196
  CardGroup2,
@@ -207,7 +207,7 @@ import {
207
207
  CardEyebrow2,
208
208
  CardDivider2,
209
209
  Card2
210
- } from "./shared/components-rtwfh1gc.js";
210
+ } from "./shared/components-fzmjcn38.js";
211
211
  import {
212
212
  Separator2
213
213
  } from "./shared/components-azrjnfxn.js";
@@ -227,7 +227,7 @@ import {
227
227
  Accordion2,
228
228
  AccordionItem2,
229
229
  AccordionTrigger2
230
- } from "./shared/components-v1zzr668.js";
230
+ } from "./shared/components-arg4h26d.js";
231
231
  import {
232
232
  AvatarImage2,
233
233
  AvatarFallback2,
@@ -236,7 +236,7 @@ import {
236
236
  import {
237
237
  parsePatch2,
238
238
  Diff2
239
- } from "./shared/components-fv9y76b0.js";
239
+ } from "./shared/components-swh0v27s.js";
240
240
  import {
241
241
  Kbd2
242
242
  } from "./shared/components-g8qgr7p8.js";
@@ -256,7 +256,7 @@ import {
256
256
  } from "./shared/components-s2pnh8h9.js";
257
257
  import {
258
258
  Code2
259
- } from "./shared/components-y4gsk1jt.js";
259
+ } from "./shared/components-60tf8tfa.js";
260
260
  import {
261
261
  TableHead2,
262
262
  TableHeader2,
@@ -267,11 +267,11 @@ import {
267
267
  TableCell2,
268
268
  TableEmpty2,
269
269
  Table2
270
- } from "./shared/components-0ep66sg9.js";
270
+ } from "./shared/components-dx8f797z.js";
271
271
  import {
272
272
  MarkdownProse2,
273
273
  Markdown2
274
- } from "./shared/components-pw6gzev8.js";
274
+ } from "./shared/components-s0c8gngv.js";
275
275
  import {
276
276
  Sparkline2
277
277
  } from "./shared/components-nw2k1pg9.js";
@@ -318,7 +318,7 @@ import {
318
318
  ComboboxItem2,
319
319
  ComboboxEmpty2,
320
320
  Combobox2
321
- } from "./shared/components-qmkfpcw0.js";
321
+ } from "./shared/components-faym1xm6.js";
322
322
  import"./shared/components-29ebea21.js";
323
323
  import"./shared/components-zckgawt6.js";
324
324
  import {
@@ -390,10 +390,10 @@ import {
390
390
  CommandTrigger2,
391
391
  CommandContent2,
392
392
  Command2
393
- } from "./shared/components-greka6z2.js";
393
+ } from "./shared/components-z6wx8fzj.js";
394
394
  import {
395
395
  Search2
396
- } from "./shared/components-rgdspnth.js";
396
+ } from "./shared/components-9c3m65ft.js";
397
397
  import"./shared/components-tcyz2tdn.js";
398
398
  import {
399
399
  SelectValue2,
@@ -404,21 +404,21 @@ import {
404
404
  SelectLabel2,
405
405
  SelectSeparator2,
406
406
  Select2
407
- } from "./shared/components-xq8j9c2f.js";
407
+ } from "./shared/components-a8bcq2yc.js";
408
408
  import {
409
409
  Switch2,
410
410
  SwitchGroup2
411
411
  } from "./shared/components-vcmky8ns.js";
412
412
  import {
413
413
  useAutosizeTextarea2
414
- } from "./shared/components-vpkh6j83.js";
414
+ } from "./shared/components-7v6ncqfc.js";
415
415
  import {
416
416
  Textarea2
417
- } from "./shared/components-ypxst3cn.js";
417
+ } from "./shared/components-ftvy33w9.js";
418
418
  import {
419
419
  BreadcrumbItem2,
420
420
  Breadcrumb2
421
- } from "./shared/components-sh8j39z3.js";
421
+ } from "./shared/components-8swhfkqn.js";
422
422
  import {
423
423
  NavigationMenuContent2,
424
424
  NavigationMenuIndicator2,
@@ -436,7 +436,7 @@ import {
436
436
  TabsList2,
437
437
  Tabs2,
438
438
  TabPanel2
439
- } from "./shared/components-8xe4h118.js";
439
+ } from "./shared/components-3fg6vabb.js";
440
440
  import {
441
441
  Tree2
442
442
  } from "./shared/components-fymenepq.js";
@@ -450,7 +450,7 @@ import {
450
450
  ContextMenuContent2,
451
451
  ContextMenu2,
452
452
  ContextMenuItem2
453
- } from "./shared/components-hjdv4y8d.js";
453
+ } from "./shared/components-zjeh9zk2.js";
454
454
  import {
455
455
  LightboxTrigger2,
456
456
  Lightbox2
@@ -7,10 +7,12 @@ interface AutosizeRows {
7
7
  }
8
8
  /**
9
9
  * Sizes the textarea to its content between `minRows` and `maxRows`, then
10
- * scrolls. It measures before paint whenever `deps` change (pass the value
11
- * and anything else that changes the text's height, such as the size step),
12
- * and again when the textarea's width changes. Returns the measure, for a
13
- * caller that changes the content outside React.
10
+ * scrolls. Where the browser supports `field-sizing: content`, the box sizes
11
+ * itself between a `min-height` and `max-height` in line units. Elsewhere it
12
+ * measures before paint whenever `deps` change (pass the value and anything
13
+ * else that changes the text's height, such as the size step), and when the
14
+ * textarea's width changes. Returns the measure, for a caller that changes
15
+ * the content outside React.
14
16
  */
15
17
  declare function useAutosizeTextarea(ref: RefObject<HTMLTextAreaElement | null>, { minRows, maxRows }: AutosizeRows, deps: DependencyList): () => void;
16
18
  export { useAutosizeTextarea };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useAutosizeTextarea2
3
- } from "../shared/components-vpkh6j83.js";
3
+ } from "../shared/components-7v6ncqfc.js";
4
4
  import"../shared/components-v2j3jx89.js";
5
5
  export {
6
6
  useAutosizeTextarea2 as useAutosizeTextarea
@@ -6,7 +6,9 @@ type Element_12xgc = JSX_1kxb["Element"];
6
6
  *
7
7
  * sugar-high tokenizes; each token type takes a `--syntax-*` token from
8
8
  * tokens/colors.css, so code follows light and dark like everything else.
9
- * Long lines scroll sideways under a fading edge instead of wrapping. It is
9
+ * Long lines scroll sideways under a fading edge instead of wrapping, on the
10
+ * platform's own scrollbar (ScrollArea's `native`), so hundreds of blocks
11
+ * cost nothing while their column resizes. It is
10
12
  * also the docs chrome's Code slot: every example's source and every fenced
11
13
  * block on these pages renders through it.
12
14
  *
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  Code2
3
- } from "../../../shared/components-y4gsk1jt.js";
3
+ } from "../../../shared/components-60tf8tfa.js";
4
4
  import"../../../shared/components-ceyn28cf.js";
5
5
  import"../../../shared/components-nwa2a9tq.js";
6
- import"../../../shared/components-esy5nsvc.js";
6
+ import"../../../shared/components-5fet4gqt.js";
7
7
  import"../../../shared/components-6f5pyzb2.js";
8
+ import"../../../shared/components-v2j3jx89.js";
8
9
  import"../../../shared/components-kxpcj2ry.js";
9
10
  import"../../../shared/components-s217vq1n.js";
10
11
  import"../../../shared/components-xnp09586.js";
@@ -3,7 +3,7 @@ import {
3
3
  ResizableHandle2,
4
4
  Resizable2,
5
5
  resizable_default
6
- } from "../../../shared/components-gr82tz50.js";
6
+ } from "../../../shared/components-fbs2602j.js";
7
7
  import"../../../shared/components-45r18egt.js";
8
8
  import"../../../shared/components-wwd093xg.js";
9
9
  import"../../../shared/components-tz0axc0f.js";
@@ -6,6 +6,8 @@ interface ScrollAreaProps extends ComponentPropsWithoutRef<"div"> {
6
6
  viewportClassName?: string;
7
7
  /** Which axes get scrollbars. Defaults to `"vertical"`. */
8
8
  orientation?: Orientation;
9
+ /** Native overflow scrolling with the platform's own scrollbar (an overlay one on macOS), as on touch: no observers and no re-render on resize, for scrollers that come by the hundred, such as code blocks. Defaults to `false`. */
10
+ native?: boolean;
9
11
  /** Classes for the outer container — set the height/width constraint here. */
10
12
  className?: string;
11
13
  /** The scrolling content. Give it an intrinsic size (`w-max`, `whitespace-nowrap`) to overflow horizontally. */
@@ -26,7 +28,8 @@ type ScrollAreaComponent = ForwardRefExoticComponent<ScrollAreaProps & RefAttrib
26
28
  * goes on the inner scrolling viewport, where the `scroll-fade` (or
27
29
  * `scroll-fade-x`) utility dissolves the edges that have more to scroll. On
28
30
  * touch-primary devices the whole thing steps aside for native overflow
29
- * scrolling. Built on Base UI's ScrollArea; scrollbar machinery adapted from
31
+ * scrolling, and `native` does the same anywhere: the fade stays (it is
32
+ * CSS), the drawn thumb gives way to the platform's. Built on Base UI's ScrollArea; scrollbar machinery adapted from
30
33
  * Lina (https://lina.sameer.sh).
31
34
  *
32
35
  * Statics:
@@ -2,8 +2,9 @@ import {
2
2
  ScrollArea2,
3
3
  ScrollBar2,
4
4
  scroll_area_default
5
- } from "../../../shared/components-esy5nsvc.js";
5
+ } from "../../../shared/components-5fet4gqt.js";
6
6
  import"../../../shared/components-6f5pyzb2.js";
7
+ import"../../../shared/components-v2j3jx89.js";
7
8
  import"../../../shared/components-kxpcj2ry.js";
8
9
  import"../../../shared/components-s217vq1n.js";
9
10
  import"../../../shared/components-xnp09586.js";
@@ -216,7 +216,7 @@ var TabsList2 = forwardRef2(({ children, className, activateOnFocus, ...props },
216
216
  const size = useSize2();
217
217
  const lift = useLift2(3);
218
218
  const hover = useFluidHover2(containerRef, { axis: "x" });
219
- const { activeIndex: hoveredIndex, setActiveIndex, itemRects, handlers, registerItem, measureItems } = hover;
219
+ const { activeIndex: hoveredIndex, setActiveIndex, itemRects, handlers, registerItem } = hover;
220
220
  const focus = useRowFocus2(hover);
221
221
  const items = Children.toArray(children).filter(isValidElement).map((child) => child.props);
222
222
  const values = items.map((item) => item.value);
@@ -225,9 +225,6 @@ var TabsList2 = forwardRef2(({ children, className, activateOnFocus, ...props },
225
225
  useLayoutEffect(() => {
226
226
  setFallback(first);
227
227
  }, [first, setFallback]);
228
- useEffect2(() => {
229
- measureItems();
230
- }, [measureItems, children]);
231
228
  const selectedIndex = selectedValue === undefined ? -1 : values.indexOf(selectedValue);
232
229
  const [optimisticIndex, setOptimisticIndex] = useState2(null);
233
230
  useEffect2(() => {
@@ -3,6 +3,9 @@
3
3
  import {
4
4
  useShape2
5
5
  } from "./components-kxpcj2ry.js";
6
+ import {
7
+ useIsoLayoutEffect2
8
+ } from "./components-v2j3jx89.js";
6
9
  import {
7
10
  useTouchPrimary2
8
11
  } from "./components-6f5pyzb2.js";
@@ -15,7 +18,8 @@ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
15
18
  import {
16
19
  createContext,
17
20
  forwardRef,
18
- useContext
21
+ useContext,
22
+ useRef
19
23
  } from "react";
20
24
  import { jsx, jsxs } from "react/jsx-runtime";
21
25
  /*!
@@ -24,12 +28,70 @@ import { jsx, jsxs } from "react/jsx-runtime";
24
28
  * MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
25
29
  * Local changes: see PORTING.md.
26
30
  */
31
+ if (typeof CSS !== "undefined" && "registerProperty" in CSS) {
32
+ for (const edge of ["x-start", "x-end", "y-start", "y-end"]) {
33
+ try {
34
+ CSS.registerProperty({
35
+ name: `--scroll-area-overflow-${edge}`,
36
+ syntax: "<length>",
37
+ inherits: false,
38
+ initialValue: "0px"
39
+ });
40
+ } catch {}
41
+ }
42
+ }
27
43
  var ScrollAreaContext = createContext(false);
28
- var ScrollArea2 = forwardRef(({ className, children, viewportClassName, orientation = "vertical", ...props }, ref) => {
29
- const isTouch = useTouchPrimary2();
44
+ var viewportOf = new WeakMap;
45
+ var edgeObserver;
46
+ function setEdge(viewport, edge, distance) {
47
+ const name = `--scroll-area-overflow-${edge}`;
48
+ const value = `${Math.max(0, Math.round(distance))}px`;
49
+ if (viewport.style.getPropertyValue(name) !== value)
50
+ viewport.style.setProperty(name, value);
51
+ }
52
+ function writeEdges(viewport) {
53
+ const { scrollLeft, scrollTop, scrollWidth, scrollHeight, clientWidth, clientHeight } = viewport;
54
+ setEdge(viewport, "x-start", scrollLeft);
55
+ setEdge(viewport, "x-end", scrollWidth - clientWidth - scrollLeft);
56
+ setEdge(viewport, "y-start", scrollTop);
57
+ setEdge(viewport, "y-end", scrollHeight - clientHeight - scrollTop);
58
+ }
59
+ function trackEdges(viewport) {
60
+ edgeObserver ??= new ResizeObserver((entries) => {
61
+ const seen = new Set;
62
+ for (const { target } of entries) {
63
+ const area = viewportOf.get(target);
64
+ if (!area || seen.has(area))
65
+ continue;
66
+ seen.add(area);
67
+ writeEdges(area);
68
+ }
69
+ });
70
+ const observer = edgeObserver;
71
+ const targets = [viewport, ...viewport.children];
72
+ for (const target of targets) {
73
+ viewportOf.set(target, viewport);
74
+ observer.observe(target);
75
+ }
76
+ const onScroll = () => writeEdges(viewport);
77
+ viewport.addEventListener("scroll", onScroll, { passive: true });
78
+ return () => {
79
+ for (const target of targets)
80
+ observer.unobserve(target);
81
+ viewport.removeEventListener("scroll", onScroll);
82
+ };
83
+ }
84
+ var ScrollArea2 = forwardRef(({ className, children, viewportClassName, orientation = "vertical", native = false, ...props }, ref) => {
85
+ const isNative = useTouchPrimary2() || native;
86
+ const viewportRef = useRef(null);
87
+ useIsoLayoutEffect2(() => {
88
+ const viewport = viewportRef.current;
89
+ if (isNative && viewport)
90
+ return trackEdges(viewport);
91
+ }, [isNative, children]);
30
92
  return /* @__PURE__ */ jsx(ScrollAreaContext.Provider, {
31
- value: isTouch,
32
- children: isTouch ? /* @__PURE__ */ jsx("div", {
93
+ value: isNative,
94
+ children: isNative ? /* @__PURE__ */ jsx("div", {
33
95
  ref,
34
96
  role: "group",
35
97
  "data-slot": "scroll-area",
@@ -37,7 +99,9 @@ var ScrollArea2 = forwardRef(({ className, children, viewportClassName, orientat
37
99
  className: cn2("relative overflow-hidden", className),
38
100
  ...props,
39
101
  children: /* @__PURE__ */ jsx("div", {
102
+ ref: viewportRef,
40
103
  "data-slot": "scroll-area-viewport",
104
+ "data-scroll-edges": "",
41
105
  className: cn2("size-full rounded-[inherit]", orientation === "vertical" && "overflow-y-auto", orientation === "horizontal" && "overflow-x-auto", orientation === "both" && "overflow-auto", viewportClassName),
42
106
  tabIndex: 0,
43
107
  children
@@ -69,9 +133,9 @@ var ScrollArea2 = forwardRef(({ className, children, viewportClassName, orientat
69
133
  });
70
134
  ScrollArea2.displayName = "ScrollArea";
71
135
  var ScrollBar2 = forwardRef(({ className, orientation = "vertical", ...props }, ref) => {
72
- const isTouch = useContext(ScrollAreaContext);
136
+ const isNative = useContext(ScrollAreaContext);
73
137
  const shape = useShape2();
74
- if (isTouch)
138
+ if (isNative)
75
139
  return null;
76
140
  return /* @__PURE__ */ jsx(ScrollAreaPrimitive.Scrollbar, {
77
141
  ref,
@@ -11,10 +11,10 @@ import {
11
11
  } from "./components-xnp09586.js";
12
12
  import {
13
13
  scroll_area_default
14
- } from "./components-esy5nsvc.js";
14
+ } from "./components-5fet4gqt.js";
15
15
 
16
16
  // primitives/content/code/index.tsx
17
- import { Fragment } from "react";
17
+ import { Fragment, useMemo } from "react";
18
18
  import { parse } from "sugar-high/core";
19
19
  import { lang, languages } from "sugar-high/lang";
20
20
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -50,17 +50,21 @@ function Code2({
50
50
  className
51
51
  }) {
52
52
  const level = useLift2(1);
53
- const source = children.trim();
54
53
  const id = lang(language);
54
+ const code = useMemo(() => {
55
+ const source = children.trim();
56
+ return /* @__PURE__ */ jsx("code", {
57
+ children: id && id !== "plaintext" ? highlight(source, id) : source
58
+ });
59
+ }, [children, id]);
55
60
  return /* @__PURE__ */ jsx(scroll_area_default, {
61
+ native: true,
56
62
  orientation: "horizontal",
57
63
  viewportClassName: "scroll-fade-x",
58
64
  className: cn2("rounded-xl", SURFACE_BG2[level], className),
59
65
  children: /* @__PURE__ */ jsx("pre", {
60
66
  className: "m-0 w-max min-w-full p-4 font-mono text-caption leading-relaxed text-foreground",
61
- children: /* @__PURE__ */ jsx("code", {
62
- children: id && id !== "plaintext" ? highlight(source, id) : source
63
- })
67
+ children: code
64
68
  })
65
69
  });
66
70
  }
@@ -0,0 +1,80 @@
1
+ "use client";
2
+
3
+ import {
4
+ useIsoLayoutEffect2
5
+ } from "./components-v2j3jx89.js";
6
+
7
+ // lib/use-autosize-textarea.ts
8
+ import { useCallback, useEffect } from "react";
9
+ var nativeSizing = typeof CSS !== "undefined" && CSS.supports("field-sizing", "content");
10
+ function lineHeightOf(el) {
11
+ const style = getComputedStyle(el);
12
+ return Number.parseFloat(style.lineHeight) || Number.parseFloat(style.fontSize) * 1.2;
13
+ }
14
+ function fit(el, height, max) {
15
+ const next = `${Math.min(height, max)}px`;
16
+ const overflow = height > max ? "auto" : "hidden";
17
+ if (el.style.height !== next)
18
+ el.style.height = next;
19
+ if (el.style.overflowY !== overflow)
20
+ el.style.overflowY = overflow;
21
+ }
22
+ function useAutosizeTextarea2(ref, { minRows, maxRows }, deps) {
23
+ const measure = useCallback((grow) => {
24
+ const el = ref.current;
25
+ if (!el || nativeSizing)
26
+ return;
27
+ const line = lineHeightOf(el);
28
+ const floor = line * minRows;
29
+ const max = line * Math.max(maxRows, minRows);
30
+ if (el.value === "" && minRows >= 1)
31
+ return fit(el, floor, max);
32
+ if (!grow)
33
+ el.style.height = "auto";
34
+ fit(el, Math.max(el.scrollHeight, floor), max);
35
+ }, [ref, minRows, maxRows]);
36
+ const resize = useCallback(() => measure(false), [measure]);
37
+ useIsoLayoutEffect2(() => {
38
+ const el = ref.current;
39
+ if (!el || !nativeSizing)
40
+ return;
41
+ el.style.setProperty("field-sizing", "content");
42
+ el.style.minHeight = `${minRows}lh`;
43
+ el.style.maxHeight = `${Math.max(maxRows, minRows)}lh`;
44
+ el.style.overflowY = "auto";
45
+ }, [ref, minRows, maxRows]);
46
+ useIsoLayoutEffect2(resize, [resize, ...deps]);
47
+ useEffect(() => {
48
+ const el = ref.current;
49
+ if (!el || nativeSizing)
50
+ return;
51
+ let width = el.offsetWidth;
52
+ let frame = 0;
53
+ const observer = new ResizeObserver(() => {
54
+ const next = el.offsetWidth;
55
+ const wider = next > width;
56
+ if (next === width)
57
+ return;
58
+ width = next;
59
+ if (el.value === "")
60
+ return;
61
+ if (!wider) {
62
+ if (el.scrollHeight > el.clientHeight)
63
+ measure(true);
64
+ return;
65
+ }
66
+ frame ||= requestAnimationFrame(() => {
67
+ frame = 0;
68
+ resize();
69
+ });
70
+ });
71
+ observer.observe(el);
72
+ return () => {
73
+ observer.disconnect();
74
+ cancelAnimationFrame(frame);
75
+ };
76
+ }, [ref, measure, resize]);
77
+ return resize;
78
+ }
79
+
80
+ export { useAutosizeTextarea2 };
@@ -24,7 +24,7 @@ import {
24
24
  } from "./components-nz14rwtd.js";
25
25
  import {
26
26
  dropdown_default
27
- } from "./components-pwsqp2np.js";
27
+ } from "./components-94vd4ck1.js";
28
28
 
29
29
  // components/navigation/breadcrumb/index.tsx
30
30
  import { Children, isValidElement, useLayoutEffect, useRef, useState } from "react";
@@ -91,7 +91,7 @@ import {
91
91
  } from "./components-nxqrw789.js";
92
92
  import {
93
93
  ScrollArea2
94
- } from "./components-esy5nsvc.js";
94
+ } from "./components-5fet4gqt.js";
95
95
 
96
96
  // components/overlays/dropdown/index.tsx
97
97
  import { Menu as Menu4 } from "@base-ui/react/menu";
@@ -48,7 +48,7 @@ import {
48
48
  CommandListRoot2,
49
49
  CommandShortcut2,
50
50
  CommandList2
51
- } from "./components-greka6z2.js";
51
+ } from "./components-z6wx8fzj.js";
52
52
 
53
53
  // components/inputs/search/index.tsx
54
54
  import { Autocomplete } from "@base-ui/react/autocomplete";
@@ -72,7 +72,7 @@ import {
72
72
  } from "./components-tcyz2tdn.js";
73
73
  import {
74
74
  ScrollArea2
75
- } from "./components-esy5nsvc.js";
75
+ } from "./components-5fet4gqt.js";
76
76
  import {
77
77
  SizeScope2
78
78
  } from "./components-nz14rwtd.js";