fix(client): use baseline menu primitive

This commit is contained in:
Magolor authored and imccyu committed 2026-09-20 12:17:48 +08:00
1 parent 4db234b408
commit d849d656a5
7 files changed
+8 -11

No files matched your search

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-09-17-session-row-menu-actions-slot.md
2026-09-17-session-row-menu-actions-slot.md: 081013c410671439f387a363cc86dc4e5fbf2fb3
2026-09-17-session-row-menu-actions-slot.zh.md: f9bdb848ac0f6908ac086c3e7d9ea44a076d8052
2026-09-17-session-row-menu-actions-slot.md: 21f17505a5e24c68b6b96a1eee34dbf76d9aa40f
2026-09-17-session-row-menu-actions-slot.zh.md: ae30d88dc8c2fb2b34ca2dc06fdb1eb5bb6c9f43
@@ -12,7 +12,7 @@ The Session row menu was a closed list of actions owned by `ui-workspace`. A thi
`ui-workspace` declares the root-scoped ordered-list slot `sidebar.workspaces.session.menu.action` under its `sidebar.workspaces` registration. Each contribution receives the target `sessionId` and row `displayTitle` (persisted title, project basename, then Session id); the contributing plugin keeps its services and mutations in its own registration closure.
The shared `MenuAction` primitive renders every contributed row inside `Menu`. It owns the same menu-item semantics, keyboard walk, submenu reset, dismissal, focus restoration, disabled state, icon position, and danger styling as owner-defined rows. Dynamic client packages declare `ui-primitives` as a runtime dependency and resolve the host's shared export through their loader `require`, avoiding a second component protocol.
The shared `MenuAction` primitive renders every contributed row inside `Menu`. It owns the same menu-item semantics, keyboard walk, submenu reset, dismissal, focus restoration, disabled state, icon position, and danger styling as owner-defined rows. Dynamic client bundles resolve `ui-primitives` directly from the host's implicit baseline through their loader `require`; they do not declare a runtime dependency or carry a second component protocol.
### Ordering and disclosure
@@ -12,7 +12,7 @@ Session 行菜单原本是由 `ui-workspace` 持有的封闭 action 列表。第
`ui-workspace` 在其 `sidebar.workspaces` 注册项下声明 root-scoped 有序列表 slot `sidebar.workspaces.session.menu.action`。每个贡献项接收目标 `sessionId` 与行 `displayTitle`(依次回退到持久化标题、项目目录名、Session id);贡献插件将自身服务与 mutation 保留在自己的注册闭包中。
共享 `MenuAction` primitive 在 `Menu` 内渲染所有贡献行。它让贡献行拥有与 owner 定义行相同的菜单项语义、键盘走位、子菜单重置、关闭行为、焦点恢复、禁用状态、图标位置与 danger 样式。动态客户端包将 `ui-primitives` 声明为运行时依赖,再通过 loader 的 `require` 解析宿主共享 export,避免引入第二套组件协议。
共享 `MenuAction` primitive 在 `Menu` 内渲染所有贡献行。它让贡献行拥有与 owner 定义行相同的菜单项语义、键盘走位、子菜单重置、关闭行为、焦点恢复、禁用状态、图标位置与 danger 样式。动态客户端 bundle 直接通过 loader 的 `require` 从宿主隐式 baseline 解析 `ui-primitives`;它们不声明运行时依赖,也不携带第二套组件协议。
### 排序与渐进披露
@@ -8,8 +8,5 @@
"dsh": {
"bundle": { "patch": "./cordis.patch.yml" },
"client": { "platform": "web" }
},
"dependencies": {
"@deepseek-ai/dsh-client-ui-primitives": "workspace:*"
}
}
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-workspace/README.md
README.md: 6abb08afe05bd5fe55d60905ab3d7c8c0b25d63a
README.zh.md: 0e7867f861a9736841e6c07ab5eefd977cbb0d0c
README.md: 98bc6c7843c6d76c236f6bce83bf70a823d3394e
README.zh.md: 678568ad19e9b20ab9ad989a6d5505af7bc295f3
+1 -1
View File
@@ -150,7 +150,7 @@ export function apply(ctx: Context): void {
#### Dynamic client package
A dynamically loaded browser half follows the same component contract. Declare `@deepseek-ai/dsh-client-ui-primitives` as a runtime dependency, resolve its shared `MenuAction` export through the loader's `require`, and render it with `React.createElement`. Do not bundle a second copy of React or the primitive: `MenuAction` must share the host menu context. The real Loader/Web fixture and generated Client Slot catalog contain runnable examples.
A dynamically loaded browser half follows the same component contract. `@deepseek-ai/dsh-client-ui-primitives` is an implicit baseline external: resolve its shared `MenuAction` export directly through the loader's `require`, and render it with `React.createElement`. Do not list the primitive as a runtime dependency or bundle another copy; declare a development dependency only when source compilation needs its types. `MenuAction` must share the host menu context. The real Loader/Web fixture and generated Client Slot catalog contain runnable examples.
### View state
+1 -1
View File
@@ -150,7 +150,7 @@ export function apply(ctx: Context): void {
#### 动态客户端包
动态加载的 browser half 采用同一套组件协议。将 `@deepseek-ai/dsh-client-ui-primitives` 声明为运行时依赖,通过 loader 的 `require` 解析共享的 `MenuAction` export,再用 `React.createElement` 渲染。不要打包第二份 React 或 primitive:`MenuAction` 必须与宿主菜单共享 context。真实 Loader/Web fixture 与生成的 Client Slot catalog 都包含可运行示例。
动态加载的 browser half 采用同一套组件协议。`@deepseek-ai/dsh-client-ui-primitives` 是隐式 baseline external:直接通过 loader 的 `require` 解析共享的 `MenuAction` export,再用 `React.createElement` 渲染。不要把 primitive 列为运行时依赖或打包另一份副本;仅在源码编译需要其类型时声明开发依赖。`MenuAction` 必须与宿主菜单共享 context。真实 Loader/Web fixture 与生成的 Client Slot catalog 都包含可运行示例。
### 视图状态