@qilin-agent/client-ui-layout 0.0.0-stage → 3.1.4
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/LICENSE +21 -0
- package/README.i18n.yaml +40 -0
- package/README.md +97 -2
- package/README.zh.md +98 -0
- package/lib/client.js +658 -0
- package/lib/index.js +6 -0
- package/lib/types/client/AppFrame.d.ts +7 -0
- package/lib/types/client/DocumentTitle.d.ts +14 -0
- package/lib/types/client/columns.d.ts +51 -0
- package/lib/types/client/index.d.ts +129 -0
- package/lib/types/client/service.d.ts +76 -0
- package/lib/types/client/shortcut-locales.d.ts +7 -0
- package/lib/types/client/stores.d.ts +72 -0
- package/lib/types/client/theme-presenter.d.ts +49 -0
- package/lib/types/index.d.ts +4 -0
- package/package.json +66 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kkutysllb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/client/ui-layout/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: d96ec500357f8268
|
|
7
|
+
zh: 57610f377112cbde
|
|
8
|
+
/qilin-agent-client-ui-layout:
|
|
9
|
+
en: 8c7be7212329e5f6
|
|
10
|
+
zh: 472481fde75bb334
|
|
11
|
+
/qilin-agent-client-ui-layout/summary:
|
|
12
|
+
en: 0315d385c20948ac
|
|
13
|
+
zh: b4d31027504adc25
|
|
14
|
+
/qilin-agent-client-ui-layout/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/qilin-agent-client-ui-layout/use-this-package:
|
|
18
|
+
en: 5a6817200e8ab63e
|
|
19
|
+
zh: 0b10ec37dab8862a
|
|
20
|
+
/qilin-agent-client-ui-layout/use-this-package/theme-presentation:
|
|
21
|
+
en: 231853ad6bda45b8
|
|
22
|
+
zh: c6d646b94f348774
|
|
23
|
+
/qilin-agent-client-ui-layout/understand-the-implementation:
|
|
24
|
+
en: ef5330bde14749ff
|
|
25
|
+
zh: 8e3f86aefaebb9bd
|
|
26
|
+
/qilin-agent-client-ui-layout/further-exploration:
|
|
27
|
+
en: 3bc37c626de945a7
|
|
28
|
+
zh: 8359c26f2144c7e4
|
|
29
|
+
/qilin-agent-client-ui-layout/model-experience:
|
|
30
|
+
en: 9a94a7197da60052
|
|
31
|
+
zh: 369a59ab63d050f1
|
|
32
|
+
/qilin-agent-client-ui-layout/model-experience/kv-cache-effect:
|
|
33
|
+
en: ca75c51c89c2c9b0
|
|
34
|
+
zh: de54f3467ef3b9be
|
|
35
|
+
/qilin-agent-client-ui-layout/known-limitations-and-deferred-work:
|
|
36
|
+
en: a2a43711814230d3
|
|
37
|
+
zh: c165c8479c913020
|
|
38
|
+
/qilin-agent-client-ui-layout/known-limitations-and-deferred-work/dev-note:
|
|
39
|
+
en: e67f633dc6fe7773
|
|
40
|
+
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -1,3 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
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
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @qilin-agent/client-ui-layout
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
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
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
The root slot composes the sidebar, main content, 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 35% 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, and reveals a grabber pill on hover.
|
|
29
|
+
|
|
30
|
+
Global panels occupy the root-scoped `main` keyed slot; `conversation` is the reserved key for the Conversation. `ctx.layout.selectPanel(id)` selects a registered panel, and `null` selects the Conversation without changing the current Session. No global panel is registered by the shipped composition.
|
|
31
|
+
|
|
32
|
+
Windows Electron's `data-windows-titlebar` marker reserves the caption height above all columns and removes the collapsed sidebar rail. Only the content area's top-left corner has a 16px radius; the other corners and the internal divider remain square. The frame publishes `--qilin-windows-content-radius` and `--qilin-windows-sidebar-width` for ui-sidebar-right's fullscreen corner and sidebar clearance. Ordinary Web documents do not receive the marker; macOS retains its separate layout.
|
|
33
|
+
|
|
34
|
+
### Theme presentation
|
|
35
|
+
|
|
36
|
+
The presenter consumes resolved theme snapshots and projects them onto the document: `html { color-scheme }` for native UA chrome, `body[data-ds-dark-theme]` from the active color scheme, the theme's alias tokens and `--qilin-content-font-size` as inline variables on body, and one owned `<meta name="theme-color">` whose content follows the computed body background. Disposing the presenter removes its metadata node with its other global writes.
|
|
37
|
+
|
|
38
|
+
-----
|
|
39
|
+
|
|
40
|
+
<a id="understand-the-implementation"></a>
|
|
41
|
+
## Understand the implementation
|
|
42
|
+
|
|
43
|
+
Desktop `Mod+B` toggles the left sidebar through the same layout action the frame's collapse control uses; the shortcut command is unavailable behind modal dialogs and yields to terminal input.
|
|
44
|
+
|
|
45
|
+
<details>
|
|
46
|
+
<summary>Implementation internals — click to expand</summary>
|
|
47
|
+
|
|
48
|
+
`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.
|
|
49
|
+
|
|
50
|
+
One registration declares four child slots and binds `ctx.layout` methods `selectPanel`, `toggleSidebar`, `openRightbar(track, fullscreen)`, and `closeRightbar`. One root store separates `panelInfo` selection from `layoutInfo` measurements, width preferences, and presentation reports. `usePanelInfo` subscribes to the stable selection object; AppFrame subscribes to the stable layout object. 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 keeps the column containers mounted. The right column's root controller renders `rightbar.session` through `SessionProvider` only while the Conversation is selected; its unmount report releases the track. The independent title component uses the selected Session title only while the Conversation is visible, with the build-configured product title or localized `common.brand.localBuild` as its fallback; locale revisions update that fallback. 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.
|
|
51
|
+
|
|
52
|
+
</details>
|
|
53
|
+
|
|
54
|
+
-----
|
|
55
|
+
|
|
56
|
+
<a id="further-exploration"></a>
|
|
57
|
+
## Further Exploration
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
- [ui-sidebar](../ui-sidebar/README.md) — occupies the `sidebar` column and its seats.
|
|
62
|
+
- [ui-conversation](../ui-conversation/README.md) — occupies the `main` key `conversation`.
|
|
63
|
+
- [ui-sidebar-right](../ui-sidebar-right/README.md) — occupies the `rightbar` column with one docking surface per session.
|
|
64
|
+
- [ui-theme](../ui-theme/README.md) — the theme seam whose resolved snapshots the presenter consumes.
|
|
65
|
+
- [Web client architecture](../../../.agents/notes/implemented/architecture/2026-07-19-gui-web-client-architecture.md) — how browser plugin rows load and register slots.
|
|
66
|
+
|
|
67
|
+
-----
|
|
68
|
+
|
|
69
|
+
<a id="model-experience"></a>
|
|
70
|
+
## Model Experience
|
|
71
|
+
|
|
72
|
+
None, as the layout shell manages browser viewing state; nothing here reaches a model request.
|
|
73
|
+
|
|
74
|
+
#### KV Cache effect
|
|
75
|
+
|
|
76
|
+
None; this package neither assembles nor sends a provider request.
|
|
77
|
+
|
|
78
|
+
## Known Limitations and Deferred Work
|
|
79
|
+
|
|
80
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
These limits define the current layout behavior. They are current package constraints, not a general window-manager comparison or a task backlog.
|
|
84
|
+
|
|
85
|
+
- **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.
|
|
86
|
+
- **Extremely narrow windows** — after the right panel closes, the center may still fall below 400px; the left 56px rail remains.
|
|
87
|
+
- **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.
|
|
88
|
+
- **No scroll anchoring during squeeze reflow** — layout changes may move the reader's viewport.
|
|
89
|
+
|
|
90
|
+
<a id="dev-note"></a>
|
|
91
|
+
### Dev Note
|
|
92
|
+
|
|
93
|
+
<details>
|
|
94
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
95
|
+
|
|
96
|
+
None.
|
|
97
|
+
|
|
98
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Web GUI 的外壳布局:三栏 AppFrame(右栏作为贴边面板的轨道)、面板几何服务与主题呈现;供窗口外壳的使用者与维护者阅读。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @qilin-agent/client-ui-layout
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
本包提供 Web GUI 的三栏 AppFrame、左右栏宽度与 `ctx.layout` 呈现控制。右栏先让步以保护中栏空间,全屏由占用方呈现,框架保留宽屏底层轨道。主题呈现器负责配色、别名 token、正文字号与 document 元数据;布局状态在刷新后重置。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
本插件在 root slot 中组合侧边栏、主内容和右栏。侧边栏宽度为 264~420px,默认为 280px,收起后保留 56px 控制栏;窗口宽度低于 1024px 时自动收起,打开右侧面板也会收起手动展开的侧边栏。右侧面板首次打开时使用视口宽度的 35%,之后保留用户的像素宽度偏好,上限为 70%。为给中栏保留 400px,框架先将右侧面板缩减至 300px,再报告空间不足,使占用方将其关闭,最后才进一步压缩中栏。拖动没有过渡延迟;右侧手柄在关闭或全屏时不显示,悬停时会显现竖条抓手。
|
|
29
|
+
|
|
30
|
+
全局面板占据 root 作用域的 `main` keyed slot;`conversation` 是为会话界面保留的 key。`ctx.layout.selectPanel(id)` 选中已注册面板,`null` 则选中会话界面,但不改变当前会话。默认组合不注册任何全局面板。
|
|
31
|
+
|
|
32
|
+
Windows Electron 的 `data-windows-titlebar` 标记在所有列上方预留顶栏高度,并移除收起后的侧栏轨道。内容区仅左上角保留 16px 圆角,其余角和内部交界处保持直角。框架发布 `--qilin-windows-content-radius` 和 `--qilin-windows-sidebar-width`,供 ui-sidebar-right 的全屏圆角及侧栏避让使用。普通 Web 文档不会获得该标记;macOS 保留其独立布局。
|
|
33
|
+
|
|
34
|
+
### 主题呈现
|
|
35
|
+
|
|
36
|
+
呈现器消费解析后的主题快照,并投影到 document:`html { color-scheme }` 驱动原生 UA 控件,依据当前配色方案设置 `body[data-ds-dark-theme]`,把主题的别名 token 与 `--qilin-content-font-size` 设为 body 上的内联变量,并持有一个 `<meta name="theme-color">`,其内容随计算后的 body 背景色更新。对呈现器执行 dispose(资源释放)时,它会连同其他全局写入一起移除自己的元数据节点。
|
|
37
|
+
|
|
38
|
+
-----
|
|
39
|
+
|
|
40
|
+
<a id="understand-the-implementation"></a>
|
|
41
|
+
## 理解实现
|
|
42
|
+
|
|
43
|
+
桌面端 `Mod+B` 通过与框架收起控件相同的布局动作切换左侧栏;该快捷键命令在模态对话框后不可用,并让位于终端输入。
|
|
44
|
+
|
|
45
|
+
<details>
|
|
46
|
+
<summary>实现细节——点击展开</summary>
|
|
47
|
+
|
|
48
|
+
`selectPanel(id)` 在改变选中态前检查实时 `main` 注册表;缺失的 key 会抛错并保留当前面板。`beginNavigation()` 为异步 UI 导航返回 abort signal。后续调用、有效面板选择(包括重复选择)或布局释放会中止该 signal,但不取消底层会话创建。消费方在提交导航或搬移草稿前检查 signal。
|
|
49
|
+
|
|
50
|
+
一次注册声明四个子 slot,并绑定 `ctx.layout` 的 `selectPanel`、`toggleSidebar`、`openRightbar(track, fullscreen)` 与 `closeRightbar`。同一个 root 存储把 `panelInfo` 选中态与 `layoutInfo` 测量、宽度偏好、呈现报告分开。`usePanelInfo` 订阅引用稳定的选中态对象,AppFrame 订阅引用稳定的布局对象。`rightbar` owner 提供实际 `width`、`viewportWidth`,以及表示能否以普通模式呈现的 `canShow`;占用方在空间不足时执行确定性的收起,变宽不自行重新展开。全屏隐藏宽度手柄,但不自行释放占用方要求保留的轨道。AppFrame 保持各列容器挂载。右栏的 root 控制器仅在选中会话界面时,经 `SessionProvider` 渲染 `rightbar.session`;内容卸载时的报告释放轨道。独立的标题组件仅在会话界面可见时使用所选会话标题,以构建配置的产品标题或本地化 `common.brand.localBuild` 为回退值;语言变化会更新该回退值。主题呈现器是第二个 effect:从解析后的快照做纯 DOM 写入——初始状态经 getter 读取一次,此后仅事件驱动,不经过 React。它先应用调色板、字号与 token 变量,再把渲染出的背景测量为唯一的颜色依据。全屏呈现禁用网格和手柄过渡;占用方完全覆盖框架后才报告新的列布局。退出全屏时,框架先保持无过渡并安装目标布局:关闭移除右轨道,恢复保留右轨道。后续普通几何操作恢复正常过渡。
|
|
51
|
+
|
|
52
|
+
</details>
|
|
53
|
+
|
|
54
|
+
-----
|
|
55
|
+
|
|
56
|
+
<a id="further-exploration"></a>
|
|
57
|
+
## 进一步探索
|
|
58
|
+
|
|
59
|
+
当布局面不够用时阅读以下页面。它们从框架进入它所渲染的栏与它所呈现的主题。
|
|
60
|
+
|
|
61
|
+
- [ui-sidebar](../ui-sidebar/README.zh.md)——占据 `sidebar` 栏及其座位。
|
|
62
|
+
- [ui-conversation](../ui-conversation/README.zh.md)——占据 `main` 中的 `conversation` key。
|
|
63
|
+
- [ui-sidebar-right](../ui-sidebar-right/README.zh.md)——以每会话一个停靠面占据 `rightbar` 栏。
|
|
64
|
+
- [ui-theme](../ui-theme/README.zh.md)——呈现器消费其解析快照的主题 seam。
|
|
65
|
+
- [Web 客户端架构](../../../.agents/notes/implemented/architecture/2026-07-19-gui-web-client-architecture.zh.md)——浏览器插件行如何加载并注册槽位。
|
|
66
|
+
|
|
67
|
+
-----
|
|
68
|
+
|
|
69
|
+
<a id="model-experience"></a>
|
|
70
|
+
## 模型体验
|
|
71
|
+
|
|
72
|
+
无。布局外壳管理浏览器查看状态;这里没有任何内容进入模型请求。
|
|
73
|
+
|
|
74
|
+
#### KV Cache 影响
|
|
75
|
+
|
|
76
|
+
无;该包既不组装也不发送提供方请求。
|
|
77
|
+
|
|
78
|
+
## 已知限制与延期工作
|
|
79
|
+
|
|
80
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
这些限制界定了当前布局行为。它们是当前包约束,不是通用窗口管理器对比或任务积压。
|
|
84
|
+
|
|
85
|
+
- **面板几何是瞬时状态**——重新加载会恢复侧栏默认值并隐藏右侧面板;拖动设置的宽度是整个框架共用的一份偏好,而非每个会话各自的属性。
|
|
86
|
+
- **极窄窗口**——右侧面板关闭后,中栏仍可能小于 400px;左侧 56px 控制栏仍会保留。
|
|
87
|
+
- **轨道与面板沿同一条曲线运动**——框架的轨道过渡和占用方的滑入读取同一组时长与缓动变量;占用方若自用一套,挤压时面板边缘就会与会话界面的边缘脱开。
|
|
88
|
+
- **挤压重排期间无滚动锚定**——布局变化可能移动读者的视口。
|
|
89
|
+
|
|
90
|
+
<a id="dev-note"></a>
|
|
91
|
+
### 开发备注
|
|
92
|
+
|
|
93
|
+
<details>
|
|
94
|
+
<summary>维护者的工作上下文——点击展开</summary>
|
|
95
|
+
|
|
96
|
+
无。
|
|
97
|
+
|
|
98
|
+
</details>
|