@deepseek-ai/dsh-client-ui-layout 0.1.3-alpha.2 → 0.1.5-alpha.1
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 +2 -2
- package/README.md +10 -8
- package/README.zh.md +10 -8
- package/lib/client.js +150 -115
- package/lib/types/client/AppFrame.d.ts +1 -1
- package/lib/types/client/columns.d.ts +18 -29
- package/lib/types/client/index.d.ts +23 -10
- package/lib/types/client/service.d.ts +16 -10
- package/lib/types/client/stores.d.ts +39 -25
- package/package.json +7 -7
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/client/ui-layout/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 0e353e21f39ba8a84e661f1c540db2c2424bcbfa
|
|
6
|
+
README.zh.md: 16471fdabb46bbfb35158ef85aa2544db4ceae93
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Shell layout for the Web GUI: the three-column AppFrame
|
|
2
|
+
description: "Shell layout for the Web GUI: the three-column AppFrame whose right column is a track for an edge-anchored panel, the panel-geometry service, and theme presentation; for users and maintainers of the window chrome."
|
|
3
3
|
kind: "package-reference"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
This package provides the
|
|
12
|
+
This package provides the Web GUI's three-column AppFrame, edge-column widths, and `ctx.layout` presentation control. The right column concedes space before the center; its occupant renders fullscreen while the frame retains the wide-screen track underneath. The theme presenter owns color scheme, alias tokens, content font size, and document metadata. Layout state resets on reload.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ This package provides the shell layout of the Web GUI: a three-column AppFrame w
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## Use this package
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
The root slot composes the sidebar, conversation, and right column. The sidebar spans 264–420px, defaults to 280px, and retains a 56px rail when collapsed; below 1024px it collapses automatically, and opening the right panel collapses a manually expanded sidebar. The right panel first opens at 45% of the viewport, then retains the user's pixel preference, capped at 70%. To protect 400px for the center, the frame first reduces the right panel to 300px, then reports insufficient room so its occupant closes it, and only then compresses the center further. Dragging has no transition delay; the right handle is absent while closed or fullscreen.
|
|
29
29
|
|
|
30
30
|
### Theme presentation
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ The presenter consumes resolved theme snapshots and projects them onto the docum
|
|
|
39
39
|
<details>
|
|
40
40
|
<summary>Implementation internals — click to expand</summary>
|
|
41
41
|
|
|
42
|
-
One `
|
|
42
|
+
One registration declares four child slots and binds `ctx.layout` methods `toggleSidebar`, `openRightbar(track, fullscreen)`, and `closeRightbar`. The store owns the single frame-width measurement, width preferences, and the occupant's presentation report. The `rightbar` owner supplies actual `width`, `viewportWidth`, and normal-presentation eligibility `canShow`; insufficient room causes a deterministic close, never automatic reopening on widening. Fullscreen hides the width handle without releasing a track the occupant retains. AppFrame always mounts the conversation and right columns; a connected Session renders through `SessionProvider`, and without one the right column is an empty zero-width track. It projects the selected Session title over the build-configured product title or the localized `common.brand.localBuild` fallback, so locale revisions update document metadata with the root entry. The theme presenter is a second effect: pure DOM writes from resolved snapshots — initial state through the getter once, then event-driven only, with no React path. It applies palette, font-size, and token variables before measuring the rendered background as the single color authority. Fullscreen presentation suppresses grid and handle transitions; its occupant reports the new columns only after covering the frame. Fullscreen exit keeps transitions suppressed while the frame installs its destination geometry: close removes the right track, and restore retains it. Subsequent normal geometry actions restore ordinary transitions.
|
|
43
43
|
|
|
44
44
|
</details>
|
|
45
45
|
|
|
@@ -51,7 +51,8 @@ One `register()` call contributes `AppFrame` into the runtime's built-in `'root'
|
|
|
51
51
|
Read these pages when the layout surface is not enough. They move from the frame to the columns it renders and the theme it presents.
|
|
52
52
|
|
|
53
53
|
- [ui-sidebar](../ui-sidebar/README.md) — occupies the `sidebar` column and its seats.
|
|
54
|
-
- [ui-conversation](../ui-conversation/README.md) — occupies the `conversation`
|
|
54
|
+
- [ui-conversation](../ui-conversation/README.md) — occupies the `conversation` column.
|
|
55
|
+
- [ui-sidebar-right](../ui-sidebar-right/README.md) — occupies the `rightbar` column with one docking surface per session.
|
|
55
56
|
- [ui-theme](../ui-theme/README.md) — the theme seam whose resolved snapshots the presenter consumes.
|
|
56
57
|
- [Web client architecture](../../../.agents/notes/implemented/architecture/2026-07-19-gui-web-client-architecture.md) — how browser plugin rows load and register slots.
|
|
57
58
|
|
|
@@ -73,8 +74,9 @@ None; this package neither assembles nor sends a provider request.
|
|
|
73
74
|
|
|
74
75
|
These limits define the current layout behavior. They are current package constraints, not a general window-manager comparison or a task backlog.
|
|
75
76
|
|
|
76
|
-
- **Panel geometry is transient** — reload restores the sidebar default and
|
|
77
|
-
- **
|
|
77
|
+
- **Panel geometry is transient** — reload restores the sidebar default and the right panel hidden; each dragged width is one frame-wide preference, not a per-Session fact.
|
|
78
|
+
- **Extremely narrow windows** — after the right panel closes, the center may still fall below 400px; the left 56px rail remains.
|
|
79
|
+
- **Track and panel travel on one shared curve** — the frame's track transition and the occupant's slide read the same duration and easing variables; an occupant that used its own would detach the panel's edge from the conversation's while squeezing.
|
|
78
80
|
- **No scroll anchoring during squeeze reflow** — layout changes may move the reader's viewport.
|
|
79
81
|
|
|
80
82
|
<a id="dev-note"></a>
|
|
@@ -87,4 +89,4 @@ None.
|
|
|
87
89
|
|
|
88
90
|
</details>
|
|
89
91
|
|
|
90
|
-
**Runtime invariant:** No companion is published. The shell viewing-state store behind ctx.layout emits no cordis events; clamp
|
|
92
|
+
**Runtime invariant:** No companion is published. The shell viewing-state store behind ctx.layout emits no cordis events; clamp and track sequencing is asserted directly by this package's columns and service specs.
|
package/README.zh.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Web GUI 的外壳布局:三栏 AppFrame
|
|
2
|
+
description: "Web GUI 的外壳布局:三栏 AppFrame——其右栏是贴边面板的轨道——面板几何服务与主题呈现;供窗口外观的用户与维护者阅读。"
|
|
3
3
|
kind: "package-reference"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
本包提供 Web GUI
|
|
12
|
+
本包提供 Web GUI 的三栏 AppFrame、左右栏宽度与 `ctx.layout` 呈现控制。右栏先让步以保护中栏空间,全屏由占用方呈现,框架保留宽屏底层轨道。主题呈现器负责配色、别名 token、正文字号与 document 元数据;布局状态在刷新后重置。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ kind: "package-reference"
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## 使用本包
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
本插件在 root slot 组合侧栏、会话与右栏。左栏为264~420px,默认280px,收起后保留56px;窗口低于1024px时自动收起,打开右栏也会收起手动展开的左栏。右栏首次打开使用窗口宽度的45%,之后保留用户像素偏好,上限为70%;中栏不足400px时先把右栏压到300px,仍不足则通知占用方收起,最后才继续压缩中栏。拖拽跟手且无过渡延迟,关闭或全屏时不显示右栏拖拽区。
|
|
29
29
|
|
|
30
30
|
### 主题呈现
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ kind: "package-reference"
|
|
|
39
39
|
<details>
|
|
40
40
|
<summary>实现细节——点击展开</summary>
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
一次注册声明四个子slot并绑定 `ctx.layout` 的 `toggleSidebar`、`openRightbar(track, fullscreen)` 与 `closeRightbar`。store持有唯一的frame宽度测量、左右栏偏好及占用方报告的呈现状态。`rightbar` 的owner参数为实际 `width`、`viewportWidth` 与普通呈现的 `canShow`;占用方在空间不足时执行确定性的收起,变宽不自行重新展开。全屏隐藏宽度手柄,但不自行释放占用方要求保留的轨道。AppFrame 始终挂载会话与右栏;已连接 Session 经 `SessionProvider` 渲染,没有 Session 时右栏是一条空的零宽轨道。它把所选 Session 标题投影到构建配置的产品标题或本地化 `common.brand.localBuild` 回退值之上,因此 locale revision 会随根 entry 一起更新文档元数据。主题呈现器是第二个 effect:从解析后的快照做纯 DOM 写入——初始状态经 getter 读取一次,此后仅事件驱动,不经过 React。它先应用调色板、字号与 token 变量,再把渲染出的背景测量为唯一的颜色依据。 全屏呈现禁用网格和手柄过渡;占用方完全覆盖框架后才报告新的列宽。 退出全屏时,框架先保持无过渡并安装目标布局:关闭移除右轨道,恢复保留右轨道。后续普通几何操作恢复正常过渡。
|
|
43
43
|
|
|
44
44
|
</details>
|
|
45
45
|
|
|
@@ -51,7 +51,8 @@ kind: "package-reference"
|
|
|
51
51
|
当布局面不够用时阅读以下页面。它们从框架进入它所渲染的栏与它所呈现的主题。
|
|
52
52
|
|
|
53
53
|
- [ui-sidebar](../ui-sidebar/README.zh.md)——占据 `sidebar` 栏及其座位。
|
|
54
|
-
- [ui-conversation](../ui-conversation/README.zh.md)——占据 `conversation`
|
|
54
|
+
- [ui-conversation](../ui-conversation/README.zh.md)——占据 `conversation` 栏。
|
|
55
|
+
- [ui-sidebar-right](../ui-sidebar-right/README.zh.md)——以每会话一个停靠面占据 `rightbar` 栏。
|
|
55
56
|
- [ui-theme](../ui-theme/README.zh.md)——呈现器消费其解析快照的主题 seam。
|
|
56
57
|
- [Web 客户端架构](../../../.agents/notes/implemented/architecture/2026-07-19-gui-web-client-architecture.zh.md)——浏览器插件行如何加载并注册槽位。
|
|
57
58
|
|
|
@@ -73,8 +74,9 @@ kind: "package-reference"
|
|
|
73
74
|
|
|
74
75
|
这些限制界定了当前布局行为。它们是当前包约束,不是通用窗口管理器对比或任务积压。
|
|
75
76
|
|
|
76
|
-
-
|
|
77
|
-
-
|
|
77
|
+
- **面板几何是瞬时状态**——重新加载会恢复侧栏默认值并隐藏右侧面板;每个拖出的宽度都是一份框架级偏好,不是按 Session 的事实。
|
|
78
|
+
- **极窄窗口**——右栏关闭后,中栏仍可能小于400px;左侧56px控制栏保留。
|
|
79
|
+
- **轨道与面板沿同一条曲线运动**——框架的轨道过渡和占位方的滑入读取同一组时长与缓动变量;占位方若自用一套,挤压时面板边缘就会与对话边缘脱开。
|
|
78
80
|
- **挤压重排期间无滚动锚定**——布局变化可能移动读者的视口。
|
|
79
81
|
|
|
80
82
|
<a id="dev-note"></a>
|
|
@@ -87,4 +89,4 @@ kind: "package-reference"
|
|
|
87
89
|
|
|
88
90
|
</details>
|
|
89
91
|
|
|
90
|
-
**运行时不变式:** 不发布伴生入口。`ctx.layout` 后的 viewing-state store 不发出 Cordis 事件;clamp
|
|
92
|
+
**运行时不变式:** 不发布伴生入口。`ctx.layout` 后的 viewing-state store 不发出 Cordis 事件;clamp 与轨道的时序由本包的 columns 与 service 规格直接断言。
|
package/lib/client.js
CHANGED
|
@@ -11,6 +11,10 @@ window.__ModuleLoader__.load({
|
|
|
11
11
|
* LG breakpoint); a manual toggle below it re-expands over the squeezed center
|
|
12
12
|
* (stores.ts narrowExpanded). */
|
|
13
13
|
const SIDEBAR_AUTO_COLLAPSE = 1024;
|
|
14
|
+
/** Maximum normal right panel width as a fraction of the frame. */
|
|
15
|
+
const RIGHTBAR_MAX_RATIO = .7;
|
|
16
|
+
/** First-open right panel preference as a fraction of the frame. */
|
|
17
|
+
const RIGHTBAR_DEFAULT_RATIO = .45;
|
|
14
18
|
/**
|
|
15
19
|
* Clamp a panel width into its contract range.
|
|
16
20
|
* @param px - requested width.
|
|
@@ -22,33 +26,21 @@ window.__ModuleLoader__.load({
|
|
|
22
26
|
return Math.min(max, Math.max(min, Math.round(px)));
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
25
|
-
* Solve the three column widths for one viewport frame.
|
|
26
|
-
* the output is a function of (viewport, preferences) only, so recovery on
|
|
27
|
-
* re-widening is automatic. Preferences re-clamp here because they cross the
|
|
28
|
-
* store boundary and callers may still supply stale ranges.
|
|
29
|
+
* Solve the three column widths for one viewport frame.
|
|
29
30
|
* @param viewport - available frame width in px.
|
|
30
31
|
* @param sidebar - sidebar width preference in px (0 = closed).
|
|
31
|
-
* @param
|
|
32
|
-
* @returns
|
|
32
|
+
* @param rightbar - requested right panel width in px (0 = no track).
|
|
33
|
+
* @returns actual widths after shrinking or removing the right track; only
|
|
34
|
+
* without that track may the center fall below its minimum, down to zero.
|
|
33
35
|
*/
|
|
34
|
-
function computeColumns(viewport, sidebar,
|
|
36
|
+
function computeColumns(viewport, sidebar, rightbar) {
|
|
35
37
|
const s = sidebar === 0 ? 56 : clampWidth(sidebar, 264, 420);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
sidebar: s,
|
|
39
|
-
center: viewport - s - d0,
|
|
40
|
-
details: d0
|
|
41
|
-
};
|
|
42
|
-
const d1 = d0 === 0 ? 0 : Math.max(300, viewport - s - 640);
|
|
43
|
-
if (s + d1 + 640 <= viewport) return {
|
|
44
|
-
sidebar: s,
|
|
45
|
-
center: 640,
|
|
46
|
-
details: d1
|
|
47
|
-
};
|
|
38
|
+
const available = viewport - s - 400;
|
|
39
|
+
const r = rightbar === 0 || available < 300 ? 0 : Math.min(available, clampWidth(rightbar, 300, viewport * RIGHTBAR_MAX_RATIO));
|
|
48
40
|
return {
|
|
49
41
|
sidebar: s,
|
|
50
|
-
center: Math.max(0, viewport - s),
|
|
51
|
-
|
|
42
|
+
center: Math.max(0, viewport - s - r),
|
|
43
|
+
rightbar: r
|
|
52
44
|
};
|
|
53
45
|
}
|
|
54
46
|
//#endregion
|
|
@@ -70,7 +62,7 @@ window.__ModuleLoader__.load({
|
|
|
70
62
|
}
|
|
71
63
|
//#endregion
|
|
72
64
|
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-layout/src/client/AppFrame.module.css.mjs
|
|
73
|
-
const css = ".pI_x6G_frame{background:var(--dsw-alias-bg-base);height:100%;transition:grid-template-columns var(--ds-transition-duration-slow) var(--ds-ease-in-out);grid-template-rows:100%;display:grid;position:relative;overflow:hidden}.pI_x6G_frame[data-dragging]{transition:none}@media (prefers-reduced-motion:reduce){.pI_x6G_frame{transition:none}}.pI_x6G_sidebarCol{background:var(--dsw-specific-sidebar-fill);border-right:.5px solid var(--dsw-alias-border-l3);min-width:0;overflow:hidden}.pI_x6G_centerCol{flex-direction:column;min-width:0;display:flex;overflow:hidden}.
|
|
65
|
+
const css = ".pI_x6G_frame{background:var(--dsw-alias-bg-base);height:100%;transition:grid-template-columns var(--ds-transition-duration-slow) var(--ds-ease-in-out);grid-template-rows:100%;display:grid;position:relative;overflow:hidden}.pI_x6G_frame[data-dragging]{transition:none}@media (prefers-reduced-motion:reduce){.pI_x6G_frame{transition:none}}.pI_x6G_sidebarCol{background:var(--dsw-specific-sidebar-fill);border-right:.5px solid var(--dsw-alias-border-l3);min-width:0;overflow:hidden}.pI_x6G_centerCol{flex-direction:column;min-width:0;display:flex;overflow:hidden}.pI_x6G_handle{cursor:col-resize;z-index:11;touch-action:none;width:8px;transition:left var(--ds-transition-duration-slow) var(--ds-ease-in-out);margin-left:-4px;position:absolute;top:0;bottom:0}.pI_x6G_frame[data-dragging] .pI_x6G_handle,.pI_x6G_frame[data-rightbar-fullscreen],.pI_x6G_frame[data-rightbar-fullscreen] .pI_x6G_handle,.pI_x6G_frame[data-rightbar-instant],.pI_x6G_frame[data-rightbar-instant] .pI_x6G_handle{transition:none}@media (prefers-reduced-motion:reduce){.pI_x6G_handle{transition:none}}.pI_x6G_rightbarCol{min-width:0;position:relative;overflow:visible}.pI_x6G_overlayLayer{z-index:20;pointer-events:none;position:absolute;inset:0}.pI_x6G_overlayLayer>*{pointer-events:auto}";
|
|
74
66
|
const tagId = "@deepseek-ai/dsh-client-ui-layout/AppFrame.module.css";
|
|
75
67
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
76
68
|
const tag = document.createElement("style");
|
|
@@ -81,10 +73,10 @@ window.__ModuleLoader__.load({
|
|
|
81
73
|
}
|
|
82
74
|
var AppFrame_module_css_default = {
|
|
83
75
|
"centerCol": "pI_x6G_centerCol",
|
|
84
|
-
"detailsCol": "pI_x6G_detailsCol",
|
|
85
76
|
"frame": "pI_x6G_frame",
|
|
86
77
|
"handle": "pI_x6G_handle",
|
|
87
78
|
"overlayLayer": "pI_x6G_overlayLayer",
|
|
79
|
+
"rightbarCol": "pI_x6G_rightbarCol",
|
|
88
80
|
"sidebarCol": "pI_x6G_sidebarCol"
|
|
89
81
|
};
|
|
90
82
|
//#endregion
|
|
@@ -92,14 +84,19 @@ window.__ModuleLoader__.load({
|
|
|
92
84
|
/**
|
|
93
85
|
* Three-column shell frame, registered into the built-in 'root' slot (the web
|
|
94
86
|
* shell renders only 'root'). Owns the grid tracks (sidebar | center |
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* renders HERE with live parameters from
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
87
|
+
* rightbar), the drag handles (pointer capture + rAF throttle), the column
|
|
88
|
+
* solve (columns.ts), and the child-slot render decisions: the sidebar slot
|
|
89
|
+
* renders HERE with live parameters from that solve, and the session-aware
|
|
90
|
+
* occupants render in fixed column positions; the strict right-column entry
|
|
91
|
+
* gates itself on current-session availability while the session-maybe
|
|
92
|
+
* conversation retains identity.
|
|
93
|
+
*
|
|
94
|
+
* The right column is a track, not a box: its occupant draws its panel anchored
|
|
95
|
+
* to the frame's right edge at the resolved normal width, and the
|
|
96
|
+
* track only decides whether the centre makes room for it. The occupant reports
|
|
97
|
+
* shown/track/fullscreen through `ctx.layout`; fullscreen keeps the reported
|
|
98
|
+
* track but hides the outer resize handle. Everything arrives through the framework
|
|
99
|
+
* shares — zero cordis or framework imports, zero self-made hooks.
|
|
103
100
|
*/
|
|
104
101
|
/** Center column grid item (session-body building block). */
|
|
105
102
|
function CenterColumn(props) {
|
|
@@ -108,10 +105,15 @@ window.__ModuleLoader__.load({
|
|
|
108
105
|
children: props.children
|
|
109
106
|
});
|
|
110
107
|
}
|
|
111
|
-
/**
|
|
112
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Right column grid item. Zero-width unless the occupant asked for a track; the
|
|
110
|
+
* occupant's panel is positioned against the column's right edge, which never
|
|
111
|
+
* moves, so it can hang over the centre when there is no track.
|
|
112
|
+
*/
|
|
113
|
+
function RightbarColumn(props) {
|
|
113
114
|
return (0, react_jsx_runtime.jsx)("div", {
|
|
114
|
-
className: AppFrame_module_css_default.
|
|
115
|
+
className: AppFrame_module_css_default.rightbarCol,
|
|
116
|
+
"data-rightbar-col": true,
|
|
115
117
|
children: props.children
|
|
116
118
|
});
|
|
117
119
|
}
|
|
@@ -124,6 +126,7 @@ window.__ModuleLoader__.load({
|
|
|
124
126
|
const origin = (0, react.useRef)(0);
|
|
125
127
|
const latest = (0, react.useRef)(0);
|
|
126
128
|
const frame = (0, react.useRef)(null);
|
|
129
|
+
const capture = (0, react.useRef)(null);
|
|
127
130
|
const callbacks = (0, react.useRef)({
|
|
128
131
|
onStart: props.onStart,
|
|
129
132
|
onDrag: props.onDrag,
|
|
@@ -134,16 +137,34 @@ window.__ModuleLoader__.load({
|
|
|
134
137
|
onDrag: props.onDrag,
|
|
135
138
|
onEnd: props.onEnd
|
|
136
139
|
};
|
|
140
|
+
const endDrag = (0, react.useCallback)(() => {
|
|
141
|
+
const active = capture.current;
|
|
142
|
+
if (active === null) return;
|
|
143
|
+
capture.current = null;
|
|
144
|
+
if (frame.current !== null) {
|
|
145
|
+
cancelAnimationFrame(frame.current);
|
|
146
|
+
frame.current = null;
|
|
147
|
+
}
|
|
148
|
+
if (active.element.hasPointerCapture(active.id)) active.element.releasePointerCapture(active.id);
|
|
149
|
+
setDragging(false);
|
|
150
|
+
callbacks.current.onEnd();
|
|
151
|
+
}, []);
|
|
152
|
+
(0, react.useEffect)(() => endDrag, [endDrag]);
|
|
137
153
|
const onPointerDown = (0, react.useCallback)((e) => {
|
|
154
|
+
if (e.button !== 0 || capture.current !== null) return;
|
|
138
155
|
e.preventDefault();
|
|
139
156
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
157
|
+
capture.current = {
|
|
158
|
+
element: e.currentTarget,
|
|
159
|
+
id: e.pointerId
|
|
160
|
+
};
|
|
140
161
|
origin.current = e.clientX;
|
|
141
162
|
latest.current = e.clientX;
|
|
142
163
|
callbacks.current.onStart();
|
|
143
164
|
setDragging(true);
|
|
144
165
|
}, []);
|
|
145
166
|
const onPointerMove = (0, react.useCallback)((e) => {
|
|
146
|
-
if (
|
|
167
|
+
if (capture.current?.id !== e.pointerId) return;
|
|
147
168
|
latest.current = e.clientX;
|
|
148
169
|
frame.current ??= requestAnimationFrame(() => {
|
|
149
170
|
frame.current = null;
|
|
@@ -151,16 +172,13 @@ window.__ModuleLoader__.load({
|
|
|
151
172
|
});
|
|
152
173
|
}, []);
|
|
153
174
|
const onPointerUp = (0, react.useCallback)((e) => {
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
setDragging(false);
|
|
162
|
-
callbacks.current.onEnd();
|
|
163
|
-
}, []);
|
|
175
|
+
if (capture.current?.id !== e.pointerId) return;
|
|
176
|
+
callbacks.current.onDrag(e.clientX - origin.current);
|
|
177
|
+
endDrag();
|
|
178
|
+
}, [endDrag]);
|
|
179
|
+
const onPointerCancel = (0, react.useCallback)((e) => {
|
|
180
|
+
if (capture.current?.id === e.pointerId) endDrag();
|
|
181
|
+
}, [endDrag]);
|
|
164
182
|
return (0, react_jsx_runtime.jsx)("div", {
|
|
165
183
|
className: AppFrame_module_css_default.handle,
|
|
166
184
|
style: { left: props.left },
|
|
@@ -168,56 +186,57 @@ window.__ModuleLoader__.load({
|
|
|
168
186
|
"data-dragging": dragging || void 0,
|
|
169
187
|
onPointerDown,
|
|
170
188
|
onPointerMove,
|
|
171
|
-
onPointerUp
|
|
189
|
+
onPointerUp,
|
|
190
|
+
onPointerCancel,
|
|
191
|
+
onLostPointerCapture: onPointerCancel
|
|
172
192
|
});
|
|
173
193
|
}
|
|
174
194
|
/** The three-column frame (see module doc). */
|
|
175
195
|
function AppFrame({ useStore, useSessions, actions, renderSlot, SessionProvider, t }) {
|
|
176
196
|
const panels = useStore((s) => s);
|
|
177
|
-
const detailsSession = useSessions((s) => {
|
|
178
|
-
const current = s.current;
|
|
179
|
-
return current !== void 0 && s.byId[current]?.blank === false ? current : void 0;
|
|
180
|
-
});
|
|
181
197
|
const documentTitle = useSessions((s) => {
|
|
182
198
|
const current = s.current;
|
|
183
199
|
return current === void 0 ? void 0 : s.byId[current]?.title;
|
|
184
200
|
});
|
|
185
201
|
const frameRef = (0, react.useRef)(null);
|
|
186
|
-
const
|
|
187
|
-
const lastSession = (0, react.useRef)(detailsSession);
|
|
202
|
+
const viewport = panels.viewportWidth;
|
|
188
203
|
(0, react.useLayoutEffect)(() => {
|
|
189
|
-
if (detailsSession === void 0) return;
|
|
190
|
-
if (lastSession.current !== void 0 && lastSession.current !== detailsSession) actions.closeDetails();
|
|
191
|
-
lastSession.current = detailsSession;
|
|
192
|
-
}, [actions, detailsSession]);
|
|
193
|
-
(0, react.useEffect)(() => {
|
|
194
204
|
const el = frameRef.current;
|
|
195
205
|
/* v8 ignore next -- the ref is always attached by effect time: the frame div renders unconditionally. */
|
|
196
206
|
if (el === null) return;
|
|
197
207
|
let raf = null;
|
|
208
|
+
let disposed = false;
|
|
209
|
+
const measure = () => {
|
|
210
|
+
const width = el.getBoundingClientRect().width;
|
|
211
|
+
if (width > 0) actions.setViewportWidth(width);
|
|
212
|
+
};
|
|
213
|
+
measure();
|
|
198
214
|
const observer = new ResizeObserver(() => {
|
|
215
|
+
if (disposed) return;
|
|
199
216
|
raf ??= requestAnimationFrame(() => {
|
|
200
217
|
raf = null;
|
|
201
|
-
|
|
202
|
-
if (width > 0) setViewport(width);
|
|
218
|
+
measure();
|
|
203
219
|
});
|
|
204
220
|
});
|
|
205
221
|
observer.observe(el);
|
|
206
222
|
return () => {
|
|
223
|
+
disposed = true;
|
|
207
224
|
observer.disconnect();
|
|
208
225
|
if (raf !== null) cancelAnimationFrame(raf);
|
|
209
226
|
};
|
|
210
|
-
}, []);
|
|
227
|
+
}, [actions]);
|
|
211
228
|
const narrow = viewport < SIDEBAR_AUTO_COLLAPSE;
|
|
212
|
-
(0, react.useEffect)(() => {
|
|
213
|
-
actions.setNarrow(narrow);
|
|
214
|
-
}, [actions, narrow]);
|
|
215
229
|
const sidebarCollapsed = narrow ? !panels.narrowExpanded : panels.sidebar === 0;
|
|
216
|
-
const
|
|
230
|
+
const sidebarPreference = sidebarCollapsed ? 0 : panels.sidebar === 0 ? 280 : panels.sidebar;
|
|
231
|
+
const rightbarPreference = panels.rightbar ?? viewport * .45;
|
|
232
|
+
const normal = computeColumns(viewport, !panels.rightbarShown && narrow ? 0 : sidebarPreference, rightbarPreference);
|
|
233
|
+
const cols = computeColumns(viewport, sidebarPreference, panels.rightbarTrack ? rightbarPreference : 0);
|
|
217
234
|
const colsRef = (0, react.useRef)(cols);
|
|
218
235
|
colsRef.current = cols;
|
|
236
|
+
const rightbarWidth = (0, react.useRef)(normal.rightbar);
|
|
237
|
+
rightbarWidth.current = normal.rightbar;
|
|
219
238
|
const sidebarBase = (0, react.useRef)(0);
|
|
220
|
-
const
|
|
239
|
+
const rightbarBase = (0, react.useRef)(0);
|
|
221
240
|
const [dragging, setDragging] = (0, react.useState)(false);
|
|
222
241
|
const onDragEnd = (0, react.useCallback)(() => {
|
|
223
242
|
setDragging(false);
|
|
@@ -226,22 +245,24 @@ window.__ModuleLoader__.load({
|
|
|
226
245
|
sidebarBase.current = colsRef.current.sidebar;
|
|
227
246
|
setDragging(true);
|
|
228
247
|
}, []);
|
|
229
|
-
const onDetailsStart = (0, react.useCallback)(() => {
|
|
230
|
-
detailsBase.current = colsRef.current.details;
|
|
231
|
-
setDragging(true);
|
|
232
|
-
}, []);
|
|
233
248
|
const onSidebarDrag = (0, react.useCallback)((dx) => {
|
|
234
249
|
actions.setSidebar(sidebarBase.current + dx);
|
|
235
250
|
}, [actions]);
|
|
236
|
-
const
|
|
237
|
-
|
|
251
|
+
const onRightbarStart = (0, react.useCallback)(() => {
|
|
252
|
+
rightbarBase.current = rightbarWidth.current;
|
|
253
|
+
setDragging(true);
|
|
254
|
+
}, []);
|
|
255
|
+
const onRightbarDrag = (0, react.useCallback)((dx) => {
|
|
256
|
+
actions.setRightbar(rightbarBase.current - dx);
|
|
238
257
|
}, [actions]);
|
|
239
258
|
return (0, react_jsx_runtime.jsxs)("div", {
|
|
240
259
|
ref: frameRef,
|
|
241
260
|
className: AppFrame_module_css_default.frame,
|
|
242
|
-
style: { gridTemplateColumns: `${cols.sidebar}px minmax(0, 1fr) ${cols.
|
|
261
|
+
style: { gridTemplateColumns: `${cols.sidebar}px minmax(0, 1fr) ${cols.rightbar}px` },
|
|
243
262
|
"data-sidebar-collapsed": sidebarCollapsed || void 0,
|
|
244
|
-
"data-
|
|
263
|
+
"data-rightbar-collapsed": cols.rightbar === 0 || void 0,
|
|
264
|
+
"data-rightbar-fullscreen": panels.rightbarFullscreen || void 0,
|
|
265
|
+
"data-rightbar-instant": panels.rightbarInstant || void 0,
|
|
245
266
|
"data-dragging": dragging || void 0,
|
|
246
267
|
children: [
|
|
247
268
|
(0, react_jsx_runtime.jsx)(DocumentTitle, {
|
|
@@ -255,7 +276,11 @@ window.__ModuleLoader__.load({
|
|
|
255
276
|
width: cols.sidebar
|
|
256
277
|
})
|
|
257
278
|
}),
|
|
258
|
-
(0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(CenterColumn, { children: renderSlot("conversation", {}) }), (0, react_jsx_runtime.jsx)(
|
|
279
|
+
(0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(CenterColumn, { children: renderSlot("conversation", {}) }), (0, react_jsx_runtime.jsx)(RightbarColumn, { children: (0, react_jsx_runtime.jsx)(SessionProvider, { children: renderSlot("rightbar", {
|
|
280
|
+
width: normal.rightbar,
|
|
281
|
+
viewportWidth: viewport,
|
|
282
|
+
canShow: normal.rightbar > 0
|
|
283
|
+
}) }) })] }),
|
|
259
284
|
(0, react_jsx_runtime.jsx)("div", {
|
|
260
285
|
className: AppFrame_module_css_default.overlayLayer,
|
|
261
286
|
"data-shell-overlay": true,
|
|
@@ -268,11 +293,11 @@ window.__ModuleLoader__.load({
|
|
|
268
293
|
onDrag: onSidebarDrag,
|
|
269
294
|
onEnd: onDragEnd
|
|
270
295
|
}),
|
|
271
|
-
|
|
272
|
-
side: "
|
|
273
|
-
left: viewport -
|
|
274
|
-
onStart:
|
|
275
|
-
onDrag:
|
|
296
|
+
panels.rightbarShown && !panels.rightbarFullscreen && normal.rightbar > 0 && (0, react_jsx_runtime.jsx)(DragHandle, {
|
|
297
|
+
side: "rightbar",
|
|
298
|
+
left: viewport - normal.rightbar,
|
|
299
|
+
onStart: onRightbarStart,
|
|
300
|
+
onDrag: onRightbarDrag,
|
|
276
301
|
onEnd: onDragEnd
|
|
277
302
|
})
|
|
278
303
|
]
|
|
@@ -281,53 +306,63 @@ window.__ModuleLoader__.load({
|
|
|
281
306
|
//#endregion
|
|
282
307
|
//#region lib/types/client/stores.js
|
|
283
308
|
/**
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
* handle would pin the store's identity in the module
|
|
287
|
-
* cache (a de-facto singleton surviving plugin reloads). register() receives
|
|
288
|
-
* the factory (exclusive use: the framework instantiates per entry), AppFrame
|
|
289
|
-
* derives its PropsStore share from the return type, and the service face
|
|
290
|
-
* receives the bound actions through the registration's inject hook.
|
|
309
|
+
* Root-owned frame measurement, panel preferences, and presentation reports.
|
|
310
|
+
* The registration supplies a fresh store and binds its actions to ctx.layout.
|
|
291
311
|
*/
|
|
292
312
|
/**
|
|
293
|
-
* Create the layout panel store handle.
|
|
294
|
-
* closing
|
|
295
|
-
* default.
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* flips the narrowExpanded override instead of the preference.
|
|
313
|
+
* Create the layout panel store handle. For the sidebar the preference IS the
|
|
314
|
+
* width, so closing it forgets its drag width — reopening restores the contract
|
|
315
|
+
* default. The right panel initializes at 45% of the frame on first opening
|
|
316
|
+
* and keeps that px preference across resizes and close. Drag writes clamp to
|
|
317
|
+
* the current frame's range. Narrow sidebar toggles change only the expansion
|
|
318
|
+
* override; opening the right panel clears that override.
|
|
300
319
|
* @returns the store handle (spec + type + identity + factory in one).
|
|
301
320
|
*/
|
|
302
321
|
function createLayoutStore() {
|
|
303
322
|
return (0, _deepseek_ai_dsh_client_store.defineStore)({
|
|
304
323
|
init: () => ({
|
|
305
324
|
sidebar: 280,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
325
|
+
viewportWidth: window.innerWidth,
|
|
326
|
+
narrowExpanded: false,
|
|
327
|
+
rightbar: null,
|
|
328
|
+
rightbarShown: false,
|
|
329
|
+
rightbarTrack: false,
|
|
330
|
+
rightbarFullscreen: false,
|
|
331
|
+
rightbarInstant: false
|
|
309
332
|
}),
|
|
310
333
|
actions: {
|
|
311
334
|
setSidebar: (d, px) => {
|
|
335
|
+
d.rightbarInstant = false;
|
|
312
336
|
d.sidebar = clampWidth(px, 264, 420);
|
|
313
337
|
},
|
|
314
|
-
setDetails: (d, px) => {
|
|
315
|
-
d.details = clampWidth(px, 300, 520);
|
|
316
|
-
},
|
|
317
338
|
toggleSidebar: (d) => {
|
|
318
|
-
|
|
339
|
+
d.rightbarInstant = false;
|
|
340
|
+
if (d.viewportWidth < 1024) d.narrowExpanded = !d.narrowExpanded;
|
|
319
341
|
else d.sidebar = d.sidebar === 0 ? 280 : 0;
|
|
320
342
|
},
|
|
321
|
-
|
|
322
|
-
if (d.
|
|
323
|
-
d.
|
|
324
|
-
d.narrowExpanded = false;
|
|
343
|
+
setViewportWidth: (d, width) => {
|
|
344
|
+
if (d.viewportWidth === width) return;
|
|
345
|
+
d.rightbarInstant = false;
|
|
346
|
+
if (d.viewportWidth < 1024 !== width < 1024) d.narrowExpanded = false;
|
|
347
|
+
d.viewportWidth = width;
|
|
348
|
+
},
|
|
349
|
+
setRightbar: (d, px) => {
|
|
350
|
+
d.rightbarInstant = false;
|
|
351
|
+
d.rightbar = clampWidth(px, 300, Math.max(300, d.viewportWidth * RIGHTBAR_MAX_RATIO));
|
|
325
352
|
},
|
|
326
|
-
|
|
327
|
-
if (d.
|
|
353
|
+
openRightbar: (d, track, fullscreen) => {
|
|
354
|
+
if (!d.rightbarShown || d.rightbarTrack !== track || d.rightbarFullscreen !== fullscreen) d.rightbarInstant = d.rightbarFullscreen && !fullscreen;
|
|
355
|
+
if (!d.rightbarShown && d.viewportWidth < 1024) d.narrowExpanded = false;
|
|
356
|
+
d.rightbar ??= Math.max(300, Math.round(d.viewportWidth * RIGHTBAR_DEFAULT_RATIO));
|
|
357
|
+
d.rightbarShown = true;
|
|
358
|
+
d.rightbarTrack = track;
|
|
359
|
+
d.rightbarFullscreen = fullscreen;
|
|
328
360
|
},
|
|
329
|
-
|
|
330
|
-
d.
|
|
361
|
+
closeRightbar: (d) => {
|
|
362
|
+
if (d.rightbarShown) d.rightbarInstant = d.rightbarFullscreen;
|
|
363
|
+
d.rightbarShown = false;
|
|
364
|
+
d.rightbarTrack = false;
|
|
365
|
+
d.rightbarFullscreen = false;
|
|
331
366
|
}
|
|
332
367
|
}
|
|
333
368
|
});
|
|
@@ -351,13 +386,13 @@ window.__ModuleLoader__.load({
|
|
|
351
386
|
toggleSidebar() {
|
|
352
387
|
this.#require().toggleSidebar();
|
|
353
388
|
}
|
|
354
|
-
/**
|
|
355
|
-
|
|
356
|
-
this.#require().
|
|
389
|
+
/** Report the right panel's track and fullscreen presentation. */
|
|
390
|
+
openRightbar(track, fullscreen) {
|
|
391
|
+
this.#require().openRightbar(track, fullscreen);
|
|
357
392
|
}
|
|
358
|
-
/**
|
|
359
|
-
|
|
360
|
-
this.#require().
|
|
393
|
+
/** Report the right panel as hidden: no track, no handle. */
|
|
394
|
+
closeRightbar() {
|
|
395
|
+
this.#require().closeRightbar();
|
|
361
396
|
}
|
|
362
397
|
#require() {
|
|
363
398
|
if (this.#panels === void 0) throw new Error("layout: panel actions not wired (root entry not mounted)");
|
|
@@ -447,7 +482,7 @@ window.__ModuleLoader__.load({
|
|
|
447
482
|
kind: "single",
|
|
448
483
|
scope: "session-maybe"
|
|
449
484
|
},
|
|
450
|
-
"
|
|
485
|
+
"rightbar": {
|
|
451
486
|
kind: "single",
|
|
452
487
|
scope: "session"
|
|
453
488
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
2
|
import type { createLayoutStore } from './stores.ts';
|
|
3
3
|
/** Full composed props: runtime share + child-slot render share + store share. */
|
|
4
|
-
export type AppFrameProps = PropsRuntime<'root'> & PropsRenderSlots<'sidebar' | 'conversation' | '
|
|
4
|
+
export type AppFrameProps = PropsRuntime<'root'> & PropsRenderSlots<'sidebar' | 'conversation' | 'rightbar' | 'shell.overlay'> & PropsStore<ReturnType<typeof createLayoutStore>> & PropsLocale<'common'>;
|
|
5
5
|
/** The three-column frame (see module doc). */
|
|
6
6
|
export declare function AppFrame({ useStore, useSessions, actions, renderSlot, SessionProvider, t, }: AppFrameProps): import("react").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=AppFrame.d.ts.map
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* preferences are never rewritten, so widening the window restores them).
|
|
6
|
-
* The sidebar never concedes: its rendered width is always the drag
|
|
7
|
-
* preference (or the collapsed rail), and center absorbs any remaining
|
|
8
|
-
* deficit as the last resort. Inputs are the layout store's plain width
|
|
9
|
-
* preferences (0 = closed); a closed sidebar resolves to the fixed
|
|
10
|
-
* SIDEBAR_COLLAPSED control rail while closed details resolve to zero width.
|
|
11
|
-
* The SIDEBAR_AUTO_COLLAPSE breakpoint is consumed by AppFrame, which decides
|
|
12
|
-
* the effective sidebar preference before solving; the solver itself stays
|
|
13
|
-
* breakpoint-free.
|
|
2
|
+
* Normal column geometry: the right column shrinks, then loses its track,
|
|
3
|
+
* before the center drops below its minimum. The sidebar never concedes here;
|
|
4
|
+
* AppFrame supplies its effective preference after responsive collapse.
|
|
14
5
|
*/
|
|
15
|
-
/** Resolved widths for one frame
|
|
6
|
+
/** Resolved widths for one frame. */
|
|
16
7
|
export interface Columns {
|
|
17
8
|
sidebar: number;
|
|
18
9
|
center: number;
|
|
19
|
-
|
|
10
|
+
rightbar: number;
|
|
20
11
|
}
|
|
21
|
-
/** Center
|
|
22
|
-
export declare const CENTER_MIN =
|
|
12
|
+
/** Center width protected while the normal right column is open. */
|
|
13
|
+
export declare const CENTER_MIN = 400;
|
|
23
14
|
/** Sidebar drag clamp floor. */
|
|
24
15
|
export declare const SIDEBAR_MIN = 264;
|
|
25
16
|
/** Sidebar drag clamp ceiling. */
|
|
@@ -32,12 +23,12 @@ export declare const SIDEBAR_COLLAPSED = 56;
|
|
|
32
23
|
* LG breakpoint); a manual toggle below it re-expands over the squeezed center
|
|
33
24
|
* (stores.ts narrowExpanded). */
|
|
34
25
|
export declare const SIDEBAR_AUTO_COLLAPSE = 1024;
|
|
35
|
-
/**
|
|
36
|
-
export declare const
|
|
37
|
-
/**
|
|
38
|
-
export declare const
|
|
39
|
-
/**
|
|
40
|
-
export declare const
|
|
26
|
+
/** Right column drag clamp floor. */
|
|
27
|
+
export declare const RIGHTBAR_MIN = 300;
|
|
28
|
+
/** Maximum normal right panel width as a fraction of the frame. */
|
|
29
|
+
export declare const RIGHTBAR_MAX_RATIO = 0.7;
|
|
30
|
+
/** First-open right panel preference as a fraction of the frame. */
|
|
31
|
+
export declare const RIGHTBAR_DEFAULT_RATIO = 0.45;
|
|
41
32
|
/**
|
|
42
33
|
* Clamp a panel width into its contract range.
|
|
43
34
|
* @param px - requested width.
|
|
@@ -47,14 +38,12 @@ export declare const DETAILS_DEFAULT = 360;
|
|
|
47
38
|
*/
|
|
48
39
|
export declare function clampWidth(px: number, min: number, max: number): number;
|
|
49
40
|
/**
|
|
50
|
-
* Solve the three column widths for one viewport frame.
|
|
51
|
-
* the output is a function of (viewport, preferences) only, so recovery on
|
|
52
|
-
* re-widening is automatic. Preferences re-clamp here because they cross the
|
|
53
|
-
* store boundary and callers may still supply stale ranges.
|
|
41
|
+
* Solve the three column widths for one viewport frame.
|
|
54
42
|
* @param viewport - available frame width in px.
|
|
55
43
|
* @param sidebar - sidebar width preference in px (0 = closed).
|
|
56
|
-
* @param
|
|
57
|
-
* @returns
|
|
44
|
+
* @param rightbar - requested right panel width in px (0 = no track).
|
|
45
|
+
* @returns actual widths after shrinking or removing the right track; only
|
|
46
|
+
* without that track may the center fall below its minimum, down to zero.
|
|
58
47
|
*/
|
|
59
|
-
export declare function computeColumns(viewport: number, sidebar: number,
|
|
48
|
+
export declare function computeColumns(viewport: number, sidebar: number, rightbar: number): Columns;
|
|
60
49
|
//# sourceMappingURL=columns.d.ts.map
|
|
@@ -51,18 +51,22 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
51
51
|
owner: ConvOwnerProps;
|
|
52
52
|
};
|
|
53
53
|
/**
|
|
54
|
-
* The right
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
54
|
+
* The right column: a track the centre makes room for, or nothing. OCCUPIED
|
|
55
|
+
* by the right Sidebar, which uses the resolved column width in normal
|
|
56
|
+
* mode and covers the viewport in fullscreen, retaining the wide-screen
|
|
57
|
+
* column reservation underneath.
|
|
58
58
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* Whether the panel is shown, and whether it takes a track, is the
|
|
60
|
+
* occupant's own recorded business — it reports the composition of its
|
|
61
|
+
* expanded and presentation state through `ctx.layout`, and the frame sizes
|
|
62
|
+
* the track and places the resize handle from that. The expand control is
|
|
63
|
+
* not this column's: it is a button in the conversation header. With no
|
|
64
|
+
* current session nothing is mounted here.
|
|
61
65
|
*/
|
|
62
|
-
'
|
|
66
|
+
'rightbar': {
|
|
63
67
|
kind: 'single';
|
|
64
68
|
scope: 'session';
|
|
65
|
-
owner:
|
|
69
|
+
owner: RightbarOwnerProps;
|
|
66
70
|
};
|
|
67
71
|
/**
|
|
68
72
|
* Frame-wide floating layer, above every column and outside their scroll
|
|
@@ -90,8 +94,17 @@ export interface SidebarOwnerProps {
|
|
|
90
94
|
/** Conversation owner share: business state and actions belong to the registrant. */
|
|
91
95
|
export interface ConvOwnerProps {
|
|
92
96
|
}
|
|
93
|
-
/**
|
|
94
|
-
export interface
|
|
97
|
+
/** Right column owner share: resolved normal geometry and opening eligibility. */
|
|
98
|
+
export interface RightbarOwnerProps {
|
|
99
|
+
/** Resolved normal panel width in px, not the saved preference; zero if it cannot fit. */
|
|
100
|
+
width: number;
|
|
101
|
+
/** Current frame width in px. */
|
|
102
|
+
viewportWidth: number;
|
|
103
|
+
/**
|
|
104
|
+
* Whether a normal right panel can retain 300px beside a 400px center.
|
|
105
|
+
* Before a narrow opening, includes the space from collapsing the left sidebar.
|
|
106
|
+
*/
|
|
107
|
+
canShow: boolean;
|
|
95
108
|
}
|
|
96
109
|
/** Required services (cordis fiber inject — the loader passes all module exports as an object plugin). */
|
|
97
110
|
export declare const inject: string[];
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* the per-session active view dissolved into ui-conversation's session store
|
|
6
6
|
* (its only consumer). What remains here is the contract other plugins'
|
|
7
7
|
* apply worlds reach for panel transitions (sidebar toggle from ui-sidebar,
|
|
8
|
-
*
|
|
9
|
-
* declared action set, delivered as the registration's bound actions.
|
|
8
|
+
* right-panel show/hide from ui-sidebar-right) — writes stay inside the
|
|
9
|
+
* store's declared action set, delivered as the registration's bound actions.
|
|
10
10
|
*/
|
|
11
11
|
import type { BoundActions } from '@deepseek-ai/dsh-client-ui-slots';
|
|
12
12
|
import type { createLayoutStore } from './stores.ts';
|
|
@@ -21,10 +21,16 @@ export type PanelActions = BoundActions<ReturnType<typeof createLayoutStore>>;
|
|
|
21
21
|
export interface ILayout {
|
|
22
22
|
/** Toggle the sidebar panel (closed ⟷ contract default width). */
|
|
23
23
|
toggleSidebar(): void;
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Report the right panel's presentation without changing its expanded state.
|
|
26
|
+
* @param track - whether the normal panel width reserves a grid track,
|
|
27
|
+
* including beneath a fullscreen overlay.
|
|
28
|
+
* @param fullscreen - whether the panel covers the frame and hides its outer
|
|
29
|
+
* resize handle; independent of the underlying grid track.
|
|
30
|
+
*/
|
|
31
|
+
openRightbar(track: boolean, fullscreen: boolean): void;
|
|
32
|
+
/** Report the right panel as hidden: no track, no handle. */
|
|
33
|
+
closeRightbar(): void;
|
|
28
34
|
}
|
|
29
35
|
/** Cross-plugin panel-action face (ctx.layout). */
|
|
30
36
|
export declare class LayoutController implements ILayout {
|
|
@@ -39,9 +45,9 @@ export declare class LayoutController implements ILayout {
|
|
|
39
45
|
attachPanels(actions: PanelActions): void;
|
|
40
46
|
/** Toggle the sidebar panel (closed ⟷ contract default width). */
|
|
41
47
|
toggleSidebar(): void;
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
48
|
+
/** Report the right panel's track and fullscreen presentation. */
|
|
49
|
+
openRightbar(track: boolean, fullscreen: boolean): void;
|
|
50
|
+
/** Report the right panel as hidden: no track, no handle. */
|
|
51
|
+
closeRightbar(): void;
|
|
46
52
|
}
|
|
47
53
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* handle would pin the store's identity in the module
|
|
5
|
-
* cache (a de-facto singleton surviving plugin reloads). register() receives
|
|
6
|
-
* the factory (exclusive use: the framework instantiates per entry), AppFrame
|
|
7
|
-
* derives its PropsStore share from the return type, and the service face
|
|
8
|
-
* receives the bound actions through the registration's inject hook.
|
|
2
|
+
* Root-owned frame measurement, panel preferences, and presentation reports.
|
|
3
|
+
* The registration supplies a fresh store and binds its actions to ctx.layout.
|
|
9
4
|
*/
|
|
10
5
|
import { type EngineStoreHandle } from '@deepseek-ai/dsh-client-store';
|
|
11
6
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* (viewport < SIDEBAR_AUTO_COLLAPSE) so toggleSidebar can pick semantics, and
|
|
15
|
-
* `narrowExpanded` is the manual override that re-expands the auto-collapsed
|
|
16
|
-
* sidebar over the squeezed center without rewriting the width preference.
|
|
7
|
+
* Transient layout preferences. Responsive concessions never rewrite widths;
|
|
8
|
+
* the right panel's expanded state belongs to its occupant.
|
|
17
9
|
*/
|
|
18
10
|
type LayoutState = {
|
|
19
11
|
sidebar: number;
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
/** Last positive frame measurement; window width bootstraps the first render. */
|
|
13
|
+
viewportWidth: number;
|
|
22
14
|
narrowExpanded: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Saved right panel width in px, or null before its first opening. Resizing
|
|
17
|
+
* the frame and closing the panel preserve this preference.
|
|
18
|
+
*/
|
|
19
|
+
rightbar: number | null;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the right panel is drawn at all, in either presentation.
|
|
22
|
+
*
|
|
23
|
+
* Derived chrome, not a source of truth: whether the right surface is
|
|
24
|
+
* expanded is a recorded fact owned by that surface, reported here so the
|
|
25
|
+
* frame can place the panel's resize handle. The occupant reports it; nothing
|
|
26
|
+
* else writes it.
|
|
27
|
+
*/
|
|
28
|
+
rightbarShown: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the normal panel width reserves a grid track, including beneath
|
|
31
|
+
* fullscreen. Reported by the occupant; always false while hidden.
|
|
32
|
+
*/
|
|
33
|
+
rightbarTrack: boolean;
|
|
34
|
+
/** Reported fullscreen presentation; hides the outer resize handle. */
|
|
35
|
+
rightbarFullscreen: boolean;
|
|
36
|
+
/** Suppress transitions for a fullscreen exit until another geometry action. */
|
|
37
|
+
rightbarInstant: boolean;
|
|
23
38
|
};
|
|
24
39
|
/**
|
|
25
40
|
* Annotation twin of the actions literal below (the export needs a declared
|
|
@@ -27,20 +42,19 @@ type LayoutState = {
|
|
|
27
42
|
*/
|
|
28
43
|
type LayoutActions = {
|
|
29
44
|
setSidebar: (draft: LayoutState, px: number) => void;
|
|
30
|
-
setDetails: (draft: LayoutState, px: number) => void;
|
|
31
45
|
toggleSidebar: (draft: LayoutState) => void;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
setViewportWidth: (draft: LayoutState, width: number) => void;
|
|
47
|
+
setRightbar: (draft: LayoutState, px: number) => void;
|
|
48
|
+
openRightbar: (draft: LayoutState, track: boolean, fullscreen: boolean) => void;
|
|
49
|
+
closeRightbar: (draft: LayoutState) => void;
|
|
35
50
|
};
|
|
36
51
|
/**
|
|
37
|
-
* Create the layout panel store handle.
|
|
38
|
-
* closing
|
|
39
|
-
* default.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* flips the narrowExpanded override instead of the preference.
|
|
52
|
+
* Create the layout panel store handle. For the sidebar the preference IS the
|
|
53
|
+
* width, so closing it forgets its drag width — reopening restores the contract
|
|
54
|
+
* default. The right panel initializes at 45% of the frame on first opening
|
|
55
|
+
* and keeps that px preference across resizes and close. Drag writes clamp to
|
|
56
|
+
* the current frame's range. Narrow sidebar toggles change only the expansion
|
|
57
|
+
* override; opening the right panel clears that override.
|
|
44
58
|
* @returns the store handle (spec + type + identity + factory in one).
|
|
45
59
|
*/
|
|
46
60
|
export declare function createLayoutStore(): EngineStoreHandle<LayoutState, LayoutActions>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-ui-layout",
|
|
3
3
|
"description": "Shell plugin: three-column AppFrame with drag handles, ctx.layout viewing-state service (navigation + panels)",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/react": "~18.3.1",
|
|
45
45
|
"react": "^18.2.0",
|
|
46
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
47
|
-
"@deepseek-ai/dsh-client-store": "^0.1.
|
|
48
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.
|
|
49
|
-
"@deepseek-ai/dsh-client-ui-session": "^0.1.
|
|
50
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.
|
|
51
|
-
"@deepseek-ai/dsh-client-ui-theme": "^0.1.
|
|
46
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.5-alpha.1",
|
|
47
|
+
"@deepseek-ai/dsh-client-store": "^0.1.5-alpha.1",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-alpha.1",
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-session": "^0.1.5-alpha.1",
|
|
50
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.5-alpha.1",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-theme": "^0.1.5-alpha.1",
|
|
52
52
|
"@deepseek-ai/cordis": "^4.0.2"
|
|
53
53
|
},
|
|
54
54
|
"files": [
|