devnonla-ui 0.13.0 → 0.14.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 (63) hide show
  1. package/package.json +1 -1
  2. package/src/app/App.tsx +2 -2
  3. package/src/app/context.ts +1 -12
  4. package/src/avatar/avatar.css +107 -0
  5. package/src/button/Button.tsx +4 -4
  6. package/src/button/ButtonCopy.tsx +1 -1
  7. package/src/calendar/Calendar.tsx +1 -1
  8. package/src/card/Card.tsx +1 -1
  9. package/src/chat/message-ui/ChatError.tsx +1 -1
  10. package/src/chat/message-ui/ChatInput.tsx +5 -4
  11. package/src/chat/message-ui/ChatUserMessage.tsx +3 -3
  12. package/src/chat/tool-ui/BackgroundTasksBar.tsx +3 -3
  13. package/src/chat/tool-ui/CallAgentToolUI.tsx +2 -2
  14. package/src/chat/tool-ui/ChatToolCall.tsx +3 -3
  15. package/src/chat/tool-ui/ReadSkillToolUI.tsx +2 -2
  16. package/src/chat/tool-ui/RunJsToolUI.tsx +1 -1
  17. package/src/chat/tool-ui/ToolUiBadge.tsx +1 -1
  18. package/src/chat/tool-ui/WebFetchToolUI.tsx +1 -1
  19. package/src/checkbox/Checkbox.tsx +2 -2
  20. package/src/codeblock/CodeBlock.tsx +1 -1
  21. package/src/colorpicker/ColorPicker.tsx +10 -8
  22. package/src/datepicker/DatePicker.tsx +3 -3
  23. package/src/desktop/DesktopHeader.tsx +2 -2
  24. package/src/desktop/DesktopStage.tsx +1 -1
  25. package/src/desktop/DesktopWindow.tsx +3 -3
  26. package/src/desktop/MeadowDesktop.tsx +2 -2
  27. package/src/drawer/Drawer.tsx +6 -2
  28. package/src/dropdown/menuClasses.ts +1 -1
  29. package/src/empty/Empty.tsx +1 -1
  30. package/src/form/variants/FieldRadio.tsx +1 -1
  31. package/src/form/variants/FieldRepeaterItem.tsx +1 -1
  32. package/src/index.ts +3 -3
  33. package/src/input/EditableInput.tsx +3 -2
  34. package/src/input/Input.tsx +15 -7
  35. package/src/lib/sizes.ts +6 -6
  36. package/src/lib/surface.ts +14 -4
  37. package/src/markdown-editor/MarkdownDiff.tsx +4 -4
  38. package/src/markdown-editor/MarkdownPreview.tsx +4 -4
  39. package/src/markdown-editor/MarkdownSource.tsx +1 -1
  40. package/src/markdown-editor/MarkdownTable.tsx +1 -1
  41. package/src/markdown-editor/MarkdownViewer.tsx +7 -7
  42. package/src/markdown-editor/MermaidBlock.tsx +1 -1
  43. package/src/markdown-editor/ReactCodeFrame.tsx +8 -4
  44. package/src/markdown-editor/markdownScale.ts +30 -25
  45. package/src/menu/Menu.tsx +1 -1
  46. package/src/message/message.tsx +18 -8
  47. package/src/modal/Modal.tsx +13 -7
  48. package/src/pagination/Pagination.tsx +3 -3
  49. package/src/popover/Popover.tsx +1 -1
  50. package/src/scroll/OverlayScroll.tsx +2 -2
  51. package/src/segmented/Segmented.tsx +1 -1
  52. package/src/select/Select.tsx +4 -4
  53. package/src/sidebar/Sidebar.tsx +35 -32
  54. package/src/skeleton/Skeleton.tsx +4 -4
  55. package/src/spin/Spin.tsx +14 -2
  56. package/src/splitter/Splitter.tsx +1 -1
  57. package/src/styles.css +166 -842
  58. package/src/table/Table.tsx +12 -12
  59. package/src/tabs/Tabs.tsx +3 -3
  60. package/src/tag/Tag.tsx +3 -3
  61. package/src/theme.ts +53 -147
  62. package/src/timepicker/TimePicker.tsx +2 -2
  63. package/src/typography/Typography.tsx +6 -6
@@ -27,7 +27,7 @@ export function FieldRadio({ field, choices }: Props) {
27
27
  />
28
28
  <span
29
29
  aria-hidden
30
- className="pointer-events-none size-4 rounded-full border border-solid border-input bg-(--control-bg) peer-checked:border-brand"
30
+ className="pointer-events-none size-4 rounded-full border border-solid border-input bg-muted peer-checked:border-brand"
31
31
  />
32
32
  <span aria-hidden className="pointer-events-none absolute inset-[3.5px] rounded-full bg-brand opacity-0 peer-checked:opacity-100" />
33
33
  </span>
@@ -37,7 +37,7 @@ export function FieldRepeaterItem({ index, remove, namePrefix, childItems, contr
37
37
  <button
38
38
  type="button"
39
39
  aria-label="Remove item"
40
- className="inline-flex size-5 items-center justify-center rounded border-0 bg-muted text-muted-foreground cursor-pointer hover:bg-destructive hover:text-destructive-foreground"
40
+ className="inline-flex size-5 items-center justify-center rounded border-0 bg-muted text-muted-foreground cursor-pointer hover:bg-destructive hover:text-(--nonla-text-on-solid)"
41
41
  onClick={() => remove(index)}
42
42
  >
43
43
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden>
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { AppProps, NonlaAppConfig } from "./app/App";
2
- export { App, useApp, useAppConfig, usePopupContainer, useToken } from "./app/App";
2
+ export { App, useApp, useAppConfig, usePopupContainer } from "./app/App";
3
3
  export type { ButtonColor, ButtonGroupProps, ButtonProps, ButtonSize, ButtonType, ButtonVariant } from "./button/Button";
4
4
  export { Button } from "./button/Button";
5
5
  export type { ButtonCopyProps } from "./button/ButtonCopy";
@@ -217,8 +217,8 @@ export type { TabsItem, TabsProps } from "./tabs/Tabs";
217
217
  export { Tabs } from "./tabs/Tabs";
218
218
  export type { TagProps, TagVariant } from "./tag/Tag";
219
219
  export { Tag } from "./tag/Tag";
220
- export type { NonlaColorMode, NonlaColorPreference, NonlaThemeKnob, NonlaThemeKnobName, NonlaTokenSnapshot } from "./theme";
221
- export { getColorMode, getColorPreference, getDesignToken, initColorMode, NONLA_COLOR_MODE_KEY, NONLA_THEME_KEYS, NONLA_THEME_KNOBS, setColorMode, setColorPreference } from "./theme";
220
+ export type { NonlaColorMode, NonlaColorPreference } from "./theme";
221
+ export { getColorMode, getColorPreference, initColorMode, NONLA_COLOR_MODE_KEY, setColorMode, setColorPreference } from "./theme";
222
222
  export type { ThemeSwitcherProps } from "./theme-switcher/ThemeSwitcher";
223
223
  export { ThemeSwitcher, useColorPreference } from "./theme-switcher/ThemeSwitcher";
224
224
  export type { ThemeToggleProps } from "./theme-toggle/ThemeToggle";
@@ -5,6 +5,7 @@ import { Button } from "../button/Button";
5
5
  import { SolarIcon } from "../icon/SolarIcon";
6
6
  import { cn } from "../lib/cn";
7
7
  import { type CanonicalSize, type ControlSize, controlHeightVar, controlRadiusVar, getSizeTokens, useControlSize } from "../lib/sizes";
8
+ import { glassSurfaceClass } from "../lib/surface";
8
9
  import { message } from "../message/message";
9
10
 
10
11
  const POPUP_PAD: Record<CanonicalSize, number> = { small: 12, default: 16, large: 20 };
@@ -12,7 +13,7 @@ const FIELD_INSET: Record<CanonicalSize, string> = { small: "-4px", default: "-6
12
13
  const MULTILINE_MIN: Record<CanonicalSize, number> = { small: 56, default: 72, large: 96 };
13
14
  const GLASS_BORDER = 1;
14
15
 
15
- const fieldClass = (saving: boolean) => cn("relative z-1 m-0 w-full border-0 bg-transparent text-foreground placeholder:text-placeholder focus:outline-none", saving && "opacity-60");
16
+ const fieldClass = (saving: boolean) => cn("relative z-1 m-0 w-full border-0 bg-transparent text-foreground placeholder:text-quaternary-foreground focus:outline-none", saving && "opacity-60");
16
17
 
17
18
  type Lock = {
18
19
  top: number;
@@ -187,7 +188,7 @@ function EditorPopover({
187
188
 
188
189
  return createPortal(
189
190
  <div
190
- className="nonla-popup-layer nonla-glass outline-none"
191
+ className={cn(glassSurfaceClass, "nonla-popup-layer outline-none")}
191
192
  style={{
192
193
  position: "fixed",
193
194
  zIndex: "var(--nonla-z-popup, 1050)",
@@ -15,11 +15,11 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "p
15
15
  onPressEnter?: (e: KeyboardEvent<HTMLInputElement>) => void;
16
16
  };
17
17
 
18
- const fieldBase = cn("w-full", controlFieldSurface, "placeholder:text-placeholder focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-45", controlFieldFocusBorder);
18
+ const fieldBase = cn("w-full", controlFieldSurface, "placeholder:text-quaternary-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-45", controlFieldFocusBorder);
19
19
 
20
20
  function variantClass(variant: InputProps["variant"]) {
21
21
  if (variant === "borderless") return "border-transparent bg-transparent hover:bg-transparent shadow-none focus:border-transparent focus:bg-transparent focus-within:bg-transparent";
22
- if (variant === "filled") return "border-transparent bg-muted focus:border-transparent focus:bg-[var(--control-bg-hover)]";
22
+ if (variant === "filled") return "border-transparent bg-muted focus:border-transparent focus:bg-muted-strong";
23
23
  return "";
24
24
  }
25
25
 
@@ -162,12 +162,15 @@ function roundTo(n: number, precision?: number) {
162
162
 
163
163
  function HandlerChevron({ dir, size }: { dir: "up" | "down"; size: number }) {
164
164
  return (
165
- <svg width={size} height={size} viewBox="0 0 10 10" fill="none" aria-hidden className="opacity-70">
165
+ <svg width={size} height={size} viewBox="0 0 10 10" fill="none" aria-hidden>
166
166
  {dir === "up" ? <path d="M2.5 6.25L5 3.75L7.5 6.25" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" /> : <path d="M2.5 3.75L5 6.25L7.5 3.75" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />}
167
167
  </svg>
168
168
  );
169
169
  }
170
170
 
171
+ /** Stepper reveal and press. Same ease-out and duration as the field focus. */
172
+ const handlerEase = "duration-[var(--nonla-dur-fast,150ms)] ease-[var(--nonla-ease-out,cubic-bezier(0.16,1,0.3,1))] motion-reduce:transition-none";
173
+
171
174
  const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function InputNumber({ value, defaultValue, onChange, min, max, step = 1, controls = true, precision, parser, formatter, disabled, size, status, className, style, placeholder, onBlur, onFocus, onKeyDown, ...rest }, ref) {
172
175
  const controlled = value !== undefined;
173
176
  const [inner, setInner] = useState<number | null>(defaultValue ?? null);
@@ -275,7 +278,7 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
275
278
  }}
276
279
  onKeyDown={handleKeyDown}
277
280
  className={cn(
278
- "min-w-0 flex-1 border-0 bg-transparent text-foreground placeholder:text-placeholder outline-none",
281
+ "min-w-0 flex-1 border-0 bg-transparent text-foreground placeholder:text-quaternary-foreground outline-none",
279
282
  "disabled:cursor-not-allowed",
280
283
  // Kill native number chrome if type ever switches
281
284
  "[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
@@ -291,7 +294,12 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
291
294
 
292
295
  {controls && !disabled ? (
293
296
  <div
294
- className={cn("absolute top-0 right-0 bottom-0 flex flex-col overflow-hidden border-l border-border/80", "opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100")}
297
+ className={cn(
298
+ "pointer-events-none absolute top-0 right-0 bottom-0 flex flex-col overflow-hidden border-l border-input opacity-0",
299
+ "transition-opacity",
300
+ handlerEase,
301
+ "group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100",
302
+ )}
295
303
  style={{ width: handlerW, borderTopRightRadius: `calc(${controlRadiusVar(size)} - 1px)`, borderBottomRightRadius: `calc(${controlRadiusVar(size)} - 1px)` }}
296
304
  >
297
305
  <button
@@ -299,7 +307,7 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
299
307
  tabIndex={-1}
300
308
  aria-label="Increase"
301
309
  disabled={atMax}
302
- className={cn("flex flex-1 items-center justify-center text-muted-foreground", "hover:bg-ink-hover hover:text-foreground active:bg-ink-active", "disabled:opacity-30 disabled:pointer-events-none", "border-b border-border/60")}
310
+ className={cn("flex flex-1 items-center justify-center border-b border-input text-tertiary-foreground", "transition-colors", handlerEase, "hover:bg-ink-hover hover:text-foreground active:bg-ink-active active:duration-75", "disabled:pointer-events-none disabled:opacity-30")}
303
311
  onMouseDown={(e) => e.preventDefault()}
304
312
  onClick={() => stepBy(1)}
305
313
  >
@@ -310,7 +318,7 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
310
318
  tabIndex={-1}
311
319
  aria-label="Decrease"
312
320
  disabled={atMin}
313
- className={cn("flex flex-1 items-center justify-center text-muted-foreground", "hover:bg-ink-hover hover:text-foreground active:bg-ink-active", "disabled:opacity-30 disabled:pointer-events-none")}
321
+ className={cn("flex flex-1 items-center justify-center text-tertiary-foreground", "transition-colors", handlerEase, "hover:bg-ink-hover hover:text-foreground active:bg-ink-active active:duration-75", "disabled:pointer-events-none disabled:opacity-30")}
314
322
  onMouseDown={(e) => e.preventDefault()}
315
323
  onClick={() => stepBy(-1)}
316
324
  >
package/src/lib/sizes.ts CHANGED
@@ -83,10 +83,10 @@ export function controlRadiusVar(size: ControlSize | undefined): string {
83
83
  return "var(--nonla-radius)";
84
84
  }
85
85
 
86
- /** Soft status border — keep the same color on focus so brand focus does not override. */
86
+ /** Soft status border — keep the same color on focus so the ink focus stroke does not override. */
87
87
  export function controlStatusClass(status?: "error" | "warning"): string {
88
- if (status === "error") return "border-[color-mix(in_oklab,var(--destructive)_55%,transparent)] focus:border-destructive focus-within:border-destructive data-[state=open]:border-destructive";
89
- if (status === "warning") return "border-[color-mix(in_oklab,var(--warn)_55%,transparent)] focus:border-warn focus-within:border-warn data-[state=open]:border-warn";
88
+ if (status === "error") return "border-[color-mix(in_oklab,var(--destructive)_55%,transparent)] focus:border-destructive! focus-within:border-destructive! data-[state=open]:border-destructive!";
89
+ if (status === "warning") return "border-[color-mix(in_oklab,var(--warn)_55%,transparent)] focus:border-warn! focus-within:border-warn! data-[state=open]:border-warn!";
90
90
  return "";
91
91
  }
92
92
 
@@ -100,11 +100,11 @@ export const controlFieldTransition = "transition-[background-color,border-color
100
100
  export const controlFieldSurface = "border border-solid border-input bg-transparent text-foreground";
101
101
 
102
102
  /**
103
- * Focus fill is Cursor `--bg-tertiary` (ink at 8%).
104
- * Keyboard focus / open menu also strengthens the stroke to `--border-primary` (ink at 20%).
103
+ * Focus fill is the sidebar step. Focus stroke is `--nonla-input-focus`.
104
+ * Each theme sets those names to a concrete color. Any focus and an open menu use the stroke.
105
105
  */
106
106
  export const controlFieldFocusBorder =
107
- "focus:bg-input-fill focus-within:bg-input-fill data-[state=open]:bg-input-fill aria-expanded:bg-input-fill focus-visible:border-input-focus has-[:focus-visible]:border-input-focus data-[state=open]:border-input-focus aria-expanded:border-input-focus";
107
+ "focus:bg-sidebar focus-within:bg-sidebar data-[state=open]:bg-sidebar aria-expanded:bg-sidebar focus:border-input-focus focus-within:border-input-focus focus-visible:border-input-focus has-[:focus-visible]:border-input-focus data-[state=open]:border-input-focus aria-expanded:border-input-focus";
108
108
 
109
109
  /** Shared field chrome (Input / Select / DatePicker). */
110
110
  export function controlFieldStyle(size: ControlSize | undefined): CSSProperties {
@@ -1,9 +1,19 @@
1
1
  /** Solid panel — window, modal, popover, menu, drawer, toast. */
2
- export const glassSurfaceClass = "nonla-glass";
2
+ export const glassSurfaceClass =
3
+ "nonla-glass border border-solid border-border bg-card text-foreground shadow-(--nonla-shadow)";
3
4
 
4
5
  /** Floating overlay chrome (Popover / Dropdown / Select / pickers / Tooltip). */
5
- export const glassOverlayClass =
6
- "nonla-popup-layer z-[var(--nonla-z-popup,1050)] rounded-xl nonla-glass outline-none nonla-popper";
6
+ export const glassOverlayClass = [
7
+ glassSurfaceClass,
8
+ "nonla-popup-layer nonla-popper z-[var(--nonla-z-popup,1050)] rounded-xl outline-none will-change-[transform,opacity]",
9
+ "[transform-origin:var(--radix-popover-content-transform-origin,var(--radix-dropdown-menu-content-transform-origin,var(--radix-select-content-transform-origin,var(--radix-tooltip-content-transform-origin,center))))]",
10
+ "data-[state=open]:data-[side=top]:animate-[nonla-pop-in-top_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
11
+ "data-[state=open]:data-[side=bottom]:animate-[nonla-pop-in-bottom_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
12
+ "data-[state=open]:data-[side=left]:animate-[nonla-pop-in-left_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
13
+ "data-[state=open]:data-[side=right]:animate-[nonla-pop-in-right_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
14
+ "data-[state=open]:not-data-[side]:animate-[nonla-pop-in-bottom_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
15
+ "data-[state=closed]:animate-[nonla-pop-out_100ms_var(--nonla-ease-in)]",
16
+ ].join(" ");
7
17
 
8
18
  /** Meadow menus — same panel as overlays. */
9
- export const meadowSurfaceClass = "rounded-xl nonla-glass";
19
+ export const meadowSurfaceClass = `rounded-xl ${glassSurfaceClass}`;
@@ -8,7 +8,7 @@ export type MarkdownDiffLayout = "inline" | "side-by-side";
8
8
  function rowBg(kind: DiffLine["kind"]): string {
9
9
  if (kind === "insert") return "bg-[color-mix(in_oklab,var(--success)_16%,var(--card))]";
10
10
  if (kind === "delete") return "bg-[color-mix(in_oklab,var(--destructive)_14%,var(--card))]";
11
- if (kind === "empty") return "bg-secondary/45";
11
+ if (kind === "empty") return "bg-muted/45";
12
12
  return "bg-card";
13
13
  }
14
14
 
@@ -65,7 +65,7 @@ function LineBody({ line }: { line: DiffLine }) {
65
65
 
66
66
  function FoldButton({ count, onClick, span }: { count: number; onClick: () => void; span?: boolean }) {
67
67
  return (
68
- <button type="button" className={cn("flex w-full items-center justify-center border-y border-border bg-secondary/70 py-0.5 text-xs text-link hover:bg-secondary", span && "col-span-2")} onClick={onClick}>
68
+ <button type="button" className={cn("flex w-full items-center justify-center border-y border-border bg-muted/70 py-0.5 text-xs text-link hover:bg-muted", span && "col-span-2")} onClick={onClick}>
69
69
  Show {count} unchanged {count === 1 ? "line" : "lines"}
70
70
  </button>
71
71
  );
@@ -166,8 +166,8 @@ function SplitDiff({ model, open, toggle, originalLabel, modifiedLabel }: { mode
166
166
  segment += 1;
167
167
  chunks.push(
168
168
  <div key={`seg-${id}`} className="flex w-full items-start">
169
- <div className="nonla-scroll-hover w-1/2 min-w-0 overflow-x-auto">{left}</div>
170
- <div className="nonla-scroll-hover w-1/2 min-w-0 overflow-x-auto border-l border-border">{right}</div>
169
+ <div className="w-1/2 min-w-0 overflow-x-auto [scrollbar-color:transparent_transparent] hover:[scrollbar-color:var(--nonla-scrollbar-thumb)_transparent] [&::-webkit-scrollbar-thumb]:bg-transparent hover:[&::-webkit-scrollbar-thumb]:bg-(--nonla-scrollbar-thumb) hover:[&::-webkit-scrollbar-thumb:hover]:bg-(--nonla-scrollbar-thumb-hover)">{left}</div>
170
+ <div className="w-1/2 min-w-0 overflow-x-auto border-l border-border [scrollbar-color:transparent_transparent] hover:[scrollbar-color:var(--nonla-scrollbar-thumb)_transparent] [&::-webkit-scrollbar-thumb]:bg-transparent hover:[&::-webkit-scrollbar-thumb]:bg-(--nonla-scrollbar-thumb) hover:[&::-webkit-scrollbar-thumb:hover]:bg-(--nonla-scrollbar-thumb-hover)">{right}</div>
171
171
  </div>,
172
172
  );
173
173
  left = [];
@@ -57,8 +57,8 @@ function BlockEditor({ value, mono, className, caret = "end", onChange, onBlur,
57
57
  });
58
58
  }}
59
59
  className={cn(
60
- "block w-full resize-none overflow-hidden border-0 bg-transparent p-0 text-(length:--md-body-size,16px) leading-(--md-body-leading,24px) text-(--md-ink) shadow-none outline-none ring-0 placeholder:text-placeholder focus:outline-none focus:ring-0",
61
- mono && "font-mono text-[13px] leading-5",
60
+ "block w-full resize-none overflow-hidden border-0 bg-transparent p-0 text-(length:--md-body-size,16px) leading-(--md-body-leading,24px) text-foreground shadow-none outline-none ring-0 placeholder:text-quaternary-foreground focus:outline-none focus:ring-0",
61
+ mono && "font-mono text-(length:--md-code-size,14px) leading-(--md-code-leading,22px)",
62
62
  className,
63
63
  )}
64
64
  aria-label="Edit markdown"
@@ -142,9 +142,9 @@ export function MarkdownPreview({ doc, editingIndex, readOnly, placeholder = "Wr
142
142
  );
143
143
  })}
144
144
  {readOnly ? (
145
- doc.blocks.length === 0 ? <p className="m-0 text-sm text-placeholder">{placeholder}</p> : null
145
+ doc.blocks.length === 0 ? <p className="m-0 text-sm text-quaternary-foreground">{placeholder}</p> : null
146
146
  ) : (
147
- <button type="button" className="mt-3 min-h-16 text-left text-sm text-placeholder" onClick={onAppend} aria-label="Add paragraph">
147
+ <button type="button" className="mt-3 min-h-16 text-left text-sm text-quaternary-foreground" onClick={onAppend} aria-label="Add paragraph">
148
148
  {doc.blocks.length === 0 ? placeholder : ""}
149
149
  </button>
150
150
  )}
@@ -63,7 +63,7 @@ export function MarkdownSource({ value, onChange, readOnly, placeholder = "Write
63
63
  setCursor(pos);
64
64
  });
65
65
  }}
66
- className="relative z-10 block w-full resize-none overflow-hidden bg-transparent py-2 pr-4 font-mono text-[13px] leading-5 text-foreground outline-none placeholder:text-placeholder"
66
+ className="relative z-10 block w-full resize-none overflow-hidden bg-transparent py-2 pr-4 font-mono text-[13px] leading-5 text-foreground outline-none placeholder:text-quaternary-foreground"
67
67
  style={{ height: Math.max(lines.length, 1) * LINE + PAD * 2 }}
68
68
  />
69
69
  </div>
@@ -35,7 +35,7 @@ export function MarkdownTable({ children }: { children: ReactNode }) {
35
35
  <div className="overflow-x-auto">
36
36
  <table
37
37
  ref={tableRef}
38
- className="w-max min-w-full border-separate border-spacing-0 text-(length:--md-table-size,15px) [&_th]:max-w-[360px] [&_td]:max-w-[360px] [&_th]:whitespace-normal [&_td]:whitespace-normal [&_th]:wrap-normal [&_td]:wrap-normal [&_th]:bg-(--nonla-table-head) [&_th]:font-semibold [&_th]:px-2.5 [&_th]:py-1.5 [&_th]:text-left [&_th]:align-top [&_th]:border-r [&_th]:border-b [&_th]:border-border [&_th:last-child]:border-r-0 [&_td]:px-2.5 [&_td]:py-1.5 [&_td]:align-top [&_td]:bg-card [&_td]:border-r [&_td]:border-b [&_td]:border-border [&_td:last-child]:border-r-0 [&_tbody_tr:last-child_td]:border-b-0"
38
+ className="w-max min-w-full border-separate border-spacing-0 text-(length:--md-table-size,15px) [&_th]:max-w-[360px] [&_td]:max-w-[360px] [&_th]:whitespace-normal [&_td]:whitespace-normal [&_th]:wrap-normal [&_td]:wrap-normal [&_th]:bg-muted [&_th]:font-semibold [&_th]:px-2.5 [&_th]:py-1.5 [&_th]:text-left [&_th]:align-top [&_th]:border-r [&_th]:border-b [&_th]:border-border [&_th:last-child]:border-r-0 [&_td]:px-2.5 [&_td]:py-1.5 [&_td]:align-top [&_td]:bg-card [&_td]:border-r [&_td]:border-b [&_td]:border-border [&_td:last-child]:border-r-0 [&_tbody_tr:last-child_td]:border-b-0"
39
39
  >
40
40
  {children}
41
41
  </table>
@@ -16,12 +16,12 @@ export { headingClass, markdownVariantStyle };
16
16
 
17
17
  /** Task checks use the body ink, so a checked box sits with the text instead of the brand fill. */
18
18
  const taskCheckClass =
19
- "data-[state=checked]:border-(--md-ink)! data-[state=checked]:bg-(--md-ink)! data-[state=checked]:text-background! data-[state=indeterminate]:border-(--md-ink)! data-[state=indeterminate]:bg-(--md-ink)! data-[state=indeterminate]:text-background!";
19
+ "data-[state=checked]:border-foreground! data-[state=checked]:bg-foreground! data-[state=checked]:text-background! data-[state=indeterminate]:border-foreground! data-[state=indeterminate]:bg-foreground! data-[state=indeterminate]:text-background!";
20
20
 
21
21
  const documentClass = cn(
22
- "min-w-0 wrap-anywhere text-(length:--md-body-size,16px) leading-(--md-body-leading,24px) text-(--md-ink)",
23
- "[&_:is(h1,h2,h3,h4,h5,h6)]:text-(--md-heading)",
24
- "[&_:is(h1,h2)]:mt-(--md-h2-mt,24px) [&_h1]:mb-(--md-h1-mb,12px) [&_h2]:mb-(--md-h2-mb,1px) [&_:is(h1,h2)]:pt-(--md-h2-py,3px) [&_:is(h1,h2)]:pb-(--md-h2-py,3px) [&_:is(h1,h2)]:text-(length:--md-h2-size,30px) [&_:is(h1,h2)]:leading-(--md-h2-leading,40px) [&_:is(h1,h2)]:font-(--md-h2-weight,600) [&_:is(h1,h2)]:tracking-normal",
22
+ "min-w-0 wrap-anywhere text-(length:--md-body-size,16px) leading-(--md-body-leading,24px) text-foreground",
23
+ "[&_:is(h1,h2,h3,h4,h5,h6)]:text-foreground",
24
+ "[&_:is(h1,h2)]:mt-(--md-h2-mt,24px) [&_h1]:mb-(--md-h1-mb,12px) [&_h2]:mb-(--md-h2-mb,1px) [&_:is(h1,h2)]:pt-(--md-h2-py,3px) [&_:is(h1,h2)]:pb-(--md-h2-py,3px) [&_:is(h1,h2)]:text-(length:--md-h2-size,30px) [&_:is(h1,h2)]:leading-(--md-h2-leading,40px) [&_:is(h1,h2)]:font-(--md-h2-weight,700) [&_:is(h1,h2)]:tracking-normal",
25
25
  "[&_h3]:mt-(--md-h3-mt,22px) [&_h3]:mb-(--md-h3-mb,1px) [&_h3]:text-(length:--md-h3-size,24px) [&_h3]:leading-(--md-h3-leading,32px) [&_h3]:font-(--md-h3-weight,700)",
26
26
  "[&_h4]:mt-(--md-h4-mt,16px) [&_h4]:mb-(--md-h4-mb,1px) [&_h4]:text-(length:--md-h4-size,20px) [&_h4]:leading-(--md-h4-leading,26px) [&_h4]:font-(--md-h4-weight,700)",
27
27
  "[&_h5]:mt-(--md-h5-mt,0px) [&_h5]:mb-(--md-h5-mb,0px) [&_h5]:text-(length:--md-h5-size,16px) [&_h5]:leading-(--md-h5-leading,1.375) [&_h5]:font-(--md-h5-weight,700)",
@@ -49,7 +49,7 @@ const previewComponents: Components = {
49
49
  const codeText = String(children).replace(/\n$/, "");
50
50
  const isBlock = codeText.includes("\n") || !!match;
51
51
  if (!isBlock) {
52
- return <code className="nonla-inline-code">{children}</code>;
52
+ return <code className="nonla-inline-code rounded-sm bg-muted px-[0.35em] py-[0.12em] align-baseline font-mono text-(length:--md-inline-size,14px) leading-none whitespace-nowrap [box-decoration-break:clone] [-webkit-box-decoration-break:clone]">{children}</code>;
53
53
  }
54
54
  if (lang.toLowerCase() === "mermaid") return <MermaidView code={codeText} />;
55
55
  return <CodeBlock code={codeText} language={lang || undefined} className="my-(--md-code-my,8px)" />;
@@ -243,10 +243,10 @@ export type MarkdownViewerProps = {
243
243
  export function MarkdownViewer({ value = "", streaming = false, sandboxSrc, trustedModules, showHeader = true, showCode = true, placeholder, className, variant = "docs" }: MarkdownViewerProps) {
244
244
  const doc = useMemo(() => parseMarkdownDoc(value), [value]);
245
245
  if (doc.blocks.length === 0) {
246
- return placeholder ? <p className={cn("m-0 text-sm text-placeholder", className)}>{placeholder}</p> : null;
246
+ return placeholder ? <p className={cn("m-0 text-sm text-quaternary-foreground", className)}>{placeholder}</p> : null;
247
247
  }
248
248
  return (
249
- <div data-variant={variant} className={cn("nonla-markdown-viewer flex min-w-0 flex-col text-(--md-ink)", variant === "chat" && "[&>[data-md-block]:first-child_:is(h1,h2,h3,h4,h5,h6)]:mt-0", className)} style={markdownVariantStyle(variant)}>
249
+ <div data-variant={variant} className={cn("nonla-markdown-viewer flex min-w-0 flex-col text-foreground", variant === "chat" && "[&>[data-md-block]:first-child_:is(h1,h2,h3,h4,h5,h6)]:mt-0", className)} style={markdownVariantStyle(variant)}>
250
250
  {doc.blocks.map((block, index) => (
251
251
  <div
252
252
  // biome-ignore lint/suspicious/noArrayIndexKey: block position is the document identity
@@ -176,7 +176,7 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
176
176
 
177
177
  if (error) {
178
178
  return (
179
- <div className={cn("my-3 rounded-lg bg-accent border border-destructive/30 p-4 text-xs text-destructive", className)}>
179
+ <div className={cn("my-3 rounded-lg bg-brand/14 border border-destructive/30 p-4 text-xs text-destructive", className)}>
180
180
  <p className="font-medium mb-1">Mermaid render error</p>
181
181
  <pre className="whitespace-pre-wrap text-[11px] opacity-70">{error}</pre>
182
182
  </div>
@@ -46,8 +46,8 @@ export function ReactCodeFrame({ title, icon, showHeader = true, code, className
46
46
  {hasCode ? <Segmented<Tab> size="small" options={TABS} value={tab} onChange={setTab} /> : null}
47
47
  </div>
48
48
  ) : null}
49
- {/* Stays mounted on the Code view, so an iframe keeps its state. */}
50
- <div className={cn("min-w-0 px-6 py-8", showingCode && "hidden")}>{children}</div>
49
+ {/* Stays mounted when the Code tab replaces it, so an iframe keeps its state. The code button keeps this and opens the source under it. */}
50
+ <div className={cn("min-w-0 px-6 py-8", hasLabel && showingCode && "hidden")}>{children}</div>
51
51
  {hasCode && !hasLabel ? (
52
52
  <div className="flex h-10 items-center justify-end border-t border-border pr-1.5">
53
53
  <Tooltip title={codeLabel}>
@@ -56,7 +56,7 @@ export function ReactCodeFrame({ title, icon, showHeader = true, code, className
56
56
  aria-expanded={open}
57
57
  aria-label={codeLabel}
58
58
  className={cn(
59
- "inline-flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
59
+ "inline-flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/55",
60
60
  open ? "bg-muted text-foreground" : "text-muted-foreground",
61
61
  )}
62
62
  onClick={() => setOpen((value) => !value)}
@@ -66,7 +66,11 @@ export function ReactCodeFrame({ title, icon, showHeader = true, code, className
66
66
  </Tooltip>
67
67
  </div>
68
68
  ) : null}
69
- {hasCode && showingCode ? <CodeBlock code={code} language="tsx" className="my-0 rounded-none border-0" /> : null}
69
+ {hasCode && showingCode ? (
70
+ <div className={cn(!hasLabel && "border-t border-border")}>
71
+ <CodeBlock code={code} language="tsx" className="my-0 rounded-none border-0" />
72
+ </div>
73
+ ) : null}
70
74
  </div>
71
75
  );
72
76
  }
@@ -6,12 +6,13 @@ export type MarkdownVariant = "docs" | "chat";
6
6
  /**
7
7
  * Size and spacing for each scale. Class fallbacks match `docs`, so the editor
8
8
  * preview stays on the article scale when no preset is set.
9
- * Docs body is 16px. Chat body and h1–h3 are 15px. Inline code is 14px on docs, 13px in chat.
9
+ * Docs body reads `--nonla-base-text-size` (16px, leading 1.5). Chat body, headings, table, and inline code are 14px.
10
+ * Fenced code is 14px.
10
11
  */
11
12
  const MARKDOWN_PRESETS = {
12
13
  docs: {
13
- "--md-body-size": "16px",
14
- "--md-body-leading": "24px",
14
+ "--md-body-size": "var(--nonla-base-text-size, 16px)",
15
+ "--md-body-leading": "calc(var(--nonla-base-text-size, 16px) * 1.5)",
15
16
  "--md-h1-size": "32px",
16
17
  "--md-h1-leading": "1.25",
17
18
  "--md-h1-weight": "800",
@@ -20,7 +21,7 @@ const MARKDOWN_PRESETS = {
20
21
  "--md-h1-py": "3px",
21
22
  "--md-h2-size": "30px",
22
23
  "--md-h2-leading": "40px",
23
- "--md-h2-weight": "600",
24
+ "--md-h2-weight": "700",
24
25
  "--md-h2-mt": "24px",
25
26
  "--md-h2-mb": "1px",
26
27
  "--md-h2-py": "3px",
@@ -58,32 +59,34 @@ const MARKDOWN_PRESETS = {
58
59
  "--md-table-my": "16px",
59
60
  "--md-table-size": "15px",
60
61
  "--md-code-my": "8px",
62
+ "--md-code-size": "14px",
63
+ "--md-code-leading": "22px",
61
64
  "--md-inline-size": "14px",
62
65
  "--md-item-pl": "4px",
63
66
  "--md-nest": "1.25rem",
64
67
  },
65
68
  chat: {
66
- "--md-body-size": "15px",
67
- "--md-body-leading": "24px",
68
- "--md-h1-size": "15px",
69
- "--md-h1-leading": "24px",
69
+ "--md-body-size": "14px",
70
+ "--md-body-leading": "22px",
71
+ "--md-h1-size": "14px",
72
+ "--md-h1-leading": "22px",
70
73
  "--md-h1-weight": "600",
71
74
  "--md-h1-mt": "0px",
72
75
  "--md-h1-mb": "2px",
73
76
  "--md-h1-py": "0px",
74
- "--md-h2-size": "15px",
75
- "--md-h2-leading": "24px",
77
+ "--md-h2-size": "14px",
78
+ "--md-h2-leading": "22px",
76
79
  "--md-h2-weight": "600",
77
80
  "--md-h2-mt": "12px",
78
81
  "--md-h2-mb": "2px",
79
82
  "--md-h2-py": "0px",
80
- "--md-h3-size": "15px",
81
- "--md-h3-leading": "24px",
83
+ "--md-h3-size": "14px",
84
+ "--md-h3-leading": "22px",
82
85
  "--md-h3-weight": "600",
83
86
  "--md-h3-mt": "10px",
84
87
  "--md-h3-mb": "2px",
85
- "--md-h4-size": "15px",
86
- "--md-h4-leading": "24px",
88
+ "--md-h4-size": "14px",
89
+ "--md-h4-leading": "22px",
87
90
  "--md-h4-weight": "600",
88
91
  "--md-h4-mt": "8px",
89
92
  "--md-h4-mb": "2px",
@@ -109,9 +112,11 @@ const MARKDOWN_PRESETS = {
109
112
  "--md-rule-my": "6px",
110
113
  "--md-img-my": "4px",
111
114
  "--md-table-my": "8px",
112
- "--md-table-size": "15px",
115
+ "--md-table-size": "14px",
113
116
  "--md-code-my": "6px",
114
- "--md-inline-size": "13px",
117
+ "--md-code-size": "14px",
118
+ "--md-code-leading": "22px",
119
+ "--md-inline-size": "14px",
115
120
  "--md-item-pl": "4px",
116
121
  "--md-nest": "1rem",
117
122
  },
@@ -126,19 +131,19 @@ export function markdownVariantStyle(variant: MarkdownVariant = "docs"): CSSProp
126
131
  * The large page title is `pageTitleClass`, used by Typography only.
127
132
  */
128
133
  export function headingClass(level: number): string {
129
- if (level <= 1) return "text-(--md-heading) mt-(--md-h2-mt,24px) mb-(--md-h1-mb,12px) pt-(--md-h2-py,3px) pb-(--md-h2-py,3px) text-(length:--md-h2-size,30px) leading-(--md-h2-leading,40px) font-(--md-h2-weight,600)";
130
- if (level === 2) return "text-(--md-heading) mt-(--md-h2-mt,24px) mb-(--md-h2-mb,1px) pt-(--md-h2-py,3px) pb-(--md-h2-py,3px) text-(length:--md-h2-size,30px) leading-(--md-h2-leading,40px) font-(--md-h2-weight,600)";
131
- if (level === 3) return "text-(--md-heading) mt-(--md-h3-mt,22px) mb-(--md-h3-mb,1px) text-(length:--md-h3-size,24px) leading-(--md-h3-leading,32px) font-(--md-h3-weight,700)";
132
- if (level === 4) return "text-(--md-heading) mt-(--md-h4-mt,16px) mb-(--md-h4-mb,1px) text-(length:--md-h4-size,20px) leading-(--md-h4-leading,26px) font-(--md-h4-weight,700)";
133
- if (level === 5) return "text-(--md-heading) mt-(--md-h5-mt,0px) mb-(--md-h5-mb,0px) text-(length:--md-h5-size,16px) leading-(--md-h5-leading,1.375) font-(--md-h5-weight,700)";
134
- return "text-(--md-heading) mt-(--md-h6-mt,0px) mb-(--md-h6-mb,0px) text-(length:--md-h6-size,14px) leading-(--md-h6-leading,1.375) font-(--md-h6-weight,700)";
134
+ if (level <= 1) return "text-foreground mt-(--md-h2-mt,24px) mb-(--md-h1-mb,12px) pt-(--md-h2-py,3px) pb-(--md-h2-py,3px) text-(length:--md-h2-size,30px) leading-(--md-h2-leading,40px) font-(--md-h2-weight,600)";
135
+ if (level === 2) return "text-foreground mt-(--md-h2-mt,24px) mb-(--md-h2-mb,1px) pt-(--md-h2-py,3px) pb-(--md-h2-py,3px) text-(length:--md-h2-size,30px) leading-(--md-h2-leading,40px) font-(--md-h2-weight,600)";
136
+ if (level === 3) return "text-foreground mt-(--md-h3-mt,22px) mb-(--md-h3-mb,1px) text-(length:--md-h3-size,24px) leading-(--md-h3-leading,32px) font-(--md-h3-weight,700)";
137
+ if (level === 4) return "text-foreground mt-(--md-h4-mt,16px) mb-(--md-h4-mb,1px) text-(length:--md-h4-size,20px) leading-(--md-h4-leading,26px) font-(--md-h4-weight,700)";
138
+ if (level === 5) return "text-foreground mt-(--md-h5-mt,0px) mb-(--md-h5-mb,0px) text-(length:--md-h5-size,16px) leading-(--md-h5-leading,1.375) font-(--md-h5-weight,700)";
139
+ return "text-foreground mt-(--md-h6-mt,0px) mb-(--md-h6-mb,0px) text-(length:--md-h6-size,14px) leading-(--md-h6-leading,1.375) font-(--md-h6-weight,700)";
135
140
  }
136
141
 
137
142
  /** Landing and page title. Not used inside markdown. */
138
- export const pageTitleClass = "text-(--md-heading) mt-(--md-h1-mt,0px) mb-(--md-h1-mb,1px) pt-(--md-h1-py,3px) pb-(--md-h1-py,3px) text-(length:--md-h1-size,32px) leading-(--md-h1-leading,1.25) font-(--md-h1-weight,800) tracking-tight";
143
+ export const pageTitleClass = "text-foreground mt-(--md-h1-mt,0px) mb-(--md-h1-mb,1px) pt-(--md-h1-py,3px) pb-(--md-h1-py,3px) text-(length:--md-h1-size,32px) leading-(--md-h1-leading,1.25) font-(--md-h1-weight,800) tracking-tight";
139
144
 
140
145
  /** Body line. Same size and color as a markdown paragraph. */
141
- export const markdownBodyClass = "text-(length:--md-body-size,16px) leading-(--md-body-leading,24px) text-(--md-ink)";
146
+ export const markdownBodyClass = "text-(length:--md-body-size,16px) leading-(--md-body-leading,24px) text-foreground";
142
147
 
143
148
  /** Paragraph box. Same rhythm as `MarkdownViewer` `p`. */
144
- export const markdownParagraphClass = "nonla-typo m-0 my-(--md-p-my,1px) py-(--md-p-py,4px) text-(length:--md-body-size,16px) leading-(--md-p-leading,1.5) text-(--md-ink)";
149
+ export const markdownParagraphClass = "nonla-typo m-0 my-(--md-p-my,1px) py-(--md-p-py,4px) text-(length:--md-body-size,16px) leading-(--md-p-leading,1.5) text-foreground";
package/src/menu/Menu.tsx CHANGED
@@ -89,7 +89,7 @@ export function MenuAction({ className, ...rest }: ButtonHTMLAttributes<HTMLButt
89
89
  }
90
90
 
91
91
  export function MenuDivider({ className }: { className?: string }) {
92
- return <div className={cn("mx-2.5 my-1 h-px bg-ink-line", className)} />;
92
+ return <div className={cn("mx-2.5 my-1 h-px bg-border", className)} />;
93
93
  }
94
94
 
95
95
  Menu.Trigger = MenuTrigger;
@@ -1,5 +1,10 @@
1
1
  import { type CSSProperties, type ReactNode, useLayoutEffect, useState } from "react";
2
2
  import { createRoot, type Root } from "react-dom/client";
3
+ import { cn } from "../lib/cn";
4
+ import { glassSurfaceClass } from "../lib/surface";
5
+
6
+ const messageHostClass =
7
+ "nonla-message-host pointer-events-none fixed top-4 left-1/2 z-(--nonla-z-message) flex max-w-[min(420px,calc(100vw-32px))] -translate-x-1/2 flex-col items-center gap-2";
3
8
 
4
9
  export type MessageType = "success" | "error" | "info" | "warning" | "loading";
5
10
 
@@ -50,7 +55,7 @@ function IconError() {
50
55
  return (
51
56
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden>
52
57
  <circle cx="8" cy="8" r="8" fill="var(--destructive)" />
53
- <path d="M5.4 5.4L10.6 10.6M10.6 5.4L5.4 10.6" stroke="var(--destructive-foreground)" strokeWidth="1.6" strokeLinecap="round" />
58
+ <path d="M5.4 5.4L10.6 10.6M10.6 5.4L5.4 10.6" stroke="var(--nonla-text-on-solid)" strokeWidth="1.6" strokeLinecap="round" />
54
59
  </svg>
55
60
  );
56
61
  }
@@ -59,7 +64,7 @@ function IconInfo() {
59
64
  return (
60
65
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden>
61
66
  <circle cx="8" cy="8" r="8" fill="var(--link)" />
62
- <path d="M8 7.1V11.2M8 4.8V5.5" stroke="var(--nonla-solid-fg)" strokeWidth="1.7" strokeLinecap="round" />
67
+ <path d="M8 7.1V11.2M8 4.8V5.5" stroke="var(--nonla-text-on-solid)" strokeWidth="1.7" strokeLinecap="round" />
63
68
  </svg>
64
69
  );
65
70
  }
@@ -75,7 +80,7 @@ function IconWarning() {
75
80
 
76
81
  function IconLoading() {
77
82
  return (
78
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden className="nonla-message-spin">
83
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden className="animate-[spin_0.8s_linear_infinite]">
79
84
  <circle cx="8" cy="8" r="6.25" stroke="color-mix(in oklab, var(--link) 30%, transparent)" strokeWidth="2" />
80
85
  <path d="M14.25 8A6.25 6.25 0 0 0 8 1.75" stroke="var(--link)" strokeWidth="2" strokeLinecap="round" />
81
86
  </svg>
@@ -103,14 +108,19 @@ function MessageList({ list }: { list: Active[] }) {
103
108
  {list.map((item) => (
104
109
  <div
105
110
  key={item.id}
106
- className={["nonla-message-item", "nonla-glass", item.leaving ? "is-leaving" : "", item.className].filter(Boolean).join(" ")}
111
+ className={cn(
112
+ glassSurfaceClass,
113
+ "nonla-message-item pointer-events-auto inline-flex items-center gap-2 rounded-(--radius) px-3 py-[9px] text-sm leading-[1.5714] will-change-[transform,opacity] animate-[nonla-message-in_var(--nonla-dur)_var(--nonla-ease-out)]",
114
+ item.leaving && "animate-[nonla-message-out_150ms_var(--nonla-ease-in)_forwards]",
115
+ item.className,
116
+ )}
107
117
  data-type={item.type}
108
118
  role="status"
109
119
  style={item.style}
110
120
  onClick={item.onClick}
111
121
  >
112
- <span className="nonla-message-icon">{item.icon ?? defaultIcon(item.type)}</span>
113
- <span className="nonla-message-content">{item.content}</span>
122
+ <span className="inline-flex size-4 shrink-0 items-center justify-center">{item.icon ?? defaultIcon(item.type)}</span>
123
+ <span className="min-w-0 wrap-break-word">{item.content}</span>
114
124
  </div>
115
125
  ))}
116
126
  </>
@@ -131,7 +141,7 @@ function dropFallbackHost() {
131
141
  function ensureHost() {
132
142
  if (renderer || (hostEl && root)) return;
133
143
  hostEl = document.createElement("div");
134
- hostEl.className = "nonla-message-host";
144
+ hostEl.className = messageHostClass;
135
145
  document.body.appendChild(hostEl);
136
146
  root = createRoot(hostEl);
137
147
  }
@@ -157,7 +167,7 @@ export function MessageHolder() {
157
167
  };
158
168
  }, []);
159
169
  return (
160
- <div className="nonla-message-host" aria-live="polite" aria-relevant="additions">
170
+ <div className={messageHostClass} aria-live="polite" aria-relevant="additions">
161
171
  <MessageList list={list} />
162
172
  </div>
163
173
  );
@@ -17,6 +17,12 @@ import { glassSurfaceClass } from "../lib/surface";
17
17
  /** Matches `--nonla-dur-fast` exit animation; fallback if animationend is skipped. */
18
18
  const EXIT_MS = 200;
19
19
 
20
+ const modalOverlayClass =
21
+ "nonla-modal-overlay fixed inset-0 z-(--nonla-z-modal) bg-(--mask) data-[state=open]:animate-[nonla-overlay-in_var(--nonla-dur)_var(--nonla-ease-out)] data-[state=closed]:pointer-events-none data-[state=closed]:animate-[nonla-overlay-out_var(--nonla-dur-fast)_var(--nonla-ease-in)_forwards]";
22
+
23
+ const modalContentClass =
24
+ "nonla-modal-content fixed top-[60px] left-1/2 z-[calc(var(--nonla-z-modal)+1)] flex w-[min(480px,calc(100vw-32px))] max-h-[calc(100vh-88px)] flex-col overflow-hidden rounded-[calc(var(--radius)+4px)] p-0 outline-none will-change-[transform,opacity] [transform:translate(-50%,0)] data-[state=open]:animate-[nonla-modal-in_var(--nonla-dur)_var(--nonla-ease-out)] data-[state=closed]:pointer-events-none data-[state=closed]:animate-[nonla-modal-out_var(--nonla-dur-fast)_var(--nonla-ease-in)_forwards] data-[centered=true]:top-1/2 data-[centered=true]:max-h-[calc(100vh-64px)] data-[centered=true]:[transform:translate(-50%,-50%)] data-[centered=true]:data-[state=open]:animate-[nonla-modal-in-centered_var(--nonla-dur)_var(--nonla-ease-out)] data-[centered=true]:data-[state=closed]:animate-[nonla-modal-out-centered_var(--nonla-dur-fast)_var(--nonla-ease-in)_forwards]";
25
+
20
26
  export type ModalProps = {
21
27
  open?: boolean;
22
28
  visible?: boolean;
@@ -171,9 +177,9 @@ function ModalView({
171
177
  >
172
178
  {isOpen || present ? (
173
179
  <Dialog.Portal container={portal}>
174
- <Dialog.Overlay className="nonla-modal-overlay" />
180
+ <Dialog.Overlay className={modalOverlayClass} />
175
181
  <Dialog.Content
176
- className={cn("nonla-modal-content", glassSurfaceClass, className)}
182
+ className={cn(modalContentClass, glassSurfaceClass, className)}
177
183
  data-centered={centered ? "true" : undefined}
178
184
  style={{ width, ...style, ...styles?.container, ...styles?.content }}
179
185
  onAnimationEnd={onContentAnimationEnd}
@@ -188,20 +194,20 @@ function ModalView({
188
194
  }}
189
195
  >
190
196
  {(title || closable) && (
191
- <div className="nonla-modal-header" style={styles?.header}>
192
- <Dialog.Title className="nonla-modal-title">{title}</Dialog.Title>
197
+ <div className="nonla-modal-header flex shrink-0 items-center justify-between gap-3 bg-transparent px-4 py-3" style={styles?.header}>
198
+ <Dialog.Title className="nonla-modal-title m-0 text-[15px] leading-[1.4] font-semibold text-foreground">{title}</Dialog.Title>
193
199
  {closable ? (
194
- <Dialog.Close className="nonla-modal-close" aria-label="Close">
200
+ <Dialog.Close className="nonla-modal-close -mt-1 -mr-1.5 -mb-1 ml-0 inline-flex size-7 cursor-pointer items-center justify-center rounded-(--radius) border-0 bg-transparent text-[18px] leading-none text-muted-foreground hover:bg-muted hover:text-foreground" aria-label="Close">
195
201
  ×
196
202
  </Dialog.Close>
197
203
  ) : null}
198
204
  </div>
199
205
  )}
200
- <div className="nonla-modal-body" style={styles?.body}>
206
+ <div className="nonla-modal-body flex-1 overflow-auto bg-transparent px-4 pt-4 pb-6 text-sm leading-normal text-foreground" style={styles?.body}>
201
207
  {body}
202
208
  </div>
203
209
  {defaultFooter != null ? (
204
- <div className="nonla-modal-footer" style={styles?.footer}>
210
+ <div className="nonla-modal-footer flex shrink-0 items-center justify-end gap-2 bg-transparent px-4 py-2.5" style={styles?.footer}>
205
211
  {typeof defaultFooter === "function" ? null : defaultFooter}
206
212
  </div>
207
213
  ) : null}