@justanarthur/modo-ui 2.5.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 (61) 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/tabs/list.tsx +1 -5
  5. package/dist/blocks/desktop-shell/index.js +5 -5
  6. package/dist/blocks/sidebar-app/index.js +6 -6
  7. package/dist/components/containers/accordion/index.js +2 -2
  8. package/dist/components/containers/card/index.js +2 -2
  9. package/dist/components/data-display/diff/index.d.ts +2 -1
  10. package/dist/components/data-display/diff/index.js +3 -2
  11. package/dist/components/data-display/markdown/index.js +5 -5
  12. package/dist/components/data-display/table/index.js +2 -2
  13. package/dist/components/inputs/combobox/index.js +3 -2
  14. package/dist/components/inputs/search/index.js +4 -3
  15. package/dist/components/inputs/select/index.js +3 -2
  16. package/dist/components/inputs/textarea/index.js +3 -3
  17. package/dist/components/navigation/breadcrumb/index.js +4 -4
  18. package/dist/components/navigation/sidebar/index.js +3 -3
  19. package/dist/components/navigation/tabs/index.js +1 -1
  20. package/dist/components/overlays/command/index.js +3 -2
  21. package/dist/components/overlays/context-menu/index.js +4 -4
  22. package/dist/components/overlays/dropdown/index.js +3 -3
  23. package/dist/docs/index.js +4 -4
  24. package/dist/index.d.ts +15 -7
  25. package/dist/index.js +22 -22
  26. package/dist/lib/use-autosize-textarea.d.ts +6 -4
  27. package/dist/lib/use-autosize-textarea.js +1 -1
  28. package/dist/primitives/content/code/index.d.ts +3 -1
  29. package/dist/primitives/content/code/index.js +3 -2
  30. package/dist/primitives/layout/resizable/index.js +1 -1
  31. package/dist/primitives/layout/scroll-area/index.d.ts +4 -1
  32. package/dist/primitives/layout/scroll-area/index.js +2 -1
  33. package/dist/shared/{components-8xe4h118.js → components-3fg6vabb.js} +1 -4
  34. package/dist/shared/{components-resqc2d2.js → components-5fet4gqt.js} +59 -7
  35. package/dist/shared/{components-5w7hxa1n.js → components-60tf8tfa.js} +10 -6
  36. package/dist/shared/components-7v6ncqfc.js +80 -0
  37. package/dist/shared/{components-66aw235e.js → components-8swhfkqn.js} +1 -1
  38. package/dist/shared/{components-pfwjhxd8.js → components-94vd4ck1.js} +1 -1
  39. package/dist/shared/{components-q28xct6t.js → components-9c3m65ft.js} +1 -1
  40. package/dist/shared/{components-jnjw9j2z.js → components-a8bcq2yc.js} +1 -1
  41. package/dist/shared/{components-b2fag579.js → components-bkg1k36x.js} +4 -4
  42. package/dist/shared/{components-z14s3avn.js → components-faym1xm6.js} +1 -1
  43. package/dist/shared/{components-gr82tz50.js → components-fbs2602j.js} +4 -3
  44. package/dist/shared/{components-ypxst3cn.js → components-ftvy33w9.js} +1 -1
  45. package/dist/shared/{components-8hzwz162.js → components-hhwv5mcm.js} +5 -4
  46. package/dist/shared/{components-k8awpmbn.js → components-s0c8gngv.js} +6 -6
  47. package/dist/shared/{components-8dgrpegd.js → components-swh0v27s.js} +4 -2
  48. package/dist/shared/{components-766w1xcw.js → components-whfr55xn.js} +3 -3
  49. package/dist/shared/{components-4d0v8nzm.js → components-z6wx8fzj.js} +1 -1
  50. package/dist/shared/{components-2c22zpm2.js → components-zjeh9zk2.js} +1 -1
  51. package/dist/styles.css +1 -1
  52. package/lib/use-autosize-textarea.ts +65 -18
  53. package/package.json +6 -1
  54. package/primitives/content/code/index.tsx +11 -6
  55. package/primitives/layout/resizable/index.tsx +15 -6
  56. package/primitives/layout/scroll-area/examples.mdx +16 -0
  57. package/primitives/layout/scroll-area/index.tsx +69 -9
  58. package/dist/shared/components-vpkh6j83.js +0 -42
  59. /package/dist/shared/{components-v1zzr668.js → components-arg4h26d.js} +0 -0
  60. /package/dist/shared/{components-0ep66sg9.js → components-dx8f797z.js} +0 -0
  61. /package/dist/shared/{components-rtwfh1gc.js → components-fzmjcn38.js} +0 -0
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-resqc2d2.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-b2fag579.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-8hzwz162.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-pfwjhxd8.js";
188
+ } from "./shared/components-94vd4ck1.js";
189
189
  import {
190
190
  SidebarInsetTopbar2,
191
191
  SidebarSearchField2,
192
192
  SidebarApp2
193
- } from "./shared/components-766w1xcw.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-8dgrpegd.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-5w7hxa1n.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-k8awpmbn.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-z14s3avn.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-4d0v8nzm.js";
393
+ } from "./shared/components-z6wx8fzj.js";
394
394
  import {
395
395
  Search2
396
- } from "./shared/components-q28xct6t.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-jnjw9j2z.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-66aw235e.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-2c22zpm2.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-5w7hxa1n.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-resqc2d2.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-resqc2d2.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
  /*!
@@ -37,11 +41,57 @@ if (typeof CSS !== "undefined" && "registerProperty" in CSS) {
37
41
  }
38
42
  }
39
43
  var ScrollAreaContext = createContext(false);
40
- var ScrollArea2 = forwardRef(({ className, children, viewportClassName, orientation = "vertical", ...props }, ref) => {
41
- 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]);
42
92
  return /* @__PURE__ */ jsx(ScrollAreaContext.Provider, {
43
- value: isTouch,
44
- children: isTouch ? /* @__PURE__ */ jsx("div", {
93
+ value: isNative,
94
+ children: isNative ? /* @__PURE__ */ jsx("div", {
45
95
  ref,
46
96
  role: "group",
47
97
  "data-slot": "scroll-area",
@@ -49,7 +99,9 @@ var ScrollArea2 = forwardRef(({ className, children, viewportClassName, orientat
49
99
  className: cn2("relative overflow-hidden", className),
50
100
  ...props,
51
101
  children: /* @__PURE__ */ jsx("div", {
102
+ ref: viewportRef,
52
103
  "data-slot": "scroll-area-viewport",
104
+ "data-scroll-edges": "",
53
105
  className: cn2("size-full rounded-[inherit]", orientation === "vertical" && "overflow-y-auto", orientation === "horizontal" && "overflow-x-auto", orientation === "both" && "overflow-auto", viewportClassName),
54
106
  tabIndex: 0,
55
107
  children
@@ -81,9 +133,9 @@ var ScrollArea2 = forwardRef(({ className, children, viewportClassName, orientat
81
133
  });
82
134
  ScrollArea2.displayName = "ScrollArea";
83
135
  var ScrollBar2 = forwardRef(({ className, orientation = "vertical", ...props }, ref) => {
84
- const isTouch = useContext(ScrollAreaContext);
136
+ const isNative = useContext(ScrollAreaContext);
85
137
  const shape = useShape2();
86
- if (isTouch)
138
+ if (isNative)
87
139
  return null;
88
140
  return /* @__PURE__ */ jsx(ScrollAreaPrimitive.Scrollbar, {
89
141
  ref,
@@ -11,10 +11,10 @@ import {
11
11
  } from "./components-xnp09586.js";
12
12
  import {
13
13
  scroll_area_default
14
- } from "./components-resqc2d2.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-pfwjhxd8.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-resqc2d2.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-4d0v8nzm.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-resqc2d2.js";
75
+ } from "./components-5fet4gqt.js";
76
76
  import {
77
77
  SizeScope2
78
78
  } from "./components-nz14rwtd.js";
@@ -13,9 +13,12 @@ import {
13
13
  import {
14
14
  useShape2
15
15
  } from "./components-kxpcj2ry.js";
16
+ import {
17
+ useIsoLayoutEffect2
18
+ } from "./components-v2j3jx89.js";
16
19
  import {
17
20
  ScrollArea2
18
- } from "./components-resqc2d2.js";
21
+ } from "./components-5fet4gqt.js";
19
22
  import {
20
23
  useReduceMotion2
21
24
  } from "./components-tz0axc0f.js";
@@ -60,9 +63,6 @@ import {
60
63
  import {
61
64
  FocusRing2
62
65
  } from "./components-5wykqxph.js";
63
- import {
64
- useIsoLayoutEffect2
65
- } from "./components-v2j3jx89.js";
66
66
  import {
67
67
  inertProps2
68
68
  } from "./components-2myjk2zf.js";
@@ -76,7 +76,7 @@ import {
76
76
  } from "./components-eawe4nxm.js";
77
77
  import {
78
78
  ScrollArea2
79
- } from "./components-resqc2d2.js";
79
+ } from "./components-5fet4gqt.js";
80
80
 
81
81
  // components/inputs/combobox/index.tsx
82
82
  import { Combobox as ComboboxPrimitive3 } from "@base-ui/react/combobox";
@@ -180,16 +180,17 @@ var Resizable2 = forwardRef(({ direction = "horizontal", sizes, onSizesChange, s
180
180
  const id = useId();
181
181
  const items = Children.toArray(children);
182
182
  const panels = items.filter((child) => isValidElement(child) && child.type === ResizablePanel2);
183
- const limits = panels.map(({ props }) => ({
183
+ const limitKey = panels.map(({ props }) => `${props.minSize}:${props.maxSize}:${props.collapsible}`).join();
184
+ const limits = useMemo(() => panels.map(({ props }) => ({
184
185
  min: props.minSize ?? 0,
185
186
  max: props.maxSize ?? 100,
186
187
  collapsible: props.collapsible ?? false
187
- }));
188
+ })), [limitKey]);
188
189
  const sizeKey = panels.map(({ props }) => props.defaultSize).join();
189
190
  const defaults = useMemo(() => defaultSizes(panels.map(({ props }) => props.defaultSize)), [sizeKey]);
190
191
  const [current, setCurrent] = useControllableState2(sizes, defaults, onSizesChange);
191
192
  const [dragging, setDragging] = useState(false);
192
- const group = { id, direction, sizes: current, limits, defaults, step, setSizes: setCurrent, dragging, setDragging };
193
+ const group = useMemo(() => ({ id, direction, sizes: current, limits, defaults, step, setSizes: setCurrent, dragging, setDragging }), [id, direction, current, limits, defaults, step, setCurrent, dragging]);
193
194
  let panel = -1;
194
195
  const indexed = items.map((child) => {
195
196
  if (!isValidElement(child))
@@ -12,7 +12,7 @@ import {
12
12
  } from "./components-bkwjvvkh.js";
13
13
  import {
14
14
  useAutosizeTextarea2
15
- } from "./components-vpkh6j83.js";
15
+ } from "./components-7v6ncqfc.js";
16
16
  import {
17
17
  useControllableState2
18
18
  } from "./components-wwd093xg.js";
@@ -29,7 +29,7 @@ import {
29
29
  import {
30
30
  useSidebarShortcut,
31
31
  sidebar_default
32
- } from "./components-b2fag579.js";
32
+ } from "./components-bkg1k36x.js";
33
33
  import {
34
34
  inertProps2
35
35
  } from "./components-2myjk2zf.js";
@@ -41,10 +41,10 @@ import {
41
41
  } from "./components-7rn454aq.js";
42
42
  import {
43
43
  resizable_default
44
- } from "./components-gr82tz50.js";
44
+ } from "./components-fbs2602j.js";
45
45
 
46
46
  // blocks/desktop-shell/index.tsx
47
- import { useCallback, useLayoutEffect, useRef, useState } from "react";
47
+ import { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
48
48
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
49
49
  var CORNER_CLEARANCE = {
50
50
  default: "[&>[data-slot=sidebar]_[data-sidebar=sidebar]]:pt-9",
@@ -165,6 +165,7 @@ function DesktopShell2({
165
165
  const hasRight = right !== undefined;
166
166
  const paneOpen = hasRight && rightOpen;
167
167
  const inCard = titleBar === "card";
168
+ const paneSizes = useMemo(() => paneOpen ? [100 - paneSize, paneSize] : [100, 0], [paneOpen, paneSize]);
168
169
  const root = useRef(null);
169
170
  const [narrow, setNarrow] = useState(false);
170
171
  useLayoutEffect(() => {
@@ -271,7 +272,7 @@ function DesktopShell2({
271
272
  /* @__PURE__ */ jsx("div", {
272
273
  className: cn2("flex min-h-0 min-w-0 flex-1 py-2 pl-2 transition-[padding] duration-fast", hasLeft && leftOpen && "pl-0", (!hasRight || narrow) && "pr-2"),
273
274
  children: !hasRight || narrow ? card(narrow && paneOpen ? right : main) : /* @__PURE__ */ jsxs(resizable_default, {
274
- sizes: paneOpen ? [100 - paneSize, paneSize] : [100, 0],
275
+ sizes: paneSizes,
275
276
  onSizesChange,
276
277
  children: [
277
278
  /* @__PURE__ */ jsx(resizable_default.Panel, {