@deepseek-ai/dsh-client-ui-primitives 0.2.1-rc.1 → 0.2.1-rc.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.
package/README.i18n.yaml CHANGED
@@ -18,11 +18,11 @@
18
18
  en: 7bae72c97d0449f5
19
19
  zh: 4589ecc2b216edc5
20
20
  /deepseek-ai-dsh-client-ui-primitives/use-this-package/component-catalog:
21
- en: 6f5457b84fc9db09
22
- zh: 85993f1c44bfee2c
21
+ en: c804a44a782227cb
22
+ zh: 14b53da9bf298c5f
23
23
  /deepseek-ai-dsh-client-ui-primitives/use-this-package/controls-and-icons:
24
- en: 28ac8f0b1edbcf81
25
- zh: 5c4c324bf84a282f
24
+ en: 09c61f61c560f8a2
25
+ zh: 895ac73add1199b8
26
26
  /deepseek-ai-dsh-client-ui-primitives/use-this-package/rendering-agent-output:
27
27
  en: 12fe9d9b1410edef
28
28
  zh: f2dfdc01170d7cce
package/README.md CHANGED
@@ -46,7 +46,7 @@ Check this table before writing a control in a feature package. A plugin cannot
46
46
  | `Checkbox` | Labeled native checkbox with controlled state, keyboard interaction, and disabled styling; the caller supplies localized `label` text. |
47
47
  | `Input` | Single-line text entry for search boxes and inline forms. Its ref targets the native input for focus and is cleared on unmount. |
48
48
  | `InlineEditor` | Autofocused multi-line inline editor for short drafts such as queued messages and goals. It grows with its text and its width up to six lines, then scrolls; Enter saves, Shift+Enter breaks the line, Enter during IME composition does nothing, and Escape cancels. The caller supplies the localized `label` and rebinds the scrollbar on an elevated surface. |
49
- | `Menu`, `MenuItemButton` | Dropdown of `items` data rows, separators, and group labels, with nested submenus; `children` adds component rows, each a `MenuItemButton` (`separatorBefore` starts a new group), in the same list. Every row shares the styling, the keyboard walk, and the focus return; closing stays the owner's state change for both kinds. While open, ↑/↓ (with Home and End) walk the list, Tab settles the focused row, and Escape or Shift+Tab close back to the anchor; selecting a row also returns the keyboard to the anchor unless the owner moved it itself. Only a keyboard on the anchor or inside the list is intercepted, and `autoFocus` decides solely whether opening focuses the first row. |
49
+ | `Menu`, `MenuItemButton` | Dropdown of `items` data rows, separators, and group labels, with nested submenus; `children` adds component rows, each a `MenuItemButton` (`separatorBefore` starts a new group), in the same list. `MenuItemButton.current` exposes the current page or view through `aria-current` without changing selection or appearance. Every row shares the styling, the keyboard walk, and the focus return; closing stays the owner's state change for both kinds. While open, ↑/↓ (with Home and End) walk the list, Tab settles the focused row, and Escape or Shift+Tab close back to the anchor; selecting a row also returns the keyboard to the anchor unless the owner moved it itself. Only a keyboard on the anchor or inside the list is intercepted, and `autoFocus` decides solely whether opening focuses the first row. |
50
50
  | `MenuGroup`, `observeStickyMenuGroups` | Localized, accessible groups for custom menus and listboxes, with shared sticky-heading styling and native intersection/size observation; the caller owns the observer's lifetime. |
51
51
  | `Pill` | Selectable capsule button for view switchers and filters; takes `active` and `onClick`. |
52
52
  | `SegmentedTabs` | Controlled equal-width tabs with a sliding indicator and Left/Right, Home, and End navigation. The caller supplies labels, tab/panel ids, and panel content. |
@@ -69,7 +69,7 @@ Check this table before writing a control in a feature package. A plugin cannot
69
69
  | `UserTextRun`, `ReferenceChip` | Uninterpreted inline text and business-resolved reference labels or activation buttons. |
70
70
  | `CommandText` | Selectable command or argument text; only horizontal overflow adds a named keyboard focus target. |
71
71
  | `TerminalBlock`, `ReadBlock`, `DiffBlock`, `SearchBlock`, `WebBlock` | The agent-output card matching each tool-result intent. |
72
- | `icons/*`, `FishLogo`, `BrandWordmark`, `ReferenceIconRegular`/`ReferenceIconMedium`, `LinkIconRegular`/`LinkIconMedium` | Glyphs and brand marks. The thinking glyph keeps an inset orbit within its 16px view box. Use `LinkIconMedium` for 14px clickable-link categories and known-site marks. |
72
+ | `icons/*`, `FishLogo`, `BrandWordmark`, `ReferenceIconRegular`/`ReferenceIconMedium`, `LinkIconRegular`/`LinkIconMedium` | Glyphs and brand marks. The thinking glyph keeps an inset orbit within its 16px view box. `IconAppsAddOutlineRegular`/`Medium`, the More launcher glyph, take `compact` to draw their tiles closer together at card size. Use `LinkIconMedium` for 14px clickable-link categories and known-site marks. |
73
73
  | `PermissionIconReadOnlyRegular`/`Medium`, `PermissionIconWorkspaceWriteRegular`/`Medium`, `PermissionIconFullAccessRegular`/`Medium`, `PermissionIconAutoReviewRegular`/`Medium` | Permission-mode glyphs for read-only, workspace-write, full-access, and auto-review choices. |
74
74
  | `PluginArtworkTerminal`/`Loop`/`Subagent`/`Search`/`Default` | Fixed-palette 36×36 plugin artwork; `Terminal` supplies the light-blue prompt in plugin cards and sidebar guide entries. `Default` marks plugins without artwork of their own. Def ids are per-instance, so the same artwork repeats safely on one page. |
75
75
  | `GuideArtworkBrowser`/`Files` | Fixed-palette 36×36 browser and folder artwork for sidebar guide entries. |
@@ -89,7 +89,7 @@ Writing your own component in your own package is fine when the need is genuinel
89
89
 
90
90
  The catalog above lists what each export is for; this section covers the behavior that props alone do not show. Product icon names omit artboard sizes and end in `Regular` for the supplied one-pixel artwork or `Medium` for the same geometry at a 1.3px stroke; the `size` prop controls rendered dimensions. Named components keep the chosen weight visible at import sites; the library owns stroke geometry instead of consumer CSS overrides. Each product, reference, link, and permission glyph intentionally keeps both weight exports even when the current product uses only one, so callers can choose emphasis without adding another API later; fill-only pairs render identically. `IconWarningOutlineRegular`/`Medium` use a circle; `IconWarningTriangleOutlineRegular`/`Medium` use a rounded triangle. `FishLogo` and `BrandWordmark` fill brand slots. `FileTypeIcon` renders the traditional 28px spreadsheet, folder, HTML, image, Markdown, generic, PDF, PPT, video, and Word glyphs, and uses the imported square technology artwork for the established 48 code and configuration categories. The import replaces artwork only: archive-only categories do not extend `CodeFileType`. `classifyFileType` applies exact filename, prefix, suffix, optional project-context, and extension rules in that order; React names win over TypeScript/JavaScript, Angular suffixes win over their base extension, and a Dart file becomes Flutter only when the supplied project files contain a `pubspec.yaml` with `flutter:`. Markdown and SVG remain traditional Markdown and image files. Spreadsheet mappings include CSV, TSV, Excel workbooks and templates, OpenDocument spreadsheets, and Numbers; KEY maps to slides, while RTF/ODT/Pages map to documents. `fileExtension` exposes the same basename and final-dot parsing for adjacent metadata labels. Traditional glyphs use a solid category-colored sheet with a white mark and translucent white corner; the generic code glyph uses angle brackets and a slash at the supplied 1.35px stroke; the generic file uses a grey sheet and darker grey corner. Callers may override the sheet color through `--dsh-file-type-icon-color`. The full-color technology artwork is the deliberate exception and retains its embedded palette. All glyphs are decorative and carry no label. `LinkIconMedium` is the leading glyph for clickable artifact links — globe, folder, code, image, document, or plain paper, and for a `url` link the mark of a well-known site named by its `href` — the developer sites a transcript usually cites (GitHub, GitLab, npm, PyPI, Stack Overflow, MDN, Wikipedia, Hacker News, YouTube, X, Bilibili, Zhihu, Juejin, CSDN) and mainstream search, video, social, shopping, and reference sites (Google, Baidu, DuckDuckGo, TikTok, Netflix, Spotify, Facebook, Instagram, Reddit, Telegram, WhatsApp, WeChat, QQ, Weibo, Taobao, AliExpress, eBay, Quora, V2EX, Apple) — while `classifyLinkPath` folds the shared file types into that existing six-category vocabulary. `ConnectionIndicator` renders a warning-colored disconnected action whose permanent retry glyph marks the retry action beside the owner-supplied outage label, the shared ongoing loader in the same warning color as its label whose one-to-three dots advance every 500ms independently of retry timing, or a success-colored recovered status. Clicking either warning state requests an immediate reconnect; no hover interaction changes the copy. The pill fades in on appearance, fades out for 150ms before unmounting, and sizes to its current label. Its owner supplies visibility, the recovery hold, localized labels, and the immediate-reconnect callback; the primitive uses no native title tooltip. `useAnchoredPosition` and `useAnchoredMaxHeight` keep floating panels and bottom-anchored overlays clamped to the viewport and following their anchor; anchored overlays and portalled `Menu` add 20px to the frame's published top clearance, or keep 20px in native fullscreen, while preserving their own minimum margins in ordinary browsers. `HoverCard` keeps its portaled preview reachable across the anchor gap and can expose a copy button through the `copyText` prop. Its `preview` variant uses the anchor or `widthAnchorRef` element’s width minus 48px, centers the panel with 24px side insets, and places it above or below the row within the viewport. The panel keeps the frame’s top clearance, caps its height at 420px, and follows content and anchor resizing; Escape or pointer and keyboard activation of the anchor dismisses it. The whole preview fades in and out over 100ms; a closing preview stops receiving pointer input and unmounts after the fade. Re-entering the anchor during the fade restores it. Reduced-motion preferences suppress the transition. Copy labels are required only when copying is enabled. `HoverCard` and nested action tooltips display independently; use `Tooltip.portal` to layer the small bubble above the card. A visible nested `Tooltip` suppresses only its enclosing tooltip, not the hover card. `Toast` uses the owner's `holdMs` for both the fade delay and its hold-and-fade lifetime. Rerenders with unchanged `holdMs` do not restart that lifetime; completion uses the latest callback, and fully faded actions cannot receive input. A new component key restarts the banner. `rankByName` is the `/` menu's shared candidate ranker for the command and skill sources: the query must be a case-insensitive ordered subsequence of the name; prefix hits rank first, then alignment score, then source order. Portalled `Menu` lists follow their anchor during dragging and CSS transforms, and stop tracking when closed. `Menu.autoFocus` focuses its first enabled item, supports Arrow Up/Down and Home/End navigation, and focuses the first button in the anchor on Escape; it is opt-in for action menus.
91
91
 
92
- `Tooltip` reads the anchor on hover or keyboard focus and fits its bubble from `ResizeObserver` border-box sizes. The bubble stays hidden until its first fit, slides inside the horizontal viewport margin, and flips above or below only when the opposite side fits. Label-size and viewport changes reuse the anchor coordinates; fitting does not synchronously measure the bubble or trigger a React render. Opt-in `openOnClick` also lets an informational button pin the same bubble for reading and associates it with the anchor description. Another click, Escape, Tab, or an outside pointerdown closes it; ordinary action tooltips still dismiss on click.
92
+ `Tooltip` reads the anchor on hover or keyboard focus and fits its bubble from `ResizeObserver` border-box sizes. It stays hidden until its first fit, prefers the requested side, then tries the opposite and perpendicular sides, sliding along the anchor without covering it when a side fits. Horizontal placements keep a 10px gap; vertical placements use `gap` (8px by default). Width and height stay within a 12px viewport margin; text wraps, and content taller than the viewport scrolls when pinned. If no side fits, a stable viewport-bounded fallback can overlap the anchor. Viewport resize refreshes the anchor coordinates; label-size changes reuse them. Fitting does not synchronously measure the bubble or trigger a React render. Opt-in `openOnClick` also lets an informational button pin the same bubble for reading and associates it with the anchor description. Another click, Escape, Tab, or an outside pointerdown closes it; ordinary action tooltips still dismiss on click.
93
93
 
94
94
  <a id="rendering-agent-output"></a>
95
95
 
package/README.zh.md CHANGED
@@ -46,7 +46,7 @@ kind: "package-library"
46
46
  | `Checkbox` | 带标签的原生复选框,支持受控状态、键盘交互和禁用样式;调用方提供本地化的 `label` 文本。 |
47
47
  | `Input` | 单行文本输入,用于搜索框与行内表单。ref 指向原生输入框,供焦点控制使用,并在卸载时清空。 |
48
48
  | `InlineEditor` | 自动聚焦的多行行内编辑器,用于排队消息、goal 等短草稿。它随文本和宽度增高,最多六行,之后滚动;Enter 保存,Shift+Enter 换行,输入法组合中的 Enter 不生效,Escape 取消。调用方提供本地化 `label`,并在 elevated 表面上重绑滚动条。 |
49
- | `Menu`, `MenuItemButton` | 由 `items` 数据行、分隔线与分组标题构成的下拉菜单,支持嵌套子菜单;`children` 在同一列表中加入组件行,每行一个 `MenuItemButton`(`separatorBefore` 开启新分组)。所有行共享样式、键盘走位与焦点归还;两类行的关闭都是 owner 状态的改变。打开期间 `↑`/`↓`(以及 Home、End)在列表中走位,Tab 选定聚焦行,Escape 或 Shift+Tab 关闭并把焦点还给锚点;选定一行同样把键盘还给锚点——除非拥有者自己移动了焦点。只拦截位于锚点或列表内的键盘,`autoFocus` 仅决定打开时是否聚焦首行。 |
49
+ | `Menu`, `MenuItemButton` | 由 `items` 数据行、分隔线与分组标题构成的下拉菜单,支持嵌套子菜单;`children` 在同一列表中加入组件行,每行一个 `MenuItemButton`(`separatorBefore` 开启新分组)。`MenuItemButton.current` 通过 `aria-current` 标识当前页面或视图,不改变选中状态或外观。所有行共享样式、键盘走位与焦点归还;两类行的关闭都是 owner 状态的改变。打开期间 `↑`/`↓`(以及 Home、End)在列表中走位,Tab 选定聚焦行,Escape 或 Shift+Tab 关闭并把焦点还给锚点;选定一行同样把键盘还给锚点——除非拥有者自己移动了焦点。只拦截位于锚点或列表内的键盘,`autoFocus` 仅决定打开时是否聚焦首行。 |
50
50
  | `MenuGroup`、`observeStickyMenuGroups` | 为自定义菜单与列表框提供本地化、可访问的分组,共用吸顶标题样式与原生交叉/尺寸观察;调用方负责观察器的生命周期。 |
51
51
  | `Pill` | 可选中的胶囊按钮,用于视图切换与筛选器;接受 `active` 与 `onClick`。 |
52
52
  | `SegmentedTabs` | 受控的等宽分段标签,支持滑动指示条及左/右方向键、Home、End 导航。调用方提供文案、标签与面板 id,以及面板内容。 |
@@ -69,7 +69,7 @@ kind: "package-library"
69
69
  | `UserTextRun`、`ReferenceChip` | 不做解析的行内文本,以及业务已解析的引用标签或激活按钮。 |
70
70
  | `CommandText` | 可选中的命令或参数文本;仅横向溢出时添加具名的键盘聚焦目标。 |
71
71
  | `TerminalBlock`、`ReadBlock`、`DiffBlock`、`SearchBlock`、`WebBlock` | 与各类工具结果意图对应的 agent 输出卡片。 |
72
- | `icons/*`、`FishLogo`、`BrandWordmark`、`ReferenceIconRegular`/`ReferenceIconMedium`、`LinkIconRegular`/`LinkIconMedium` | 字形与品牌标识。思考图标的轨道在 16px 视口内保留内边距。`LinkIconMedium` 用于 14px 的可点击链接分类及已知站点标记。 |
72
+ | `icons/*`、`FishLogo`、`BrandWordmark`、`ReferenceIconRegular`/`ReferenceIconMedium`、`LinkIconRegular`/`LinkIconMedium` | 字形与品牌标识。思考图标的轨道在 16px 视口内保留内边距。“更多”入口使用的 `IconAppsAddOutlineRegular`/`Medium` 接受 `compact`,在卡片尺寸下让方块更靠近。`LinkIconMedium` 用于 14px 的可点击链接分类及已知站点标记。 |
73
73
  | `PermissionIconReadOnlyRegular`/`Medium`、`PermissionIconWorkspaceWriteRegular`/`Medium`、`PermissionIconFullAccessRegular`/`Medium`、`PermissionIconAutoReviewRegular`/`Medium` | 只读、工作区写入、完全访问与自动审查选项使用的权限模式图形。 |
74
74
  | `PluginArtworkTerminal`/`Loop`/`Subagent`/`Search`/`Default` | 固定配色的 36×36 插件插画;`Terminal` 为插件卡片和侧边栏开始页入口提供浅蓝色提示符。`Default` 用于没有自有插画的插件。def id 按实例生成,同一插画可在一页中安全重复。 |
75
75
  | `GuideArtworkBrowser`/`Files` | 固定配色的 36×36 浏览器与文件夹插画,用于侧栏引导入口。 |
@@ -89,7 +89,7 @@ kind: "package-library"
89
89
 
90
90
  上面的目录说明每个导出的用途;本节讲 props 本身看不出来的行为。产品图标名称不含画板尺寸,以 `Regular` 表示原始 1px 图形,以 `Medium` 表示同一几何的 1.3px 描边;`size` prop 控制渲染尺寸。具名组件让所选线重在导入处可见;描边几何由组件库拥有,而不是由消费方 CSS 覆盖。每个产品、引用、链接与权限图形都会有意保留两种线重导出,即使当前产品只使用其中一种,也让调用方无需再次扩展 API 就能选择强调程度;仅填充的成对图形外观相同。`IconWarningOutlineRegular`/`Medium` 使用圆形;`IconWarningTriangleOutlineRegular`/`Medium` 使用圆角三角形。`FishLogo` 与 `BrandWordmark` 填充品牌 slot。`FileTypeIcon` 渲染传统的 28px spreadsheet、folder、HTML、image、Markdown、generic、PDF、PPT、video 与 Word 图形,并为现有 48 个代码和配置类别使用导入的方形技术图形。该导入只替换图形:资源包中额外的类别不会扩展 `CodeFileType`。`classifyFileType` 按完整文件名、前缀、后缀、可选项目上下文、扩展名的顺序匹配;React 文件名优先于 TypeScript/JavaScript,Angular 后缀优先于基础扩展名,只有传入的项目文件包含带 `flutter:` 的 `pubspec.yaml` 时 Dart 文件才使用 Flutter。Markdown 与 SVG 仍分别使用传统 Markdown 与图片图形。表格映射包括 CSV、TSV、Excel 工作簿与模板、OpenDocument 表格和 Numbers;KEY 映射为幻灯片,RTF/ODT/Pages 映射为文档。`fileExtension` 为相邻元数据 label 暴露同一套 basename 与最终点号解析。传统图形使用实色分类底板、白色标记和半透明白色折角;通用代码图形使用尖括号与斜线,保留原图 1.35px 描边;通用文件使用灰色底板与较深灰色折角。调用方可通过 `--dsh-file-type-icon-color` 覆盖底板颜色。全彩技术图形是明确例外,会保留其内嵌调色板。所有图形都是装饰性的,不自带 label。`LinkIconMedium` 是可点击产物链接的前置图形——地球、文件夹、代码、图片、文档或纸张,`url` 链接的 `href` 指向已知站点时则改用该站点自己的标记——转写内容常引用的开发者站点(GitHub、GitLab、npm、PyPI、Stack Overflow、MDN、Wikipedia、Hacker News、YouTube、X、Bilibili、知乎、掘金、CSDN),以及主流搜索、视频、社交、购物与参考资料站点(Google、百度、DuckDuckGo、TikTok、Netflix、Spotify、Facebook、Instagram、Reddit、Telegram、WhatsApp、微信、QQ、微博、淘宝、速卖通、eBay、Quora、V2EX、Apple)——`classifyLinkPath` 把共享文件类型折叠进原有六类词汇。`ConnectionIndicator` 可渲染警告色的断联操作(常驻重试图形指明重试动作,断联文案由持有方提供)、与文案使用相同警告色的共享 ongoing loading 加一至三个点以独立于 retry 时序的 500ms 节奏推进的连接中状态,或成功色的恢复状态。点击任一警告状态都会请求立即重连;没有任何悬停交互会改变文案。药丸出现时淡入、卸载前淡出 150ms,宽度随当前 label 自适应。它的持有方提供可见性、恢复驻留时间、本地化 label 与立即重连回调;该原语不使用原生 title tooltip。`useAnchoredPosition` 与 `useAnchoredMaxHeight` 让浮动面板与底部锚定浮层始终钳制在视口内并跟随锚点;锚定浮层与 portal 模式的 `Menu` 在框架发布的顶部占用量上增加 20px,原生全屏时保留 20px,普通浏览器中沿用自身的最小边距。`HoverCard` 通过指针离开宽限期让采用 portal 的预览在跨过锚点间隙时仍可触及,并可通过 `copyText` prop 提供复制按钮。其 `preview` 变体使用 anchor 或 `widthAnchorRef` 元素的宽度减去 48px,左右各内缩 24px,并在视口内放置于行的上方或下方。浮层避开框架顶部保留区,高度最多 420px,会跟随内容及 anchor 尺寸变化;Escape 或通过鼠标和键盘激活锚点可将其关闭。整个浮层的淡入和淡出各持续 100ms;关闭中的浮层停止接收指针输入,淡出后卸载。在淡出期间移回锚点可恢复显示。减少动态效果偏好会禁用过渡动画。只有启用复制时才必须提供复制标签。`HoverCard` 与嵌套的操作提示独立显示;使用 `Tooltip.portal` 将小气泡置于卡片上层。可见的嵌套 `Tooltip` 只隐藏外层 tooltip,不隐藏悬停卡片。`Toast` 使用调用方的 `holdMs` 同时控制淡出延迟与停留加淡出的总时长。`holdMs` 未变时,父组件重渲染不会重启该生命周期;完成时调用最新回调,完全淡出的操作不能接收输入。新的组件 key 会重新开始横幅周期。`rankByName` 是 `/` 菜单命令源与 skill(技能)源共享的候选排序器:查询必须是名字的不区分大小写的有序子序列;前缀命中排最前,其次按对齐分数,再按来源顺序。 portal 模式的 `Menu` 列表会在拖动和 CSS 变换期间跟随锚点,并在关闭时停止跟踪。`Menu.autoFocus` 聚焦首个启用项,支持上下方向键与 Home/End 导航,并在 Escape 时聚焦 anchor 内的第一个按钮;操作菜单可显式启用。
91
91
 
92
- `Tooltip` 在悬停或键盘聚焦时读取锚点位置,再根据 `ResizeObserver` 提供的边框盒尺寸调整气泡。首次定位前气泡保持隐藏;横向移入视口留白,仅在另一侧容得下时上下翻转。标签尺寸与视口变化复用锚点坐标;定位不会同步测量气泡,也不会触发 React 渲染。 信息按钮可显式启用 `openOnClick`,点击后保持同一个气泡供阅读,并将内容关联为锚点的无障碍描述;再次点击、Escape、Tab 或外部 pointerdown 会关闭。普通操作按钮的 tooltip 仍在点击时关闭。
92
+ `Tooltip` 在悬停或键盘聚焦时读取锚点位置,再根据 `ResizeObserver` 提供的边框盒尺寸调整气泡。首次定位前保持隐藏,优先使用指定方向,再尝试相反方向和垂直于该方向的两侧;只要某一侧容得下,就沿锚点平移而不遮挡锚点。左右放置保留 10px 间距,上下放置使用 `gap`(默认 8px)。宽高限制在视口内并保留 12px 边距;文本自动换行,超出视口高度的内容在固定气泡后可滚动。若所有方向都放不下,则使用稳定的视口内回退位置,可能遮挡锚点。视口尺寸变化会重新读取锚点坐标,标签尺寸变化则复用坐标;定位不会同步测量气泡,也不会触发 React 渲染。 信息按钮可显式启用 `openOnClick`,点击后保持同一个气泡供阅读,并将内容关联为锚点的无障碍描述;再次点击、Escape、Tab 或外部 pointerdown 会关闭。普通操作按钮的 tooltip 仍在点击时关闭。
93
93
 
94
94
  <a id="rendering-agent-output"></a>
95
95
 
@@ -1,6 +1,6 @@
1
1
  .bubble {
2
2
  display: inline-flex;
3
- align-items: center;
3
+ align-items: safe center;
4
4
  gap: 8px;
5
5
  position: fixed;
6
6
  z-index: 100;
@@ -8,7 +8,10 @@
8
8
  viewport edge, so anchors near the right edge would wrap early;
9
9
  max-content sizes by the label alone, capped at half the viewport. */
10
10
  width: max-content;
11
- max-width: 50vw;
11
+ box-sizing: border-box;
12
+ max-width: min(50vw, calc(100vw - 24px));
13
+ max-height: calc(100vh - 24px);
14
+ overflow: auto;
12
15
  padding: 3px 7px;
13
16
  border-radius: var(--dsw-radius-sm);
14
17
  background: var(--dsw-alias-tooltip-bg);
@@ -30,7 +33,8 @@
30
33
  .bubble[data-has-shortcut] { padding-inline-end: 5px; }
31
34
  .bubble[data-has-shortcut]:not(:has(.label)) { padding: 3px; }
32
35
 
33
- .bubble[data-side='right'] {
36
+ .bubble[data-side='right'],
37
+ .bubble[data-side='left'] {
34
38
  transform: translateY(-50%);
35
39
  }
36
40
 
package/lib/index.js CHANGED
@@ -3038,6 +3038,56 @@ const IconMicrophoneOutlineMedium = (props) => jsx(IconMicrophoneOutlineArtwork,
3038
3038
  ...props,
3039
3039
  strokeWidth: ICON_MEDIUM_STROKE
3040
3040
  });
3041
+ const IconAppsAddOutlineArtwork = ({ size = 16, className, strokeWidth, compact = false }) => {
3042
+ const near = compact ? 2.75 : 2.25;
3043
+ const far = compact ? 9.25 : 9.75;
3044
+ const plusX = far + 2;
3045
+ const plusY = near + 2;
3046
+ return jsxs("svg", {
3047
+ width: size,
3048
+ height: size,
3049
+ viewBox: "0 0 16 16",
3050
+ className,
3051
+ fill: "none",
3052
+ stroke: "currentColor",
3053
+ strokeWidth,
3054
+ "aria-hidden": "true",
3055
+ children: [
3056
+ jsx("rect", {
3057
+ x: near,
3058
+ y: near,
3059
+ width: 4,
3060
+ height: 4,
3061
+ rx: 1
3062
+ }),
3063
+ jsx("rect", {
3064
+ x: near,
3065
+ y: far,
3066
+ width: 4,
3067
+ height: 4,
3068
+ rx: 1
3069
+ }),
3070
+ jsx("rect", {
3071
+ x: far,
3072
+ y: far,
3073
+ width: 4,
3074
+ height: 4,
3075
+ rx: 1
3076
+ }),
3077
+ jsx("path", { d: `M${plusX} ${plusY - 2.5}v5M${plusX - 2.5} ${plusY}h5` })
3078
+ ]
3079
+ });
3080
+ };
3081
+ /** Three entry tiles and an add mark with one-pixel strokes. */
3082
+ const IconAppsAddOutlineRegular = (props) => jsx(IconAppsAddOutlineArtwork, {
3083
+ ...props,
3084
+ strokeWidth: 1
3085
+ });
3086
+ /** Three entry tiles and an add mark with 1.3px strokes. */
3087
+ const IconAppsAddOutlineMedium = (props) => jsx(IconAppsAddOutlineArtwork, {
3088
+ ...props,
3089
+ strokeWidth: ICON_MEDIUM_STROKE
3090
+ });
3041
3091
  //#endregion
3042
3092
  //#region lib/types/StateDot.js
3043
3093
  /**
@@ -3894,13 +3944,14 @@ const MenuSurface = forwardRef(function MenuSurface({ compact = false, className
3894
3944
  * @param props.children - visible row label.
3895
3945
  * @param props.shortcut - effective key labels and accessible combination.
3896
3946
  * @param props.icon - optional leading icon.
3947
+ * @param props.current - whether the row identifies the currently displayed page or view.
3897
3948
  * @param props.disabled - whether the row cannot be activated.
3898
3949
  * @param props.danger - whether to use the destructive row colors.
3899
3950
  * @param props.separatorBefore - whether this row starts a new group (hairline above it).
3900
3951
  * @param props.onSelect - row activation callback.
3901
3952
  * @returns one menu-item row.
3902
3953
  */
3903
- function MenuItemButton({ children, shortcut, icon, disabled = false, danger = false, separatorBefore = false, onSelect }) {
3954
+ function MenuItemButton({ children, shortcut, icon, current, disabled = false, danger = false, separatorBefore = false, onSelect }) {
3904
3955
  return jsxs("div", {
3905
3956
  className: css$15.itemWrap,
3906
3957
  children: [separatorBefore && jsx("div", {
@@ -3912,6 +3963,7 @@ function MenuItemButton({ children, shortcut, icon, disabled = false, danger = f
3912
3963
  className: clsx(css$15.item, danger && css$15.danger),
3913
3964
  disabled,
3914
3965
  "aria-keyshortcuts": shortcut?.aria,
3966
+ "aria-current": current === true ? "page" : void 0,
3915
3967
  onClick: onSelect,
3916
3968
  children: [
3917
3969
  icon !== void 0 && jsx("span", {
@@ -3981,6 +4033,7 @@ const MEASURE_STYLE = {
3981
4033
  * the trigger (render-prop anchors, effect-positioned proxies — measuring the
3982
4034
  * wrapper there races the host's layout effects). Called on open, each animation
3983
4035
  * frame, and scroll/resize; return null to skip placement for that frame.
4036
+ * @param props.minWidthFromAnchor - in portal mode, keep the menu at least as wide as its anchor, bounded by viewport margins.
3984
4037
  * @param props.footer - rows pinned below the scrolling items area, separated
3985
4038
  * by a hairline; they stay visible while the items above scroll.
3986
4039
  * @param props.children - component rows rendered after `items` in the same
@@ -3997,7 +4050,7 @@ const MEASURE_STYLE = {
3997
4050
  * document.body outside the owner's DOM subtree.
3998
4051
  * @returns anchor wrapper with the conditional list.
3999
4052
  */
4000
- function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onSelect, onClose, align = "start", side = "bottom", portal = false, closeOnPointerLeave = false, dense = false, compact = false, autoFocus = false, selection = "check", getAnchorRect, footer, className, listClassName }) {
4053
+ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onSelect, onClose, align = "start", side = "bottom", portal = false, closeOnPointerLeave = false, dense = false, compact = false, autoFocus = false, selection = "check", getAnchorRect, minWidthFromAnchor = false, footer, className, listClassName }) {
4001
4054
  const rootRef = useRef(null);
4002
4055
  const listRef = useRef(null);
4003
4056
  /** Index the arrow walk last focused, the resume point when focus left the rows. */
@@ -4059,6 +4112,10 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
4059
4112
  const vw = window.innerWidth;
4060
4113
  const vh = window.innerHeight;
4061
4114
  const listEl = listRef.current;
4115
+ if (listEl !== null) {
4116
+ const minimum = minWidthFromAnchor ? `${Math.min(r.width, Math.max(0, vw - MARGIN * 2))}px` : "";
4117
+ if (listEl.style.minWidth !== minimum) listEl.style.minWidth = minimum;
4118
+ }
4062
4119
  const lw = listEl?.offsetWidth ?? 0;
4063
4120
  const lh = listEl?.offsetHeight ?? 0;
4064
4121
  let x;
@@ -4098,7 +4155,8 @@ function Menu({ open, anchor, items = [], children, selectedId, selectedIds, onS
4098
4155
  portal,
4099
4156
  align,
4100
4157
  side,
4101
- getAnchorRect
4158
+ getAnchorRect,
4159
+ minWidthFromAnchor
4102
4160
  ]);
4103
4161
  useEffect(() => {
4104
4162
  if (!open) {
@@ -6619,6 +6677,73 @@ function ReferenceChip({ appearance, label, title, onActivate }) {
6619
6677
  });
6620
6678
  }
6621
6679
  //#endregion
6680
+ //#region lib/types/tooltip-placement.js
6681
+ const opposite = {
6682
+ right: "left",
6683
+ left: "right",
6684
+ top: "bottom",
6685
+ bottom: "top"
6686
+ };
6687
+ /**
6688
+ * Prefer the requested side, its opposite, then perpendicular sides without covering the anchor.
6689
+ * @param input - Observed dimensions, anchor edges, viewport and requested placement; horizontal gaps remain 10px.
6690
+ * @returns Border-box coordinates and the selected side; if no side fits, a viewport-bounded fallback.
6691
+ */
6692
+ function placeTooltip(input) {
6693
+ const { anchor, viewportWidth, viewportHeight, side, align, gap } = input;
6694
+ let { width, height } = input;
6695
+ const margin = 12;
6696
+ const maxWidth = Math.max(0, viewportWidth - margin * 2);
6697
+ const maxHeight = Math.max(0, viewportHeight - margin * 2);
6698
+ width = Math.min(width, maxWidth);
6699
+ height = Math.min(height, maxHeight);
6700
+ const clampX = (x) => Math.max(margin, Math.min(x, viewportWidth - margin - width));
6701
+ const clampY = (y) => Math.max(margin, Math.min(y, viewportHeight - margin - height));
6702
+ const horizontal = side === "right" || side === "left";
6703
+ const candidates = [
6704
+ side,
6705
+ opposite[side],
6706
+ ...horizontal ? ["bottom", "top"] : ["right", "left"]
6707
+ ];
6708
+ const positions = {
6709
+ right: {
6710
+ left: anchor.right + 10,
6711
+ top: clampY((anchor.top + anchor.bottom - height) / 2)
6712
+ },
6713
+ left: {
6714
+ left: anchor.left - 10 - width,
6715
+ top: clampY((anchor.top + anchor.bottom - height) / 2)
6716
+ },
6717
+ bottom: {
6718
+ left: clampX(align === "end" ? anchor.right - width : (anchor.left + anchor.right - width) / 2),
6719
+ top: anchor.bottom + gap
6720
+ },
6721
+ top: {
6722
+ left: clampX(align === "end" ? anchor.right - width : (anchor.left + anchor.right - width) / 2),
6723
+ top: anchor.top - gap - height
6724
+ }
6725
+ };
6726
+ for (const candidate of candidates) {
6727
+ const position = positions[candidate];
6728
+ if (position.left >= margin && position.top >= margin && position.left + width <= viewportWidth - margin && position.top + height <= viewportHeight - margin) return {
6729
+ ...position,
6730
+ side: candidate,
6731
+ width,
6732
+ height,
6733
+ overflow: false
6734
+ };
6735
+ }
6736
+ const position = positions[side];
6737
+ return {
6738
+ left: clampX(position.left),
6739
+ top: clampY(position.top),
6740
+ side,
6741
+ width,
6742
+ height,
6743
+ overflow: true
6744
+ };
6745
+ }
6746
+ //#endregion
6622
6747
  //#region lib/types/input-modality.js
6623
6748
  /**
6624
6749
  * Document-wide input tracking shared by tooltips and focus-ring styles.
@@ -6694,28 +6819,29 @@ const TooltipSuppression = createContext(null);
6694
6819
  * Attach a hover/focus tooltip to an anchor element.
6695
6820
  * @param props.label - bubble text, or a resolver evaluated only while visible; an empty string shows only shortcut keys.
6696
6821
  * @param props.shortcutKeys - effective key labels rendered as platform-formatted keycaps after optional text.
6697
- * @param props.side - placement relative to the anchor (default 'right').
6822
+ * @param props.side - preferred placement (default 'right'); fitting tries the opposite then perpendicular sides.
6698
6823
  * @param props.align - horizontal anchor-edge alignment for 'bottom'/'top' bubbles: 'end' pins
6699
6824
  * the bubble's right edge to the anchor's (for anchors beside other hover surfaces the centered
6700
- * bubble would overlap); default 'center'. Ignored for side 'right'.
6825
+ * bubble would overlap); default 'center'. Horizontal placements ignore it.
6701
6826
  * @param props.portal - render the bubble under document.body, so an ancestor's clipping or its
6702
6827
  * stacking context (which confines the bubble's z-index to that context) cannot hide it.
6703
6828
  * @param props.delayMs - hover delay in milliseconds (default 0).
6704
6829
  * @param props.focusDelayMs - keyboard focus delay in milliseconds (default 0); blur, click,
6705
6830
  * mouse leave, disabling, and unmount cancel a pending show.
6706
6831
  * @param props.gap - anchor-to-bubble distance in pixels for 'bottom'/'top' bubbles (default 8);
6707
- * ignored for side 'right'.
6832
+ * horizontal placements use 10px, including after a flip.
6708
6833
  * @param props.disabled - suppress the bubble while true; the anchor renders identically so
6709
6834
  * toggling never remounts it (which would cut its CSS transitions).
6710
6835
  * @param props.maxWidth - bubble width cap in pixels, for labels long enough that the default
6711
- * half-viewport cap would render a slab wider than the surface the anchor sits on.
6836
+ * half-viewport cap would render a slab wider than the surface the anchor sits on; always bounded by viewport margins.
6712
6837
  * @param props.openOnClick - clicking also pins the bubble for reading; another click, Escape,
6713
6838
  * Tab, or an outside pointerdown dismisses it. Defaults to false for ordinary action tooltips.
6714
6839
  * @param props.children - a single anchor element; its own ref (callback or object) is forwarded alongside the tooltip's.
6715
6840
  * @returns the cloned anchor plus a fixed-position bubble, optionally portaled to the body.
6716
6841
  * The bubble stays hidden until ResizeObserver supplies its size for viewport fitting; clicking the
6717
6842
  * anchor dismisses the bubble unless openOnClick is enabled, and focus arriving after a pointer
6718
- * interaction (a closing menu refocusing its trigger) never raises it.
6843
+ * interaction (a closing menu refocusing its trigger) never raises it. When no side fits, the
6844
+ * viewport-bounded fallback may overlap the anchor; oversized content is scrollable when pinned.
6719
6845
  */
6720
6846
  function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayMs = 0, focusDelayMs = 0, gap = 8, disabled = false, portal = false, maxWidth, openOnClick = false, children }) {
6721
6847
  const id = useId();
@@ -6730,7 +6856,6 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
6730
6856
  const [pos, setPos] = useState(null);
6731
6857
  const bubble = useRef(null);
6732
6858
  const resolvedLabel = pos === null ? null : typeof label === "function" ? label() : label;
6733
- const y = pos === null ? 0 : side === "right" ? pos.top + (pos.bottom - pos.top) / 2 : side === "top" ? pos.top - gap : pos.bottom + gap;
6734
6859
  const showTimer = useRef(null);
6735
6860
  const triggers = useRef({
6736
6861
  hover: false,
@@ -6745,32 +6870,41 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
6745
6870
  useEffect(() => {
6746
6871
  const el = bubble.current;
6747
6872
  if (pos === null || !visible || suppressed || el === null) return;
6748
- const edgeMargin = 12;
6749
6873
  let size;
6750
- let placement = side;
6874
+ let anchorRect = pos;
6751
6875
  const fit = () => {
6752
6876
  if (size === void 0) return;
6753
- const { inlineSize: width, blockSize: height } = size;
6754
- const offset = side === "right" ? 0 : align === "end" ? width : width / 2;
6755
- const left = Math.max(edgeMargin, Math.min(pos.x - offset, window.innerWidth - edgeMargin - width));
6756
- const fitsBelow = pos.bottom + gap + height <= window.innerHeight - edgeMargin;
6757
- const fitsAbove = pos.top - gap - height >= edgeMargin;
6758
- if (placement === "bottom" && !fitsBelow && fitsAbove) placement = "top";
6759
- else if (placement === "top" && !fitsAbove && fitsBelow) placement = "bottom";
6760
- el.style.left = `${left + offset}px`;
6761
- el.style.top = `${placement === "right" ? (pos.top + pos.bottom) / 2 : placement === "top" ? pos.top - gap : pos.bottom + gap}px`;
6762
- el.dataset.side = placement;
6877
+ const placement = placeTooltip({
6878
+ anchor: anchorRect,
6879
+ width: size.inlineSize,
6880
+ height: size.blockSize,
6881
+ viewportWidth: window.innerWidth,
6882
+ viewportHeight: window.innerHeight,
6883
+ side,
6884
+ align,
6885
+ gap
6886
+ });
6887
+ const horizontal = placement.side === "right" || placement.side === "left";
6888
+ const offsetX = horizontal ? 0 : align === "end" ? placement.width : placement.width / 2;
6889
+ const offsetY = horizontal ? placement.height / 2 : placement.side === "top" ? placement.height : 0;
6890
+ el.style.left = `${placement.left + offsetX}px`;
6891
+ el.style.top = `${placement.top + offsetY}px`;
6892
+ el.dataset.side = placement.side;
6763
6893
  el.style.visibility = "visible";
6764
6894
  };
6895
+ const onResize = () => {
6896
+ if (anchor.current !== null) anchorRect = anchor.current.getBoundingClientRect();
6897
+ fit();
6898
+ };
6765
6899
  const observer = new ResizeObserver((entries) => {
6766
6900
  size = entries[0]?.borderBoxSize[0];
6767
6901
  fit();
6768
6902
  });
6769
6903
  observer.observe(el, { box: "border-box" });
6770
- window.addEventListener("resize", fit);
6904
+ window.addEventListener("resize", onResize);
6771
6905
  return () => {
6772
6906
  observer.disconnect();
6773
- window.removeEventListener("resize", fit);
6907
+ window.removeEventListener("resize", onResize);
6774
6908
  };
6775
6909
  }, [
6776
6910
  align,
@@ -6813,12 +6947,7 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
6813
6947
  const el = anchor.current;
6814
6948
  /* v8 ignore next -- the ref is attached by event time: events fire on the cloned anchor. */
6815
6949
  if (el === null) return;
6816
- const r = el.getBoundingClientRect();
6817
- setPos({
6818
- x: side === "right" ? r.right + 10 : align === "end" ? r.right : r.left + r.width / 2,
6819
- top: r.top,
6820
- bottom: r.bottom
6821
- });
6950
+ setPos(el.getBoundingClientRect());
6822
6951
  announce(true);
6823
6952
  };
6824
6953
  const showAfterDelay = (delay) => {
@@ -6879,10 +7008,10 @@ function Tooltip({ label, shortcutKeys, side = "right", align = "center", delayM
6879
7008
  "data-align": align,
6880
7009
  "data-has-shortcut": shortcutKeys?.length ? true : void 0,
6881
7010
  style: {
6882
- left: pos.x,
6883
- top: y,
7011
+ left: pos.left,
7012
+ top: pos.top,
6884
7013
  visibility: "hidden",
6885
- ...maxWidth === void 0 ? {} : { maxWidth }
7014
+ ...maxWidth === void 0 ? {} : { maxWidth: `min(${maxWidth}px, calc(100vw - 24px))` }
6886
7015
  },
6887
7016
  role: "tooltip",
6888
7017
  "aria-label": shortcutKeys?.length ? [resolvedLabel, shortcutKeys.join(" ")].filter(Boolean).join(" ") : void 0,
@@ -12578,6 +12707,6 @@ function GuideArtworkFiles({ size = 36, className }) {
12578
12707
  });
12579
12708
  }
12580
12709
  //#endregion
12581
- export { BrandWordmark, Button, CODE_HIGHLIGHT_EXTENSIONS, Checkbox, CodeBlock, CommandText, ConnectionIndicator, DEFAULT_DIFF_MAX_LINES, DEFAULT_READ_MAX_LINES, DEFAULT_SEARCH_MAX_LINES, DEFAULT_TERMINAL_MAX_LINES, DiffBlock, DisclosureRow, FISH_LOGO_PATH, FISH_LOGO_VIEWBOX, FileTypeIcon, FishLogo, GuideArtworkBrowser, GuideArtworkFiles, HoverCard, HoverCardGroup, ICON_MEDIUM_STROKE, ICON_REGULAR_STROKE, IconAgentPresetOutlineMedium, IconAgentPresetOutlineRegular, IconAlarmClockOutlineMedium, IconAlarmClockOutlineRegular, IconApiOutlineMedium, IconApiOutlineRegular, IconArchiveCheckOutlineMedium, IconArchiveCheckOutlineRegular, IconArchiveOffOutlineMedium, IconArchiveOffOutlineRegular, IconArchiveOutlineMedium, IconArchiveOutlineRegular, IconBranchOutlineMedium, IconBranchOutlineRegular, IconBrowseOutlineMedium, IconBrowseOutlineRegular, IconCheckCircleFillMedium, IconCheckCircleFillRegular, IconCheckCircleOutlineMedium, IconCheckCircleOutlineRegular, IconCheckOutlineMedium, IconCheckOutlineRegular, IconChecklistOutlineMedium, IconChecklistOutlineRegular, IconChevronDownOutlineMedium, IconChevronDownOutlineRegular, IconChevronLeftOutlineMedium, IconChevronLeftOutlineRegular, IconChevronRightOutlineMedium, IconChevronRightOutlineRegular, IconChevronUpOutlineMedium, IconChevronUpOutlineRegular, IconChevronsUpDownOutlineMedium, IconChevronsUpDownOutlineRegular, IconClockOutlineMedium, IconClockOutlineRegular, IconCloseCircleFillMedium, IconCloseCircleFillRegular, IconCloseFillMedium, IconCloseFillRegular, IconCloseOutlineMedium, IconCloseOutlineRegular, IconCodeOutlineMedium, IconCodeOutlineRegular, IconCompactOutlineMedium, IconCompactOutlineRegular, IconCompareSplitOutlineMedium, IconCompareSplitOutlineRegular, IconContextInjectionOutlineMedium, IconContextInjectionOutlineRegular, IconCopyOutlineMedium, IconCopyOutlineRegular, IconCordisPluginOutlineMedium, IconCordisPluginOutlineRegular, IconDarkOutlineMedium, IconDarkOutlineRegular, IconDataOutlineMedium, IconDataOutlineRegular, IconDatabaseOutlineMedium, IconDatabaseOutlineRegular, IconDeliverDocMedium, IconDeliverDocRegular, IconDislikeFillMedium, IconDislikeFillRegular, IconDislikeOutlineMedium, IconDislikeOutlineRegular, IconDownloadOutlineMedium, IconDownloadOutlineRegular, IconEditOutlineMedium, IconEditOutlineRegular, IconEllipsisOutlineMedium, IconEllipsisOutlineRegular, IconEnhanceOutlineMedium, IconEnhanceOutlineRegular, IconFlatListOutlineMedium, IconFlatListOutlineRegular, IconFolderCloseMedium, IconFolderCloseRegular, IconFolderOpenMedium, IconFolderOpenOutlineMedium, IconFolderOpenOutlineRegular, IconFolderOpenRegular, IconFollowsystemOutlineMedium, IconFollowsystemOutlineRegular, IconFullscreenOutlineMedium, IconFullscreenOutlineRegular, IconGaugeOutlineMedium, IconGaugeOutlineRegular, IconGlobeOutlineMedium, IconGlobeOutlineRegular, IconGoalOutlineMedium, IconGoalOutlineRegular, IconInfoOutlineMedium, IconInfoOutlineRegular, IconInspectOutlineMedium, IconInspectOutlineRegular, IconLightOutlineMedium, IconLightOutlineRegular, IconLikeFillMedium, IconLikeFillRegular, IconLikeOutlineMedium, IconLikeOutlineRegular, IconLinkOutlineMedium, IconLinkOutlineRegular, IconListPenOutlineMedium, IconListPenOutlineRegular, IconLoadingOutlineMedium, IconLoadingOutlineRegular, IconMicrophoneOutlineMedium, IconMicrophoneOutlineRegular, IconNewChatOutlineMedium, IconNewChatOutlineRegular, IconNowrapFillMedium, IconNowrapFillRegular, IconPanelLeftOutlineMedium, IconPanelLeftOutlineRegular, IconPaperPlaneOutlineMedium, IconPaperPlaneOutlineRegular, IconPaperclipOutlineMedium, IconPaperclipOutlineRegular, IconPauseOutlineMedium, IconPauseOutlineRegular, IconPersonalizationOutlineMedium, IconPersonalizationOutlineRegular, IconPinFillMedium, IconPinFillRegular, IconPinOutlineMedium, IconPinOutlineRegular, IconPlanOutlineMedium, IconPlanOutlineRegular, IconPlayOutlineMedium, IconPlayOutlineRegular, IconPluginPinwheelOutlineMedium, IconPluginPinwheelOutlineRegular, IconPlusOutlineMedium, IconPlusOutlineRegular, IconProjectAddOutlineMedium, IconProjectAddOutlineRegular, IconQuestionOutlineMedium, IconQuestionOutlineRegular, IconQueueOutlineMedium, IconQueueOutlineRegular, IconRefreshOutlineMedium, IconRefreshOutlineRegular, IconRightUpOutlineMedium, IconRightUpOutlineRegular, IconSearchOutlineMedium, IconSearchOutlineRegular, IconSendOutlineMedium, IconSendOutlineRegular, IconSettingsOutlineMedium, IconSettingsOutlineRegular, IconShareOutlineMedium, IconShareOutlineRegular, IconShieldOutlineMedium, IconShieldOutlineRegular, IconSkillOutlineMedium, IconSkillOutlineRegular, IconSlidersTwoOutlineMedium, IconSlidersTwoOutlineRegular, IconSparkleMedium, IconSparkleRegular, IconStopFillMedium, IconStopFillRegular, IconThinkOutlineMedium, IconThinkOutlineRegular, IconTrashOutlineMedium, IconTrashOutlineRegular, IconTreeCornerMedium, IconTreeCornerRegular, IconTriangleRightFillMedium, IconTriangleRightFillRegular, IconUnarchiveOutlineMedium, IconUnarchiveOutlineRegular, IconUserOutlineMedium, IconUserOutlineRegular, IconUsersOutlineMedium, IconUsersOutlineRegular, IconWarningOutlineMedium, IconWarningOutlineRegular, IconWarningTriangleOutlineMedium, IconWarningTriangleOutlineRegular, IconWorkspaceTreeOutlineMedium, IconWorkspaceTreeOutlineRegular, IconWrapFillMedium, IconWrapFillRegular, IconWrapLinesOutlineMedium, IconWrapLinesOutlineRegular, ImageLightbox, InlineEditor, Input, JsonBlock, JsonTree, LinkIconMedium, LinkIconRegular, MarkdownDelegateProvider, MarkdownText, Menu, MenuGroup, MenuItemButton, MenuSurface, Modal, PathLabel, PermissionIconAutoReviewMedium, PermissionIconAutoReviewRegular, PermissionIconFullAccessMedium, PermissionIconFullAccessRegular, PermissionIconReadOnlyMedium, PermissionIconReadOnlyRegular, PermissionIconWorkspaceWriteMedium, PermissionIconWorkspaceWriteRegular, Pill, PluginArtworkDefault, PluginArtworkLoop, PluginArtworkSearch, PluginArtworkSubagent, PluginArtworkTerminal, ReadBlock, ReferenceChip, ReferenceIconMedium, ReferenceIconRegular, RiskConfirmation, SHIELD_OUTLINE_PATH, SearchBlock, SegmentedControl, SegmentedTabs, SettingsForm, SettingsFormModel, SettingsSecretField, SettingsValueField, ShortcutKeys, StateDot, Switch, Tag, TerminalBlock, TextShimmer, Toast, Tooltip, UserTextRun, WebBlock, classifyFileType, classifyLinkPath, closeTopModal, diffTotals, extractMarkdownPlainText, fileExtension, fileSizeText, focusWithoutRing, isBehindModal, isDarwinDesktop, languageForPath, modalSelector, observeComposition, observeStickyMenuGroups, pointerModality, rankByName, relativeTime, settingsNumberField, settingsTextField, useAnchoredMaxHeight, useAnchoredPosition, useCodeHighlighter, useDismissOnOutsidePointer, useModalLayer, writeClipboard };
12710
+ export { BrandWordmark, Button, CODE_HIGHLIGHT_EXTENSIONS, Checkbox, CodeBlock, CommandText, ConnectionIndicator, DEFAULT_DIFF_MAX_LINES, DEFAULT_READ_MAX_LINES, DEFAULT_SEARCH_MAX_LINES, DEFAULT_TERMINAL_MAX_LINES, DiffBlock, DisclosureRow, FISH_LOGO_PATH, FISH_LOGO_VIEWBOX, FileTypeIcon, FishLogo, GuideArtworkBrowser, GuideArtworkFiles, HoverCard, HoverCardGroup, ICON_MEDIUM_STROKE, ICON_REGULAR_STROKE, IconAgentPresetOutlineMedium, IconAgentPresetOutlineRegular, IconAlarmClockOutlineMedium, IconAlarmClockOutlineRegular, IconApiOutlineMedium, IconApiOutlineRegular, IconAppsAddOutlineMedium, IconAppsAddOutlineRegular, IconArchiveCheckOutlineMedium, IconArchiveCheckOutlineRegular, IconArchiveOffOutlineMedium, IconArchiveOffOutlineRegular, IconArchiveOutlineMedium, IconArchiveOutlineRegular, IconBranchOutlineMedium, IconBranchOutlineRegular, IconBrowseOutlineMedium, IconBrowseOutlineRegular, IconCheckCircleFillMedium, IconCheckCircleFillRegular, IconCheckCircleOutlineMedium, IconCheckCircleOutlineRegular, IconCheckOutlineMedium, IconCheckOutlineRegular, IconChecklistOutlineMedium, IconChecklistOutlineRegular, IconChevronDownOutlineMedium, IconChevronDownOutlineRegular, IconChevronLeftOutlineMedium, IconChevronLeftOutlineRegular, IconChevronRightOutlineMedium, IconChevronRightOutlineRegular, IconChevronUpOutlineMedium, IconChevronUpOutlineRegular, IconChevronsUpDownOutlineMedium, IconChevronsUpDownOutlineRegular, IconClockOutlineMedium, IconClockOutlineRegular, IconCloseCircleFillMedium, IconCloseCircleFillRegular, IconCloseFillMedium, IconCloseFillRegular, IconCloseOutlineMedium, IconCloseOutlineRegular, IconCodeOutlineMedium, IconCodeOutlineRegular, IconCompactOutlineMedium, IconCompactOutlineRegular, IconCompareSplitOutlineMedium, IconCompareSplitOutlineRegular, IconContextInjectionOutlineMedium, IconContextInjectionOutlineRegular, IconCopyOutlineMedium, IconCopyOutlineRegular, IconCordisPluginOutlineMedium, IconCordisPluginOutlineRegular, IconDarkOutlineMedium, IconDarkOutlineRegular, IconDataOutlineMedium, IconDataOutlineRegular, IconDatabaseOutlineMedium, IconDatabaseOutlineRegular, IconDeliverDocMedium, IconDeliverDocRegular, IconDislikeFillMedium, IconDislikeFillRegular, IconDislikeOutlineMedium, IconDislikeOutlineRegular, IconDownloadOutlineMedium, IconDownloadOutlineRegular, IconEditOutlineMedium, IconEditOutlineRegular, IconEllipsisOutlineMedium, IconEllipsisOutlineRegular, IconEnhanceOutlineMedium, IconEnhanceOutlineRegular, IconFlatListOutlineMedium, IconFlatListOutlineRegular, IconFolderCloseMedium, IconFolderCloseRegular, IconFolderOpenMedium, IconFolderOpenOutlineMedium, IconFolderOpenOutlineRegular, IconFolderOpenRegular, IconFollowsystemOutlineMedium, IconFollowsystemOutlineRegular, IconFullscreenOutlineMedium, IconFullscreenOutlineRegular, IconGaugeOutlineMedium, IconGaugeOutlineRegular, IconGlobeOutlineMedium, IconGlobeOutlineRegular, IconGoalOutlineMedium, IconGoalOutlineRegular, IconInfoOutlineMedium, IconInfoOutlineRegular, IconInspectOutlineMedium, IconInspectOutlineRegular, IconLightOutlineMedium, IconLightOutlineRegular, IconLikeFillMedium, IconLikeFillRegular, IconLikeOutlineMedium, IconLikeOutlineRegular, IconLinkOutlineMedium, IconLinkOutlineRegular, IconListPenOutlineMedium, IconListPenOutlineRegular, IconLoadingOutlineMedium, IconLoadingOutlineRegular, IconMicrophoneOutlineMedium, IconMicrophoneOutlineRegular, IconNewChatOutlineMedium, IconNewChatOutlineRegular, IconNowrapFillMedium, IconNowrapFillRegular, IconPanelLeftOutlineMedium, IconPanelLeftOutlineRegular, IconPaperPlaneOutlineMedium, IconPaperPlaneOutlineRegular, IconPaperclipOutlineMedium, IconPaperclipOutlineRegular, IconPauseOutlineMedium, IconPauseOutlineRegular, IconPersonalizationOutlineMedium, IconPersonalizationOutlineRegular, IconPinFillMedium, IconPinFillRegular, IconPinOutlineMedium, IconPinOutlineRegular, IconPlanOutlineMedium, IconPlanOutlineRegular, IconPlayOutlineMedium, IconPlayOutlineRegular, IconPluginPinwheelOutlineMedium, IconPluginPinwheelOutlineRegular, IconPlusOutlineMedium, IconPlusOutlineRegular, IconProjectAddOutlineMedium, IconProjectAddOutlineRegular, IconQuestionOutlineMedium, IconQuestionOutlineRegular, IconQueueOutlineMedium, IconQueueOutlineRegular, IconRefreshOutlineMedium, IconRefreshOutlineRegular, IconRightUpOutlineMedium, IconRightUpOutlineRegular, IconSearchOutlineMedium, IconSearchOutlineRegular, IconSendOutlineMedium, IconSendOutlineRegular, IconSettingsOutlineMedium, IconSettingsOutlineRegular, IconShareOutlineMedium, IconShareOutlineRegular, IconShieldOutlineMedium, IconShieldOutlineRegular, IconSkillOutlineMedium, IconSkillOutlineRegular, IconSlidersTwoOutlineMedium, IconSlidersTwoOutlineRegular, IconSparkleMedium, IconSparkleRegular, IconStopFillMedium, IconStopFillRegular, IconThinkOutlineMedium, IconThinkOutlineRegular, IconTrashOutlineMedium, IconTrashOutlineRegular, IconTreeCornerMedium, IconTreeCornerRegular, IconTriangleRightFillMedium, IconTriangleRightFillRegular, IconUnarchiveOutlineMedium, IconUnarchiveOutlineRegular, IconUserOutlineMedium, IconUserOutlineRegular, IconUsersOutlineMedium, IconUsersOutlineRegular, IconWarningOutlineMedium, IconWarningOutlineRegular, IconWarningTriangleOutlineMedium, IconWarningTriangleOutlineRegular, IconWorkspaceTreeOutlineMedium, IconWorkspaceTreeOutlineRegular, IconWrapFillMedium, IconWrapFillRegular, IconWrapLinesOutlineMedium, IconWrapLinesOutlineRegular, ImageLightbox, InlineEditor, Input, JsonBlock, JsonTree, LinkIconMedium, LinkIconRegular, MarkdownDelegateProvider, MarkdownText, Menu, MenuGroup, MenuItemButton, MenuSurface, Modal, PathLabel, PermissionIconAutoReviewMedium, PermissionIconAutoReviewRegular, PermissionIconFullAccessMedium, PermissionIconFullAccessRegular, PermissionIconReadOnlyMedium, PermissionIconReadOnlyRegular, PermissionIconWorkspaceWriteMedium, PermissionIconWorkspaceWriteRegular, Pill, PluginArtworkDefault, PluginArtworkLoop, PluginArtworkSearch, PluginArtworkSubagent, PluginArtworkTerminal, ReadBlock, ReferenceChip, ReferenceIconMedium, ReferenceIconRegular, RiskConfirmation, SHIELD_OUTLINE_PATH, SearchBlock, SegmentedControl, SegmentedTabs, SettingsForm, SettingsFormModel, SettingsSecretField, SettingsValueField, ShortcutKeys, StateDot, Switch, Tag, TerminalBlock, TextShimmer, Toast, Tooltip, UserTextRun, WebBlock, classifyFileType, classifyLinkPath, closeTopModal, diffTotals, extractMarkdownPlainText, fileExtension, fileSizeText, focusWithoutRing, isBehindModal, isDarwinDesktop, languageForPath, modalSelector, observeComposition, observeStickyMenuGroups, pointerModality, rankByName, relativeTime, settingsNumberField, settingsTextField, useAnchoredMaxHeight, useAnchoredPosition, useCodeHighlighter, useDismissOnOutsidePointer, useModalLayer, writeClipboard };
12582
12711
 
12583
12712
  //# sourceMappingURL=index.js.map
@@ -37,6 +37,8 @@ export interface MenuItemButtonProps {
37
37
  shortcut?: MenuItem['shortcut'];
38
38
  /** Leading icon (figma .Menu_cell gap 8). */
39
39
  icon?: ReactNode;
40
+ /** Whether this row identifies the currently displayed page or view. */
41
+ current?: boolean;
40
42
  /** Whether the row cannot be activated. */
41
43
  disabled?: boolean;
42
44
  /** Destructive row: error-colored text/icon and danger hover fill. */
@@ -60,13 +62,14 @@ export interface MenuItemButtonProps {
60
62
  * @param props.children - visible row label.
61
63
  * @param props.shortcut - effective key labels and accessible combination.
62
64
  * @param props.icon - optional leading icon.
65
+ * @param props.current - whether the row identifies the currently displayed page or view.
63
66
  * @param props.disabled - whether the row cannot be activated.
64
67
  * @param props.danger - whether to use the destructive row colors.
65
68
  * @param props.separatorBefore - whether this row starts a new group (hairline above it).
66
69
  * @param props.onSelect - row activation callback.
67
70
  * @returns one menu-item row.
68
71
  */
69
- export declare function MenuItemButton({ children, shortcut, icon, disabled, danger, separatorBefore, onSelect, }: MenuItemButtonProps): import("react").JSX.Element;
72
+ export declare function MenuItemButton({ children, shortcut, icon, current, disabled, danger, separatorBefore, onSelect, }: MenuItemButtonProps): import("react").JSX.Element;
70
73
  /**
71
74
  * Render an anchored dropdown menu. While the list is open its keys mirror the
72
75
  * composer's: Tab settles the focused row — from the trigger, Tab enters the
@@ -102,6 +105,7 @@ export declare function MenuItemButton({ children, shortcut, icon, disabled, dan
102
105
  * the trigger (render-prop anchors, effect-positioned proxies — measuring the
103
106
  * wrapper there races the host's layout effects). Called on open, each animation
104
107
  * frame, and scroll/resize; return null to skip placement for that frame.
108
+ * @param props.minWidthFromAnchor - in portal mode, keep the menu at least as wide as its anchor, bounded by viewport margins.
105
109
  * @param props.footer - rows pinned below the scrolling items area, separated
106
110
  * by a hairline; they stay visible while the items above scroll.
107
111
  * @param props.children - component rows rendered after `items` in the same
@@ -118,7 +122,7 @@ export declare function MenuItemButton({ children, shortcut, icon, disabled, dan
118
122
  * document.body outside the owner's DOM subtree.
119
123
  * @returns anchor wrapper with the conditional list.
120
124
  */
121
- export declare function Menu({ open, anchor, items, children, selectedId, selectedIds, onSelect, onClose, align, side, portal, closeOnPointerLeave, dense, compact, autoFocus, selection, getAnchorRect, footer, className, listClassName }: {
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 }: {
122
126
  open: boolean;
123
127
  autoFocus?: boolean;
124
128
  anchor: ReactNode;
@@ -137,6 +141,7 @@ export declare function Menu({ open, anchor, items, children, selectedId, select
137
141
  compact?: boolean;
138
142
  selection?: 'check' | 'fill';
139
143
  getAnchorRect?: () => DOMRect | null;
144
+ minWidthFromAnchor?: boolean;
140
145
  className?: string | undefined;
141
146
  listClassName?: string | undefined;
142
147
  }): import("react").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /** Anchor-preserving tooltips; an optional body portal escapes clipping containers and stacking contexts that cap the bubble's z-index. */
2
2
  import type { FocusEventHandler, MouseEventHandler, ReactElement, Ref } from 'react';
3
- /** Bubble placement relative to the anchor. */
4
- export type TooltipSide = 'right' | 'bottom' | 'top';
3
+ import { type TooltipSide } from './tooltip-placement.ts';
4
+ export type { TooltipSide } from './tooltip-placement.ts';
5
5
  /**
6
6
  * Suppression channel for nested tooltips: a visible descendant tooltip
7
7
  * withdraws the enclosing tooltip while its bubble is shown.
@@ -22,28 +22,29 @@ type TooltipLabel = string | (() => string);
22
22
  * Attach a hover/focus tooltip to an anchor element.
23
23
  * @param props.label - bubble text, or a resolver evaluated only while visible; an empty string shows only shortcut keys.
24
24
  * @param props.shortcutKeys - effective key labels rendered as platform-formatted keycaps after optional text.
25
- * @param props.side - placement relative to the anchor (default 'right').
25
+ * @param props.side - preferred placement (default 'right'); fitting tries the opposite then perpendicular sides.
26
26
  * @param props.align - horizontal anchor-edge alignment for 'bottom'/'top' bubbles: 'end' pins
27
27
  * the bubble's right edge to the anchor's (for anchors beside other hover surfaces the centered
28
- * bubble would overlap); default 'center'. Ignored for side 'right'.
28
+ * bubble would overlap); default 'center'. Horizontal placements ignore it.
29
29
  * @param props.portal - render the bubble under document.body, so an ancestor's clipping or its
30
30
  * stacking context (which confines the bubble's z-index to that context) cannot hide it.
31
31
  * @param props.delayMs - hover delay in milliseconds (default 0).
32
32
  * @param props.focusDelayMs - keyboard focus delay in milliseconds (default 0); blur, click,
33
33
  * mouse leave, disabling, and unmount cancel a pending show.
34
34
  * @param props.gap - anchor-to-bubble distance in pixels for 'bottom'/'top' bubbles (default 8);
35
- * ignored for side 'right'.
35
+ * horizontal placements use 10px, including after a flip.
36
36
  * @param props.disabled - suppress the bubble while true; the anchor renders identically so
37
37
  * toggling never remounts it (which would cut its CSS transitions).
38
38
  * @param props.maxWidth - bubble width cap in pixels, for labels long enough that the default
39
- * half-viewport cap would render a slab wider than the surface the anchor sits on.
39
+ * half-viewport cap would render a slab wider than the surface the anchor sits on; always bounded by viewport margins.
40
40
  * @param props.openOnClick - clicking also pins the bubble for reading; another click, Escape,
41
41
  * Tab, or an outside pointerdown dismisses it. Defaults to false for ordinary action tooltips.
42
42
  * @param props.children - a single anchor element; its own ref (callback or object) is forwarded alongside the tooltip's.
43
43
  * @returns the cloned anchor plus a fixed-position bubble, optionally portaled to the body.
44
44
  * The bubble stays hidden until ResizeObserver supplies its size for viewport fitting; clicking the
45
45
  * 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.
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.
47
48
  */
48
49
  export declare function Tooltip({ label, shortcutKeys, side, align, delayMs, focusDelayMs, gap, disabled, portal, maxWidth, openOnClick, children }: {
49
50
  label: TooltipLabel;
@@ -59,5 +60,4 @@ export declare function Tooltip({ label, shortcutKeys, side, align, delayMs, foc
59
60
  openOnClick?: boolean;
60
61
  children: ReactElement<AnchorProps>;
61
62
  }): import("react").JSX.Element;
62
- export {};
63
63
  //# sourceMappingURL=Tooltip.d.ts.map
@@ -382,4 +382,12 @@ export declare const IconSlidersTwoOutlineMedium: (props: IconProps) => import("
382
382
  export declare const IconMicrophoneOutlineRegular: (props: IconProps) => import("react").JSX.Element;
383
383
  /** Microphone with uniform 1.3px strokes. */
384
384
  export declare const IconMicrophoneOutlineMedium: (props: IconProps) => import("react").JSX.Element;
385
+ /** `compact` moves the tiles 0.5px inward, for glyphs drawn at card size. */
386
+ type AppsAddIconProps = IconProps & {
387
+ readonly compact?: boolean | undefined;
388
+ };
389
+ /** Three entry tiles and an add mark with one-pixel strokes. */
390
+ export declare const IconAppsAddOutlineRegular: (props: AppsAddIconProps) => import("react").JSX.Element;
391
+ /** Three entry tiles and an add mark with 1.3px strokes. */
392
+ export declare const IconAppsAddOutlineMedium: (props: AppsAddIconProps) => import("react").JSX.Element;
385
393
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,35 @@
1
+ /** Deterministic tooltip placement using measured border boxes and viewport coordinates. */
2
+ /** Bubble placement relative to the anchor. */
3
+ export type TooltipSide = 'right' | 'left' | 'bottom' | 'top';
4
+ interface PlacementInput {
5
+ anchor: {
6
+ left: number;
7
+ right: number;
8
+ top: number;
9
+ bottom: number;
10
+ };
11
+ width: number;
12
+ height: number;
13
+ viewportWidth: number;
14
+ viewportHeight: number;
15
+ side: TooltipSide;
16
+ align: 'center' | 'end';
17
+ gap: number;
18
+ }
19
+ interface TooltipPlacement {
20
+ left: number;
21
+ top: number;
22
+ width: number;
23
+ height: number;
24
+ side: TooltipSide;
25
+ /** No complete side fits, so placement is bounded by the viewport instead. */
26
+ overflow: boolean;
27
+ }
28
+ /**
29
+ * Prefer the requested side, its opposite, then perpendicular sides without covering the anchor.
30
+ * @param input - Observed dimensions, anchor edges, viewport and requested placement; horizontal gaps remain 10px.
31
+ * @returns Border-box coordinates and the selected side; if no side fits, a viewport-bounded fallback.
32
+ */
33
+ export declare function placeTooltip(input: PlacementInput): TooltipPlacement;
34
+ export {};
35
+ //# sourceMappingURL=tooltip-placement.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-ui-primitives",
3
3
  "description": "Pure React atoms for the dsh web UI: controls, icons, markdown, and JSON inspectors (zero cordis)",
4
- "version": "0.2.1-rc.1",
4
+ "version": "0.2.1-rc.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@deepseek-ai/dsh-client-store": "0.2.1-rc.1",
26
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.3",
27
27
  "@deepseek-ai/cordis": "~4.0.5",
28
- "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.1",
28
+ "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.3",
29
29
  "react": "^18.2.0",
30
30
  "clsx": "^2.0.0",
31
31
  "diff": "^9.0.0",
@@ -38,7 +38,7 @@
38
38
  "micromark-util-symbol": "^2.0.1",
39
39
  "micromark-util-types": "^2.0.2",
40
40
  "shiki": "^4.4.3",
41
- "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.1",
41
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.3",
42
42
  "@shikijs/langs": "^4.4.3",
43
43
  "@types/mdast": "^4.0.4",
44
44
  "micromark-factory-space": "^2.0.1",