@allbluecn/web-app 0.27.15 → 0.27.16
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/package.json +1 -1
- package/src/components/bug/peek-panel.tsx +11 -5
- package/src/components/mini-quick-panel/mini-quick-panel.tsx +59 -1
- package/src/components/shared-kit/peek/side-peek-geometry.ts +88 -0
- package/src/components/story/ai/story-ai-toolbar.tsx +37 -3
- package/src/components/story/peek-panel.tsx +9 -34
- package/src/components/testcase/peek-panel.tsx +12 -6
- package/src/lib/changelog/sdk-versions.ts +1 -1
- package/src/lib/desktop-bridge-types.ts +5 -0
package/package.json
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
} from "@/components/shared-kit/peek/dock-slot";
|
|
44
44
|
import { useDockPanelResize } from "@/components/shared-kit/peek/dock-resize";
|
|
45
45
|
import { DockResizeHandle } from "@/components/shared-kit/peek/dock-resize-handle";
|
|
46
|
+
import { sidePeekCornerClass, useSidePeekFullCover } from "@/components/shared-kit/peek/side-peek-geometry";
|
|
46
47
|
import { useLayoutResponsive, useDockPresence } from "@/lib/layout-responsive";
|
|
47
48
|
import { m } from "@/paraglide/messages.js";
|
|
48
49
|
|
|
@@ -53,10 +54,10 @@ const CONTENT_CLASS: Record<"modal" | "full-screen", string> = {
|
|
|
53
54
|
"full-screen": "inset-4 w-auto h-auto sm:max-w-none",
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
/** 侧边浮窗(side-peek
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
/** 侧边浮窗(side-peek):贴内容区右缘滑出的浮层层。圆角/描边口径与需求面板
|
|
58
|
+
共用 `shared-kit/peek/side-peek-geometry`(满宽四角与父容器边框内缘同心,
|
|
59
|
+
未满宽左侧浮窗直角、右侧两角同心且自绘 ring+shadow)。 */
|
|
60
|
+
const SIDE_PEEK_PANEL_CLASS = "flex flex-col overflow-hidden bg-popover";
|
|
60
61
|
|
|
61
62
|
/** 侧边面板(side-dock):四角圆角与右侧内容容器一致(rounded-xl)。
|
|
62
63
|
停靠时额外加边框(独立卡片);重叠时自身不加边框(避免与内容容器的边框叠成 2px)。 */
|
|
@@ -111,6 +112,10 @@ export function BugPeekPanel({
|
|
|
111
112
|
const isDock = isDockMode(mode);
|
|
112
113
|
const { dockOverlay } = useLayoutResponsive();
|
|
113
114
|
useDockPresence(isDock, { enabled: !embedded });
|
|
115
|
+
// 侧边浮窗满宽检测(口径见 shared-kit/peek/side-peek-geometry):满宽四角与
|
|
116
|
+
// 内容容器内缘同心,未满宽左侧直角、右侧两角同心
|
|
117
|
+
const sidePeekPanelRef = useRef<HTMLDivElement | null>(null);
|
|
118
|
+
const sidePeekFullCover = useSidePeekFullCover(mode, sidePeekPanelRef, !embedded);
|
|
114
119
|
|
|
115
120
|
// 侧边面板宽度拖拽:与 story/testcase 面板共用槽位与持久化 key(embedded 时不接管槽位)
|
|
116
121
|
const dockResize = useDockPanelResize({
|
|
@@ -272,13 +277,14 @@ export function BugPeekPanel({
|
|
|
272
277
|
const dockLayout = !embedded && isDock && dockSlot !== null && !dockOverlay;
|
|
273
278
|
const panel = (
|
|
274
279
|
<div
|
|
280
|
+
ref={sidePeekPanelRef}
|
|
275
281
|
data-testid="peek-panel"
|
|
276
282
|
className={`${
|
|
277
283
|
dockLayout
|
|
278
284
|
? `relative h-full w-full ${DOCKED_PANEL_BORDER_CLASS} ${SIDE_DOCK_PANEL_CLASS}`
|
|
279
285
|
: embedded
|
|
280
286
|
? `absolute inset-0 z-20 ${DOCKED_PANEL_BORDER_CLASS} ${SIDE_DOCK_PANEL_CLASS}`
|
|
281
|
-
: `absolute inset-y-0 right-0 z-20 ${PEEK_SIDE_PANEL_WIDTH_CLASS} ${SIDE_PEEK_PANEL_CLASS}`
|
|
287
|
+
: `absolute inset-y-0 right-0 z-20 ${PEEK_SIDE_PANEL_WIDTH_CLASS} ${SIDE_PEEK_PANEL_CLASS} ${sidePeekCornerClass(sidePeekFullCover)}`
|
|
282
288
|
}`}
|
|
283
289
|
onClick={(e) => {
|
|
284
290
|
// 仅拦截本容器 DOM 内的点击(防止冒泡到列表背景误关 peek)。
|
|
@@ -44,6 +44,7 @@ import { quickCaptureStoryFn, listUsersBriefFn, listLabelsFn } from "@/server/se
|
|
|
44
44
|
import { listProjectsBriefFn } from "@/server/serverFns/project"
|
|
45
45
|
import { Button } from "@/components/ui/button"
|
|
46
46
|
import { Input } from "@/components/ui/input"
|
|
47
|
+
import { useDebouncedCallback } from "@/lib/pacer"
|
|
47
48
|
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
|
|
48
49
|
import {
|
|
49
50
|
DropdownMenu,
|
|
@@ -73,6 +74,17 @@ type QuickCaptureTab = "story" | "bug" | "task"
|
|
|
73
74
|
/** 保存成功反馈(已记录 IDENTIFIER)自动清除时长 */
|
|
74
75
|
const FEEDBACK_CLEAR_MS = 1500
|
|
75
76
|
|
|
77
|
+
/** mini 窗口高度自适应(2026-11-06):描述多行后编辑器长到 max-h-44,故事 tab
|
|
78
|
+
* 内容超过壳侧固定 480px(规格 4.1.2),滚动区把内联字段 chip 行裁一半(视觉
|
|
79
|
+
* 上像被记录按钮盖住)。测量故事 tab 自然内容高 → 经桥请求壳侧把窗口调高
|
|
80
|
+
* (壳侧 clamp 进 workArea);旧壳无此桥方法 → optional-chain 降级为原滚动行为。
|
|
81
|
+
* 收起/清空内容后回到基准高度,避免窗口只增不减。 */
|
|
82
|
+
const MINI_PANEL_BASE_HEIGHT = 480
|
|
83
|
+
const MINI_PANEL_MAX_HEIGHT = 640
|
|
84
|
+
/** 内容高变化抖动阈值(px):TipTap 每行 ~24px,小于阈值的请求不值得触发
|
|
85
|
+
* 窗口 resize(原生窗口抖动比内容裁切更扰人) */
|
|
86
|
+
const MINI_PANEL_HEIGHT_HYSTERESIS = 16
|
|
87
|
+
|
|
76
88
|
/** 项目选择:普通项目 / 灵感箱固定项(后者由后端懒创建,故不携带 projectId) */
|
|
77
89
|
type ProjectPick = { type: "project"; id: string } | { type: "inbox" }
|
|
78
90
|
|
|
@@ -122,6 +134,11 @@ export function MiniQuickPanel({ initialMode }: { initialMode: QuickCaptureMode
|
|
|
122
134
|
const tiptapEditorRef = useRef<any>(null)
|
|
123
135
|
const editorWrapRef = useRef<HTMLDivElement | null>(null)
|
|
124
136
|
const titleInputRef = useRef<HTMLInputElement | null>(null)
|
|
137
|
+
// 窗口高度自适应测量点(2026-11-06):scrollRef=滚动容器(flex-1 视口),
|
|
138
|
+
// contentRef=自然内容高(不受容器裁剪);sentHeightRef=已请求值(滞回去抖)
|
|
139
|
+
const storyScrollRef = useRef<HTMLDivElement | null>(null)
|
|
140
|
+
const storyContentRef = useRef<HTMLDivElement | null>(null)
|
|
141
|
+
const sentHeightRef = useRef<number>(MINI_PANEL_BASE_HEIGHT)
|
|
125
142
|
|
|
126
143
|
const {
|
|
127
144
|
model: aiModel,
|
|
@@ -212,6 +229,42 @@ export function MiniQuickPanel({ initialMode }: { initialMode: QuickCaptureMode
|
|
|
212
229
|
setMounted(true)
|
|
213
230
|
}, [])
|
|
214
231
|
|
|
232
|
+
// mini 窗口高度自适应(2026-11-06):desired = 视口高 − 滚动区可视高 + 内容自然高
|
|
233
|
+
// (即「不出现滚动条所需窗口高」),clamp [480, 640] 后经桥请求壳侧 resize;
|
|
234
|
+
// 壳侧负责 clamp 进 workArea。滞回 16px 过滤编辑器逐行增长时的 resize 抖动。
|
|
235
|
+
// 旧壳无 setMiniPanelHeight → 桥调用 no-op,维持固定 480 + 滚动兜底。
|
|
236
|
+
const requestPanelHeight = useDebouncedCallback((height: number) => {
|
|
237
|
+
getDesktopBridge()?.setMiniPanelHeight?.(height)
|
|
238
|
+
}, { wait: 150 })
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
if (activeTab !== "story") {
|
|
241
|
+
// 占位 tab(BUG/任务)内容极少:回基准高度(窗口只增不减的反向保障)
|
|
242
|
+
sentHeightRef.current = MINI_PANEL_BASE_HEIGHT
|
|
243
|
+
requestPanelHeight(MINI_PANEL_BASE_HEIGHT)
|
|
244
|
+
return
|
|
245
|
+
}
|
|
246
|
+
const scroll = storyScrollRef.current
|
|
247
|
+
const content = storyContentRef.current
|
|
248
|
+
if (!scroll || !content) return
|
|
249
|
+
const sync = () => {
|
|
250
|
+
const desired = Math.ceil(
|
|
251
|
+
window.innerHeight - scroll.clientHeight + content.scrollHeight,
|
|
252
|
+
)
|
|
253
|
+
const clamped = Math.min(
|
|
254
|
+
Math.max(desired, MINI_PANEL_BASE_HEIGHT),
|
|
255
|
+
MINI_PANEL_MAX_HEIGHT,
|
|
256
|
+
)
|
|
257
|
+
if (Math.abs(clamped - sentHeightRef.current) >= MINI_PANEL_HEIGHT_HYSTERESIS) {
|
|
258
|
+
sentHeightRef.current = clamped
|
|
259
|
+
requestPanelHeight(clamped)
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const observer = new ResizeObserver(sync)
|
|
263
|
+
observer.observe(content)
|
|
264
|
+
sync()
|
|
265
|
+
return () => observer.disconnect()
|
|
266
|
+
}, [activeTab, requestPanelHeight])
|
|
267
|
+
|
|
215
268
|
// 焦点管理:面板每次显示/获得焦点时把焦点放到标题框。否则焦点停在第一个
|
|
216
269
|
// 可聚焦元素(顶部图钉按钮)——表现为图钉出现 focus ring、Enter/Esc 落到
|
|
217
270
|
// 按钮上(快捷键像失效)。三重触发覆盖窗口生命周期:
|
|
@@ -497,7 +550,10 @@ export function MiniQuickPanel({ initialMode }: { initialMode: QuickCaptureMode
|
|
|
497
550
|
</div>
|
|
498
551
|
|
|
499
552
|
{activeTab === "story" ? (
|
|
500
|
-
<div className="flex-1
|
|
553
|
+
<div ref={storyScrollRef} className="flex-1 overflow-y-auto p-3">
|
|
554
|
+
{/* 内层包裹承接 space-y 与自然高测量(外层是 flex-1 裁剪视口):
|
|
555
|
+
窗口高度自适应按此节点的 scrollHeight 计算(见上方 ResizeObserver) */}
|
|
556
|
+
<div ref={storyContentRef} className="space-y-3">
|
|
501
557
|
<Popover open={projectOpen} onOpenChange={setProjectOpen}>
|
|
502
558
|
<PopoverTrigger
|
|
503
559
|
render={
|
|
@@ -615,10 +671,12 @@ export function MiniQuickPanel({ initialMode }: { initialMode: QuickCaptureMode
|
|
|
615
671
|
workspaceState={aiWorkspace}
|
|
616
672
|
onModelMenuOpen={requestLocalModels}
|
|
617
673
|
onGenerating={setAiGenerating}
|
|
674
|
+
modelPopoverSide="bottom"
|
|
618
675
|
/>
|
|
619
676
|
)}
|
|
620
677
|
</div>
|
|
621
678
|
</div>
|
|
679
|
+
</div>
|
|
622
680
|
|
|
623
681
|
<div className="flex flex-wrap items-center gap-1.5">
|
|
624
682
|
<StateEditor value={state} onChange={setState} variant="button" />
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// AllBlue - 理想之海
|
|
3
|
+
// Copyright (C) 2026 AllBlue Contributors
|
|
4
|
+
//
|
|
5
|
+
// This program is free software: you can redistribute it and/or modify
|
|
6
|
+
// it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
// (at your option) any later version.
|
|
9
|
+
//
|
|
10
|
+
// This program is distributed in the hope that it will be useful,
|
|
11
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
// GNU Affero General Public License for more details.
|
|
14
|
+
//
|
|
15
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
// 侧边浮窗(side-peek)几何口径单一来源:需求 / 用例 / BUG 三块面板共用,
|
|
19
|
+
// 禁止各面板再写一份圆角/描边常量(历史上三处各写一份,圆角从 18px 到 2xl 漂移)。
|
|
20
|
+
//
|
|
21
|
+
// 关键几何:面板 `absolute inset-y-0 right-0` 相对列表根(`relative ... p-4`)的
|
|
22
|
+
// padding box 定位,而列表根的 padding box 恰好在内容容器 SidebarInset
|
|
23
|
+
// (`rounded-xl` + 1px 边框)的边框之内 1px。因此面板四角若要与容器边框「同心、
|
|
24
|
+
// 完美重合」,半径必须是「父容器圆角 − 边框 1px」= calc(var(--radius) + 3px),
|
|
25
|
+
// 直接套 rounded-xl(calc(var(--radius) + 4px))会大 1px,圆弧压到容器边框上、
|
|
26
|
+
// 角落出现双弧与楔形缝隙。
|
|
27
|
+
//
|
|
28
|
+
// ⚠ 不能写 `rounded-[calc(var(--radius-xl)-1px)]`:`--radius-xl` 定义在
|
|
29
|
+
// `@theme inline` 里,不会 emit 到运行时 CSS(只内联进 rounded-xl 工具类),
|
|
30
|
+
// 引用它只会得到无效值 → 圆角归零。故用 :root 实变量 `--radius` 换算。
|
|
31
|
+
|
|
32
|
+
import { useEffect, useState, type RefObject } from "react";
|
|
33
|
+
import type { PeekMode } from "./peek-mode";
|
|
34
|
+
|
|
35
|
+
/** 满宽(面板盖满 containing block):四角与父容器边框内缘同心。 */
|
|
36
|
+
export const SIDE_PEEK_FULL_COVER_CLASS = "rounded-[calc(var(--radius)+3px)]";
|
|
37
|
+
|
|
38
|
+
/** 未满宽(浮在列表上方):左侧保持浮窗直角,右侧两角贴容器右缘同心;
|
|
39
|
+
自绘 1px ring + 阴影作为浮层描边(ring 沿直边被列表根 overflow-hidden 裁掉,
|
|
40
|
+
只在左缘与角落可见,正好充当浮窗边框)。 */
|
|
41
|
+
export const SIDE_PEEK_FLOATING_CLASS =
|
|
42
|
+
"rounded-r-[calc(var(--radius)+3px)] rounded-l-none shadow-xl ring-1 ring-foreground/10";
|
|
43
|
+
|
|
44
|
+
/** 满宽态 / 浮层态的圆角+描边类(side-peek 分支专用)。 */
|
|
45
|
+
export function sidePeekCornerClass(fullCover: boolean): string {
|
|
46
|
+
return fullCover ? SIDE_PEEK_FULL_COVER_CLASS : SIDE_PEEK_FLOATING_CLASS;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 侧边浮窗满宽检测:面板宽度公式 min(100%, max(85vw,560px), 1200px) 解析为
|
|
51
|
+
* 100%(覆盖整个定位父容器)时,面板四缘与内容容器(SidebarInset)内缘重合,
|
|
52
|
+
* 四角切同心圆角;否则只有右侧贴容器右缘。
|
|
53
|
+
*
|
|
54
|
+
* 纯 CSS 无法比较「解析宽 vs 容器宽」——容器查询测的是内容盒,与绝对定位含
|
|
55
|
+
* padding 的 containing block(padding box)差一个 p-4——故 JS 实测:offsetParent
|
|
56
|
+
* 即面板 containing block,其 clientWidth(padding box 宽)被面板 offsetWidth
|
|
57
|
+
* 追平 ⟺ 重合。
|
|
58
|
+
*
|
|
59
|
+
* @param enabled 面板不是 side-peek 浮层(dock / 叠加层)时传 false,跳过观测
|
|
60
|
+
*/
|
|
61
|
+
export function useSidePeekFullCover(
|
|
62
|
+
mode: PeekMode,
|
|
63
|
+
panelRef: RefObject<HTMLElement | null>,
|
|
64
|
+
enabled = true,
|
|
65
|
+
): boolean {
|
|
66
|
+
const [fullCover, setFullCover] = useState(false);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!enabled || mode !== "side-peek") {
|
|
69
|
+
setFullCover(false);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const el = panelRef.current;
|
|
73
|
+
if (!el) return;
|
|
74
|
+
const host = el.offsetParent;
|
|
75
|
+
if (!(host instanceof HTMLElement)) return;
|
|
76
|
+
const measure = () => setFullCover(el.offsetWidth >= host.clientWidth - 1);
|
|
77
|
+
measure();
|
|
78
|
+
const ro = new ResizeObserver(measure);
|
|
79
|
+
ro.observe(el);
|
|
80
|
+
ro.observe(host);
|
|
81
|
+
window.addEventListener("resize", measure);
|
|
82
|
+
return () => {
|
|
83
|
+
ro.disconnect();
|
|
84
|
+
window.removeEventListener("resize", measure);
|
|
85
|
+
};
|
|
86
|
+
}, [mode, panelRef, enabled]);
|
|
87
|
+
return fullCover;
|
|
88
|
+
}
|
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
PopoverContent,
|
|
27
27
|
PopoverTrigger,
|
|
28
28
|
} from "@/components/ui/popover"
|
|
29
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover"
|
|
30
|
+
import { cn } from "cn"
|
|
29
31
|
import { Button } from "@/components/ui/button"
|
|
30
32
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
|
|
31
33
|
import { ModelBrandIcon } from "@/components/ai/model-brand-icon"
|
|
@@ -85,6 +87,12 @@ export interface StoryAiToolbarProps extends ShowActionProps {
|
|
|
85
87
|
showModelSelect?: boolean
|
|
86
88
|
/** 模型选择器位置与显隐:leading=左侧常显(默认),trailing=右侧常显,trailing-hover=右侧 hover 淡入 */
|
|
87
89
|
modelSelectVariant?: "leading" | "trailing" | "trailing-hover"
|
|
90
|
+
/** 模型弹出层方向(缺省=默认跟随碰撞翻转)。mini 快捷面板传 "bottom":强制
|
|
91
|
+
* 从触发器下方弹出且**永不翻转**(collisionAvoidance side:'shift')——面板窗
|
|
92
|
+
* 口仅 ~480px 高,触发器贴编辑器底缘时向上翻转会让列表上缘超出窗口顶被裁
|
|
93
|
+
* (用户看到「下拉列表遮挡列表内容」)。弹出层限高可滚动,列表长时在面板
|
|
94
|
+
* 内滚动选模型。仅影响弹层定位,不改模型列表渲染。 */
|
|
95
|
+
modelPopoverSide?: "bottom"
|
|
88
96
|
/** 是否撑满父容器(flex-grow)。弹窗中 false=内容宽度靠 mr-auto 右靠;详情页 true=撑满 wrapper */
|
|
89
97
|
fill?: boolean
|
|
90
98
|
}
|
|
@@ -316,6 +324,7 @@ export function StoryAiToolbar(props: StoryAiToolbarProps) {
|
|
|
316
324
|
const renderModelSelect = (variant: "leading" | "trailing" | "trailing-hover") => {
|
|
317
325
|
const isTrailingPos = variant !== "leading"
|
|
318
326
|
const isHover = variant === "trailing-hover"
|
|
327
|
+
const forceBottom = props.modelPopoverSide === "bottom"
|
|
319
328
|
// 收起后 trailing 模型按钮改用 hidden(display:none 彻底让位,空间留给可见按钮 + 更多),
|
|
320
329
|
// 模型选择移入「更多」按钮的右侧子菜单;overflow hook 用缓存宽度判断恢复(hysteresis)。
|
|
321
330
|
// ⚠ Popover 打开期间禁止隐藏触发器:锚点 display:none 后 getBoundingClientRect
|
|
@@ -355,9 +364,34 @@ export function StoryAiToolbar(props: StoryAiToolbarProps) {
|
|
|
355
364
|
<span className="max-w-36 truncate">{modelLabel}</span>
|
|
356
365
|
<ChevronDown className="ml-0.5 size-3" />
|
|
357
366
|
</PopoverTrigger>
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
367
|
+
{forceBottom ? (
|
|
368
|
+
/* mini 面板专用弹出层:side 固定 bottom + collisionAvoidance side:'shift'
|
|
369
|
+
(永不翻转);限高滚动。类名与 ui/popover.tsx 的 PopoverContent 同源
|
|
370
|
+
(bg-popover/ring/shadow),仅宽度与限高按面板场景定制。不并入
|
|
371
|
+
ui/popover.tsx(shadcn 原生组件禁改),等价能力以就地基元实现。 */
|
|
372
|
+
<PopoverPrimitive.Portal>
|
|
373
|
+
<PopoverPrimitive.Positioner
|
|
374
|
+
side="bottom"
|
|
375
|
+
align={isTrailingPos ? "end" : "start"}
|
|
376
|
+
sideOffset={4}
|
|
377
|
+
collisionAvoidance={{ side: "shift", align: "shift" }}
|
|
378
|
+
className="isolate z-50"
|
|
379
|
+
>
|
|
380
|
+
<PopoverPrimitive.Popup
|
|
381
|
+
data-slot="popover-content"
|
|
382
|
+
className={cn(
|
|
383
|
+
"z-50 flex w-60 flex-col gap-1 overflow-y-auto rounded-md bg-popover p-2 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden max-h-60",
|
|
384
|
+
)}
|
|
385
|
+
>
|
|
386
|
+
{renderModelList()}
|
|
387
|
+
</PopoverPrimitive.Popup>
|
|
388
|
+
</PopoverPrimitive.Positioner>
|
|
389
|
+
</PopoverPrimitive.Portal>
|
|
390
|
+
) : (
|
|
391
|
+
<PopoverContent className="w-60 p-2" align={isTrailingPos ? "end" : "start"}>
|
|
392
|
+
{renderModelList()}
|
|
393
|
+
</PopoverContent>
|
|
394
|
+
)}
|
|
361
395
|
</Popover>
|
|
362
396
|
)
|
|
363
397
|
}
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
} from "@/components/shared-kit/peek/dock-slot";
|
|
53
53
|
import { useDockPanelResize } from "@/components/shared-kit/peek/dock-resize";
|
|
54
54
|
import { DockResizeHandle } from "@/components/shared-kit/peek/dock-resize-handle";
|
|
55
|
+
import { sidePeekCornerClass, useSidePeekFullCover } from "@/components/shared-kit/peek/side-peek-geometry";
|
|
55
56
|
import { useLayoutResponsive, useDockPresence } from "@/lib/layout-responsive";
|
|
56
57
|
import { m } from "@/paraglide/messages.js";
|
|
57
58
|
|
|
@@ -68,13 +69,11 @@ const OVERLAY_CLASS: Record<"modal" | "full-screen", string> = {
|
|
|
68
69
|
"full-screen": "bg-popover",
|
|
69
70
|
};
|
|
70
71
|
|
|
71
|
-
/** 侧边浮窗(side-peek
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
左缘与需求列表父容器(SidebarInset rounded-xl)左边框重合时改用同款
|
|
75
|
-
rounded-xl——此时面板视觉上就是内容容器本身。 */
|
|
72
|
+
/** 侧边浮窗(side-peek):贴内容区右缘滑出的浮层层。圆角/描边口径见
|
|
73
|
+
`shared-kit/peek/side-peek-geometry`(三模块共用:满宽四角与父容器边框内缘
|
|
74
|
+
同心,未满宽左侧浮窗直角、右侧两角同心且自绘 ring+shadow)。 */
|
|
76
75
|
const SIDE_PEEK_PANEL_CLASS =
|
|
77
|
-
"flex flex-col overflow-hidden bg-popover [--detail-surface:var(--popover)]
|
|
76
|
+
"flex flex-col overflow-hidden bg-popover [--detail-surface:var(--popover)]";
|
|
78
77
|
|
|
79
78
|
/** 侧边面板(side-dock):四角圆角与右侧内容容器一致(rounded-xl)。
|
|
80
79
|
停靠时额外加边框(独立卡片);重叠时自身不加边框(避免与内容容器的边框叠成 2px)。 */
|
|
@@ -346,34 +345,10 @@ export function StoryPeekPanel({
|
|
|
346
345
|
const { dockOverlay } = useLayoutResponsive();
|
|
347
346
|
useDockPresence(isDock);
|
|
348
347
|
|
|
349
|
-
//
|
|
350
|
-
//
|
|
351
|
-
// 切父容器同款圆角(rounded-xl)。纯 CSS 无法比较「解析宽 vs 容器宽」——容器
|
|
352
|
-
// 查询测的是内容盒,与绝对定位含 padding 的 containing block(padding box)
|
|
353
|
-
// 差一个 p-4——故 JS 实测:offsetParent 即面板 containing block,其
|
|
354
|
-
// clientWidth(padding box 宽)被面板 offsetWidth 追平 ⟺ 重合。
|
|
348
|
+
// 侧边浮窗满宽检测(口径见 shared-kit/peek/side-peek-geometry):满宽时面板四缘
|
|
349
|
+
// 与需求列表父容器(SidebarInset)内缘重合,四角切同心圆角;否则只有右侧贴容器右缘。
|
|
355
350
|
const sidePeekPanelRef = useRef<HTMLDivElement | null>(null);
|
|
356
|
-
const
|
|
357
|
-
useEffect(() => {
|
|
358
|
-
if (mode !== "side-peek") {
|
|
359
|
-
setSidePeekFullCover(false);
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
const el = sidePeekPanelRef.current;
|
|
363
|
-
if (!el) return;
|
|
364
|
-
const host = el.offsetParent;
|
|
365
|
-
if (!(host instanceof HTMLElement)) return;
|
|
366
|
-
const measure = () => setSidePeekFullCover(el.offsetWidth >= host.clientWidth - 1);
|
|
367
|
-
measure();
|
|
368
|
-
const ro = new ResizeObserver(measure);
|
|
369
|
-
ro.observe(el);
|
|
370
|
-
ro.observe(host);
|
|
371
|
-
window.addEventListener("resize", measure);
|
|
372
|
-
return () => {
|
|
373
|
-
ro.disconnect();
|
|
374
|
-
window.removeEventListener("resize", measure);
|
|
375
|
-
};
|
|
376
|
-
}, [mode]);
|
|
351
|
+
const sidePeekFullCover = useSidePeekFullCover(mode, sidePeekPanelRef);
|
|
377
352
|
|
|
378
353
|
// 侧边面板(dock)宽度拖拽:把手在「列表与面板之间的间隙」上(见 DockResizeHandle),
|
|
379
354
|
// 范围 [默认宽/2, 默认宽],宽度与 testcase/bug 面板共用持久化 key
|
|
@@ -541,7 +516,7 @@ export function StoryPeekPanel({
|
|
|
541
516
|
<div
|
|
542
517
|
ref={sidePeekPanelRef}
|
|
543
518
|
data-testid="peek-panel"
|
|
544
|
-
className={`${dockLayout ? `relative h-full w-full ${DOCKED_PANEL_BORDER_CLASS}` : `absolute inset-y-0 right-0 z-20 ${PEEK_SIDE_PANEL_WIDTH_CLASS}`} ${isDock ? SIDE_DOCK_PANEL_CLASS : `${SIDE_PEEK_PANEL_CLASS} ${sidePeekFullCover
|
|
519
|
+
className={`${dockLayout ? `relative h-full w-full ${DOCKED_PANEL_BORDER_CLASS}` : `absolute inset-y-0 right-0 z-20 ${PEEK_SIDE_PANEL_WIDTH_CLASS}`} ${isDock ? SIDE_DOCK_PANEL_CLASS : `${SIDE_PEEK_PANEL_CLASS} ${sidePeekCornerClass(sidePeekFullCover)}`}`}
|
|
545
520
|
onClick={(e) => {
|
|
546
521
|
// 仅拦截本容器 DOM 内的点击(防止冒泡到列表背景误关 peek)。
|
|
547
522
|
// Radix 弹层 portal 到 body、不在本容器 DOM 内,其合成事件冒泡会经过这里,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// 数据面:直接消费列表 TestCaseSummary DTO(title/precondition/steps/priority/type/
|
|
22
22
|
// state/identifier/storyId 全齐,YAGNI 不加详情 serverFn);「最近执行」P1 仅空态
|
|
23
23
|
// (执行数据 P2 才有)。↑↓/Esc 走面板热键,「打开详情」navigate 到 $caseId。
|
|
24
|
-
import { useCallback } from "react";
|
|
24
|
+
import { useCallback, useRef } from "react";
|
|
25
25
|
import { Link, useNavigate } from "@tanstack/react-router";
|
|
26
26
|
import { useAppHotkeys, useHotkey } from "@tanstack/react-hotkeys";
|
|
27
27
|
import {
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
} from "@/components/shared-kit/peek/dock-slot";
|
|
53
53
|
import { useDockPanelResize } from "@/components/shared-kit/peek/dock-resize";
|
|
54
54
|
import { DockResizeHandle } from "@/components/shared-kit/peek/dock-resize-handle";
|
|
55
|
+
import { sidePeekCornerClass, useSidePeekFullCover } from "@/components/shared-kit/peek/side-peek-geometry";
|
|
55
56
|
import { useLayoutResponsive, useDockPresence } from "@/lib/layout-responsive";
|
|
56
57
|
import type { TestCaseSummary } from "@/server/serverFns/testcase/types";
|
|
57
58
|
import type { FolderNodeDto } from "./folder-tree";
|
|
@@ -67,10 +68,10 @@ const CONTENT_CLASS: Record<"modal" | "full-screen", string> = {
|
|
|
67
68
|
"full-screen": "inset-4 w-auto h-auto sm:max-w-none",
|
|
68
69
|
};
|
|
69
70
|
|
|
70
|
-
/** 侧边浮窗(side-peek
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
/** 侧边浮窗(side-peek):贴内容区右缘滑出的浮层层。圆角/描边口径与需求面板
|
|
72
|
+
共用 `shared-kit/peek/side-peek-geometry`(满宽四角与父容器边框内缘同心,
|
|
73
|
+
未满宽左侧浮窗直角、右侧两角同心且自绘 ring+shadow)。 */
|
|
74
|
+
const SIDE_PEEK_PANEL_CLASS = "flex flex-col overflow-hidden bg-popover";
|
|
74
75
|
|
|
75
76
|
/** 侧边面板(side-dock):四角圆角与右侧内容容器一致(rounded-xl)。
|
|
76
77
|
停靠时额外加边框(独立卡片);重叠时自身不加边框(避免与内容容器的边框叠成 2px)。 */
|
|
@@ -118,6 +119,10 @@ export function TestCasePeekPanel({
|
|
|
118
119
|
const isDock = isDockMode(mode);
|
|
119
120
|
const { dockOverlay } = useLayoutResponsive();
|
|
120
121
|
useDockPresence(isDock, { enabled: !embedded });
|
|
122
|
+
// 侧边浮窗满宽检测(口径见 shared-kit/peek/side-peek-geometry):满宽四角与
|
|
123
|
+
// 内容容器内缘同心,未满宽左侧直角、右侧两角同心
|
|
124
|
+
const sidePeekPanelRef = useRef<HTMLDivElement | null>(null);
|
|
125
|
+
const sidePeekFullCover = useSidePeekFullCover(mode, sidePeekPanelRef, !embedded);
|
|
121
126
|
|
|
122
127
|
// 侧边面板宽度拖拽:与 story/bug 面板共用槽位与持久化 key(embedded 时不接管槽位)
|
|
123
128
|
const dockResize = useDockPanelResize({
|
|
@@ -394,13 +399,14 @@ export function TestCasePeekPanel({
|
|
|
394
399
|
const dockLayout = !embedded && isDock && dockSlot !== null && !dockOverlay;
|
|
395
400
|
const panel = (
|
|
396
401
|
<div
|
|
402
|
+
ref={sidePeekPanelRef}
|
|
397
403
|
data-testid="peek-panel"
|
|
398
404
|
className={`${
|
|
399
405
|
dockLayout
|
|
400
406
|
? `relative h-full w-full ${DOCKED_PANEL_BORDER_CLASS} ${SIDE_DOCK_PANEL_CLASS}`
|
|
401
407
|
: embedded
|
|
402
408
|
? `absolute inset-0 z-20 ${DOCKED_PANEL_BORDER_CLASS} ${SIDE_DOCK_PANEL_CLASS}`
|
|
403
|
-
: `absolute inset-y-0 right-0 z-20 ${PEEK_SIDE_PANEL_WIDTH_CLASS} ${SIDE_PEEK_PANEL_CLASS}`
|
|
409
|
+
: `absolute inset-y-0 right-0 z-20 ${PEEK_SIDE_PANEL_WIDTH_CLASS} ${SIDE_PEEK_PANEL_CLASS} ${sidePeekCornerClass(sidePeekFullCover)}`
|
|
404
410
|
}`}
|
|
405
411
|
onClick={(e) => {
|
|
406
412
|
// 仅拦截本容器 DOM 内的点击(防止冒泡到列表背景误关 peek)。
|
|
@@ -112,7 +112,7 @@ export const SDK_GROUPS: SdkGroup[] = [
|
|
|
112
112
|
"items": [
|
|
113
113
|
{
|
|
114
114
|
"name": "@allbluecn/web-app",
|
|
115
|
-
"version": "v0.27.
|
|
115
|
+
"version": "v0.27.16",
|
|
116
116
|
"lastUpdate": "Nov 6, 2026",
|
|
117
117
|
"source": "apps/web/package.json",
|
|
118
118
|
"docsUrl": "https://github.com/allbluecn/allblue"
|
|
@@ -124,6 +124,11 @@ export interface DesktopBridgeApi {
|
|
|
124
124
|
* 旧壳 undefined——调用方可选链降级。 */
|
|
125
125
|
openMainWindow?: () => void
|
|
126
126
|
quitApp?: () => void
|
|
127
|
+
/** mini 窗口高度自适应(2026-11-06 追加,add-only):渲染端按故事 tab 自然
|
|
128
|
+
* 内容高请求窗口高度(防抖 + 滞回去抖后仅传整数值),main 侧 clamp 进
|
|
129
|
+
* [480, 640] 与 workArea。旧壳 undefined——调用方可选链降级为固定 480 +
|
|
130
|
+
* 滚动兜底(面板内容不裁切只是需要滚动)。 */
|
|
131
|
+
setMiniPanelHeight?: (height: number) => void
|
|
127
132
|
}
|
|
128
133
|
|
|
129
134
|
/** A11 desktop-state 三态载荷(main 侧 desktop-state.json 持久化态的广播形状):
|