@sparkelf/dsh-plus 0.2.9-alpha.59 → 0.2.9-alpha.61
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
diff --git a/apps/web/tests/access-confirmation.e2e.ts b/apps/web/tests/access-confirmation.e2e.ts
|
|
2
|
-
index
|
|
2
|
+
index f97978d3..edab518b 100644
|
|
3
3
|
--- a/apps/web/tests/access-confirmation.e2e.ts
|
|
4
4
|
+++ b/apps/web/tests/access-confirmation.e2e.ts
|
|
5
5
|
@@ -151,6 +151,12 @@ describe('web e2e: experimental Auto and Full access confirmation', () => {
|
|
@@ -16,10 +16,10 @@ index f97978d346..edab518be0 100644
|
|
|
16
16
|
const dialog = page.getByRole('dialog', { name: '确认启用完全权限?' })
|
|
17
17
|
await dialog.waitFor({ timeout: 10_000 })
|
|
18
18
|
diff --git a/apps/web/tests/default-model.e2e.ts b/apps/web/tests/default-model.e2e.ts
|
|
19
|
-
index
|
|
19
|
+
index 03a22e3c..d9cd04b8 100644
|
|
20
20
|
--- a/apps/web/tests/default-model.e2e.ts
|
|
21
21
|
+++ b/apps/web/tests/default-model.e2e.ts
|
|
22
|
-
@@ -
|
|
22
|
+
@@ -481,6 +481,13 @@ describe('web e2e: the composer model switch is the default for later sessions',
|
|
23
23
|
await trigger.waitFor({ timeout: 15_000 })
|
|
24
24
|
expect(await trigger.evaluate(element => getComputedStyle(element).fontWeight)).toBe('400')
|
|
25
25
|
await trigger.click()
|
|
@@ -34,10 +34,10 @@ index 9625333287..c71f8c02de 100644
|
|
|
34
34
|
const composerBounds = await page.locator('[data-composer-card]').first().boundingBox()
|
|
35
35
|
expect(modelMenuBounds!.width).toBeLessThan(composerBounds!.width)
|
|
36
36
|
diff --git a/packages/client/ui-layout/README.md b/packages/client/ui-layout/README.md
|
|
37
|
-
index
|
|
37
|
+
index 8a204762..b91e932d 100644
|
|
38
38
|
--- a/packages/client/ui-layout/README.md
|
|
39
39
|
+++ b/packages/client/ui-layout/README.md
|
|
40
|
-
@@ -
|
|
40
|
+
@@ -62,7 +62,7 @@ The root registration supplies folded-landscape posture through an injected obse
|
|
41
41
|
|
|
42
42
|
`selectPanel(id)` checks the live `main` registry before changing selection; an absent key throws and leaves the current panel intact. `beginNavigation()` returns an abort signal for an asynchronous UI navigation. A later call, a valid panel selection (including repeated selection), or layout disposal aborts that signal without cancelling underlying Session creation. Consumers check the signal before committing navigation or moving drafts.
|
|
43
43
|
|
|
@@ -47,291 +47,86 @@ index 43c61b89d1..8fa5117005 100644
|
|
|
47
47
|
</details>
|
|
48
48
|
|
|
49
49
|
diff --git a/packages/client/ui-layout/src/client/AppFrame.tsx b/packages/client/ui-layout/src/client/AppFrame.tsx
|
|
50
|
-
index
|
|
50
|
+
index 23e71c9c..50e1d3a9 100644
|
|
51
51
|
--- a/packages/client/ui-layout/src/client/AppFrame.tsx
|
|
52
52
|
+++ b/packages/client/ui-layout/src/client/AppFrame.tsx
|
|
53
|
-
@@ -
|
|
53
|
+
@@ -39,7 +39,7 @@ export type AppFrameProps =
|
|
54
54
|
|
|
55
55
|
/** Center column grid item (session-body building block). */
|
|
56
|
-
function CenterColumn(props: { children?: ReactNode }) {
|
|
57
|
-
- return <div className={css.centerCol}>{props.children}</div>
|
|
58
|
-
+ return <div className={css.centerCol} data-dsh-center-col>{props.children}</div>
|
|
56
|
+
function CenterColumn(props: { children?: ReactNode; inert: boolean }) {
|
|
57
|
+
- return <div className={css.centerCol} {...{ inert: props.inert ? '' : undefined }}>{props.children}</div>
|
|
58
|
+
+ return <div className={css.centerCol} data-dsh-center-col {...{ inert: props.inert ? '' : undefined }}>{props.children}</div>
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/** Subscribe to the main key without subscribing the column frame to each panel id. */
|
|
62
|
-
diff --git a/packages/client/ui-model-selection/src/client/ModelSelect.module.css b/packages/client/ui-model-selection/src/client/ModelSelect.module.css
|
|
63
|
-
index c36809acaa..21fb6c73b8 100644
|
|
64
|
-
--- a/packages/client/ui-model-selection/src/client/ModelSelect.module.css
|
|
65
|
-
+++ b/packages/client/ui-model-selection/src/client/ModelSelect.module.css
|
|
66
|
-
@@ -97,7 +97,9 @@
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
/* Let the visible pane's rows set the card width, but keep pathological ids
|
|
70
|
-
- and narrow screens inside a bounded card where ellipsis remains. */
|
|
71
|
-
+ and narrow screens inside a bounded card where ellipsis remains. The card's
|
|
72
|
-
+ own pad is part of that bound, as it is on the Menu primitive's surface. */
|
|
73
|
-
+ box-sizing: border-box;
|
|
74
|
-
width: max-content;
|
|
75
|
-
min-width: min(240px, calc(100vw - 32px));
|
|
76
|
-
max-width: min(420px, calc(100vw - 32px));
|
|
77
62
|
diff --git a/packages/client/ui-model-selection/src/client/ModelSelect.tsx b/packages/client/ui-model-selection/src/client/ModelSelect.tsx
|
|
78
|
-
index
|
|
63
|
+
index ecc984ca..ab32c21e 100644
|
|
79
64
|
--- a/packages/client/ui-model-selection/src/client/ModelSelect.tsx
|
|
80
65
|
+++ b/packages/client/ui-model-selection/src/client/ModelSelect.tsx
|
|
81
|
-
@@ -
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
+
|
|
86
|
-
+
|
|
87
|
-
+
|
|
88
|
-
+
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (lh > 0) y = Math.min(Math.max(y, MARGIN), window.innerHeight - lh - MARGIN)
|
|
100
|
-
- setMenuPos({ left: x, top: y })
|
|
101
|
-
+ // A bounded card takes the owner's width: the same 12px inset on both
|
|
102
|
-
+ // sides, never wider than the room between them.
|
|
103
|
-
+ const bounds = boundary === undefined
|
|
104
|
-
+ ? {}
|
|
105
|
-
+ : { minWidth: Math.min(264, availableWidth), maxWidth: availableWidth }
|
|
106
|
-
+ setMenuPos({ left: x, top: y, ...bounds })
|
|
107
|
-
}
|
|
108
|
-
place()
|
|
109
|
-
window.addEventListener('scroll', place, true)
|
|
110
|
-
diff --git a/packages/client/ui-model-selection/tests/model-select.client.spec.tsx b/packages/client/ui-model-selection/tests/model-select.client.spec.tsx
|
|
111
|
-
index dbb5b247db..584e1f0366 100644
|
|
112
|
-
--- a/packages/client/ui-model-selection/tests/model-select.client.spec.tsx
|
|
113
|
-
+++ b/packages/client/ui-model-selection/tests/model-select.client.spec.tsx
|
|
114
|
-
@@ -454,14 +454,19 @@ describe('ModelSelect reasoning effort', () => {
|
|
115
|
-
Object.defineProperty(HTMLElement.prototype, 'offsetWidth', { configurable: true, get: () => 200 })
|
|
116
|
-
Object.defineProperty(HTMLElement.prototype, 'offsetHeight', { configurable: true, get: () => 300 })
|
|
117
|
-
try {
|
|
118
|
-
- const { container } = render(<ModelSelect renderSlot={renderLabel}
|
|
119
|
-
+ const { container } = render(<div data-dsh-center-col><ModelSelect renderSlot={renderLabel}
|
|
120
|
-
locked={false}
|
|
121
|
-
available
|
|
122
|
-
directory={createSnapshotStore(state())}
|
|
123
|
-
load={vi.fn()} resolveText={resolveText}
|
|
124
|
-
select={vi.fn().mockResolvedValue({ ok: true, value: undefined })}
|
|
125
|
-
t={t}
|
|
126
|
-
- />)
|
|
127
|
-
+ /></div>)
|
|
128
|
-
+ // The composer card's own rect is a zero rect in jsdom; the column's is not.
|
|
129
|
-
+ Object.defineProperty(container.firstElementChild, 'getBoundingClientRect', {
|
|
130
|
-
+ configurable: true,
|
|
131
|
-
+ value: () => ({ left: 280, right: 520, top: 0, bottom: 700, width: 240, height: 700, x: 280, y: 0, toJSON: () => ({}) }),
|
|
132
|
-
+ })
|
|
133
|
-
const trigger = screen.getByRole('button', { name: /选择模型/ })
|
|
134
|
-
fireEvent.click(trigger)
|
|
135
|
-
const menu = screen.getByRole('menu')
|
|
136
|
-
@@ -469,8 +474,9 @@ describe('ModelSelect reasoning effort', () => {
|
|
137
|
-
expect(container.contains(menu)).toBe(false)
|
|
138
|
-
expect(menu.parentElement).toBe(document.body)
|
|
139
|
-
// jsdom anchor rects are all zero, so the measured 200x300 card clamps
|
|
140
|
-
- // to the 12px viewport margin on both axes.
|
|
141
|
-
- expect(menu.style.left).toBe('12px')
|
|
142
|
-
+ // to the centre column's 12px inset horizontally and the viewport's on
|
|
143
|
-
+ // the vertical axis.
|
|
144
|
-
+ expect(menu.style.left).toBe('292px')
|
|
145
|
-
expect(menu.style.top).toBe('12px')
|
|
146
|
-
// Interactions inside the trigger subtree or the portaled card stay open.
|
|
147
|
-
expect(fireEvent.mouseDown(menu)).toBe(true)
|
|
148
|
-
diff --git a/packages/client/ui-permission-presets/src/client/PermissionSelect.tsx b/packages/client/ui-permission-presets/src/client/PermissionSelect.tsx
|
|
149
|
-
index 0281c41a24..f44f20a8fc 100644
|
|
150
|
-
--- a/packages/client/ui-permission-presets/src/client/PermissionSelect.tsx
|
|
151
|
-
+++ b/packages/client/ui-permission-presets/src/client/PermissionSelect.tsx
|
|
152
|
-
@@ -1,4 +1,4 @@
|
|
153
|
-
-import { useEffect, useState } from 'react'
|
|
154
|
-
+import { useEffect, useRef, useState } from 'react'
|
|
155
|
-
import type { ReactNode } from 'react'
|
|
156
|
-
import clsx from 'clsx'
|
|
157
|
-
import {
|
|
158
|
-
@@ -81,6 +81,8 @@ export function PermissionSelect({
|
|
159
|
-
const catalog = usePermissionCatalog(state => state.value)
|
|
160
|
-
const [pick, setPick] = useState<string | null>(null)
|
|
161
|
-
const [open, setOpen] = useState(false)
|
|
162
|
-
+ /** The center column this trigger sits in; the portaled menu clamps to it. */
|
|
163
|
-
+ const boundaryRef = useRef<HTMLElement | null>(null)
|
|
164
|
-
const [confirmation, setConfirmation] = useState<string | null>(null)
|
|
165
|
-
const [acknowledged, setAcknowledged] = useState(false)
|
|
166
|
-
|
|
167
|
-
@@ -171,8 +173,12 @@ export function PermissionSelect({
|
|
168
|
-
onClose={() => { setOpen(false) }}
|
|
169
|
-
side="top"
|
|
170
|
-
portal
|
|
171
|
-
+ boundaryRef={boundaryRef}
|
|
172
|
-
anchor={
|
|
173
|
-
<button
|
|
174
|
-
+ ref={(node) => {
|
|
175
|
-
+ boundaryRef.current = node?.closest<HTMLElement>('[data-dsh-center-col]') ?? null
|
|
176
|
-
+ }}
|
|
177
|
-
type="button"
|
|
178
|
-
className={css.trigger}
|
|
179
|
-
aria-label={t('mode', { name: currentLabel })}
|
|
180
|
-
diff --git a/packages/client/ui-primitives/README.md b/packages/client/ui-primitives/README.md
|
|
181
|
-
index d95d802886..bb1d53df18 100644
|
|
182
|
-
--- a/packages/client/ui-primitives/README.md
|
|
183
|
-
+++ b/packages/client/ui-primitives/README.md
|
|
184
|
-
@@ -49,7 +49,7 @@ Check this table before writing a control in a feature package. A plugin cannot
|
|
185
|
-
| `Input` | Single-line text entry for search boxes and inline forms. Its ref targets the native input for focus and is cleared on unmount. |
|
|
186
|
-
| `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. |
|
|
187
|
-
| `ZoomControls`, `DOCUMENT_ZOOM` | Floating document zoom controls with localized labels, fixed presets, and visibility/activity callbacks. An omitted `fit` hides the fitting row. The toolbar carries `data-document-zoom-controls`, plus `data-document-zoom-visible` while visible. An owner `className` overrides `bottom` and `max-width` regardless of stylesheet order; `inset-inline-start` and `transform` center the toolbar and move it on enter and exit, `opacity` fades it, and all three stay with the primitive. Renderers share the published scale limits. |
|
|
188
|
-
-| `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. |
|
|
189
|
-
+| `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. A portaled list may intersect viewport clamping with an owner boundary. |
|
|
190
|
-
| `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. |
|
|
191
|
-
| `Pill` | Selectable capsule button for view switchers and filters; takes `active` and `onClick`. |
|
|
192
|
-
| `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. Default `size="md"` is 42px tall with a 4px inset; `size="sm"` is 34px tall with a 2px inset. |
|
|
193
|
-
diff --git a/packages/client/ui-primitives/README.zh.md b/packages/client/ui-primitives/README.zh.md
|
|
194
|
-
index 115e1defe5..9972ffe785 100644
|
|
195
|
-
--- a/packages/client/ui-primitives/README.zh.md
|
|
196
|
-
+++ b/packages/client/ui-primitives/README.zh.md
|
|
197
|
-
@@ -25,7 +25,7 @@ kind: "package-library"
|
|
198
|
-
<a id="use-this-package"></a>
|
|
199
|
-
## 使用本包
|
|
200
|
-
|
|
201
|
-
-`Toast` 在浅色和深色模式下均使用主题的系统提示背景与文字颜色。`Menu` 数据条目与 `MenuItemButton` 组件条目接收功能 owner 提供的有效快捷键,并在末端以无背景的浅灰色文字对齐显示,子菜单也采用同一呈现。主指针为粗指针(`pointer: coarse`)且未使用[键盘导航](#input-modality)时,菜单隐藏这些提示。键盘导航会显示提示,直到下一次指针按下;快捷键绑定始终生效。`ShortcutKeys` 默认以无方块的按键文字显示菜单和行内提示。`tooltip` 变体在深色气泡上使用稍浅的键帽,以加号连接的组合则共用一个填充色块。`Tooltip.shortcutKeys` 将键帽与可选的本地化操作文本垂直居中排列,标签为空时只显示按键。可选的 `className` 供调用方设置交互状态样式。`Modal` 使用框架共享的浮层起点,视口边距至少为 24px。其遮罩不绘制 Windows 顶栏区域,覆盖整个视口的模态层仍阻挡背景点击。`Modal` 与设置外壳通过 `useModalLayer` 共用顶层 Esc 和 Tab 处理,关闭时恢复先前焦点。`closeTopModal(document)` 请求前台弹窗当前的关闭操作;上层菜单或未注册的对话框会阻止关闭其后方弹窗。组件通过 `isBehindModal` 避免将焦点移到嵌套弹窗后方。菜单先消费自己的 Esc,再由模态层处理关闭。 `observeComposition` 为局部弹层和录键处理提供相同的 composition-end 与旧版 IME 保护;调用方随交互生命周期释放其 document 监听。
|
|
202
|
-
+`Toast` 在浅色和深色模式下均使用主题的系统提示背景与文字颜色。`Menu` 数据条目与 `MenuItemButton` 组件条目接收功能 owner 提供的有效快捷键,并在末端以无背景的浅灰色文字对齐显示,子菜单也采用同一呈现。主指针为粗指针(`pointer: coarse`)且未使用[键盘导航](#input-modality)时,菜单隐藏这些提示。键盘导航会显示提示,直到下一次指针按下;快捷键绑定始终生效。`ShortcutKeys` 默认以无方块的按键文字显示菜单和行内提示。`tooltip` 变体在深色气泡上使用稍浅的键帽,以加号连接的组合则共用一个填充色块。`Tooltip.shortcutKeys` 将键帽与可选的本地化操作文本垂直居中排列,标签为空时只显示按键。可选的 `className` 供调用方设置交互状态样式。`Modal` 使用框架共享的浮层起点,视口边距至少为 24px。其遮罩不绘制 Windows 顶栏区域,覆盖整个视口的模态层仍阻挡背景点击。`Modal` 与设置外壳通过 `useModalLayer` 共用顶层 Esc 和 Tab 处理,关闭时恢复先前焦点。`closeTopModal(document)` 请求前台弹窗当前的关闭操作;上层菜单或未注册的对话框会阻止关闭其后方弹窗。组件通过 `isBehindModal` 避免将焦点移到嵌套弹窗后方。菜单先消费自己的 Esc,再由模态层处理关闭。 portal 模式的列表可把视口钳制与 owner boundary 取交集。 `observeComposition` 为局部弹层和录键处理提供相同的 composition-end 与旧版 IME 保护;调用方随交互生命周期释放其 document 监听。
|
|
203
|
-
|
|
204
|
-
`isMobileDevice()` 识别 iOS 和 Android 手机及平板,供自动聚焦和收起键盘使用。它识别 UA 中的 `Android`、`iPhone`、`iPad` 或 `iPod`,以及报告 `MacIntel` 且触摸点数大于一的 iPad。其他设备(包括 Windows 触屏电脑)返回 false,不受窗口宽度影响。函数缓存首次判断结果,供页面内的所有调用方共享;组件重新挂载会复用该结果,重新加载页面时会再次读取浏览器环境。识别出的移动设备需要用户主动聚焦文本输入框。隐藏移动平台信息的浏览器模式或自定义 UA 可能导致识别失败;未识别的 UA 返回 false。仅凭桌面 UA 无法区分 Android 平板与 Linux 电脑。
|
|
205
|
-
|
|
206
|
-
diff --git a/packages/client/ui-primitives/src/Menu.tsx b/packages/client/ui-primitives/src/Menu.tsx
|
|
207
|
-
index 68b3a5766e..e25866591a 100644
|
|
208
|
-
--- a/packages/client/ui-primitives/src/Menu.tsx
|
|
209
|
-
+++ b/packages/client/ui-primitives/src/Menu.tsx
|
|
210
|
-
@@ -1,5 +1,5 @@
|
|
211
|
-
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|
212
|
-
-import type { CSSProperties, ReactNode, SyntheticEvent } from 'react'
|
|
213
|
-
+import type { CSSProperties, ReactNode, RefObject, SyntheticEvent } from 'react'
|
|
214
|
-
import { createPortal } from 'react-dom'
|
|
215
|
-
import clsx from 'clsx'
|
|
216
|
-
import { IconCheckOutlineRegular } from './icons/index.tsx'
|
|
217
|
-
@@ -154,6 +154,10 @@ const MEASURE_STYLE: CSSProperties = { visibility: 'hidden', left: 0, top: 0 }
|
|
218
|
-
* wrapper there races the host's layout effects). Called on open, each animation
|
|
219
|
-
* frame, and scroll/resize; return null to skip placement for that frame.
|
|
220
|
-
* @param props.minWidthFromAnchor - in portal mode, keep the menu at least as wide as its anchor, bounded by viewport margins.
|
|
221
|
-
+ * @param props.boundaryRef - portal mode only: intersect horizontal placement
|
|
222
|
-
+ * with this owner element's rect as well as the viewport, so a menu owned by a
|
|
223
|
-
+ * column stays inside that column when a sidebar or panel leaves a narrow
|
|
224
|
-
+ * center.
|
|
225
|
-
* @param props.footer - rows pinned below the scrolling items area, separated
|
|
226
|
-
* by a hairline; they stay visible while the items above scroll.
|
|
227
|
-
* @param props.children - component rows rendered after `items` in the same
|
|
228
|
-
@@ -170,7 +174,7 @@ const MEASURE_STYLE: CSSProperties = { visibility: 'hidden', left: 0, top: 0 }
|
|
229
|
-
* document.body outside the owner's DOM subtree.
|
|
230
|
-
* @returns anchor wrapper with the conditional list.
|
|
231
|
-
*/
|
|
232
|
-
-export 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 }: {
|
|
233
|
-
+export 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, boundaryRef, footer, className, listClassName }: {
|
|
234
|
-
open: boolean
|
|
235
|
-
autoFocus?: boolean
|
|
236
|
-
anchor: ReactNode
|
|
237
|
-
@@ -190,6 +194,7 @@ export function Menu({ open, anchor, items = [], children, selectedId, selectedI
|
|
238
|
-
selection?: 'check' | 'fill'
|
|
239
|
-
getAnchorRect?: () => DOMRect | null
|
|
66
|
+
@@ -98,6 +98,10 @@ export function ModelSelect(
|
|
67
|
+
gap: 8,
|
|
68
|
+
margin: 12,
|
|
69
|
+
layoutKey: pane,
|
|
70
|
+
+ // The composer's center column, when this trigger sits in one, is narrower than the viewport;
|
|
71
|
+
+ // without it the card could spill under the neighbouring panes.
|
|
72
|
+
+ boundary: () => triggerRef.current?.closest<HTMLElement>('[data-dsh-center-col]')
|
|
73
|
+
+ ?.getBoundingClientRect() ?? null,
|
|
74
|
+
})
|
|
75
|
+
const itemRefs = useRef<(HTMLButtonElement | null)[]>([])
|
|
76
|
+
const id = useId()
|
|
77
|
+
diff --git a/packages/client/ui-primitives/src/useAnchoredPosition.ts b/packages/client/ui-primitives/src/useAnchoredPosition.ts
|
|
78
|
+
index 61a891e5..617bb643 100644
|
|
79
|
+
--- a/packages/client/ui-primitives/src/useAnchoredPosition.ts
|
|
80
|
+
+++ b/packages/client/ui-primitives/src/useAnchoredPosition.ts
|
|
81
|
+
@@ -26,6 +26,15 @@ export interface AnchoredPositionOptions {
|
|
82
|
+
layoutKey?: string | number
|
|
83
|
+
/** Minimum panel width follows the anchor, bounded by the visible viewport. */
|
|
240
84
|
minWidthFromAnchor?: boolean
|
|
241
|
-
+
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
+
|
|
250
|
-
|
|
251
|
-
+ const boundary = boundaryRef?.current?.getBoundingClientRect()
|
|
252
|
-
+ const minX = Math.max(MARGIN, (boundary?.left ?? 0) + MARGIN)
|
|
253
|
-
+ const maxX = Math.min(vw - MARGIN, (boundary?.right ?? vw) - MARGIN)
|
|
254
|
-
+ const availableWidth = Math.max(0, maxX - minX)
|
|
255
|
-
const listEl = listRef.current
|
|
256
|
-
if (listEl !== null) {
|
|
257
|
-
const minimum = minWidthFromAnchor ? `${Math.min(r.width, Math.max(0, vw - MARGIN * 2))}px` : ''
|
|
258
|
-
if (listEl.style.minWidth !== minimum) listEl.style.minWidth = minimum
|
|
259
|
-
}
|
|
260
|
-
const lw = listEl?.offsetWidth ?? 0
|
|
261
|
-
+ const placedWidth = boundary === undefined ? lw : Math.min(lw, availableWidth)
|
|
262
|
-
const lh = listEl?.offsetHeight ?? 0
|
|
85
|
+
+ /**
|
|
86
|
+
+ * Region the panel must stay inside, in viewport coordinates.
|
|
87
|
+
+ *
|
|
88
|
+
+ * A panel portaled to the body is constrained by the visible viewport by default, which is
|
|
89
|
+
+ * wider than the column an anchored control may live in (the composer's center column, for
|
|
90
|
+
+ * one). Supplying the region narrows both the size limits and the horizontal clamp, so the
|
|
91
|
+
+ * panel cannot spill outside the column it belongs to. Absent keeps the viewport behaviour.
|
|
92
|
+
+ */
|
|
93
|
+
+ boundary?: () => DOMRect | null
|
|
94
|
+
}
|
|
263
95
|
|
|
264
|
-
|
|
265
|
-
@@ -
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
-
|
|
270
|
-
+
|
|
271
|
-
|
|
96
|
+
/**
|
|
97
|
+
@@ -37,7 +46,7 @@ export interface AnchoredPositionOptions {
|
|
98
|
+
*/
|
|
99
|
+
export function useAnchoredPosition(options: AnchoredPositionOptions): CSSProperties | null {
|
|
100
|
+
const { open, anchorRef, panelRef, side = 'bottom', align = 'start', gap, margin,
|
|
101
|
+
- getAnchorRect, layoutKey, minWidthFromAnchor = false, frameClearance = true } = options
|
|
102
|
+
+ getAnchorRect, layoutKey, minWidthFromAnchor = false, frameClearance = true, boundary } = options
|
|
103
|
+
const [position, setPosition] = useState<CSSProperties | null>(null)
|
|
104
|
+
useLayoutEffect(() => {
|
|
105
|
+
if (!open) {
|
|
106
|
+
@@ -66,7 +75,9 @@ export function useAnchoredPosition(options: AnchoredPositionOptions): CSSProper
|
|
107
|
+
const width = viewport?.width ?? (anchor.ownerDocument.documentElement.clientWidth || win.innerWidth)
|
|
108
|
+
const height = viewport?.height ?? (anchor.ownerDocument.documentElement.clientHeight || win.innerHeight)
|
|
109
|
+
const topMargin = frameClearance ? overlayTopMargin(margin, rect, gap) : margin
|
|
110
|
+
- const maxWidth = Math.max(0, width - margin * 2)
|
|
111
|
+
+ const region = boundary?.() ?? null
|
|
112
|
+
+ const maxWidth = Math.max(0, Math.min(width - margin * 2,
|
|
113
|
+
+ region === null ? Number.POSITIVE_INFINITY : region.width - margin * 2))
|
|
114
|
+
panel.style.setProperty('--dsh-anchored-max-width', `${maxWidth}px`)
|
|
115
|
+
panel.style.setProperty('--dsh-anchored-max-height', `${Math.max(0, height - topMargin - margin)}px`)
|
|
116
|
+
if (minWidthFromAnchor) panel.style.minWidth = `${Math.min(rect.width, maxWidth)}px`
|
|
117
|
+
@@ -76,8 +87,14 @@ export function useAnchoredPosition(options: AnchoredPositionOptions): CSSProper
|
|
118
|
+
const offsetY = visualOrigin ? y : 0
|
|
119
|
+
const left = offsetX + (side === 'right' ? rect.right + gap : align === 'end' ? rect.right - panelWidth : rect.left)
|
|
120
|
+
const top = offsetY + (side === 'right' ? rect.top : side === 'top' ? rect.top - gap - panelHeight : rect.bottom + gap)
|
|
121
|
+
+ // The region narrows the horizontal clamp the same way it narrows the size limit:
|
|
122
|
+
+ // an anchored panel inside a column must not slide under its neighbours.
|
|
123
|
+
+ const minLeft = region === null ? x + margin : Math.max(x + margin, region.left + margin)
|
|
124
|
+
+ const maxLeft = region === null
|
|
125
|
+
+ ? x + width - margin - panelWidth
|
|
126
|
+
+ : Math.min(x + width - margin - panelWidth, region.right - margin - panelWidth)
|
|
127
|
+
next = {
|
|
128
|
+
- left: Math.max(x + margin, Math.min(left, x + width - margin - panelWidth)),
|
|
129
|
+
+ left: Math.max(minLeft, Math.min(left, maxLeft)),
|
|
130
|
+
top: Math.max(y + topMargin, Math.min(top, y + height - margin - panelHeight)),
|
|
131
|
+
}
|
|
272
132
|
}
|
|
273
|
-
|
|
274
|
-
- if (lw > 0) x = Math.min(Math.max(x, MARGIN), vw - lw - MARGIN)
|
|
275
|
-
+ if (lw > 0) x = Math.min(Math.max(x, minX), maxX - placedWidth)
|
|
276
|
-
if (lh > 0) y = Math.min(Math.max(y, overlayTopMargin(MARGIN, r, GAP)), vh - lh - MARGIN)
|
|
277
|
-
|
|
278
|
-
- setFixedPos(current => current?.left === x && current.top === y ? current : { left: x, top: y })
|
|
279
|
-
+ // A bounded card takes the owner's width: the same 12px inset on both
|
|
280
|
-
+ // sides, never wider than the room between them.
|
|
281
|
-
+ const bounds = boundary === undefined
|
|
282
|
-
+ ? {}
|
|
283
|
-
+ : { minWidth: Math.min(218, availableWidth), maxWidth: availableWidth }
|
|
284
|
-
+ setFixedPos(current => current?.left === x && current.top === y
|
|
285
|
-
+ && current.minWidth === bounds.minWidth && current.maxWidth === bounds.maxWidth
|
|
286
|
-
+ ? current
|
|
287
|
-
+ : { left: x, top: y, ...bounds })
|
|
288
|
-
}
|
|
289
|
-
// First run measures the hidden pre-render (same commit as `open`), so
|
|
290
|
-
// end/top alignment and clamping use real dimensions before anything
|
|
291
|
-
@@ -305,7 +325,7 @@ export function Menu({ open, anchor, items = [], children, selectedId, selectedI
|
|
292
|
-
window.removeEventListener('scroll', place, true)
|
|
293
|
-
window.removeEventListener('resize', place)
|
|
294
|
-
}
|
|
295
|
-
- }, [open, portal, align, side, getAnchorRect, minWidthFromAnchor])
|
|
296
|
-
+ }, [open, portal, align, side, getAnchorRect, minWidthFromAnchor, boundaryRef])
|
|
297
|
-
|
|
298
|
-
// Opening remembers where the keyboard was, so closing can hand it back to
|
|
299
|
-
// that control — an anchor wrapping several (a split button) cannot be asked
|
|
300
|
-
diff --git a/packages/client/ui-primitives/tests/atoms.client.spec.tsx b/packages/client/ui-primitives/tests/atoms.client.spec.tsx
|
|
301
|
-
index 8b198e4365..592c56641d 100644
|
|
302
|
-
--- a/packages/client/ui-primitives/tests/atoms.client.spec.tsx
|
|
303
|
-
+++ b/packages/client/ui-primitives/tests/atoms.client.spec.tsx
|
|
304
|
-
@@ -596,6 +596,33 @@ describe('Menu', () => {
|
|
305
|
-
expect(menu.style.top).toBe('132px')
|
|
306
|
-
})
|
|
307
|
-
|
|
308
|
-
+ it('portal mode intersects viewport clamping with an owner boundary', () => {
|
|
309
|
-
+ const offsetWidth = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'offsetWidth')!
|
|
310
|
-
+ Object.defineProperty(HTMLElement.prototype, 'offsetWidth', { configurable: true, get: () => 300 })
|
|
311
|
-
+ const anchor = { left: 480, right: 500, top: 100, bottom: 128, width: 20, height: 28, x: 480, y: 100, toJSON: () => ({}) } as DOMRect
|
|
312
|
-
+ const boundary = { left: 280, right: 520, top: 0, bottom: 700, width: 240, height: 700, x: 280, y: 0, toJSON: () => ({}) } as DOMRect
|
|
313
|
-
+ try {
|
|
314
|
-
+ render(<Menu
|
|
315
|
-
+ portal
|
|
316
|
-
+ open
|
|
317
|
-
+ align="end"
|
|
318
|
-
+ getAnchorRect={() => anchor}
|
|
319
|
-
+ boundaryRef={{ current: { getBoundingClientRect: () => boundary } as HTMLElement }}
|
|
320
|
-
+ anchor={null}
|
|
321
|
-
+ items={items}
|
|
322
|
-
+ onSelect={() => {}}
|
|
323
|
-
+ onClose={() => {}}
|
|
324
|
-
+ />)
|
|
325
|
-
+ const menu = screen.getByRole('menu')
|
|
326
|
-
+ // The owner is 240px wide, so the 12px insets leave 216px for a 300px card.
|
|
327
|
-
+ expect(menu.style.left).toBe('292px')
|
|
328
|
-
+ expect(menu.style.minWidth).toBe('216px')
|
|
329
|
-
+ expect(menu.style.maxWidth).toBe('216px')
|
|
330
|
-
+ } finally {
|
|
331
|
-
+ Object.defineProperty(HTMLElement.prototype, 'offsetWidth', offsetWidth)
|
|
332
|
-
+ }
|
|
333
|
-
+ })
|
|
334
|
-
+
|
|
335
|
-
it('portal mode skips the frame when getAnchorRect returns null (no menu until a rect exists)', () => {
|
|
336
|
-
render(
|
|
337
|
-
<Menu
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
diff --git a/packages/client/ui-trajectory/src/client/TrajectoryToolbar.module.css b/packages/client/ui-trajectory/src/client/TrajectoryToolbar.module.css
|
|
2
|
-
index
|
|
2
|
+
index ca346565..98f68705 100644
|
|
3
3
|
--- a/packages/client/ui-trajectory/src/client/TrajectoryToolbar.module.css
|
|
4
4
|
+++ b/packages/client/ui-trajectory/src/client/TrajectoryToolbar.module.css
|
|
5
|
-
@@ -
|
|
5
|
+
@@ -178,13 +178,19 @@
|
|
6
6
|
font: 14px/14px var(--ds-font-family-code);
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -24,7 +24,7 @@ index 2bbc35663a..b2dde8dd3b 100644
|
|
|
24
24
|
gap: 4px;
|
|
25
25
|
border: 0.5px solid var(--dsw-alias-border-l4);
|
|
26
26
|
diff --git a/packages/client/ui-trajectory/src/client/TrajectoryToolbar.tsx b/packages/client/ui-trajectory/src/client/TrajectoryToolbar.tsx
|
|
27
|
-
index
|
|
27
|
+
index 98303805..3a1ad957 100644
|
|
28
28
|
--- a/packages/client/ui-trajectory/src/client/TrajectoryToolbar.tsx
|
|
29
29
|
+++ b/packages/client/ui-trajectory/src/client/TrajectoryToolbar.tsx
|
|
30
30
|
@@ -1,5 +1,6 @@
|
|
@@ -34,7 +34,7 @@ index c3861f03a9..a63ac8823b 100644
|
|
|
34
34
|
import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots'
|
|
35
35
|
import { IconSearchOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
36
36
|
import type { NS } from './locales.ts'
|
|
37
|
-
@@ -
|
|
37
|
+
@@ -30,6 +31,8 @@ export interface TrajectoryToolbarProps {
|
|
38
38
|
searchQuery: string
|
|
39
39
|
/** Update the live ledger search query. */
|
|
40
40
|
onSearchQueryChange: (query: string) => void
|
|
@@ -43,16 +43,16 @@ index c3861f03a9..a63ac8823b 100644
|
|
|
43
43
|
/** Translate a toolbar dictionary key. */
|
|
44
44
|
t: TranslateNS<typeof NS>
|
|
45
45
|
}
|
|
46
|
-
@@ -
|
|
47
|
-
|
|
46
|
+
@@ -52,6 +55,7 @@ export function TrajectoryToolbar({
|
|
47
|
+
onToggleAllSubCalls,
|
|
48
48
|
searchQuery,
|
|
49
49
|
onSearchQueryChange,
|
|
50
50
|
+ utilities,
|
|
51
51
|
t,
|
|
52
52
|
}: TrajectoryToolbarProps) {
|
|
53
53
|
return (
|
|
54
|
-
@@ -
|
|
55
|
-
{t('toolbar.
|
|
54
|
+
@@ -130,7 +134,8 @@ export function TrajectoryToolbar({
|
|
55
|
+
{t('toolbar.subCalls')}
|
|
56
56
|
</button>
|
|
57
57
|
</div>
|
|
58
58
|
- <div className={css.search}>
|
|
@@ -62,7 +62,7 @@ index c3861f03a9..a63ac8823b 100644
|
|
|
62
62
|
<input
|
|
63
63
|
type="search"
|
|
64
64
|
diff --git a/packages/client/ui-trajectory/src/client/TrajectoryView.tsx b/packages/client/ui-trajectory/src/client/TrajectoryView.tsx
|
|
65
|
-
index
|
|
65
|
+
index 3c70561d..e0095772 100644
|
|
66
66
|
--- a/packages/client/ui-trajectory/src/client/TrajectoryView.tsx
|
|
67
67
|
+++ b/packages/client/ui-trajectory/src/client/TrajectoryView.tsx
|
|
68
68
|
@@ -135,7 +135,9 @@ export function TrajectoryView({
|
|
@@ -76,8 +76,8 @@ index 6835939198..47db0ef561 100644
|
|
|
76
76
|
& InjectFace<TrajectoryViewInjected>
|
|
77
77
|
& PropsLocale<'trajectory'>) {
|
|
78
78
|
const [collapsedTurns, setCollapsedTurns] = useState<ReadonlySet<number>>(EMPTY_TURN_IDS)
|
|
79
|
-
@@ -
|
|
80
|
-
|
|
79
|
+
@@ -562,6 +564,7 @@ export function TrajectoryView({
|
|
80
|
+
onToggleAllSubCalls={toggleAllSubCalls}
|
|
81
81
|
searchQuery={searchQuery}
|
|
82
82
|
onSearchQueryChange={setSearchQuery}
|
|
83
83
|
+ utilities={renderSlot('conversation.trajectory.toolbar.utilities', {})}
|
|
@@ -85,7 +85,7 @@ index 6835939198..47db0ef561 100644
|
|
|
85
85
|
/>
|
|
86
86
|
<TrajectoryTimeline
|
|
87
87
|
diff --git a/packages/client/ui-trajectory/src/client/index.ts b/packages/client/ui-trajectory/src/client/index.ts
|
|
88
|
-
index
|
|
88
|
+
index 28bf045a..6e44cb96 100644
|
|
89
89
|
--- a/packages/client/ui-trajectory/src/client/index.ts
|
|
90
90
|
+++ b/packages/client/ui-trajectory/src/client/index.ts
|
|
91
91
|
@@ -38,6 +38,13 @@ export type {
|
|
@@ -115,10 +115,10 @@ index 28bf045ab4..6e44cb96f7 100644
|
|
|
115
115
|
const session = ctx.sessions.binding(sessionId)?.session
|
|
116
116
|
if (session === undefined) {
|
|
117
117
|
diff --git a/packages/client/ui-trajectory/tests/views.client.spec.tsx b/packages/client/ui-trajectory/tests/views.client.spec.tsx
|
|
118
|
-
index
|
|
118
|
+
index 9b61aaef..d5933bad 100644
|
|
119
119
|
--- a/packages/client/ui-trajectory/tests/views.client.spec.tsx
|
|
120
120
|
+++ b/packages/client/ui-trajectory/tests/views.client.spec.tsx
|
|
121
|
-
@@ -
|
|
121
|
+
@@ -251,6 +251,9 @@ function standaloneProps(
|
|
122
122
|
loadImage: () => Promise.reject(new Error('standalone views load no images')),
|
|
123
123
|
// The locale seat the outlet would inject for the declared namespace.
|
|
124
124
|
t: tZh,
|
|
@@ -129,7 +129,7 @@ index c233d3315a..93a0fb5f3f 100644
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
diff --git a/packages/session-query/session-log-export/package.json b/packages/session-query/session-log-export/package.json
|
|
132
|
-
index
|
|
132
|
+
index 376163ed..81d87972 100644
|
|
133
133
|
--- a/packages/session-query/session-log-export/package.json
|
|
134
134
|
+++ b/packages/session-query/session-log-export/package.json
|
|
135
135
|
@@ -49,8 +49,8 @@
|
|
@@ -167,7 +167,7 @@ index 083b0e2ba7..a63d999978 100644
|
|
|
167
167
|
"platform": "web"
|
|
168
168
|
}
|
|
169
169
|
diff --git a/packages/session-query/session-log-export/src/client/HeaderAction.module.css b/packages/session-query/session-log-export/src/client/HeaderAction.module.css
|
|
170
|
-
index
|
|
170
|
+
index 90ca1eed..aa22e45e 100644
|
|
171
171
|
--- a/packages/session-query/session-log-export/src/client/HeaderAction.module.css
|
|
172
172
|
+++ b/packages/session-query/session-log-export/src/client/HeaderAction.module.css
|
|
173
173
|
@@ -10,3 +10,46 @@
|
|
@@ -218,7 +218,7 @@ index 90ca1eedbc..aa22e45ead 100644
|
|
|
218
218
|
+ .trajectoryButton { display: inline-flex; }
|
|
219
219
|
+}
|
|
220
220
|
diff --git a/packages/session-query/session-log-export/src/client/HeaderAction.tsx b/packages/session-query/session-log-export/src/client/HeaderAction.tsx
|
|
221
|
-
index
|
|
221
|
+
index fcf0cfd8..74a8209f 100644
|
|
222
222
|
--- a/packages/session-query/session-log-export/src/client/HeaderAction.tsx
|
|
223
223
|
+++ b/packages/session-query/session-log-export/src/client/HeaderAction.tsx
|
|
224
224
|
@@ -1,12 +1,13 @@
|
|
@@ -290,7 +290,7 @@ index fcf0cfd862..74a8209ffa 100644
|
|
|
290
290
|
+ )
|
|
291
291
|
+}
|
|
292
292
|
diff --git a/packages/session-query/session-log-export/src/client/index.ts b/packages/session-query/session-log-export/src/client/index.ts
|
|
293
|
-
index
|
|
293
|
+
index 74808d17..f3acaa07 100644
|
|
294
294
|
--- a/packages/session-query/session-log-export/src/client/index.ts
|
|
295
295
|
+++ b/packages/session-query/session-log-export/src/client/index.ts
|
|
296
296
|
@@ -8,11 +8,16 @@ import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
@@ -339,7 +339,7 @@ index 74808d1751..f3acaa0746 100644
|
|
|
339
339
|
|
|
340
340
|
export type { SessionLogDownloadDialogInjected, SessionLogDownloadDialogProps } from './Dialog.tsx'
|
|
341
341
|
diff --git a/packages/session-query/session-log-export/tsconfig.client.json b/packages/session-query/session-log-export/tsconfig.client.json
|
|
342
|
-
index
|
|
342
|
+
index c78dbf68..5e4fd918 100644
|
|
343
343
|
--- a/packages/session-query/session-log-export/tsconfig.client.json
|
|
344
344
|
+++ b/packages/session-query/session-log-export/tsconfig.client.json
|
|
345
345
|
@@ -28,6 +28,7 @@
|