@vvedantb/ui 0.77.0 → 0.78.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.
package/README.md CHANGED
@@ -1790,7 +1790,7 @@ const config = {
1790
1790
  ```
1791
1791
 
1792
1792
  Outside a `StickToBottom` (for example a page outline) use `JumpRail` with `items` (`{ id, title, preview?, level? }`), a `scrollRef` or `getScrollElement`, and `targetAttribute="data-toc-id"` or `resolveTarget`. `onReveal` runs when a target is not in the DOM; `onBeforeScroll` runs just before it. `onSelect(id)` runs after a click or Enter/Space pick, once the scroll has started or `onReveal` has run, so an app can move focus to the target for keyboard users; `ChatJumpRail` accepts it too. `observeKey` re-observes when the rendered window changes. The geometry helpers (`resolveJumpRailTopPercent`, `resolveJumpRailIndexFromPointer`, `resolveJumpRailHeightStyle`, `resolveJumpRailTickWidthClass`, `resolveJumpRailTickLevelStyle`) are exported.
1793
- - `Message`: `classes.root`, `classes.user`, `classes.assistant` (the role classes of `Message`), `classes.content` (all `MessageContent` classes), `classes.branchSelector`, `classes.branchIcon` (a class in place of the arrows' `size={14}`), and `lazyActionTooltips`: a `MessageAction` mounts its tooltip on first hover or focus (focus opens it), not with the button.
1793
+ - `Message`: `classes.root`, `classes.user`, `classes.assistant` (the role classes of `Message`), `classes.content` (all `MessageContent` classes), `classes.branchSelector`, `classes.branchIcon` (a class in place of the arrows' `size={14}`), and `lazyActionTooltips` (default `true`): a `MessageAction` mounts its tooltip on first hover or focus (focus opens it), not with the button. Set `false` to mount it with the button.
1794
1794
  - Quoted replies (0.39.0): `Message` takes `actions` (right-click menu plus hover toolbar) and `highlighted`; `MessageQuote` goes in `MessageContent` above the text; `ReplyQuoteChip` goes in `PromptInputHeader`.
1795
1795
 
1796
1796
  ```tsx
@@ -329,7 +329,7 @@ function stepSeconds(step) {
329
329
  return seconds >= 1 ? seconds : undefined;
330
330
  }
331
331
  function ActivityReasoningLine(t0) {
332
- const $ = _c(19);
332
+ const $ = _c(20);
333
333
  const {
334
334
  step
335
335
  } = t0;
@@ -396,36 +396,39 @@ function ActivityReasoningLine(t0) {
396
396
  } else {
397
397
  t3 = $[10];
398
398
  }
399
- let t4;
400
- if ($[11] !== Markdown || $[12] !== thoughts) {
401
- t4 = /*#__PURE__*/_jsx(AgentTraceCollapsibleContent, {
399
+ const t4 = isActive ? "streaming" : "static";
400
+ let t5;
401
+ if ($[11] !== Markdown || $[12] !== t4 || $[13] !== thoughts) {
402
+ t5 = /*#__PURE__*/_jsx(AgentTraceCollapsibleContent, {
402
403
  children: /*#__PURE__*/_jsx(Markdown, {
403
404
  className: "text-sm",
405
+ mode: t4,
404
406
  children: thoughts
405
407
  })
406
408
  });
407
409
  $[11] = Markdown;
408
- $[12] = thoughts;
409
- $[13] = t4;
410
+ $[12] = t4;
411
+ $[13] = thoughts;
412
+ $[14] = t5;
410
413
  } else {
411
- t4 = $[13];
414
+ t5 = $[14];
412
415
  }
413
- let t5;
414
- if ($[14] !== disclosure.onOpenChange || $[15] !== disclosure.open || $[16] !== t3 || $[17] !== t4) {
415
- t5 = /*#__PURE__*/_jsxs(AgentTraceCollapsible, {
416
+ let t6;
417
+ if ($[15] !== disclosure.onOpenChange || $[16] !== disclosure.open || $[17] !== t3 || $[18] !== t5) {
418
+ t6 = /*#__PURE__*/_jsxs(AgentTraceCollapsible, {
416
419
  open: disclosure.open,
417
420
  onOpenChange: disclosure.onOpenChange,
418
- children: [t3, t4]
421
+ children: [t3, t5]
419
422
  });
420
- $[14] = disclosure.onOpenChange;
421
- $[15] = disclosure.open;
422
- $[16] = t3;
423
- $[17] = t4;
423
+ $[15] = disclosure.onOpenChange;
424
+ $[16] = disclosure.open;
425
+ $[17] = t3;
424
426
  $[18] = t5;
427
+ $[19] = t6;
425
428
  } else {
426
- t5 = $[18];
429
+ t6 = $[19];
427
430
  }
428
- return t5;
431
+ return t6;
429
432
  }
430
433
  function ActivityTodosLine(t0) {
431
434
  const $ = _c(25);
@@ -930,7 +933,7 @@ function ActivityResponseBlock(t0) {
930
933
  return t3;
931
934
  }
932
935
  function ActivityReasoningBlock(t0) {
933
- const $ = _c(5);
936
+ const $ = _c(6);
934
937
  const {
935
938
  step
936
939
  } = t0;
@@ -947,19 +950,22 @@ function ActivityReasoningBlock(t0) {
947
950
  if (!thoughts) {
948
951
  return null;
949
952
  }
950
- let t2;
951
- if ($[2] !== Markdown || $[3] !== thoughts) {
952
- t2 = /*#__PURE__*/_jsx(Markdown, {
953
+ const t2 = step.status === "active" ? "streaming" : "static";
954
+ let t3;
955
+ if ($[2] !== Markdown || $[3] !== t2 || $[4] !== thoughts) {
956
+ t3 = /*#__PURE__*/_jsx(Markdown, {
953
957
  className: "my-1 text-foreground text-sm leading-relaxed",
958
+ mode: t2,
954
959
  children: thoughts
955
960
  });
956
961
  $[2] = Markdown;
957
- $[3] = thoughts;
958
- $[4] = t2;
962
+ $[3] = t2;
963
+ $[4] = thoughts;
964
+ $[5] = t3;
959
965
  } else {
960
- t2 = $[4];
966
+ t3 = $[5];
961
967
  }
962
- return t2;
968
+ return t3;
963
969
  }
964
970
  function ActivityActionGroup(t0) {
965
971
  const $ = _c(28);
@@ -352,7 +352,7 @@ export const ConversationScrollButton = t0 => {
352
352
  t1 = $[10];
353
353
  }
354
354
  const handleScrollToBottom = t1;
355
- const motionClass = classes?.scrollButtonMotion ?? "pointer-events-none absolute bottom-4 left-0 right-0 z-10 flex justify-center";
355
+ const motionClass = classes?.scrollButtonMotion ?? "pointer-events-none absolute bottom-4 left-0 right-0 z-30 flex justify-center";
356
356
  let t2;
357
357
  if ($[11] !== className || $[12] !== classes?.scrollButton || $[13] !== defaults?.animate || $[14] !== defaults?.exit || $[15] !== defaults?.initial || $[16] !== defaults?.size || $[17] !== defaults?.transition || $[18] !== handleScrollToBottom || $[19] !== icon || $[20] !== label || $[21] !== merge || $[22] !== motionClass || $[23] !== props || $[24] !== size || $[25] !== visible) {
358
358
  t2 = visible ? /*#__PURE__*/_jsx(m.div, {
@@ -447,7 +447,7 @@ export const MessageContent = t0 => {
447
447
  const merge = useCn();
448
448
  let t1;
449
449
  if ($[4] !== content) {
450
- t1 = content ?? ["flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-primary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-primary-foreground", "group-[.is-assistant]:px-0 group-[.is-assistant]:text-foreground"];
450
+ t1 = content ?? ["flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-(--user-bubble,var(--primary)) group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-(--user-bubble-foreground,var(--primary-foreground))", "group-[.is-assistant]:px-0 group-[.is-assistant]:text-foreground"];
451
451
  $[4] = content;
452
452
  $[5] = t1;
453
453
  } else {
@@ -527,7 +527,7 @@ export const MessageActionsBar = t0 => {
527
527
  };
528
528
  export const MessageAction = props => {
529
529
  const $ = _c(3);
530
- const lazy = useUiConfig("Message")?.lazyActionTooltips;
530
+ const lazy = useUiConfig("Message")?.lazyActionTooltips ?? true;
531
531
  let t0;
532
532
  if ($[0] !== lazy || $[1] !== props) {
533
533
  t0 = lazy ? /*#__PURE__*/_jsx(LazyMessageAction, {
@@ -12,7 +12,9 @@ export const floatingSurfaceAnimateClass = ["data-[state=open]:animate-in data-[
12
12
  * Hover cards and selects keep `floatingSurfaceAnimateClass`.
13
13
  */
14
14
  export const triggerZoomAnimateClass = "origin-[var(--radix-popper-transform-origin)] duration-150 data-[state=closed]:duration-100 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-[0.4] data-[state=closed]:zoom-out-[0.4]";
15
- export const menuContentClass = ["z-50 min-w-[12rem] overflow-hidden p-1 outline-none max-sm:max-h-[85dvh] max-sm:overflow-y-auto", menuSurfaceClass, triggerZoomAnimateClass].join(" ");
15
+ const menuContentClass = ["z-50 min-w-[12rem] overflow-x-hidden overflow-y-auto p-1 outline-none", menuSurfaceClass, triggerZoomAnimateClass].join(" ");
16
+ export const dropdownMenuContentClass = `${menuContentClass} max-h-(--radix-dropdown-menu-content-available-height)`;
17
+ export const contextMenuContentClass = `${menuContentClass} max-h-(--radix-context-menu-content-available-height)`;
16
18
  export const menuSubTriggerClass = "flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm text-foreground outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[state=open]:bg-default data-[disabled]:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
17
19
  export const menuItemClass = "relative flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0 [&_svg]:pointer-events-none";
18
20
 
@@ -69,28 +69,29 @@ function CollapsibleContent(t0) {
69
69
  }
70
70
  const content = useUiConfig("Collapsible")?.classes?.content;
71
71
  const cn = useCn();
72
- let t1;
73
- if ($[3] !== className || $[4] !== cn || $[5] !== content) {
74
- t1 = content === undefined ? className : cn(content, className);
72
+ const t1 = content ?? "ui-collapsible-content";
73
+ let t2;
74
+ if ($[3] !== className || $[4] !== cn || $[5] !== t1) {
75
+ t2 = cn(t1, className);
75
76
  $[3] = className;
76
77
  $[4] = cn;
77
- $[5] = content;
78
- $[6] = t1;
78
+ $[5] = t1;
79
+ $[6] = t2;
79
80
  } else {
80
- t1 = $[6];
81
+ t2 = $[6];
81
82
  }
82
- let t2;
83
- if ($[7] !== props || $[8] !== t1) {
84
- t2 = /*#__PURE__*/_jsx(CollapsiblePrimitive.CollapsibleContent, {
85
- className: t1,
83
+ let t3;
84
+ if ($[7] !== props || $[8] !== t2) {
85
+ t3 = /*#__PURE__*/_jsx(CollapsiblePrimitive.CollapsibleContent, {
86
+ className: t2,
86
87
  ...props
87
88
  });
88
89
  $[7] = props;
89
- $[8] = t1;
90
- $[9] = t2;
90
+ $[8] = t2;
91
+ $[9] = t3;
91
92
  } else {
92
- t2 = $[9];
93
+ t3 = $[9];
93
94
  }
94
- return t2;
95
+ return t3;
95
96
  }
96
97
  export { Collapsible, CollapsibleTrigger, CollapsibleContent };
@@ -2,7 +2,7 @@ import { c as _c } from "react/compiler-runtime";
2
2
  import * as React from "react";
3
3
  import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
4
4
  import { IconCheck, IconChevronRight, IconCircleFilled } from "@tabler/icons-react";
5
- import { menuCheckboxRadioItemClass, menuContentClass, menuItemClass, menuItemDestructiveClass, menuLabelClass, menuSeparatorClass, menuShortcutClass, menuSubTriggerClass } from "./_menu-classes.js";
5
+ import { menuCheckboxRadioItemClass, contextMenuContentClass, menuItemClass, menuItemDestructiveClass, menuLabelClass, menuSeparatorClass, menuShortcutClass, menuSubTriggerClass } from "./_menu-classes.js";
6
6
  import { MenuItemRow, SubTriggerRow, suppressAltKeyDown } from "./_menu-parts.js";
7
7
  import { useCn, useUiConfig } from "./ui-config.js";
8
8
 
@@ -180,7 +180,7 @@ const ContextMenuSubContent = /*#__PURE__*/React.forwardRef((t0, ref) => {
180
180
  const merge = useCn();
181
181
  let t1;
182
182
  if ($[4] !== config?.classes?.subContent) {
183
- t1 = config?.classes?.subContent ?? [menuContentClass, "w-40"];
183
+ t1 = config?.classes?.subContent ?? [contextMenuContentClass, "w-40"];
184
184
  $[4] = config?.classes?.subContent;
185
185
  $[5] = t1;
186
186
  } else {
@@ -259,7 +259,7 @@ const ContextMenuContent = /*#__PURE__*/React.forwardRef((t0, ref) => {
259
259
  const t1 = collisionPadding ?? config?.collisionPadding ?? 8;
260
260
  let t2;
261
261
  if ($[6] !== config?.classes?.content) {
262
- t2 = config?.classes?.content ?? [menuContentClass, "w-40"];
262
+ t2 = config?.classes?.content ?? [contextMenuContentClass, "w-40"];
263
263
  $[6] = config?.classes?.content;
264
264
  $[7] = t2;
265
265
  } else {
@@ -2,7 +2,7 @@ import { c as _c } from "react/compiler-runtime";
2
2
  import * as React from "react";
3
3
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
4
  import { IconCheck, IconChevronRight, IconCircleFilled } from "@tabler/icons-react";
5
- import { menuCheckboxRadioItemClass, menuContentClass, menuItemClass, menuItemDestructiveClass, menuLabelClass, menuSeparatorClass, menuShortcutClass, menuSubTriggerClass } from "./_menu-classes.js";
5
+ import { menuCheckboxRadioItemClass, dropdownMenuContentClass, menuItemClass, menuItemDestructiveClass, menuLabelClass, menuSeparatorClass, menuShortcutClass, menuSubTriggerClass } from "./_menu-classes.js";
6
6
  import { fitViewportClass, MenuItemRow, SubTriggerRow, suppressAltKeyDown } from "./_menu-parts.js";
7
7
  import { restoreModalScrollLock } from "./overlay-a11y.js";
8
8
  import { useCn, useUiConfig } from "./ui-config.js";
@@ -175,7 +175,7 @@ const DropdownMenuSubContent = /*#__PURE__*/React.forwardRef((t0, ref) => {
175
175
  }
176
176
  const classes = useUiConfig("DropdownMenu")?.classes;
177
177
  const merge = useCn();
178
- const t1 = classes?.subContent ?? menuContentClass;
178
+ const t1 = classes?.subContent ?? dropdownMenuContentClass;
179
179
  let t2;
180
180
  if ($[3] !== className || $[4] !== merge || $[5] !== t1) {
181
181
  t2 = merge(t1, className);
@@ -253,7 +253,7 @@ const DropdownMenuContent = /*#__PURE__*/React.forwardRef((t0, ref) => {
253
253
  const merge = useCn();
254
254
  const t1 = sideOffset ?? config?.sideOffset ?? 4;
255
255
  const t2 = collisionPadding ?? config?.collisionPadding ?? 8;
256
- const t3 = config?.classes?.content ?? menuContentClass;
256
+ const t3 = config?.classes?.content ?? dropdownMenuContentClass;
257
257
  const t4 = fitViewport && fitViewportClass;
258
258
  let t5;
259
259
  if ($[10] !== className || $[11] !== merge || $[12] !== t3 || $[13] !== t4) {
@@ -27,8 +27,8 @@ function HoverCard(t0) {
27
27
  props = $[3];
28
28
  }
29
29
  const config = useUiConfig("HoverCard");
30
- const t1 = openDelay ?? config?.openDelay;
31
- const t2 = closeDelay ?? config?.closeDelay;
30
+ const t1 = openDelay ?? config?.openDelay ?? 250;
31
+ const t2 = closeDelay ?? config?.closeDelay ?? 100;
32
32
  let t3;
33
33
  if ($[4] !== props || $[5] !== t1 || $[6] !== t2) {
34
34
  t3 = /*#__PURE__*/_jsx(HoverCardPrimitive.Root, {
@@ -74,7 +74,7 @@ const PATTERNS = {
74
74
  round: false
75
75
  }
76
76
  };
77
- const DEFAULT_COLORS = ["currentColor", "currentColor", "currentColor"];
77
+ const DEFAULT_COLORS = ["var(--loading-dot-1, currentColor)", "var(--loading-dot-2, currentColor)", "var(--loading-dot-3, currentColor)"];
78
78
  const defaultLabelClass = "text-sm font-medium text-muted-foreground";
79
79
  function pulseRefs(delays, dur) {
80
80
  return delays.map(d => d === null ? undefined : cell => {
@@ -203,9 +203,9 @@ function CircleSpinner(t0) {
203
203
  arc: t4,
204
204
  lead: t5
205
205
  } = colors;
206
- const track = t3 === undefined ? "currentColor" : t3;
207
- const arc = t4 === undefined ? "currentColor" : t4;
208
- const lead = t5 === undefined ? "currentColor" : t5;
206
+ const track = t3 === undefined ? "var(--spinner-track, currentColor)" : t3;
207
+ const arc = t4 === undefined ? "var(--spinner-arc, currentColor)" : t4;
208
+ const lead = t5 === undefined ? "var(--spinner-lead, currentColor)" : t5;
209
209
  let t6;
210
210
  if ($[6] !== decorative) {
211
211
  t6 = a11yProps(decorative);
@@ -232,7 +232,9 @@ function CircleSpinner(t0) {
232
232
  cy: "12",
233
233
  r: "9",
234
234
  fill: "none",
235
- stroke: track,
235
+ style: {
236
+ stroke: track
237
+ },
236
238
  strokeWidth: 3,
237
239
  opacity: 0.2
238
240
  });
@@ -258,7 +260,9 @@ function CircleSpinner(t0) {
258
260
  cy: "12",
259
261
  r: "9",
260
262
  fill: "none",
261
- stroke: arc,
263
+ style: {
264
+ stroke: arc
265
+ },
262
266
  strokeWidth: 3,
263
267
  strokeLinecap: "round",
264
268
  pathLength: 1,
@@ -276,7 +280,9 @@ function CircleSpinner(t0) {
276
280
  cy: "12",
277
281
  r: "9",
278
282
  fill: "none",
279
- stroke: lead,
283
+ style: {
284
+ stroke: lead
285
+ },
280
286
  strokeWidth: 3,
281
287
  strokeLinecap: "round",
282
288
  pathLength: 1,
@@ -2,8 +2,9 @@
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { AnimatePresence, m } from "motion/react";
5
- import { useState } from "react";
5
+ import { useState, useSyncExternalStore } from "react";
6
6
  import { motionEase } from "../motion/presets.js";
7
+ import { useReducedMotionSetting } from "../motion/reduced-motion.js";
7
8
  import { cn } from "../utils/cn.js";
8
9
  import { useUiConfig } from "./ui-config.js";
9
10
 
@@ -11,14 +12,31 @@ import { useUiConfig } from "./ui-config.js";
11
12
  * How tab content moves when the tab changes. The new panel comes from the
12
13
  * side of the tab that was picked (right of the old one: from the right), as a
13
14
  * phone swipe does.
14
- * - `"none"` (default): swap at once.
15
- * - `"slide"`: a short 32px slide with a fade. Reads the direction without
16
- * moving the page; the desktop default for apps that opt in.
15
+ * - `"none"`: swap at once.
16
+ * - `"slide"` (default): a short 32px slide with a fade. Reads the direction
17
+ * without moving the page. The old panel leaves the way the new one enters.
17
18
  * - `"push"`: the old panel leaves the full width as the new one enters, like
18
19
  * a phone pager. Heavier; suits narrow or swipe-driven surfaces.
19
20
  */
20
21
  import { jsx as _jsx } from "react/jsx-runtime";
21
22
  const SLIDE_PX = 32;
23
+ function subscribePageMotion(onChange) {
24
+ const observer = new MutationObserver(onChange);
25
+ observer.observe(document.documentElement, {
26
+ attributes: true,
27
+ attributeFilter: ["data-page-motion"]
28
+ });
29
+ return () => observer.disconnect();
30
+ }
31
+ function usePageMotionOff() {
32
+ return useSyncExternalStore(subscribePageMotion, _temp, _temp2);
33
+ }
34
+ function _temp2() {
35
+ return false;
36
+ }
37
+ function _temp() {
38
+ return document.documentElement.dataset.pageMotion === "off";
39
+ }
22
40
  const variants = {
23
41
  slide: {
24
42
  enter: dir => ({
@@ -80,7 +98,9 @@ export function TabsTransition(t0) {
80
98
  children
81
99
  } = t0;
82
100
  const configVariant = useUiConfig("Tabs")?.transition;
83
- const variant = variantProp ?? configVariant ?? "none";
101
+ const reduced = useReducedMotionSetting();
102
+ const pageMotionOff = usePageMotionOff();
103
+ const variant = reduced || pageMotionOff ? "none" : variantProp ?? configVariant ?? "slide";
84
104
  const [previous, setPrevious] = useState(value);
85
105
  const [direction, setDirection] = useState(1);
86
106
  if (value !== previous) {
@@ -56,7 +56,7 @@ const TabsList = /*#__PURE__*/React.forwardRef((t0, ref) => {
56
56
  const config = useUiConfig("Tabs");
57
57
  const cn = useCn();
58
58
  const variant = variantProp ?? config?.variant ?? "pills";
59
- const pillMotion = pillMotionProp ?? config?.pillMotion ?? "x";
59
+ const pillMotion = pillMotionProp ?? config?.pillMotion ?? "xy";
60
60
  const listRef = React.useRef(null);
61
61
  const pillRef = React.useRef(null);
62
62
  const pillReadyRef = React.useRef(false);
@@ -22,7 +22,7 @@ function TooltipProvider(t0) {
22
22
  props = $[2];
23
23
  }
24
24
  const config = useUiConfig("Tooltip");
25
- const t1 = delayDuration ?? config?.delayDuration;
25
+ const t1 = delayDuration ?? config?.delayDuration ?? 300;
26
26
  let t2;
27
27
  if ($[3] !== props || $[4] !== t1) {
28
28
  t2 = /*#__PURE__*/_jsx(TooltipPrimitive.Provider, {
@@ -5,16 +5,14 @@
5
5
  *
6
6
  * @import "@vvedantb/ui/tokens/css/markdown.css";
7
7
  *
8
- * Reads the shadcn channel variables as `rgb(var(--name))`: --foreground,
9
- * --muted-foreground, --border, --primary, --success, --warning,
10
- * --destructive, and --radius, --font-mono and --motion-fast (150ms when
11
- * unset). The app (or compat-shadcn-rgb.css) must define them as space
12
- * separated RGB channels. Code block and table panels fill with
13
- * `var(--color-surface-secondary)`, which tokens.css and compat-shadcn-rgb.css
14
- * both define (the compat file maps it to the app's `--muted`).
8
+ * Reads full colour tokens as `var(--name)`: --foreground, --muted (grey
9
+ * text), --border, --primary, --success, --warning, --destructive, and
10
+ * --radius, --font-mono and --motion-fast (150ms when unset). Tints use
11
+ * `color-mix(in oklab, var(--name) N%, transparent)`. Code block and table
12
+ * panels fill with `var(--color-surface-secondary)`, which tokens.css defines.
15
13
  *
16
14
  * Set on :root, `.markdown` or any ancestor to change (default shown):
17
- * --markdown-alert-important: var(--primary) (RGB channels)
15
+ * --markdown-alert-important: var(--primary) (a colour)
18
16
  *
19
17
  * Typography is owned here rather than by `prose`: headings stay compact so a
20
18
  * chat reply reads as a reply, not a document. Sizes are in `em` so the scale
@@ -50,7 +48,7 @@
50
48
  margin: 1.25rem 0 0.5rem;
51
49
  font-weight: 600;
52
50
  line-height: 1.3;
53
- color: rgb(var(--foreground));
51
+ color: var(--foreground);
54
52
  letter-spacing: -0.01em;
55
53
  }
56
54
  .markdown h1 {
@@ -66,7 +64,7 @@
66
64
  font-size: 1em;
67
65
  }
68
66
  .markdown h6 {
69
- color: rgb(var(--muted-foreground));
67
+ color: var(--muted);
70
68
  }
71
69
  .markdown :is(h1, h2, h3, h4, h5, h6) + * {
72
70
  margin-top: 0;
@@ -79,7 +77,7 @@
79
77
  .markdown hr {
80
78
  margin-block: 1.25rem;
81
79
  border: 0;
82
- border-top: 1px solid rgb(var(--border));
80
+ border-top: 1px solid var(--border);
83
81
  }
84
82
 
85
83
  /* Lists */
@@ -105,7 +103,7 @@
105
103
  list-style: lower-roman;
106
104
  }
107
105
  .markdown li::marker {
108
- color: rgb(var(--muted-foreground));
106
+ color: var(--muted);
109
107
  font-variant-numeric: tabular-nums;
110
108
  }
111
109
  .markdown li + li {
@@ -125,20 +123,20 @@
125
123
  .markdown .task-list-item > input[type="checkbox"] {
126
124
  margin: 0 0.45em 0.15em -1.25rem;
127
125
  vertical-align: middle;
128
- accent-color: rgb(var(--primary));
126
+ accent-color: var(--primary);
129
127
  }
130
128
 
131
129
  /* Quotes and GitHub alerts */
132
130
  .markdown blockquote {
133
131
  padding-left: 0.8rem;
134
- border-left: 2px solid rgb(var(--border));
135
- color: rgb(var(--muted-foreground));
132
+ border-left: 2px solid var(--border);
133
+ color: var(--muted);
136
134
  }
137
135
  .markdown-alert {
138
136
  --alert: var(--foreground);
139
137
  padding: 0.6rem 0.8rem;
140
138
  border-radius: clamp(0.75rem, var(--radius), 1rem);
141
- background: rgb(var(--alert) / 0.06);
139
+ background: color-mix(in oklab, var(--alert) 6%, transparent);
142
140
  }
143
141
  .markdown-alert[data-alert="tip"] {
144
142
  --alert: var(--success);
@@ -164,7 +162,7 @@
164
162
  gap: 0.4rem;
165
163
  margin: 0;
166
164
  font-weight: 600;
167
- color: rgb(var(--alert));
165
+ color: var(--alert);
168
166
  }
169
167
  .markdown-alert-title svg {
170
168
  width: 1.1em;
@@ -174,10 +172,10 @@
174
172
 
175
173
  /* Links */
176
174
  .markdown-link {
177
- color: rgb(var(--primary));
175
+ color: var(--primary);
178
176
  font-weight: 500;
179
177
  text-decoration: underline;
180
- text-decoration-color: rgb(var(--primary) / 0.3);
178
+ text-decoration-color: color-mix(in oklab, var(--primary) 30%, transparent);
181
179
  text-underline-offset: 0.2em;
182
180
  transition: text-decoration-color var(--motion-fast, 150ms) ease-out;
183
181
  }
@@ -193,7 +191,7 @@
193
191
  margin-right: 0.3em;
194
192
  vertical-align: -0.12em;
195
193
  border-radius: 0.2em;
196
- color: rgb(var(--muted-foreground));
194
+ color: var(--muted);
197
195
  }
198
196
  .markdown-link-icon[data-failed] {
199
197
  display: none;
@@ -204,7 +202,7 @@
204
202
  padding: 0.1em 0.35em;
205
203
  border-radius: 0.375rem;
206
204
  /* Foreground-relative, so it still reads inside muted tables and callouts. */
207
- background: rgb(var(--foreground) / 0.06);
205
+ background: color-mix(in oklab, var(--foreground) 6%, transparent);
208
206
  font-family: var(--font-mono), ui-monospace, monospace;
209
207
  font-size: 0.86em;
210
208
  overflow-wrap: anywhere;
@@ -215,7 +213,7 @@
215
213
  height: 1em;
216
214
  margin-right: 0.25em;
217
215
  vertical-align: -0.15em;
218
- color: rgb(var(--muted-foreground));
216
+ color: var(--muted);
219
217
  }
220
218
 
221
219
  /* Code blocks */
@@ -235,7 +233,7 @@
235
233
  font-family: var(--font-mono), ui-monospace, monospace;
236
234
  font-size: 0.75rem;
237
235
  line-height: 1.75rem;
238
- color: rgb(var(--muted-foreground));
236
+ color: var(--muted);
239
237
  }
240
238
  .markdown-code-label {
241
239
  display: flex;
@@ -294,7 +292,7 @@
294
292
  white-space: nowrap;
295
293
  }
296
294
  .markdown tbody tr + tr {
297
- border-top: 1px solid rgb(var(--border) / 0.7);
295
+ border-top: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
298
296
  }
299
297
 
300
298
  .markdown .katex-display {
@@ -106,12 +106,46 @@
106
106
  }
107
107
  }
108
108
 
109
+ @keyframes ui-collapsible-down {
110
+ from {
111
+ height: 0;
112
+ }
113
+ to {
114
+ height: var(--radix-collapsible-content-height);
115
+ }
116
+ }
117
+
118
+ @keyframes ui-collapsible-up {
119
+ from {
120
+ height: var(--radix-collapsible-content-height);
121
+ }
122
+ to {
123
+ height: 0;
124
+ }
125
+ }
126
+
127
+ .ui-collapsible-content {
128
+ overflow: hidden;
129
+ }
130
+
131
+ .ui-collapsible-content[data-state="open"] {
132
+ animation: ui-collapsible-down var(--motion-base, 220ms) var(--motion-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
133
+ }
134
+
135
+ .ui-collapsible-content[data-state="closed"] {
136
+ animation: ui-collapsible-up var(--motion-base, 220ms) var(--motion-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
137
+ }
138
+
109
139
  /*
110
140
  * Reduced motion follows the root `MotionProvider reducedMotion` setting
111
141
  * (`html[data-reduced-motion]`): the OS query unless it is `"never"`, and
112
142
  * always when it is `"always"`.
113
143
  */
114
144
  @media (prefers-reduced-motion: reduce) {
145
+ html:not([data-reduced-motion="never"]) .ui-collapsible-content {
146
+ animation: none;
147
+ }
148
+
115
149
  html:not([data-reduced-motion="never"]) :is(.ui-page-enter, .ui-enter, .ui-enter-up, .ui-stagger > *) {
116
150
  animation-duration: 1ms;
117
151
  animation-name: ui-fade-only;
@@ -129,6 +163,11 @@
129
163
  animation-name: ui-fade-only;
130
164
  }
131
165
 
166
+ html[data-reduced-motion="always"] .ui-collapsible-content,
167
+ html[data-page-motion="off"] .ui-collapsible-content {
168
+ animation: none !important;
169
+ }
170
+
132
171
  html[data-reduced-motion="always"]::view-transition-group(*),
133
172
  html[data-reduced-motion="always"]::view-transition-old(*),
134
173
  html[data-reduced-motion="always"]::view-transition-new(*) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/ui",
3
- "version": "0.77.0",
3
+ "version": "0.78.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
6
6
  "type": "module",
@@ -307,7 +307,9 @@ function ActivityReasoningLine({ step }: { step: ActivityStep }) {
307
307
  <AgentTraceCollapsible open={disclosure.open} onOpenChange={disclosure.onOpenChange}>
308
308
  <AgentTraceCollapsibleTrigger>{line}</AgentTraceCollapsibleTrigger>
309
309
  <AgentTraceCollapsibleContent>
310
- <Markdown className="text-sm">{thoughts}</Markdown>
310
+ <Markdown className="text-sm" mode={isActive ? "streaming" : "static"}>
311
+ {thoughts}
312
+ </Markdown>
311
313
  </AgentTraceCollapsibleContent>
312
314
  </AgentTraceCollapsible>
313
315
  );
@@ -467,7 +469,10 @@ function ActivityReasoningBlock({ step }: { step: ActivityStep }) {
467
469
  const thoughts = step.detail?.trim();
468
470
  if (!thoughts) return null;
469
471
  return (
470
- <Markdown className="my-1 text-foreground text-sm leading-relaxed">
472
+ <Markdown
473
+ className="my-1 text-foreground text-sm leading-relaxed"
474
+ mode={step.status === "active" ? "streaming" : "static"}
475
+ >
471
476
  {thoughts}
472
477
  </Markdown>
473
478
  );
@@ -169,7 +169,7 @@ export const ConversationScrollButton = ({
169
169
  scrollToBottom();
170
170
  };
171
171
  const motionClass =
172
- classes?.scrollButtonMotion ?? "pointer-events-none absolute bottom-4 left-0 right-0 z-10 flex justify-center";
172
+ classes?.scrollButtonMotion ?? "pointer-events-none absolute bottom-4 left-0 right-0 z-30 flex justify-center";
173
173
  const presence = (
174
174
  <LazyMotion features={domAnimation}>
175
175
  <AnimatePresence initial={false}>
@@ -258,7 +258,7 @@ export const MessageContent = ({
258
258
  className={merge(
259
259
  content ?? [
260
260
  "flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm",
261
- "group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-primary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-primary-foreground",
261
+ "group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-(--user-bubble,var(--primary)) group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-(--user-bubble-foreground,var(--primary-foreground))",
262
262
  "group-[.is-assistant]:px-0 group-[.is-assistant]:text-foreground",
263
263
  ],
264
264
  className,
@@ -289,7 +289,7 @@ export type MessageActionProps = ComponentProps<typeof Button> & {
289
289
  label?: string;
290
290
  };
291
291
  export const MessageAction = (props: MessageActionProps) => {
292
- const lazy = useUiConfig("Message")?.lazyActionTooltips;
292
+ const lazy = useUiConfig("Message")?.lazyActionTooltips ?? true;
293
293
  return lazy ? <LazyMessageAction {...props} /> : <EagerMessageAction {...props} />;
294
294
  };
295
295
  function EagerMessageAction({
@@ -20,12 +20,16 @@ export const floatingSurfaceAnimateClass = [
20
20
  export const triggerZoomAnimateClass =
21
21
  "origin-[var(--radix-popper-transform-origin)] duration-150 data-[state=closed]:duration-100 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-[0.4] data-[state=closed]:zoom-out-[0.4]";
22
22
 
23
- export const menuContentClass = [
24
- "z-50 min-w-[12rem] overflow-hidden p-1 outline-none max-sm:max-h-[85dvh] max-sm:overflow-y-auto",
23
+ const menuContentClass = [
24
+ "z-50 min-w-[12rem] overflow-x-hidden overflow-y-auto p-1 outline-none",
25
25
  menuSurfaceClass,
26
26
  triggerZoomAnimateClass,
27
27
  ].join(" ");
28
28
 
29
+ export const dropdownMenuContentClass = `${menuContentClass} max-h-(--radix-dropdown-menu-content-available-height)`;
30
+
31
+ export const contextMenuContentClass = `${menuContentClass} max-h-(--radix-context-menu-content-available-height)`;
32
+
29
33
  export const menuSubTriggerClass =
30
34
  "flex cursor-pointer select-none items-center gap-2 rounded-menu-item px-2.5 py-1.5 max-sm:min-h-10 text-sm text-foreground outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[state=open]:bg-default data-[disabled]:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
31
35
 
@@ -36,7 +36,7 @@ function CollapsibleContent({ className, ...props }: CollapsibleContentProps) {
36
36
  const cn = useCn();
37
37
  return (
38
38
  <CollapsiblePrimitive.CollapsibleContent
39
- className={content === undefined ? className : cn(content, className)}
39
+ className={cn(content ?? "ui-collapsible-content", className)}
40
40
  {...props}
41
41
  />
42
42
  );
@@ -7,7 +7,7 @@ import {
7
7
  } from "@tabler/icons-react";
8
8
  import {
9
9
  menuCheckboxRadioItemClass,
10
- menuContentClass,
10
+ contextMenuContentClass,
11
11
  menuItemClass,
12
12
  menuItemDestructiveClass,
13
13
  menuLabelClass,
@@ -80,7 +80,7 @@ const ContextMenuSubContent = React.forwardRef<
80
80
  const content = (
81
81
  <ContextMenuPrimitive.SubContent
82
82
  ref={ref}
83
- className={merge(config?.classes?.subContent ?? [menuContentClass, "w-40"], className)}
83
+ className={merge(config?.classes?.subContent ?? [contextMenuContentClass, "w-40"], className)}
84
84
  {...props}
85
85
  />
86
86
  );
@@ -105,7 +105,7 @@ const ContextMenuContent = React.forwardRef<
105
105
  <ContextMenuPrimitive.Content
106
106
  ref={ref}
107
107
  collisionPadding={collisionPadding ?? config?.collisionPadding ?? 8}
108
- className={merge(config?.classes?.content ?? [menuContentClass, "w-40"], className)}
108
+ className={merge(config?.classes?.content ?? [contextMenuContentClass, "w-40"], className)}
109
109
  onKeyDown={suppressAltKey ? suppressAltKeyDown(onKeyDown) : onKeyDown}
110
110
  {...props}
111
111
  />
@@ -7,7 +7,7 @@ import {
7
7
  } from "@tabler/icons-react";
8
8
  import {
9
9
  menuCheckboxRadioItemClass,
10
- menuContentClass,
10
+ dropdownMenuContentClass,
11
11
  menuItemClass,
12
12
  menuItemDestructiveClass,
13
13
  menuLabelClass,
@@ -83,7 +83,7 @@ const DropdownMenuSubContent = React.forwardRef<
83
83
  <DropdownMenuPrimitive.Portal>
84
84
  <DropdownMenuPrimitive.SubContent
85
85
  ref={ref}
86
- className={merge(classes?.subContent ?? menuContentClass, className)}
86
+ className={merge(classes?.subContent ?? dropdownMenuContentClass, className)}
87
87
  {...props}
88
88
  />
89
89
  </DropdownMenuPrimitive.Portal>
@@ -123,7 +123,7 @@ const DropdownMenuContent = React.forwardRef<
123
123
  sideOffset={sideOffset ?? config?.sideOffset ?? 4}
124
124
  collisionPadding={collisionPadding ?? config?.collisionPadding ?? 8}
125
125
  className={merge(
126
- config?.classes?.content ?? menuContentClass,
126
+ config?.classes?.content ?? dropdownMenuContentClass,
127
127
  fitViewport && fitViewportClass,
128
128
  className,
129
129
  )}
@@ -23,8 +23,8 @@ function HoverCard({
23
23
  const config = useUiConfig("HoverCard");
24
24
  return (
25
25
  <HoverCardPrimitive.Root
26
- openDelay={openDelay ?? config?.openDelay}
27
- closeDelay={closeDelay ?? config?.closeDelay}
26
+ openDelay={openDelay ?? config?.openDelay ?? 250}
27
+ closeDelay={closeDelay ?? config?.closeDelay ?? 100}
28
28
  {...props}
29
29
  />
30
30
  );
@@ -72,7 +72,11 @@ const PATTERNS: Record<
72
72
  Orbit: { delays: orbit, dur: 950, round: false },
73
73
  };
74
74
 
75
- const DEFAULT_COLORS: LoadingStateColors = ["currentColor", "currentColor", "currentColor"];
75
+ const DEFAULT_COLORS: LoadingStateColors = [
76
+ "var(--loading-dot-1, currentColor)",
77
+ "var(--loading-dot-2, currentColor)",
78
+ "var(--loading-dot-3, currentColor)",
79
+ ];
76
80
 
77
81
  const defaultLabelClass = "text-sm font-medium text-muted-foreground";
78
82
 
@@ -131,7 +131,11 @@ function CircleSpinner({
131
131
  }: VariantProps & { colors: SpinnerCircleColors }) {
132
132
  const merge = useCn();
133
133
  const pixels = typeof size === "number" ? size : undefined;
134
- const { track = "currentColor", arc = "currentColor", lead = "currentColor" } = colors;
134
+ const {
135
+ track = "var(--spinner-track, currentColor)",
136
+ arc = "var(--spinner-arc, currentColor)",
137
+ lead = "var(--spinner-lead, currentColor)",
138
+ } = colors;
135
139
  return (
136
140
  <svg
137
141
  viewBox="0 0 24 24"
@@ -141,14 +145,14 @@ function CircleSpinner({
141
145
  className={merge(typeof size === "number" ? undefined : sizeClasses[size], className)}
142
146
  {...props}
143
147
  >
144
- <circle cx="12" cy="12" r="9" fill="none" stroke={track} strokeWidth={3} opacity={0.2} />
148
+ <circle cx="12" cy="12" r="9" fill="none" style={{ stroke: track }} strokeWidth={3} opacity={0.2} />
145
149
  <g ref={spinArc} style={{ transformBox: "view-box", transformOrigin: "12px 12px" }}>
146
150
  <circle
147
151
  cx="12"
148
152
  cy="12"
149
153
  r="9"
150
154
  fill="none"
151
- stroke={arc}
155
+ style={{ stroke: arc }}
152
156
  strokeWidth={3}
153
157
  strokeLinecap="round"
154
158
  pathLength={1}
@@ -159,7 +163,7 @@ function CircleSpinner({
159
163
  cy="12"
160
164
  r="9"
161
165
  fill="none"
162
- stroke={lead}
166
+ style={{ stroke: lead }}
163
167
  strokeWidth={3}
164
168
  strokeLinecap="round"
165
169
  pathLength={1}
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
 
3
3
  import { AnimatePresence, m, type Variants } from "motion/react";
4
- import { useState, type ReactNode } from "react";
4
+ import { useState, useSyncExternalStore, type ReactNode } from "react";
5
5
  import { motionEase } from "../motion/presets";
6
+ import { useReducedMotionSetting } from "../motion/reduced-motion";
6
7
  import { cn } from "../utils/cn";
7
8
  import { useUiConfig } from "./ui-config";
8
9
 
@@ -10,9 +11,9 @@ import { useUiConfig } from "./ui-config";
10
11
  * How tab content moves when the tab changes. The new panel comes from the
11
12
  * side of the tab that was picked (right of the old one: from the right), as a
12
13
  * phone swipe does.
13
- * - `"none"` (default): swap at once.
14
- * - `"slide"`: a short 32px slide with a fade. Reads the direction without
15
- * moving the page; the desktop default for apps that opt in.
14
+ * - `"none"`: swap at once.
15
+ * - `"slide"` (default): a short 32px slide with a fade. Reads the direction
16
+ * without moving the page. The old panel leaves the way the new one enters.
16
17
  * - `"push"`: the old panel leaves the full width as the new one enters, like
17
18
  * a phone pager. Heavier; suits narrow or swipe-driven surfaces.
18
19
  */
@@ -22,6 +23,23 @@ type Direction = 1 | -1;
22
23
 
23
24
  const SLIDE_PX = 32;
24
25
 
26
+ function subscribePageMotion(onChange: () => void) {
27
+ const observer = new MutationObserver(onChange);
28
+ observer.observe(document.documentElement, {
29
+ attributes: true,
30
+ attributeFilter: ["data-page-motion"],
31
+ });
32
+ return () => observer.disconnect();
33
+ }
34
+
35
+ function usePageMotionOff() {
36
+ return useSyncExternalStore(
37
+ subscribePageMotion,
38
+ () => document.documentElement.dataset.pageMotion === "off",
39
+ () => false,
40
+ );
41
+ }
42
+
25
43
  const variants: Record<Exclude<TabsTransitionVariant, "none">, Variants> = {
26
44
  slide: {
27
45
  enter: (dir: Direction) => ({ x: dir * SLIDE_PX, opacity: 0 }),
@@ -67,7 +85,9 @@ export function TabsTransition({
67
85
  children,
68
86
  }: TabsTransitionProps) {
69
87
  const configVariant = useUiConfig("Tabs")?.transition;
70
- const variant = variantProp ?? configVariant ?? "none";
88
+ const reduced = useReducedMotionSetting();
89
+ const pageMotionOff = usePageMotionOff();
90
+ const variant = reduced || pageMotionOff ? "none" : (variantProp ?? configVariant ?? "slide");
71
91
  const [previous, setPrevious] = useState(value);
72
92
  const [direction, setDirection] = useState<Direction>(1);
73
93
  if (value !== previous) {
package/src/ui/tabs.tsx CHANGED
@@ -49,7 +49,7 @@ const TabsList = React.forwardRef<
49
49
  const config = useUiConfig("Tabs");
50
50
  const cn = useCn();
51
51
  const variant = variantProp ?? config?.variant ?? "pills";
52
- const pillMotion = pillMotionProp ?? config?.pillMotion ?? "x";
52
+ const pillMotion = pillMotionProp ?? config?.pillMotion ?? "xy";
53
53
  const listRef = React.useRef<React.ComponentRef<
54
54
  typeof TabsPrimitive.List
55
55
  > | null>(null);
@@ -17,7 +17,7 @@ function TooltipProvider({
17
17
  const config = useUiConfig("Tooltip");
18
18
  return (
19
19
  <TooltipPrimitive.Provider
20
- delayDuration={delayDuration ?? config?.delayDuration}
20
+ delayDuration={delayDuration ?? config?.delayDuration ?? 300}
21
21
  {...props}
22
22
  />
23
23
  );
@@ -5,16 +5,14 @@
5
5
  *
6
6
  * @import "@vvedantb/ui/tokens/css/markdown.css";
7
7
  *
8
- * Reads the shadcn channel variables as `rgb(var(--name))`: --foreground,
9
- * --muted-foreground, --border, --primary, --success, --warning,
10
- * --destructive, and --radius, --font-mono and --motion-fast (150ms when
11
- * unset). The app (or compat-shadcn-rgb.css) must define them as space
12
- * separated RGB channels. Code block and table panels fill with
13
- * `var(--color-surface-secondary)`, which tokens.css and compat-shadcn-rgb.css
14
- * both define (the compat file maps it to the app's `--muted`).
8
+ * Reads full colour tokens as `var(--name)`: --foreground, --muted (grey
9
+ * text), --border, --primary, --success, --warning, --destructive, and
10
+ * --radius, --font-mono and --motion-fast (150ms when unset). Tints use
11
+ * `color-mix(in oklab, var(--name) N%, transparent)`. Code block and table
12
+ * panels fill with `var(--color-surface-secondary)`, which tokens.css defines.
15
13
  *
16
14
  * Set on :root, `.markdown` or any ancestor to change (default shown):
17
- * --markdown-alert-important: var(--primary) (RGB channels)
15
+ * --markdown-alert-important: var(--primary) (a colour)
18
16
  *
19
17
  * Typography is owned here rather than by `prose`: headings stay compact so a
20
18
  * chat reply reads as a reply, not a document. Sizes are in `em` so the scale
@@ -50,7 +48,7 @@
50
48
  margin: 1.25rem 0 0.5rem;
51
49
  font-weight: 600;
52
50
  line-height: 1.3;
53
- color: rgb(var(--foreground));
51
+ color: var(--foreground);
54
52
  letter-spacing: -0.01em;
55
53
  }
56
54
  .markdown h1 {
@@ -66,7 +64,7 @@
66
64
  font-size: 1em;
67
65
  }
68
66
  .markdown h6 {
69
- color: rgb(var(--muted-foreground));
67
+ color: var(--muted);
70
68
  }
71
69
  .markdown :is(h1, h2, h3, h4, h5, h6) + * {
72
70
  margin-top: 0;
@@ -79,7 +77,7 @@
79
77
  .markdown hr {
80
78
  margin-block: 1.25rem;
81
79
  border: 0;
82
- border-top: 1px solid rgb(var(--border));
80
+ border-top: 1px solid var(--border);
83
81
  }
84
82
 
85
83
  /* Lists */
@@ -105,7 +103,7 @@
105
103
  list-style: lower-roman;
106
104
  }
107
105
  .markdown li::marker {
108
- color: rgb(var(--muted-foreground));
106
+ color: var(--muted);
109
107
  font-variant-numeric: tabular-nums;
110
108
  }
111
109
  .markdown li + li {
@@ -125,20 +123,20 @@
125
123
  .markdown .task-list-item > input[type="checkbox"] {
126
124
  margin: 0 0.45em 0.15em -1.25rem;
127
125
  vertical-align: middle;
128
- accent-color: rgb(var(--primary));
126
+ accent-color: var(--primary);
129
127
  }
130
128
 
131
129
  /* Quotes and GitHub alerts */
132
130
  .markdown blockquote {
133
131
  padding-left: 0.8rem;
134
- border-left: 2px solid rgb(var(--border));
135
- color: rgb(var(--muted-foreground));
132
+ border-left: 2px solid var(--border);
133
+ color: var(--muted);
136
134
  }
137
135
  .markdown-alert {
138
136
  --alert: var(--foreground);
139
137
  padding: 0.6rem 0.8rem;
140
138
  border-radius: clamp(0.75rem, var(--radius), 1rem);
141
- background: rgb(var(--alert) / 0.06);
139
+ background: color-mix(in oklab, var(--alert) 6%, transparent);
142
140
  }
143
141
  .markdown-alert[data-alert="tip"] {
144
142
  --alert: var(--success);
@@ -164,7 +162,7 @@
164
162
  gap: 0.4rem;
165
163
  margin: 0;
166
164
  font-weight: 600;
167
- color: rgb(var(--alert));
165
+ color: var(--alert);
168
166
  }
169
167
  .markdown-alert-title svg {
170
168
  width: 1.1em;
@@ -174,10 +172,10 @@
174
172
 
175
173
  /* Links */
176
174
  .markdown-link {
177
- color: rgb(var(--primary));
175
+ color: var(--primary);
178
176
  font-weight: 500;
179
177
  text-decoration: underline;
180
- text-decoration-color: rgb(var(--primary) / 0.3);
178
+ text-decoration-color: color-mix(in oklab, var(--primary) 30%, transparent);
181
179
  text-underline-offset: 0.2em;
182
180
  transition: text-decoration-color var(--motion-fast, 150ms) ease-out;
183
181
  }
@@ -193,7 +191,7 @@
193
191
  margin-right: 0.3em;
194
192
  vertical-align: -0.12em;
195
193
  border-radius: 0.2em;
196
- color: rgb(var(--muted-foreground));
194
+ color: var(--muted);
197
195
  }
198
196
  .markdown-link-icon[data-failed] {
199
197
  display: none;
@@ -204,7 +202,7 @@
204
202
  padding: 0.1em 0.35em;
205
203
  border-radius: 0.375rem;
206
204
  /* Foreground-relative, so it still reads inside muted tables and callouts. */
207
- background: rgb(var(--foreground) / 0.06);
205
+ background: color-mix(in oklab, var(--foreground) 6%, transparent);
208
206
  font-family: var(--font-mono), ui-monospace, monospace;
209
207
  font-size: 0.86em;
210
208
  overflow-wrap: anywhere;
@@ -215,7 +213,7 @@
215
213
  height: 1em;
216
214
  margin-right: 0.25em;
217
215
  vertical-align: -0.15em;
218
- color: rgb(var(--muted-foreground));
216
+ color: var(--muted);
219
217
  }
220
218
 
221
219
  /* Code blocks */
@@ -235,7 +233,7 @@
235
233
  font-family: var(--font-mono), ui-monospace, monospace;
236
234
  font-size: 0.75rem;
237
235
  line-height: 1.75rem;
238
- color: rgb(var(--muted-foreground));
236
+ color: var(--muted);
239
237
  }
240
238
  .markdown-code-label {
241
239
  display: flex;
@@ -294,7 +292,7 @@
294
292
  white-space: nowrap;
295
293
  }
296
294
  .markdown tbody tr + tr {
297
- border-top: 1px solid rgb(var(--border) / 0.7);
295
+ border-top: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
298
296
  }
299
297
 
300
298
  .markdown .katex-display {
@@ -106,12 +106,46 @@
106
106
  }
107
107
  }
108
108
 
109
+ @keyframes ui-collapsible-down {
110
+ from {
111
+ height: 0;
112
+ }
113
+ to {
114
+ height: var(--radix-collapsible-content-height);
115
+ }
116
+ }
117
+
118
+ @keyframes ui-collapsible-up {
119
+ from {
120
+ height: var(--radix-collapsible-content-height);
121
+ }
122
+ to {
123
+ height: 0;
124
+ }
125
+ }
126
+
127
+ .ui-collapsible-content {
128
+ overflow: hidden;
129
+ }
130
+
131
+ .ui-collapsible-content[data-state="open"] {
132
+ animation: ui-collapsible-down var(--motion-base, 220ms) var(--motion-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
133
+ }
134
+
135
+ .ui-collapsible-content[data-state="closed"] {
136
+ animation: ui-collapsible-up var(--motion-base, 220ms) var(--motion-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
137
+ }
138
+
109
139
  /*
110
140
  * Reduced motion follows the root `MotionProvider reducedMotion` setting
111
141
  * (`html[data-reduced-motion]`): the OS query unless it is `"never"`, and
112
142
  * always when it is `"always"`.
113
143
  */
114
144
  @media (prefers-reduced-motion: reduce) {
145
+ html:not([data-reduced-motion="never"]) .ui-collapsible-content {
146
+ animation: none;
147
+ }
148
+
115
149
  html:not([data-reduced-motion="never"]) :is(.ui-page-enter, .ui-enter, .ui-enter-up, .ui-stagger > *) {
116
150
  animation-duration: 1ms;
117
151
  animation-name: ui-fade-only;
@@ -129,6 +163,11 @@
129
163
  animation-name: ui-fade-only;
130
164
  }
131
165
 
166
+ html[data-reduced-motion="always"] .ui-collapsible-content,
167
+ html[data-page-motion="off"] .ui-collapsible-content {
168
+ animation: none !important;
169
+ }
170
+
132
171
  html[data-reduced-motion="always"]::view-transition-group(*),
133
172
  html[data-reduced-motion="always"]::view-transition-old(*),
134
173
  html[data-reduced-motion="always"]::view-transition-new(*) {