@mast-ai/react-ui 0.2.0 → 0.4.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.
@@ -9,11 +9,11 @@ import type { GetToolLabel } from './ToolLabelContext.js';
9
9
  */
10
10
  export interface ConversationPanelProps {
11
11
  /**
12
- * Forces a theme regardless of the user's `prefers-color-scheme` setting.
13
- * When omitted, the panel follows the OS preference via the default
14
- * stylesheet's media query.
12
+ * Selects the panel's theme. Defaults to `'light'`. Pass `'dark'` to force
13
+ * the dark palette regardless of OS preference, or `'auto'` to follow the
14
+ * user's `prefers-color-scheme` setting.
15
15
  */
16
- theme?: 'light' | 'dark';
16
+ theme?: 'light' | 'dark' | 'auto';
17
17
  /** Optional class added to the root `[data-mast-root]` element. */
18
18
  className?: string;
19
19
  /**
@@ -54,8 +54,12 @@ export interface ConversationPanelProps {
54
54
  *
55
55
  * Internally renders {@link MessageList} and {@link ChatInput} inside a
56
56
  * `[data-mast-root]` div so the default stylesheet's CSS custom properties
57
- * resolve. Sets `data-mast-theme` from the optional `theme` prop, which the
58
- * default stylesheet uses to override the OS-driven dark mode preference.
57
+ * resolve. The same div carries `mast-panel` so the bundled chrome (border,
58
+ * padding, flex column, `height: 100%`) is applied; consumers composing
59
+ * primitives manually opt into chrome by adding the class themselves (see
60
+ * USAGE.md §8). `data-mast-theme` is set from the optional `theme` prop;
61
+ * the default stylesheet uses it to select between light, dark, and an
62
+ * OS-following auto mode.
59
63
  *
60
64
  * Must be rendered inside an `<AgentProvider>`.
61
65
  */
@@ -49,8 +49,10 @@ export interface MessageListProps {
49
49
  * `virtualizer.measureElement`, so messages with long tool call results or
50
50
  * large markdown blocks expand the viewport correctly.
51
51
  *
52
- * Auto-scrolls to the bottom whenever a new entry is appended or the last
53
- * entry's `text` grows during streaming.
52
+ * Auto-scrolls to the bottom whenever the content grows (new entry, streaming
53
+ * text deltas, thinking/tool blocks expanding) **only if** the user is already
54
+ * at the bottom of the list. If the user has scrolled up to read an earlier
55
+ * message, their scroll position is preserved until they scroll back down.
54
56
  *
55
57
  * Reads `messages` from `useAgent()`, so this component must be rendered
56
58
  * inside an `<AgentProvider>`.
package/dist/context.d.ts CHANGED
@@ -35,8 +35,13 @@ export interface AgentProviderProps {
35
35
  * {@link import('./approval.js').INLINE_APPROVAL} to defer to the inline
36
36
  * approval queue exposed via `useAgent().pendingApprovals`.
37
37
  *
38
- * Not called when no tool requires approval, and not called when the prop
39
- * is omitted in which case `requiresApproval: true` tools execute silently.
38
+ * Defaults to a callback that returns `INLINE_APPROVAL` for every call when
39
+ * omitted, so tools marked `requiresApproval: true` always pause for user
40
+ * confirmation by default. Apps that already render `<InlineApproval>` (or
41
+ * read `useAgent().pendingApprovals`) get a working approval flow with no
42
+ * additional wiring. Provide a custom callback to plug in a different
43
+ * confirmation UI, auto-approve specific tools, inject canned results, or
44
+ * short-circuit cancellations.
40
45
  */
41
46
  onApprovalRequired?: OnApprovalRequired;
42
47
  /**
@@ -66,18 +71,28 @@ export interface AgentProviderProps {
66
71
  */
67
72
  onConversationChange?: (history: Message[], entries: ConversationEntry[]) => void;
68
73
  /**
69
- * Forces a theme on the auto-rendered `[data-mast-root]` wrapper. When
70
- * omitted, the panel follows the OS preference via the default stylesheet's
71
- * `prefers-color-scheme` media query. Ignored when `disableRoot` is `true`.
74
+ * Selects the theme on the auto-rendered `[data-mast-root]` wrapper.
75
+ * Defaults to `'light'`. Pass `'dark'` to force the dark palette or
76
+ * `'auto'` to follow the OS `prefers-color-scheme` preference. Only
77
+ * meaningful when `disableRoot` is explicitly `false` (so the provider
78
+ * actually renders the wrapper); when omitted or `true`, this prop has no
79
+ * effect and consumers should set `data-mast-theme` themselves on whatever
80
+ * element carries `data-mast-root`.
72
81
  */
73
- theme?: 'light' | 'dark';
82
+ theme?: 'light' | 'dark' | 'auto';
74
83
  /**
75
- * Disable the auto-rendered `<div data-mast-root>` wrapper around `children`.
76
- * Use this when you want to place `data-mast-root` somewhere else in the
77
- * tree yourself, e.g. on a chat sidebar's outer container so additional
78
- * non-library UI inside also picks up the library's CSS variables.
84
+ * Controls whether the provider renders an auto wrapper `<div data-mast-root>`
85
+ * around `children`.
79
86
  *
80
- * Default: `false` (the wrapper is rendered).
87
+ * Default: `true` the provider is transparent in the DOM and consumers
88
+ * are responsible for placing `data-mast-root` themselves (typically on the
89
+ * outermost container, or implicitly via `<ConversationPanel>` which carries
90
+ * its own `data-mast-root`). This avoids the auto wrapper's panel chrome
91
+ * (border, padding, `height: 100%`) leaking onto whatever subtree the
92
+ * provider wraps, including app-root mounts.
93
+ *
94
+ * Set to `false` to opt back into the auto wrapper for zero-config setups
95
+ * that compose primitives directly without their own root container.
81
96
  */
82
97
  disableRoot?: boolean;
83
98
  }