@deepseek-ai/dsh-client-ui-primitives 0.2.1-rc.5 → 0.2.2-alpha.3

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 (67) hide show
  1. package/README.i18n.yaml +18 -18
  2. package/README.md +45 -15
  3. package/README.zh.md +45 -15
  4. package/lib/AnimatedRows.module.css +7 -0
  5. package/lib/Button.module.css +18 -11
  6. package/lib/CodeCard.module.css +4 -2
  7. package/lib/ConnectionIndicator.module.css +8 -6
  8. package/lib/DetailDocument.module.css +67 -0
  9. package/lib/DiffBlock.module.css +4 -2
  10. package/lib/DisclosureRow.module.css +11 -7
  11. package/lib/HoverCard.module.css +13 -0
  12. package/lib/JsonTree.module.css +45 -9
  13. package/lib/Menu.module.css +55 -17
  14. package/lib/MenuSurface.module.css +16 -0
  15. package/lib/Modal.module.css +4 -2
  16. package/lib/Pill.module.css +4 -2
  17. package/lib/QuotePreview.module.css +101 -0
  18. package/lib/ReadBlock.module.css +4 -2
  19. package/lib/RowDragPreview.module.css +12 -0
  20. package/lib/SearchBlock.module.css +4 -2
  21. package/lib/SegmentedControl.module.css +6 -1
  22. package/lib/SegmentedTabs.module.css +25 -3
  23. package/lib/TerminalBlock.module.css +4 -2
  24. package/lib/Toast.module.css +4 -2
  25. package/lib/UserMessageBubble.module.css +11 -0
  26. package/lib/WebBlock.module.css +14 -2
  27. package/lib/ZoomControls.module.css +54 -0
  28. package/lib/index.js +3923 -4809
  29. package/lib/markdown/JsonBlock.module.css +4 -2
  30. package/lib/markdown/MarkdownText.module.css +37 -12
  31. package/lib/settings-form/fields.module.css +11 -3
  32. package/lib/types/AnimatedRows.d.ts +46 -0
  33. package/lib/types/Button.d.ts +1 -1
  34. package/lib/types/DetailDocument.d.ts +78 -0
  35. package/lib/types/DraggableImage.d.ts +19 -0
  36. package/lib/types/HoverCard.d.ts +7 -2
  37. package/lib/types/HoverCardGroup.d.ts +4 -2
  38. package/lib/types/ImageLightbox.d.ts +4 -1
  39. package/lib/types/Menu.d.ts +25 -9
  40. package/lib/types/MenuSurface.d.ts +9 -0
  41. package/lib/types/QuotePreview.d.ts +24 -0
  42. package/lib/types/SegmentedTabs.d.ts +3 -1
  43. package/lib/types/Tooltip.d.ts +13 -7
  44. package/lib/types/UserMessageBubble.d.ts +11 -0
  45. package/lib/types/ZoomControls.d.ts +27 -0
  46. package/lib/types/document-zoom.d.ts +17 -0
  47. package/lib/types/file-drag-actions.d.ts +32 -0
  48. package/lib/types/focus.d.ts +7 -0
  49. package/lib/types/icons/artwork.d.ts +422 -0
  50. package/lib/types/icons/index.d.ts +199 -194
  51. package/lib/types/icons/shared-artwork.d.ts +6 -12
  52. package/lib/types/image-drag.d.ts +17 -0
  53. package/lib/types/index.d.ts +23 -3
  54. package/lib/types/markdown/MarkdownDelegate.d.ts +26 -3
  55. package/lib/types/markdown/MarkdownText.d.ts +12 -5
  56. package/lib/types/markdown/file-link.d.ts +13 -3
  57. package/lib/types/markdown/highlight.d.ts +22 -0
  58. package/lib/types/markdown/quote-text.d.ts +8 -0
  59. package/lib/types/markdown/render.d.ts +9 -4
  60. package/lib/types/markdown/windows-path-destinations.d.ts +11 -0
  61. package/lib/types/overlay-top-margin.d.ts +9 -2
  62. package/lib/types/use-clipboard-copy.d.ts +14 -0
  63. package/lib/types/useAnchoredPosition.d.ts +22 -22
  64. package/lib/types/useRowDragPreview.d.ts +20 -0
  65. package/lib/types/user-text.d.ts +4 -1
  66. package/package.json +9 -7
  67. package/lib/types/use-copy-feedback.d.ts +0 -14
@@ -13,8 +13,10 @@
13
13
  border-radius: var(--dsw-radius-sm);
14
14
  }
15
15
 
16
- .toggle:hover {
17
- background: var(--dsw-alias-interactive-bg-hover);
16
+ @media (hover: hover) {
17
+ .toggle:hover {
18
+ background: var(--dsw-alias-interactive-bg-hover);
19
+ }
18
20
  }
19
21
 
20
22
  .body {
@@ -74,13 +74,20 @@
74
74
  margin-right: -3px;
75
75
  }
76
76
 
77
- .markdown a:hover,
78
77
  .markdown a:focus {
79
78
  outline: none;
80
79
  text-decoration: underline dotted var(--dsw-alias-link);
81
80
  text-underline-offset: 3px;
82
81
  }
83
82
 
83
+ @media (hover: hover) {
84
+ .markdown a:hover {
85
+ outline: none;
86
+ text-decoration: underline dotted var(--dsw-alias-link);
87
+ text-underline-offset: 3px;
88
+ }
89
+ }
90
+
84
91
  .markdown a:focus-visible,
85
92
  .fileMention:focus-visible {
86
93
  box-shadow: 0 0 0 2px var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
@@ -195,8 +202,8 @@
195
202
  overscroll-behavior-x: contain;
196
203
  }
197
204
 
198
- /* Wide tables reveal their horizontal bar on hover (or keyboard focus)
199
- instead of keeping it painted. Chromium never repaints state-conditioned
205
+ /* Hover-capable inputs reveal a wide table's bar on hover or keyboard focus.
206
+ Other inputs keep native horizontal scrolling. Chromium never repaints state-conditioned
200
207
  scrollbar STYLES (neither hover-conditioned `::-webkit-scrollbar*` rules
201
208
  nor a :hover `scrollbar-color` change reaches the painted bar), so the
202
209
  toggle is `overflow-x` itself — a layout change repaints reliably. The
@@ -205,17 +212,23 @@
205
212
  Other engines and overlay scrollbars may reserve a different height.
206
213
  Wheel and trackpad scrolling need the pointer over the table, which is
207
214
  already the hover that re-enables scrolling. */
208
- .tableScroll:global(.md-table-wide) {
209
- overflow-x: hidden;
210
- padding-bottom: var(--dsh-scrollbar-width, 5px);
211
- }
212
-
213
- .tableScroll:global(.md-table-wide):hover,
214
215
  .tableScroll:global(.md-table-wide):focus-visible {
215
216
  overflow-x: scroll;
216
217
  padding-bottom: 0;
217
218
  }
218
219
 
220
+ @media (hover: hover) {
221
+ .tableScroll:global(.md-table-wide) {
222
+ overflow-x: hidden;
223
+ padding-bottom: var(--dsh-scrollbar-width, 5px);
224
+ }
225
+
226
+ .tableScroll:global(.md-table-wide):hover {
227
+ overflow-x: scroll;
228
+ padding-bottom: 0;
229
+ }
230
+ }
231
+
219
232
  /* Chromium keyboard-focuses scrollable containers by default; the ring uses
220
233
  the sheet's link focus color. */
221
234
  .tableScroll:focus-visible {
@@ -321,13 +334,20 @@
321
334
  text-align: inherit;
322
335
  }
323
336
 
324
- .fileMention:hover,
325
337
  .fileMention:focus {
326
338
  outline: none;
327
339
  text-decoration: underline dotted var(--dsw-alias-link);
328
340
  text-underline-offset: 3px;
329
341
  }
330
342
 
343
+ @media (hover: hover) {
344
+ .fileMention:hover {
345
+ outline: none;
346
+ text-decoration: underline dotted var(--dsw-alias-link);
347
+ text-underline-offset: 3px;
348
+ }
349
+ }
350
+
331
351
  .compact {
332
352
  max-width: 100%;
333
353
  font-size: var(--dsh-content-font-size-secondary, 13px);
@@ -374,13 +394,18 @@
374
394
  text-decoration: underline dotted;
375
395
  }
376
396
 
377
- .compact a:hover,
378
397
  .compact a:focus,
379
- .compact .fileMention:hover,
380
398
  .compact .fileMention:focus {
381
399
  text-decoration-color: currentColor;
382
400
  }
383
401
 
402
+ @media (hover: hover) {
403
+ .compact a:hover,
404
+ .compact .fileMention:hover {
405
+ text-decoration-color: currentColor;
406
+ }
407
+ }
408
+
384
409
  .compact :not(pre) > code {
385
410
  display: inline;
386
411
  font: inherit;
@@ -53,12 +53,18 @@
53
53
  cursor: pointer;
54
54
  }
55
55
 
56
- .helpButton:hover,
57
56
  .helpButton[aria-expanded='true'] {
58
57
  background: var(--dsw-alias-bg-layer-4);
59
58
  color: var(--dsw-alias-label-secondary);
60
59
  }
61
60
 
61
+ @media (hover: hover) {
62
+ .helpButton:hover {
63
+ background: var(--dsw-alias-bg-layer-4);
64
+ color: var(--dsw-alias-label-secondary);
65
+ }
66
+ }
67
+
62
68
  .helpButton:focus-visible {
63
69
  outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
64
70
  outline-offset: 1px;
@@ -96,8 +102,10 @@
96
102
  cursor: pointer;
97
103
  }
98
104
 
99
- .reset:hover:not(:disabled) {
100
- color: var(--dsw-alias-label-primary);
105
+ @media (hover: hover) {
106
+ .reset:hover:not(:disabled) {
107
+ color: var(--dsw-alias-label-primary);
108
+ }
101
109
  }
102
110
 
103
111
  .reset:disabled {
@@ -0,0 +1,46 @@
1
+ /** React-commit-driven movement and entry/exit fades for keyed rows. */
2
+ import { Component, type AriaRole, type ReactNode } from 'react';
3
+ /** Keyed row content, list semantics, and animation readiness. */
4
+ export interface AnimatedRowsProps {
5
+ children: ReactNode;
6
+ className: string;
7
+ role?: AriaRole;
8
+ label?: string;
9
+ /** Unique DOM-order keys matching the rendered data-row-key attributes. */
10
+ rowKeys: readonly string[];
11
+ ready: boolean;
12
+ /** Changes that replace the view or reveal hidden rows settle immediately. */
13
+ resetKey: string;
14
+ }
15
+ interface RowPosition {
16
+ element: HTMLElement;
17
+ rect: DOMRect;
18
+ opacity: number;
19
+ }
20
+ interface RowSnapshot {
21
+ positions: Map<string, RowPosition>;
22
+ removed: Map<string, RowPosition>;
23
+ }
24
+ /**
25
+ * Animates keyed rows only when their rendered membership or order changes.
26
+ * Motion starts after the first pointer or keyboard input inside the mounted list.
27
+ * The parent supplies a positioned container for the inert exit overlay.
28
+ */
29
+ export declare class AnimatedRows extends Component<AnimatedRowsProps> {
30
+ private armed;
31
+ private readonly list;
32
+ private readonly overlay;
33
+ private readonly movements;
34
+ private readonly exits;
35
+ getSnapshotBeforeUpdate(previous: AnimatedRowsProps): RowSnapshot | null;
36
+ componentDidUpdate(previous: AnimatedRowsProps, _state: unknown, snapshot: RowSnapshot | null): void;
37
+ componentWillUnmount(): void;
38
+ private readPositions;
39
+ private move;
40
+ private cancelMovements;
41
+ private removeExit;
42
+ private clear;
43
+ render(): ReactNode;
44
+ }
45
+ export {};
46
+ //# sourceMappingURL=AnimatedRows.d.ts.map
@@ -3,7 +3,7 @@ import { type ButtonHTMLAttributes, type ReactNode } from 'react';
3
3
  export type ButtonVariant = 'primary' | 'ghost' | 'outline' | 'toolbar';
4
4
  /**
5
5
  * Render a button.
6
- * @param props.variant - visual family (default 'ghost').
6
+ * @param props.variant - visual family (default 'ghost'); outlined buttons use a DPR-aware inset stroke.
7
7
  * @param props.size - 'md' 36px control with 12px corners or 'sm' 28px control with 8px corners.
8
8
  * @param props.icon - optional leading 16px icon node.
9
9
  * @param ref - native button for focus management and overlay anchors.
@@ -0,0 +1,78 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type MarkdownLabels, type MarkdownPathImages } from './markdown/MarkdownText.tsx';
3
+ /** One read of a long Markdown description, such as a plugin's detail document. */
4
+ export type DetailDocumentState = {
5
+ readonly status: 'loading';
6
+ } | {
7
+ readonly status: 'found';
8
+ readonly markdown: string;
9
+ } | {
10
+ readonly status: 'none';
11
+ } | {
12
+ readonly status: 'error';
13
+ readonly message: string;
14
+ };
15
+ /** A read as owners track it: in flight, settled with a document or none, or failed with a localized message. */
16
+ export type DetailDocumentRead = undefined | {
17
+ readonly status: 'loading';
18
+ } | {
19
+ readonly status: 'ready';
20
+ readonly markdown: string | undefined;
21
+ } | {
22
+ readonly status: 'error';
23
+ readonly message: string;
24
+ };
25
+ /**
26
+ * The state {@link DetailDocument} shows for an owner's read: loading until it settles, then the document, none, or the
27
+ * failure.
28
+ * @param read - the owner's read; undefined before it starts.
29
+ * @returns the state to show.
30
+ */
31
+ export declare function detailDocumentState(read: DetailDocumentRead): DetailDocumentState;
32
+ /** Translated strings of a detail document's chrome, as an owner's dictionary supplies them. */
33
+ export interface DetailDocumentCopy {
34
+ readonly title: string;
35
+ readonly loading: string;
36
+ readonly retry: string;
37
+ readonly copy: string;
38
+ readonly copied: string;
39
+ readonly codeBlock: string;
40
+ readonly wrap: string;
41
+ readonly unwrap: string;
42
+ readonly footnotes: string;
43
+ }
44
+ /**
45
+ * Assemble reference-stable labels for {@link DetailDocument} from translated strings.
46
+ * @param copy - the translated strings.
47
+ * @returns labels that keep their identity while the strings stay equal.
48
+ */
49
+ export declare function useDetailDocumentLabels(copy: DetailDocumentCopy): DetailDocumentLabels;
50
+ /** Localized chrome of a detail document. */
51
+ export interface DetailDocumentLabels {
52
+ /** Accessible name of the scrollable document region; the section shows no heading of its own. */
53
+ readonly title: string;
54
+ /** Accessible name of the loading placeholder. */
55
+ readonly loading: string;
56
+ /** Retry button text. */
57
+ readonly retry: string;
58
+ readonly markdown: MarkdownLabels;
59
+ }
60
+ /**
61
+ * A section showing a long Markdown description, without a heading of its own: three skeleton lines while it loads, the
62
+ * document once found, or the owner's failure message with a retry. Nothing renders for `none`. A document taller than
63
+ * the section's height limit scrolls inside it, and the scroll region, named by `labels.title`, takes keyboard focus.
64
+ * Raw HTML is omitted, relative links stay text, and only images the owner's `images` resolver accepts, or absolute
65
+ * HTTP(S) images, load.
66
+ * @param props.state - the read to show.
67
+ * @param props.labels - localized region name, placeholder name, retry text, and Markdown chrome; keep `markdown` reference-stable.
68
+ * @param props.images - resolves the document's relative image destinations to displayable URLs.
69
+ * @param props.onRetry - reads the document again after a failure.
70
+ * @returns the section, or null.
71
+ */
72
+ export declare function DetailDocument({ state, labels, images, onRetry }: {
73
+ readonly state: DetailDocumentState;
74
+ readonly labels: DetailDocumentLabels;
75
+ readonly images?: MarkdownPathImages | undefined;
76
+ readonly onRetry: () => void;
77
+ }): ReactNode;
78
+ //# sourceMappingURL=DetailDocument.d.ts.map
@@ -0,0 +1,19 @@
1
+ /** Original-image drag gestures owned by a presentation primitive. */
2
+ import { type ImgHTMLAttributes } from 'react';
3
+ import type { FileDragActions } from './file-drag-actions.ts';
4
+ /** Image presentation plus original content and explicit file preparation callbacks. */
5
+ export interface DraggableImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'draggable' | 'onDragStart' | 'onDragEnd' | 'onPointerEnter' | 'onPointerLeave' | 'onPointerDown' | 'onPointerUp' | 'onClickCapture'> {
6
+ readonly fileDrag: FileDragActions;
7
+ readonly src: string;
8
+ readonly name: string;
9
+ readonly resourceAddress?: string | undefined;
10
+ readonly original?: File | undefined;
11
+ }
12
+ /**
13
+ * Render an image with original-file dragging; using explicit application-owned callbacks.
14
+ * @param props - image attributes, original filename and file preparation callbacks.
15
+ * @param ref - image element for measurement and pointer-mode bindings.
16
+ * @returns a draggable image that suppresses only the mouse click following its drag.
17
+ */
18
+ export declare const DraggableImage: import("react").ForwardRefExoticComponent<DraggableImageProps & import("react").RefAttributes<HTMLImageElement>>;
19
+ //# sourceMappingURL=DraggableImage.d.ts.map
@@ -1,14 +1,18 @@
1
1
  import type { ReactNode, RefObject } from 'react';
2
2
  /**
3
3
  * Render an anchor with a hover-triggered preview card independently of nested tooltips.
4
+ * Touch entry does not open a preview or intercept the anchor's action.
4
5
  * @param props.anchor - the hover target (rendered in place inside a wrapper span).
5
6
  * @param props.content - card content; the pointer may rest on it, so it is
6
7
  * readable and selectable, but it carries no dismissal affordance of its own.
7
8
  * @param props.openDelayMs - hover dwell before the card shows (default 500).
8
9
  * @param props.variant - compact card beside the anchor, or a preview above/below it
9
- * with 24px side insets, a 420px height cap, frame-top clearance, and 100ms opacity transitions.
10
+ * with 24px side insets, a 420px height cap, the frame-top clearance (capped below an anchor inside the top strip),
11
+ * and 100ms opacity transitions.
10
12
  * @param props.widthAnchorRef - optional element whose width and horizontal position size the preview.
11
13
  * @param props.inline - keep the anchor in prose; show a contained preview on hover or keyboard focus.
14
+ * Its hover region connects the anchor and preview across the visual gap.
15
+ * @param props.fitContent - size an inline card to its content within the usual width cap.
12
16
  * @param props.disabled - suppress opening; turning true dismisses an open card.
13
17
  * @param props.grouped - share first-display dwell across the surrounding list and active portal.
14
18
  * Group replacement removes the previous card immediately, including a fading preview.
@@ -18,10 +22,11 @@ import type { ReactNode, RefObject } from 'react';
18
22
  * @param props.copiedLabel - localized visible success label.
19
23
  * @returns anchor wrapper with the conditional portaled card.
20
24
  */
21
- export declare function HoverCard({ anchor, content, openDelayMs, disabled, grouped, copyText, copyLabel, copiedLabel, variant, widthAnchorRef, inline, }: {
25
+ export declare function HoverCard({ anchor, content, openDelayMs, disabled, grouped, copyText, copyLabel, copiedLabel, variant, widthAnchorRef, inline, fitContent, }: {
22
26
  anchor: ReactNode;
23
27
  /** Inline media preview using the shared menu material and keyboard focus. */
24
28
  inline?: boolean;
29
+ fitContent?: boolean;
25
30
  content: ReactNode;
26
31
  openDelayMs?: number;
27
32
  disabled?: boolean;
@@ -13,11 +13,13 @@ export declare const HoverCardGroupContext: import("react").Context<GroupState |
13
13
  * Share first-display dwell across a list and its active portal, including the card's existing pointer grace.
14
14
  * @param props.children - list contents, including opted-in HoverCards.
15
15
  * @param props.className - classes for the physical list container.
16
+ * @param props.as - physical container tag; use span to preserve inline text layout.
16
17
  * @returns the list container and its private hover coordinator.
17
18
  */
18
- export declare function HoverCardGroup({ children, className }: {
19
+ export declare function HoverCardGroup({ children, className, as: Container }: {
19
20
  children: ReactNode;
20
- className?: string;
21
+ className?: string | undefined;
22
+ as?: 'div' | 'span';
21
23
  }): import("react").JSX.Element;
22
24
  export {};
23
25
  //# sourceMappingURL=HoverCardGroup.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { HTMLAttributes } from 'react';
1
2
  /** Lightbox strings the owner resolves from its own locale namespace. */
2
3
  export interface ImageLightboxLabels {
3
4
  /** Accessible name of the preview dialog. */
@@ -15,13 +16,15 @@ export interface ImageLightboxLabels {
15
16
  * @param props.src - the original image URL.
16
17
  * @param props.alt - the image's alt text.
17
18
  * @param props.labels - dialog and close-control strings.
19
+ * @param props.contextMenuProps - optional original-image gesture bindings.
18
20
  * @param props.onClose - dismiss callback owned by the opener.
19
21
  * @returns the modal preview dialog.
20
22
  */
21
- export declare function ImageLightbox({ src, alt, labels, onClose }: {
23
+ export declare function ImageLightbox({ src, alt, labels, onClose, contextMenuProps }: {
22
24
  src: string;
23
25
  alt: string;
24
26
  labels: ImageLightboxLabels;
25
27
  onClose: () => void;
28
+ contextMenuProps?: Pick<HTMLAttributes<HTMLElement>, 'onContextMenu' | 'onKeyDown' | 'tabIndex'> | undefined;
26
29
  }): import("react").ReactPortal;
27
30
  //# sourceMappingURL=ImageLightbox.d.ts.map
@@ -14,7 +14,7 @@ export interface MenuItem {
14
14
  /** Destructive row: error-colored text/icon and danger hover fill. */
15
15
  danger?: boolean;
16
16
  /** Nested card opened to the right on hover/focus. */
17
- submenu?: readonly MenuItem[];
17
+ submenu?: readonly MenuEntry[];
18
18
  }
19
19
  /** Hairline between item groups (not selectable). */
20
20
  export interface MenuSeparator {
@@ -41,6 +41,12 @@ export interface MenuItemButtonProps {
41
41
  current?: boolean;
42
42
  /** Whether the row cannot be activated. */
43
43
  disabled?: boolean;
44
+ /**
45
+ * Why the disabled row cannot be activated. The row then stays hoverable and
46
+ * focusable, shows the reason in a tooltip, and exposes it as the row's
47
+ * description; an enabled row ignores it.
48
+ */
49
+ disabledReason?: string | undefined;
44
50
  /** Destructive row: error-colored text/icon and danger hover fill. */
45
51
  danger?: boolean;
46
52
  /**
@@ -64,12 +70,13 @@ export interface MenuItemButtonProps {
64
70
  * @param props.icon - optional leading icon.
65
71
  * @param props.current - whether the row identifies the currently displayed page or view.
66
72
  * @param props.disabled - whether the row cannot be activated.
73
+ * @param props.disabledReason - why a disabled row cannot be activated, shown in a tooltip and read as its description.
67
74
  * @param props.danger - whether to use the destructive row colors.
68
75
  * @param props.separatorBefore - whether this row starts a new group (hairline above it).
69
76
  * @param props.onSelect - row activation callback.
70
77
  * @returns one menu-item row.
71
78
  */
72
- export declare function MenuItemButton({ children, shortcut, icon, current, disabled, danger, separatorBefore, onSelect, }: MenuItemButtonProps): import("react").JSX.Element;
79
+ export declare function MenuItemButton({ children, shortcut, icon, current, disabled, disabledReason, danger, separatorBefore, onSelect, }: MenuItemButtonProps): import("react").JSX.Element;
73
80
  /**
74
81
  * Render an anchored dropdown menu. While the list is open its keys mirror the
75
82
  * composer's: Tab settles the focused row — from the trigger, Tab enters the
@@ -77,6 +84,9 @@ export declare function MenuItemButton({ children, shortcut, icon, current, disa
77
84
  * anchor's first button, and selecting a row does the same — the rows unmount
78
85
  * with the list. Only a keyboard on the trigger or inside the list is
79
86
  * intercepted; Tab presses elsewhere on the page stay the browser's.
87
+ * @param props.contextual - cursor positioning, context dismissal, and per-divider icon alignment.
88
+ * @param props.exiting - retain an inert popup during dismissal or replacement fade.
89
+ * @param props.returnFocus - original control captured before asynchronous menu preparation.
80
90
  * @param props.autoFocus - focus the first item on open; the arrow keys walk the list either way.
81
91
  * @param props.open - whether the list is showing (owner-controlled).
82
92
  * @param props.anchor - the trigger element (rendered in place).
@@ -90,9 +100,9 @@ export declare function MenuItemButton({ children, shortcut, icon, current, disa
90
100
  * @param props.align - list alignment against the anchor (default 'start').
91
101
  * @param props.side - open below (`bottom`, default) or above (`top`) the anchor.
92
102
  * @param props.portal - render the list into document.body, fixed-positioned
93
- * from the anchor rect (follows movement and resizing while open). Use when an
94
- * ancestor's overflow clipping would crop the in-place list; default false
95
- * keeps the pure-CSS in-place behavior.
103
+ * synchronously (follows movement, resizing, and browser zoom while open)
104
+ * and clamped inside the visual viewport. Use when an ancestor's overflow clipping would crop the
105
+ * in-place list; default false keeps the pure-CSS in-place behavior.
96
106
  * @param props.closeOnPointerLeave - close the list once the pointer has left
97
107
  * both trigger and list for the pointer grace (default false keeps it open
98
108
  * until outside click/Escape/selection). The grace makes the 4px trigger->list
@@ -103,11 +113,11 @@ export declare function MenuItemButton({ children, shortcut, icon, current, disa
103
113
  * directly (e.g. from a host-owned trigger button) instead of measuring the
104
114
  * Menu's own wrapper span. Required when the wrapper isn't itself laid out at
105
115
  * the trigger (render-prop anchors, effect-positioned proxies — measuring the
106
- * wrapper there races the host's layout effects). Called on open, each animation
107
- * frame, and scroll/resize; return null to skip placement for that frame.
116
+ * wrapper there races the host's layout effects). Called while tracking the
117
+ * anchor and on scroll/resize; return null to defer placement.
108
118
  * @param props.minWidthFromAnchor - in portal mode, keep the menu at least as wide as its anchor, bounded by viewport margins.
109
119
  * @param props.footer - rows pinned below the scrolling items area, separated
110
- * by a hairline; they stay visible while the items above scroll.
120
+ * by a hairline; contextual menus reuse an explicit leading separator. These rows stay visible while the items above scroll.
111
121
  * @param props.children - component rows rendered after `items` in the same
112
122
  * list, each a `role="menuitem"` button such as {@link MenuItemButton}; they
113
123
  * share the keyboard walk, the submenu exclusivity, and the post-selection
@@ -122,8 +132,14 @@ export declare function MenuItemButton({ children, shortcut, icon, current, disa
122
132
  * document.body outside the owner's DOM subtree.
123
133
  * @returns anchor wrapper with the conditional list.
124
134
  */
125
- export declare function Menu({ open, anchor, items, children, selectedId, selectedIds, onSelect, onClose, align, side, portal, closeOnPointerLeave, dense, compact, autoFocus, selection, getAnchorRect, minWidthFromAnchor, footer, className, listClassName }: {
135
+ export declare function Menu({ open, anchor, items, children, selectedId, selectedIds, onSelect, onClose, align, side, portal, closeOnPointerLeave, dense, compact, autoFocus, selection, getAnchorRect, minWidthFromAnchor, footer, className, listClassName, contextual, exiting, returnFocus }: {
126
136
  open: boolean;
137
+ /** Pointer-positioned popup: cursor clearance, grouped icons, and context gestures. */
138
+ contextual?: boolean;
139
+ /** Resolve the original control for focus restoration and inert/hidden dismissal. */
140
+ returnFocus?: (() => HTMLElement | null) | undefined;
141
+ /** Retain a dismissed context popup during its short fade. */
142
+ exiting?: 'dismiss' | 'replace' | undefined;
127
143
  autoFocus?: boolean;
128
144
  anchor: ReactNode;
129
145
  items?: readonly MenuEntry[];
@@ -1,9 +1,18 @@
1
1
  /** Shared menu material and the macOS backing that lets Chromium blur transparent windows. */
2
2
  import { type ComponentPropsWithoutRef } from 'react';
3
+ /** Context-menu transition durations in milliseconds, shared with its lifecycle owner. */
4
+ export declare const MENU_TRANSITION_MS: Readonly<{
5
+ enter: 40;
6
+ dismiss: 80;
7
+ replace: 10;
8
+ prepare: 20;
9
+ }>;
3
10
  /** Menu containers preserve native div props and refs. */
4
11
  export interface MenuSurfaceProps extends ComponentPropsWithoutRef<'div'> {
5
12
  /** Match the shared compact menu's smaller outer radius. */
6
13
  compact?: boolean;
14
+ /** Fade direct content, material, and native backing without isolating the material's backdrop. */
15
+ phase?: 'enter' | 'dismiss' | 'replace' | undefined;
7
16
  }
8
17
  /**
9
18
  * Paint a menu and, on macOS, an opaque backing behind the page content within its bounds.
@@ -0,0 +1,24 @@
1
+ /** Shared compact presentation for draft and sent text quotes. */
2
+ import type { JSX } from 'react';
3
+ /** Optional whole-quote removal control supplied by an editable owner. */
4
+ export interface QuotePreviewRemoval {
5
+ /** Localized accessible name for the removal button. */
6
+ readonly label: string;
7
+ /** Remove the complete owning quote node. */
8
+ readonly onRemove: () => void;
9
+ }
10
+ /** Presentation inputs for one compact quote excerpt. */
11
+ export interface QuotePreviewProps {
12
+ /** Exact selected text rendered inline and exposed in a popover while clipped. */
13
+ readonly text: string;
14
+ /** Composer-only removal action; omit for inert sent quotes. */
15
+ readonly removal?: QuotePreviewRemoval | undefined;
16
+ }
17
+ /**
18
+ * Render one width-capped quote preview shared by editable drafts and sent messages.
19
+ * Clipped excerpts open a content-sized, scrollable popover that fits within the viewport.
20
+ * @param props - selected text and optional localized removal action.
21
+ * @returns a non-navigating quote preview with a full-text popover only while clipped.
22
+ */
23
+ export declare function QuotePreview({ text, removal }: QuotePreviewProps): JSX.Element;
24
+ //# sourceMappingURL=QuotePreview.d.ts.map
@@ -14,13 +14,15 @@ export interface SegmentedTab<Value extends string = string> {
14
14
  * Keyboard selection also moves focus; only the selected tab is a tab stop.
15
15
  * @param props.label - localized accessible name for the tab list.
16
16
  * @param props.className - layout placement; panels remain caller-owned.
17
+ * @param props.size - `sm` draws 30px tabs with a 2px inset (34px tall); the default `md` draws 34px tabs with a 4px inset (42px tall).
17
18
  * @returns the tab list, without its panels.
18
19
  */
19
- export declare function SegmentedTabs<Value extends string>({ items, value, onChange, label, className }: {
20
+ export declare function SegmentedTabs<Value extends string>({ items, value, onChange, label, className, size }: {
20
21
  items: readonly [SegmentedTab<Value>, ...SegmentedTab<Value>[]];
21
22
  value: Value;
22
23
  onChange: (value: Value) => void;
23
24
  label: string;
24
25
  className?: string | undefined;
26
+ size?: 'sm' | 'md' | undefined;
25
27
  }): ReactNode;
26
28
  //# sourceMappingURL=SegmentedTabs.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /** Anchor-preserving tooltips; an optional body portal escapes clipping containers and stacking contexts that cap the bubble's z-index. */
2
- import type { FocusEventHandler, MouseEventHandler, ReactElement, Ref } from 'react';
2
+ import type { FocusEventHandler, MouseEventHandler, PointerEventHandler, ReactElement, Ref } from 'react';
3
3
  import { type TooltipSide } from './tooltip-placement.ts';
4
4
  export type { TooltipSide } from './tooltip-placement.ts';
5
5
  /**
@@ -11,8 +11,9 @@ export declare const TooltipSuppression: import("react").Context<((suppressed: b
11
11
  interface AnchorProps {
12
12
  'aria-describedby'?: string | undefined;
13
13
  ref?: Ref<HTMLElement> | undefined;
14
- onMouseEnter?: MouseEventHandler | undefined;
15
- onMouseLeave?: MouseEventHandler | undefined;
14
+ onPointerEnter?: PointerEventHandler | undefined;
15
+ onPointerLeave?: PointerEventHandler | undefined;
16
+ onPointerDown?: PointerEventHandler | undefined;
16
17
  onClick?: MouseEventHandler | undefined;
17
18
  onFocus?: FocusEventHandler | undefined;
18
19
  onBlur?: FocusEventHandler | undefined;
@@ -37,16 +38,20 @@ type TooltipLabel = string | (() => string);
37
38
  * toggling never remounts it (which would cut its CSS transitions).
38
39
  * @param props.maxWidth - bubble width cap in pixels, for labels long enough that the default
39
40
  * half-viewport cap would render a slab wider than the surface the anchor sits on; always bounded by viewport margins.
40
- * @param props.openOnClick - clicking also pins the bubble for reading; another click, Escape,
41
+ * @param props.openOnClick - clicking or tapping also pins the bubble for reading; another click, Escape,
41
42
  * Tab, or an outside pointerdown dismisses it. Defaults to false for ordinary action tooltips.
43
+ * @param props.onlyWhenClipped - show the bubble only when the anchor or an HTML element inside it
44
+ * overflows horizontally, measured when the bubble is about to show; for labels that repeat
45
+ * text an ellipsis may cut off. Defaults to false.
42
46
  * @param props.children - a single anchor element; its own ref (callback or object) is forwarded alongside the tooltip's.
43
47
  * @returns the cloned anchor plus a fixed-position bubble, optionally portaled to the body.
44
48
  * The bubble stays hidden until ResizeObserver supplies its size for viewport fitting; clicking the
45
49
  * anchor dismisses the bubble unless openOnClick is enabled, and focus arriving after a pointer
46
- * interaction (a closing menu refocusing its trigger) never raises it. When no side fits, the
47
- * viewport-bounded fallback may overlap the anchor; oversized content is scrollable when pinned.
50
+ * interaction (a closing menu refocusing its trigger) never raises it. Touch cannot trigger hover
51
+ * tooltips; tapping still invokes the child's action and can open an openOnClick explanation.
52
+ * When no side fits, the viewport-bounded fallback may overlap the anchor; oversized content is scrollable when pinned.
48
53
  */
49
- export declare function Tooltip({ label, shortcutKeys, side, align, delayMs, focusDelayMs, gap, disabled, portal, maxWidth, openOnClick, children }: {
54
+ export declare function Tooltip({ label, shortcutKeys, side, align, delayMs, focusDelayMs, gap, disabled, portal, maxWidth, openOnClick, onlyWhenClipped, children }: {
50
55
  label: TooltipLabel;
51
56
  shortcutKeys?: readonly string[] | undefined;
52
57
  side?: TooltipSide;
@@ -58,6 +63,7 @@ export declare function Tooltip({ label, shortcutKeys, side, align, delayMs, foc
58
63
  portal?: boolean;
59
64
  maxWidth?: number;
60
65
  openOnClick?: boolean;
66
+ onlyWhenClipped?: boolean;
61
67
  children: ReactElement<AnchorProps>;
62
68
  }): import("react").JSX.Element;
63
69
  //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1,11 @@
1
+ /** Shared user-message background, typography, and content inset. */
2
+ import type { ComponentPropsWithoutRef } from 'react';
3
+ /** Native div attributes for user-authored message content. */
4
+ export type UserMessageBubbleProps = ComponentPropsWithoutRef<'div'>;
5
+ /**
6
+ * Render user-style message content without row placement or actions.
7
+ * @param props - Native div attributes and the caller-owned content.
8
+ * @returns A theme-aware message surface that wraps its content.
9
+ */
10
+ export declare function UserMessageBubble({ className, ...props }: UserMessageBubbleProps): import("react").JSX.Element;
11
+ //# sourceMappingURL=UserMessageBubble.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { type DocumentZoomLabels } from './document-zoom.ts';
2
+ /** Live percentage display updated independently from the document tree. */
3
+ export interface ZoomControlsHandle {
4
+ /** @param zoom - current gesture scale multiplier. */
5
+ showZoom: (zoom: number) => void;
6
+ }
7
+ /**
8
+ * Present optional fitting, fixed presets, and incremental controls.
9
+ * @param props - committed `zoom`, optional `fit` row (omitted: no fitting row), localized labels, `visible`, optional
10
+ * owner `className`, and zoom and activity callbacks.
11
+ * @param ref - `showZoom` displays a transient scale until `zoom` changes.
12
+ * @returns a localized zoom toolbar.
13
+ */
14
+ export declare const ZoomControls: import("react").ForwardRefExoticComponent<{
15
+ readonly zoom: number;
16
+ readonly fit?: {
17
+ readonly label: string;
18
+ readonly selected: boolean;
19
+ readonly onSelect: () => void;
20
+ } | undefined;
21
+ readonly className?: string | undefined;
22
+ readonly labels: DocumentZoomLabels;
23
+ readonly visible: boolean;
24
+ readonly onZoom: (zoom: number) => void;
25
+ readonly onActiveChange: (active: boolean) => void;
26
+ } & import("react").RefAttributes<ZoomControlsHandle>>;
27
+ //# sourceMappingURL=ZoomControls.d.ts.map
@@ -0,0 +1,17 @@
1
+ /** Shared fixed document scales used by preview surfaces and their controls. */
2
+ /** Fixed scale limits, incremental step, and menu choices. */
3
+ export declare const DOCUMENT_ZOOM: {
4
+ readonly minimum: 0.25;
5
+ readonly maximum: 4;
6
+ readonly step: 0.25;
7
+ readonly presets: readonly [0.25, 0.5, 1, 1.5, 2];
8
+ };
9
+ /** Localized labels supplied by the document renderer. */
10
+ export interface DocumentZoomLabels {
11
+ readonly controls: string;
12
+ readonly menu: string;
13
+ readonly out: string;
14
+ readonly into: string;
15
+ readonly value: (percent: number) => string;
16
+ }
17
+ //# sourceMappingURL=document-zoom.d.ts.map