nx-kv 0.68.1 → 0.68.3
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/CHANGELOG.md +58 -0
- package/package.json +1 -1
- package/src/core/db/seed-templates.ts +10 -50
- package/src/web/frontend/App.tsx +12 -0
- package/src/web/frontend/components/layout/vsc-crumbs.css +16 -9
- package/src/web/frontend/components/layout/vsc-crumbs.tsx +47 -25
- package/src/web/frontend/components/popup/index.tsx +4 -1
- package/src/web/frontend/components/popup/style.css +2 -0
- package/src/web/frontend/components/task-panel/task-page.tsx +1 -0
- package/src/web/frontend/components/task-panel/task-row.tsx +50 -21
- package/src/web/frontend/modules/md/fill-session.ts +36 -0
- package/src/web/frontend/modules/md/new-task-from-template.ts +22 -0
- package/src/web/frontend/modules/md/task-intent.ts +29 -0
- package/src/web/frontend/modules/prompts/render-template-body.ts +14 -0
- package/src/web/frontend/modules/prompts/template-preview.ts +62 -0
- package/src/web/frontend/page/dir/index.tsx +13 -3
- package/src/web/frontend/page/dir/task-beside.ts +64 -0
- package/src/web/frontend/page/dir/task.tsx +12 -24
- package/src/web/frontend/page/dir/use-auto-submit.ts +20 -0
- package/src/web/frontend/page/group/index.tsx +19 -3
- package/src/web/frontend/page/settings/style.css +12 -2
- package/src/web/frontend/page/templates/fill.tsx +128 -0
- package/src/web/frontend/page/templates/index.tsx +6 -0
- package/src/web/frontend/page/templates/manage.tsx +7 -33
- package/src/web/frontend/page/templates/style.css +32 -5
- package/src/web/frontend/page/templates/template-list.tsx +48 -68
- package/src/web/frontend/routes/templates.ts +10 -0
- package/src/web/frontend/styles-v2/dag.css +22 -1
- package/src/web/frontend/styles-v2/shell.css +16 -1
- package/src/web/public/assets/app-context-KCsdqNTq.js +1 -0
- package/src/web/public/assets/{bar-C-XvccT_.js → bar-DEY9q8mI.js} +1 -1
- package/src/web/public/assets/{button-Cs6w2CDi.js → button-BRGGaUcY.js} +1 -1
- package/src/web/public/assets/{composer-launch-DocQvHKh.js → composer-launch-DEHhs8k_.js} +1 -1
- package/src/web/public/assets/{composer-panel-DvUN4WhE.js → composer-panel-Cke_nbex.js} +1 -1
- package/src/web/public/assets/{dag-Bl0StA5e.js → dag-BvkJhdpX.js} +1 -1
- package/src/web/public/assets/dir-C8HhVpFz.js +1 -0
- package/src/web/public/assets/{doc-CKbuO1Gj.js → doc-R8KHVCxp.js} +1 -1
- package/src/web/public/assets/group-d9wqo1pL.js +1 -0
- package/src/web/public/assets/{index-DeuU-ww6.css → index-CUnLXQWJ.css} +1 -1
- package/src/web/public/assets/{index-BCtGuLkO.js → index-DqTSNBzX.js} +3 -3
- package/src/web/public/assets/manage-session-CuaL7QqQ.js +1 -0
- package/src/web/public/assets/{md-history-sxG54jJ_.js → md-history-BR2jLhFQ.js} +1 -1
- package/src/web/public/assets/{member-picker-CHX0nS0O.js → member-picker-BJ-Ucm-9.js} +1 -1
- package/src/web/public/assets/{popup-dBtYqEM1.js → popup-BdVXUaJk.js} +1 -1
- package/src/web/public/assets/{popup-BAvk7J7u.css → popup-CHK8uSG4.css} +1 -1
- package/src/web/public/assets/{progress-CPQSMxLp.js → progress-CLSIX544.js} +1 -1
- package/src/web/public/assets/{refs-Bzf1kVpx.js → refs-Cb9pmVsb.js} +1 -1
- package/src/web/public/assets/{reopen-text-B2d9SZi0.js → reopen-text-C3dnqygC.js} +1 -1
- package/src/web/public/assets/{repo-form-modal-geOSTx9x.js → repo-form-modal-awEPCcJK.js} +1 -1
- package/src/web/public/assets/{repos-BbKWW4no.js → repos-CIgKjolu.js} +1 -1
- package/src/web/public/assets/{route-crumb-CqDySF_k.js → route-crumb-DvXzznKm.js} +1 -1
- package/src/web/public/assets/{settings-Cy9N4Yuf.js → settings-BiqKrd8o.js} +1 -1
- package/src/web/public/assets/settings-CjXDi7qu.css +1 -0
- package/src/web/public/assets/task-C664y4Vd.js +14 -0
- package/src/web/public/assets/task-intent-CX5DZccN.js +1 -0
- package/src/web/public/assets/{task-Dcd2eA8B.css → task-j7fMfJUp.css} +1 -1
- package/src/web/public/assets/task-ops-D8L16-TP.js +2 -0
- package/src/web/public/assets/template-preview-CjQ-ucPt.js +1 -0
- package/src/web/public/assets/templates-BZ1EM7W4.js +10 -0
- package/src/web/public/assets/templates-DiEKBY-m.css +1 -0
- package/src/web/public/assets/{tool-bar-DpfJRjFG.js → tool-bar-CAMqYt5j.js} +1 -1
- package/src/web/public/assets/{use-rail-drag-DcUzHeV_.js → use-rail-drag-C3GpkThI.js} +1 -1
- package/src/web/public/index.html +12 -12
- package/src/web/frontend/page/templates/scope-chips.tsx +0 -237
- package/src/web/public/assets/app-context-CngKv8Tc.js +0 -1
- package/src/web/public/assets/dir-BgkZkxiK.js +0 -1
- package/src/web/public/assets/group-BkBWu0VU.js +0 -1
- package/src/web/public/assets/manage-session-CS8UvmUd.js +0 -1
- package/src/web/public/assets/settings-d2ah_h6O.css +0 -1
- package/src/web/public/assets/task-DQNhVFdJ.js +0 -14
- package/src/web/public/assets/task-ops-CdBj-EnL.js +0 -2
- package/src/web/public/assets/templates-B-xUIUa6.js +0 -10
- package/src/web/public/assets/templates-CwYDIBYn.css +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,64 @@
|
|
|
2
2
|
|
|
3
3
|
本文件对外可见的变更。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。
|
|
4
4
|
|
|
5
|
+
## [0.68.3] - 2026-11-24 设置浮窗弹性缩放开场 + 材质升级
|
|
6
|
+
|
|
7
|
+
#253 的验收反馈(#260):「提升设置页面的视觉层级与材质表现,增强界面质感;弹窗过渡
|
|
8
|
+
动画改弹性缩放(Elastic Scale):初始 Scale 从较小值开始,快速放大并超过目标尺寸
|
|
9
|
+
(Overshoot),回弹至 100%,建议 Spring 或带超调的 cubic-bezier」。
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- **浮窗弹性开场**(`styles-v2/shell.css`):`.flexlayout__float_window` 挂
|
|
14
|
+
`flx-float-pop 0.34s cubic-bezier(0.34, 1.56, 0.64, 1)`——标准 back-out 曲线
|
|
15
|
+
(y2=1.56>1)自动产生「scale 0.6 放大 → 超过 100% → 回弹落定」,等效弹簧动画。
|
|
16
|
+
浮窗元素按 layoutId 复用,只在创建时播一次,拖动/改矩形不重放。
|
|
17
|
+
- **浮窗材质三层影**:发丝环勾边(`0 0 0 1px` 8% 黑)+ 近距环境影(`0 2px 6px`)+
|
|
18
|
+
远距主投影(`0 24px 64px -20px` 30%)替代原单层硬影;圆角 10px → 12px。
|
|
19
|
+
- **设置页层级分隔**(`page/settings/style.css`):分区标题(`.setp-h`)压细线与内容
|
|
20
|
+
拉开;相邻设置行画 `--line` 发丝分隔(中间隔了别的元素就不画);激活导航白底胶囊加
|
|
21
|
+
发丝环。
|
|
22
|
+
|
|
23
|
+
### Verification
|
|
24
|
+
|
|
25
|
+
- 全量门禁通过:lint / typecheck / build / smoke / unit 1187/1187。
|
|
26
|
+
- Playwright 探针实测(8 项断言全绿):开窗瞬间 `document.getAnimations()` 捕到
|
|
27
|
+
`flx-float-pop` 在播;计算样式 = 0.34s + cubic-bezier(0.34, **1.56**, 0.64, 1) 超调
|
|
28
|
+
缓动 + 圆角 12px + 三层影;落定后 transform 回 `matrix(1,…)`、opacity 1;设置页
|
|
29
|
+
标题细线与行分隔均为 1px solid。截图目视材质成立。
|
|
30
|
+
- 本轮知识沉淀:ref `ref_c7157855dc71e9ca`「设置浮窗二轮验收:弹性缩放开场 + 三层影
|
|
31
|
+
材质 + 设置页层级分隔」。
|
|
32
|
+
|
|
33
|
+
## [0.68.2] - 2026-11-24 面包屑二轮验收:下拉定宽滚动 + 任务段双按钮
|
|
34
|
+
|
|
35
|
+
#254 的验收反馈(#259):「点击出现的面板固定最大高度,超过在容器内滚动;宽度调到
|
|
36
|
+
150px;任务的面板 hover 显示两个 icon btn——复制 + 预览,点击出现子侧边栏显示对应
|
|
37
|
+
任务原文」。
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- 任务段 hover 出**两个** icon btn:复制(沿「路径复制偏好」两态不变)+ 预览
|
|
42
|
+
(眼睛,`onPreview` 由任务页提供:评论任务跳来源原文,普通任务把自己的原文
|
|
43
|
+
旁路打开——`openBesideMain` 先收旧旁路,同一时刻只有一块;草稿 toast 提示)。
|
|
44
|
+
旁路原文「子侧边栏」即 PagePanel 的 beside 形态(BesideHeader 关闭条),非新组件。
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- `.pp-menu` 加全局固定最大高度 `min(60vh, 440px)` + 容器内滚动——所有 PopMenu
|
|
49
|
+
的同级清单超长不再顶出视口。
|
|
50
|
+
- `PopMenu` 新增可选 `width`(内联同时压 `width + minWidth`,否则盖不过 CSS 的
|
|
51
|
+
`min-width:168px`);面包屑三段下拉统一定宽 **150px**,缺省行为不变。
|
|
52
|
+
- 任务页 beside 三函数(打开来源原文 / 关闭自己 / 预览原文)抽成 `task-beside.ts`
|
|
53
|
+
的 `useBesideOps`——task.tsx 回到 600 行门禁内。
|
|
54
|
+
|
|
55
|
+
### Verification
|
|
56
|
+
|
|
57
|
+
- 全量门禁通过:lint / typecheck / build / smoke / unit 1179/1179。
|
|
58
|
+
- Playwright 探针实测(独立 store + 压矮视口触发滚动,8 项断言全绿):任务段 hover
|
|
59
|
+
双按钮可见、下拉定宽 150、scrollHeight > clientHeight(容器内滚)、剪贴板载荷、
|
|
60
|
+
预览打开「原文 #2」旁路页签(`.mdw.is-beside` 在场)。
|
|
61
|
+
- 本轮知识沉淀:ref `ref_b000ae6b52e1a8d5`「面包屑二轮验收」。
|
|
62
|
+
|
|
5
63
|
## [0.68.1] - 2026-11-24 管理命名空间:搜索分区 + 成员增删
|
|
6
64
|
|
|
7
65
|
用户口径:「顶部增加搜索框,支持搜索ns。对于btn增加管理:支持管理该命名空间具体项目
|
package/package.json
CHANGED
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
// 重启绝不能被代码里的出厂文本覆盖(T06 裁决:builtin 标记不覆盖用户编辑)。
|
|
10
10
|
// 所以升级内置模板正文 = 改这里的出厂文本 + 用户手动重置(没有自动覆盖)。
|
|
11
11
|
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// context 组/仓库上下文(参考文档地址、关键要求)
|
|
12
|
+
// #191 起模板表只服务一件事:**按模板初始化 task 草稿**(newtask category)。
|
|
13
|
+
// 出厂只有一条「ref 生成」内置模板;delivery / enhance / context 三条提示词段
|
|
14
|
+
// 已下线(见 RETIRED_BUILTIN_TEMPLATE_IDS)——提示词模板走独立引擎
|
|
15
|
+
// (modules/promptplug/plugins/* 的 BUILTIN),与本表无关系。
|
|
17
16
|
import type { DbApi } from './driver.js';
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -93,6 +92,12 @@ export const RETIRED_BUILTIN_TEMPLATE_IDS = Object.freeze([
|
|
|
93
92
|
'newtask.feature',
|
|
94
93
|
'newtask.research',
|
|
95
94
|
'newtask.doc',
|
|
95
|
+
// #191:任务模板只负责「按模板初始化 task 草稿」,与提示词模板无关——提示词
|
|
96
|
+
// 有自己的引擎(promptplug 插件 BUILTIN,见 modules/promptplug/plugins/*)。
|
|
97
|
+
// 这三条是提示词段,历史上混在模板表里出现在任务模板列表,现下线(软删 builtin 行)。
|
|
98
|
+
'delivery.main',
|
|
99
|
+
'enhance.timegoal',
|
|
100
|
+
'context.main',
|
|
96
101
|
]);
|
|
97
102
|
|
|
98
103
|
/** 内置模板清单(顺序即 sort_order)。id 稳定:升级不改 id,用户配置跟着 id 走。 */
|
|
@@ -107,51 +112,6 @@ export const BUILTIN_TEMPLATES = Object.freeze([
|
|
|
107
112
|
vars: {},
|
|
108
113
|
isDefault: 1,
|
|
109
114
|
},
|
|
110
|
-
{
|
|
111
|
-
id: 'delivery.main',
|
|
112
|
-
category: 'delivery',
|
|
113
|
-
name: '交付文本骨架',
|
|
114
|
-
slot: 'suffix',
|
|
115
|
-
body: [
|
|
116
|
-
'{{task.text}}',
|
|
117
|
-
'',
|
|
118
|
-
'{{#if repo}}📁 项目:{{repo.name}}{{#if repo.desc}} —— {{repo.desc}}{{/if}}{{/if}}',
|
|
119
|
-
'{{#each repo.docs}}',
|
|
120
|
-
' 📄 {{this.desc}}{{#if this.refId}}(nx-kv docs get --ref {{this.refId}}){{/if}}',
|
|
121
|
-
'{{/each}}',
|
|
122
|
-
].join('\n'),
|
|
123
|
-
varsSchema: [],
|
|
124
|
-
vars: {},
|
|
125
|
-
isDefault: 1,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
id: 'enhance.timegoal',
|
|
129
|
-
category: 'enhance',
|
|
130
|
-
name: '时间目标提醒',
|
|
131
|
-
slot: 'suffix',
|
|
132
|
-
body: [
|
|
133
|
-
'{{#if goal}}',
|
|
134
|
-
'⏱ 本次任务有 {{goal.durationHuman}} 的时间目标,{{goal.remainingHuman}}内应交付;',
|
|
135
|
-
'到点前先执行 timegoal check 汇报现状,未到点不得标记完成。',
|
|
136
|
-
'{{/if}}',
|
|
137
|
-
].join('\n'),
|
|
138
|
-
varsSchema: [],
|
|
139
|
-
vars: {},
|
|
140
|
-
isDefault: 1,
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
id: 'context.main',
|
|
144
|
-
category: 'context',
|
|
145
|
-
name: '仓库/组上下文',
|
|
146
|
-
slot: 'suffix',
|
|
147
|
-
body: [
|
|
148
|
-
'{{#if group}}🗂 项目组「{{group.name}}」{{#if group.desc}}:{{group.desc}}{{/if}}{{/if}}',
|
|
149
|
-
'{{#each group.docs}}\n - {{this.path}}{{/each}}',
|
|
150
|
-
].join('\n'),
|
|
151
|
-
varsSchema: [],
|
|
152
|
-
vars: {},
|
|
153
|
-
isDefault: 1,
|
|
154
|
-
},
|
|
155
115
|
]);
|
|
156
116
|
|
|
157
117
|
/**
|
package/src/web/frontend/App.tsx
CHANGED
|
@@ -129,6 +129,18 @@ function routeFromHash(): AppRoute {
|
|
|
129
129
|
scope: '',
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
+
// #151/#191:参数填写中间页(#/templates/fill/<sessionId>,会话在内存里)
|
|
133
|
+
if (rest.startsWith('fill/')) {
|
|
134
|
+
return {
|
|
135
|
+
view: 'templates',
|
|
136
|
+
key: '',
|
|
137
|
+
task: '',
|
|
138
|
+
mode: 'fill',
|
|
139
|
+
id: decodeURIComponent(rest.slice(5)),
|
|
140
|
+
topic: '',
|
|
141
|
+
scope: '',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
132
144
|
if (rest === 'new') {
|
|
133
145
|
return {
|
|
134
146
|
view: 'templates',
|
|
@@ -54,26 +54,33 @@
|
|
|
54
54
|
color: var(--ink, #16181c);
|
|
55
55
|
font-weight: 600;
|
|
56
56
|
}
|
|
57
|
-
/*
|
|
57
|
+
/* 任务段 hover 的两个 icon btn(#259:复制路径 + 预览原文)——平时隐身,
|
|
58
|
+
悬浮任务段(或键盘聚焦其按钮)才亮 */
|
|
59
|
+
.vsc-acts {
|
|
60
|
+
flex: none;
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: 1px;
|
|
64
|
+
opacity: 0;
|
|
65
|
+
transition: opacity 0.12s;
|
|
66
|
+
}
|
|
67
|
+
.vsc-crumb.is-cur:hover .vsc-acts,
|
|
68
|
+
.vsc-acts:focus-within {
|
|
69
|
+
opacity: 1;
|
|
70
|
+
}
|
|
58
71
|
.vsc-copy {
|
|
59
72
|
flex: none;
|
|
60
73
|
border: 0;
|
|
61
74
|
background: none;
|
|
62
75
|
cursor: pointer;
|
|
63
76
|
color: var(--mid, #838a93);
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
77
|
+
width: 22px;
|
|
78
|
+
height: 22px;
|
|
66
79
|
border-radius: 6px;
|
|
67
80
|
display: inline-flex;
|
|
68
81
|
align-items: center;
|
|
69
82
|
justify-content: center;
|
|
70
83
|
padding: 0;
|
|
71
|
-
opacity: 0;
|
|
72
|
-
transition: opacity 0.12s;
|
|
73
|
-
}
|
|
74
|
-
.vsc-crumbs:hover .vsc-copy,
|
|
75
|
-
.vsc-copy:focus-visible {
|
|
76
|
-
opacity: 1;
|
|
77
84
|
}
|
|
78
85
|
.vsc-copy:hover {
|
|
79
86
|
background: var(--soft, #f1f0ec);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// VS Code 式面包屑(任务页顶条,#254
|
|
2
|
-
//
|
|
1
|
+
// VS Code 式面包屑(任务页顶条,#254/#259):段间「>」分隔、点段弹同级下拉(定宽 150、
|
|
2
|
+
// 超高容器内滚);悬浮任务段亮出**两个** icon btn——复制(路径复制偏好两态)与预览
|
|
3
|
+
// (打开旁路原文子侧边栏,onPreview 由宿主任务页给)。
|
|
3
4
|
// 旧 RouteBreadcrumb([ 目录 / #N ] 方括号式)继续服务其余页面;任务页只换这条。
|
|
4
5
|
import { useMemo, useState } from 'react';
|
|
5
6
|
import { useApp } from '../../app-context.jsx';
|
|
@@ -14,10 +15,11 @@ import './vsc-crumbs.css';
|
|
|
14
15
|
interface MenuState {
|
|
15
16
|
x: number;
|
|
16
17
|
y: number;
|
|
18
|
+
width?: number;
|
|
17
19
|
items: Array<PopMenuItem | string>;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
export default function VscCrumbs() {
|
|
22
|
+
export default function VscCrumbs({ onPreview }: { onPreview?: (() => void) | null } = {}) {
|
|
21
23
|
const app = useApp();
|
|
22
24
|
const toast = useToast();
|
|
23
25
|
const [menu, setMenu] = useState<MenuState | null>(null);
|
|
@@ -34,6 +36,7 @@ export default function VscCrumbs() {
|
|
|
34
36
|
setMenu({
|
|
35
37
|
x: e.clientX,
|
|
36
38
|
y: e.clientY + 6,
|
|
39
|
+
width: 150, // #259 验收:下拉定宽 150px
|
|
37
40
|
items: seg.siblings.map((s: VscSibling) => ({
|
|
38
41
|
label: s.label,
|
|
39
42
|
icon: s.nsId ? 'flow' : undefined,
|
|
@@ -71,29 +74,48 @@ export default function VscCrumbs() {
|
|
|
71
74
|
return (
|
|
72
75
|
<div className="vsc-crumbs">
|
|
73
76
|
<nav className="vsc-crumbs-path" aria-label="当前位置">
|
|
74
|
-
{trail.segments.map((seg, i) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
{trail.segments.map((seg, i) => {
|
|
78
|
+
const isCur = i === trail.segments.length - 1;
|
|
79
|
+
return (
|
|
80
|
+
<span key={seg.kind} className={'vsc-crumb' + (isCur ? ' is-cur' : '')}>
|
|
81
|
+
{i > 0 && (
|
|
82
|
+
<span className="vsc-sep" aria-hidden>
|
|
83
|
+
>
|
|
84
|
+
</span>
|
|
85
|
+
)}
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
className="vsc-crumb-t"
|
|
89
|
+
disabled={!seg.siblings.length}
|
|
90
|
+
title={seg.siblings.length ? `显示「${seg.label}」的同级` : seg.label}
|
|
91
|
+
onClick={(e) => openSiblings(seg, e)}
|
|
92
|
+
>
|
|
93
|
+
{seg.label}
|
|
94
|
+
</button>
|
|
95
|
+
{/* #259 验收:任务段 hover 出两个 icon btn——复制路径 + 预览原文(旁路子侧边栏) */}
|
|
96
|
+
{isCur && (
|
|
97
|
+
<span className="vsc-acts">
|
|
98
|
+
<button type="button" className="vsc-copy" title={copyTitle} aria-label={copyTitle} onClick={copy}>
|
|
99
|
+
<Icon name="copy" size={13} />
|
|
100
|
+
</button>
|
|
101
|
+
{onPreview && (
|
|
102
|
+
<button
|
|
103
|
+
type="button"
|
|
104
|
+
className="vsc-copy"
|
|
105
|
+
title="预览原文(旁路打开)"
|
|
106
|
+
aria-label="预览原文"
|
|
107
|
+
onClick={onPreview}
|
|
108
|
+
>
|
|
109
|
+
<Icon name="eye" size={13} />
|
|
110
|
+
</button>
|
|
111
|
+
)}
|
|
112
|
+
</span>
|
|
113
|
+
)}
|
|
114
|
+
</span>
|
|
115
|
+
);
|
|
116
|
+
})}
|
|
92
117
|
</nav>
|
|
93
|
-
<
|
|
94
|
-
<Icon name="copy" size={13} />
|
|
95
|
-
</button>
|
|
96
|
-
{menu && <PopMenu x={menu.x} y={menu.y} items={menu.items} onClose={() => setMenu(null)} />}
|
|
118
|
+
{menu && <PopMenu x={menu.x} y={menu.y} width={menu.width} items={menu.items} onClose={() => setMenu(null)} />}
|
|
97
119
|
</div>
|
|
98
120
|
);
|
|
99
121
|
}
|
|
@@ -212,6 +212,8 @@ export interface PopMenuProps {
|
|
|
212
212
|
/** [{label, icon?, danger?, onClick}] 或 'sep';未标注类型的数组里 'sep' 会退化成 string,一并收 */
|
|
213
213
|
items: Array<PopMenuItem | string>;
|
|
214
214
|
onClose: () => void;
|
|
215
|
+
/** #259:固定宽度(px;缺省 168 起随内容伸)。要盖过 CSS 的 min-width,须连 minWidth 一起内联 */
|
|
216
|
+
width?: number;
|
|
215
217
|
}
|
|
216
218
|
|
|
217
219
|
/**
|
|
@@ -219,7 +221,7 @@ export interface PopMenuProps {
|
|
|
219
221
|
* @param {Array} items [{label, icon?, danger?, onClick}] 或 'sep'
|
|
220
222
|
* @param {Function} onClose
|
|
221
223
|
*/
|
|
222
|
-
export function PopMenu({ x, y, items, onClose }: PopMenuProps) {
|
|
224
|
+
export function PopMenu({ x, y, items, onClose, width }: PopMenuProps) {
|
|
223
225
|
const ref = useRef<HTMLDivElement | null>(null);
|
|
224
226
|
// DOM 边界:activeElement 声明为 Element|null,focus() 只在 HTMLElement 上有
|
|
225
227
|
const returnFocus = useRef<HTMLElement | null>(document.activeElement as HTMLElement | null);
|
|
@@ -268,6 +270,7 @@ export function PopMenu({ x, y, items, onClose }: PopMenuProps) {
|
|
|
268
270
|
const style: CSSProperties = {
|
|
269
271
|
left: Math.min(x ?? 0, window.innerWidth - 190),
|
|
270
272
|
top: Math.min(y ?? 0, window.innerHeight - 40 - items.length * 30),
|
|
273
|
+
...(width ? { width, minWidth: width } : {}),
|
|
271
274
|
};
|
|
272
275
|
|
|
273
276
|
return (
|
|
@@ -53,6 +53,8 @@
|
|
|
53
53
|
.pp-menu {
|
|
54
54
|
position: fixed; z-index: 100; min-width: 168px; background: var(--paper); border: 1px solid var(--soft-2);
|
|
55
55
|
border-radius: 8px; box-shadow: var(--shadow); padding: 4px; animation: pp-pop 0.1s ease;
|
|
56
|
+
/* #259:固定最大高度——同级清单长了在容器内滚,不再把菜单顶出视口 */
|
|
57
|
+
max-height: min(60vh, 440px); overflow-y: auto;
|
|
56
58
|
}
|
|
57
59
|
.rowmenu .pp-menu { position: absolute; top: calc(100% + 4px); right: 0; left: auto; }
|
|
58
60
|
.pp-menu-item {
|
|
@@ -370,6 +370,7 @@ export default function TaskPage({
|
|
|
370
370
|
projectTag={r.projectTag}
|
|
371
371
|
projectTitle={r.projectTitle}
|
|
372
372
|
searchCtx={searching ? contextOf(r.task, q) : null}
|
|
373
|
+
searchQuery={searching ? String(q || '') : ''}
|
|
373
374
|
selectable
|
|
374
375
|
picked={picked.has(r.key)}
|
|
375
376
|
onTogglePick={() => togglePick(r.key)}
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
// 整行可点开任务(div role=button,键盘可达);行内多选框 / 操作按钮
|
|
10
10
|
// stopPropagation,点它们不触发开任务。拖拽视觉类复用 rp-proj-row
|
|
11
11
|
// 的 dragging / drop-before / drop-after(styles-v2/dag.css)。
|
|
12
|
-
import type
|
|
12
|
+
import { useState, type DragEvent as ReactDragEvent, type ReactNode } from 'react';
|
|
13
13
|
import { Icon } from '../icons.jsx';
|
|
14
14
|
import StatusTag from '../status-tag/index.jsx';
|
|
15
15
|
import { taskLabel } from '../sidebar/model.js';
|
|
16
|
-
import type
|
|
16
|
+
import { contextOf, type SearchContext } from '../../modules/board/task-search.js';
|
|
17
17
|
import type { LocalTask } from '../../types.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -68,6 +68,8 @@ export interface TaskRowProps {
|
|
|
68
68
|
ops?: ReactNode;
|
|
69
69
|
/** 搜索命中上下文(#248:命中行前后各 10 行;搜索未激活或无正文命中时为 null) */
|
|
70
70
|
searchCtx?: SearchContext | null;
|
|
71
|
+
/** 当前搜索串(#192:展开全文时重算命中高亮用;不传则展开纯原文不高亮) */
|
|
72
|
+
searchQuery?: string;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
/** 短时间戳:MM-DD HH:MM(放不下原样截 16 字)。 */
|
|
@@ -115,7 +117,10 @@ export default function TaskRow({
|
|
|
115
117
|
history = false,
|
|
116
118
|
ops = null,
|
|
117
119
|
searchCtx = null,
|
|
120
|
+
searchQuery = '',
|
|
118
121
|
}: TaskRowProps) {
|
|
122
|
+
// #192:搜索上下文的「展开全文 / 收起」——纯 UI 态,每行自己持有
|
|
123
|
+
const [ctxExpanded, setCtxExpanded] = useState(false);
|
|
119
124
|
const rowCls =
|
|
120
125
|
'rp-proj-row'
|
|
121
126
|
+ (dragVisual?.dragging ? ' dragging' : '')
|
|
@@ -227,25 +232,49 @@ export default function TaskRow({
|
|
|
227
232
|
) : null}
|
|
228
233
|
</div>
|
|
229
234
|
{searchCtx ? (
|
|
230
|
-
<div
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
e
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
<span
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
235
|
+
<div className="rp-proj-task-ctx">
|
|
236
|
+
{/* #192:上下文头部——左侧说明,右侧「展开全文 / 收起」按钮(点击不开任务) */}
|
|
237
|
+
<div className="ctx-head">
|
|
238
|
+
<span className="ctx-head-label">匹配上下文</span>
|
|
239
|
+
<button
|
|
240
|
+
type="button"
|
|
241
|
+
className={'ctx-expand' + (ctxExpanded ? ' is-open' : '')}
|
|
242
|
+
title={ctxExpanded ? '收起,只看命中附近' : '展开这条任务的完整原文'}
|
|
243
|
+
onClick={(e) => {
|
|
244
|
+
e.stopPropagation();
|
|
245
|
+
setCtxExpanded((v) => !v);
|
|
246
|
+
}}
|
|
247
|
+
onKeyDown={(e) => e.stopPropagation()}
|
|
248
|
+
>
|
|
249
|
+
<Icon name="chevron" size={11} />
|
|
250
|
+
<span>{ctxExpanded ? '收起' : '展开全文'}</span>
|
|
251
|
+
</button>
|
|
252
|
+
</div>
|
|
253
|
+
<div
|
|
254
|
+
className="ctx-lines"
|
|
255
|
+
role="button"
|
|
256
|
+
tabIndex={0}
|
|
257
|
+
title="打开这条任务"
|
|
258
|
+
onClick={() => onOpen?.(t)}
|
|
259
|
+
onKeyDown={(e) => {
|
|
260
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
onOpen?.(t);
|
|
263
|
+
}
|
|
264
|
+
}}
|
|
265
|
+
>
|
|
266
|
+
{(() => {
|
|
267
|
+
const shown = ctxExpanded
|
|
268
|
+
? (contextOf(t, searchQuery, Number.MAX_SAFE_INTEGER) || searchCtx)
|
|
269
|
+
: searchCtx;
|
|
270
|
+
return shown.lines.map((l, i) => (
|
|
271
|
+
<div key={i} className={'ctx-line' + (i === shown.hitIndex ? ' hit' : '')}>
|
|
272
|
+
<span className="ctx-no">{shown.hitLineNo - shown.hitIndex + i}</span>
|
|
273
|
+
<span className="ctx-tx">{l || '\u00a0'}</span>
|
|
274
|
+
</div>
|
|
275
|
+
));
|
|
276
|
+
})()}
|
|
277
|
+
</div>
|
|
249
278
|
</div>
|
|
250
279
|
) : null}
|
|
251
280
|
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// 参数填写页的一次性会话(#151):从「新建任务」下拉点带槽位的模板时建立,
|
|
2
|
+
// 路由只带 sessionId(#/templates/fill/<id>),上下文放这里,避免给 AppRoute 加
|
|
3
|
+
// 一堆一次性的 query 键。会话是内存态——这是中间页,刷新即丢是可接受的。
|
|
4
|
+
export interface FillSession {
|
|
5
|
+
templateId: string;
|
|
6
|
+
/** 可见域三把钥匙(用于主题级模板管理返回等,当前主要供展示) */
|
|
7
|
+
topic?: string;
|
|
8
|
+
group?: string;
|
|
9
|
+
repo?: string;
|
|
10
|
+
/** 新建落点:dirKey 开目录任务页;groupId 开组锚定页 */
|
|
11
|
+
dirKey?: string;
|
|
12
|
+
groupId?: string;
|
|
13
|
+
/** 任务正文 frontmatter 的归属(组任务路由用) */
|
|
14
|
+
board?: string;
|
|
15
|
+
project?: string;
|
|
16
|
+
/** 填完是否直接提交落库(false = 进编辑页保留草稿) */
|
|
17
|
+
submit?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let seq = 0;
|
|
21
|
+
const sessions = new Map<string, FillSession>();
|
|
22
|
+
|
|
23
|
+
export function putFillSession(session: FillSession): string {
|
|
24
|
+
seq += 1;
|
|
25
|
+
const id = `fill_${Date.now().toString(36)}_${seq}`;
|
|
26
|
+
sessions.set(id, { ...session });
|
|
27
|
+
return id;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function getFillSession(id: unknown): FillSession | undefined {
|
|
31
|
+
return sessions.get(String(id || ''));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function dropFillSession(id: unknown): void {
|
|
35
|
+
sessions.delete(String(id || ''));
|
|
36
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// 「按模板新建任务」的统一入口(#151):模板正文里有 {{槽位}} 时先去参数填写
|
|
2
|
+
// 中间页,否则直接走原来的纯文本草稿路径。目录页与组页共用这一层,避免两版
|
|
3
|
+
// 下拉又漂移(用户明确要求「以 repo 那个为准」)。
|
|
4
|
+
import { putFillSession, type FillSession } from './fill-session.js';
|
|
5
|
+
import { templateSlots } from '../prompts/template-preview.js';
|
|
6
|
+
|
|
7
|
+
interface NavApp {
|
|
8
|
+
onNavigate?: (hash: string) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** 含有槽位 → 已转向参数页并返回 true;无槽位 → 调用方继续原来的新建路径。 */
|
|
12
|
+
export function startFillIfSlotted(
|
|
13
|
+
tpl: { id?: string; body?: unknown } | null | undefined,
|
|
14
|
+
ctx: Omit<FillSession, 'templateId'>,
|
|
15
|
+
app: NavApp,
|
|
16
|
+
): boolean {
|
|
17
|
+
const slots = templateSlots(tpl?.body);
|
|
18
|
+
if (!slots.length || !tpl?.id) return false;
|
|
19
|
+
const sessionId = putFillSession({ ...ctx, templateId: String(tpl.id) });
|
|
20
|
+
app.onNavigate?.(`#/templates/fill/${sessionId}`);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// 参数填写页 → 任务编辑器的一次性意图(#151)。
|
|
2
|
+
//
|
|
3
|
+
// 「直接提交」按钮需要:参数页渲染出纯文本草稿 → 开任务页 → 任务页自动触发提交
|
|
4
|
+
// 落库为待领取任务。App.openPage 的 config 只认 {dirKey|groupId, task},多带字段
|
|
5
|
+
// 会被丢掉(路由反向映射也只认这套键),所以不往 config 里塞 autoSubmit 标志,
|
|
6
|
+
// 改用一个以 docId 为键的一次性 intent:参数页 set,任务页 mount 时 take(取后即删)。
|
|
7
|
+
// StrictMode 双跑 / 重复挂载都只会消费一次。
|
|
8
|
+
export interface TaskIntent {
|
|
9
|
+
/** 进页后自动触发 submit() 落库为待领取任务 */
|
|
10
|
+
submit?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const pending = new Map<string, TaskIntent>();
|
|
14
|
+
|
|
15
|
+
const keyOf = (id: unknown): string => String(id || '');
|
|
16
|
+
|
|
17
|
+
export function setTaskIntent(id: unknown, intent: TaskIntent): void {
|
|
18
|
+
const k = keyOf(id);
|
|
19
|
+
if (k) pending.set(k, { ...intent });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** 取走并清除(同一 docId 只消费一次)。 */
|
|
23
|
+
export function takeTaskIntent(id: unknown): TaskIntent | undefined {
|
|
24
|
+
const k = keyOf(id);
|
|
25
|
+
if (!k) return undefined;
|
|
26
|
+
const v = pending.get(k);
|
|
27
|
+
if (v) pending.delete(k);
|
|
28
|
+
return v;
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// 模板正文渲染(面板侧通用工具):{{槽位名}} → 槽位值(没值就留空)。
|
|
2
|
+
//
|
|
3
|
+
// 从旧 placeholders.ts 收缩而来(v6,方案 §7):占位符目录 / 段落标记 / 参数速查表
|
|
4
|
+
// 这些**手工副本**已删除——变量目录由 prompt.registry 的 fields 派生(声明是 UI
|
|
5
|
+
// 的唯一数据源),本文件只保留与字段目录无关的纯渲染函数。
|
|
6
|
+
/** 渲染模板正文:{{槽位名}} → 槽位值(没值就留空) */
|
|
7
|
+
export function renderTemplateBody(body: unknown, values?: Record<string, unknown> | null): string {
|
|
8
|
+
const vals: Record<string, unknown> = values && typeof values === 'object' ? values : {};
|
|
9
|
+
return String(body ?? '').replace(/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g, (all, name) => {
|
|
10
|
+
const key = String(name).trim();
|
|
11
|
+
const v = vals[key];
|
|
12
|
+
return v === undefined || v === null ? '' : String(v);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// 任务模板的**预览**渲染(面板侧,纯函数):与真正生成任务用的
|
|
2
|
+
// renderTemplateBody 只差「没值的槽位怎么显示」——
|
|
3
|
+
// 生成任务:没值 → 留空(任务正文里不能出现裸 {{槽位}})
|
|
4
|
+
// 预览: 没值 → 可见占位 〔槽位名〕,用户才知道哪里要填
|
|
5
|
+
//
|
|
6
|
+
// 两套语义分开,是因为它们的消费者不同:前者进交付正文,后者进设置页的预览框。
|
|
7
|
+
// 预览**不写任何存储**、不改变真相——模板正文(templates.json / sqlite)仍是唯一真源。
|
|
8
|
+
import { withFrontmatter } from '../../../../shared/frontmatter.js';
|
|
9
|
+
import { renderTemplateBody } from './render-template-body.js';
|
|
10
|
+
|
|
11
|
+
const SLOT_RE = /\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g;
|
|
12
|
+
|
|
13
|
+
/** 模板正文里声明了哪些槽位(按首次出现顺序去重)。 */
|
|
14
|
+
export function templateSlots(body: unknown): string[] {
|
|
15
|
+
const seen = new Set<string>();
|
|
16
|
+
for (const m of String(body ?? '').matchAll(SLOT_RE)) {
|
|
17
|
+
const key = String(m[1] ?? '').trim();
|
|
18
|
+
if (key) seen.add(key);
|
|
19
|
+
}
|
|
20
|
+
return [...seen];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 预览渲染:{{槽位}} → 槽位值;没有值的槽位显示加粗占位〔槽位名〕。 */
|
|
24
|
+
export function renderTemplatePreview(
|
|
25
|
+
body: unknown,
|
|
26
|
+
values?: Record<string, unknown> | null,
|
|
27
|
+
): string {
|
|
28
|
+
const vals: Record<string, unknown> = values && typeof values === 'object' ? values : {};
|
|
29
|
+
return String(body ?? '').replace(SLOT_RE, (_all, name) => {
|
|
30
|
+
const key = String(name ?? '').trim();
|
|
31
|
+
const v = vals[key];
|
|
32
|
+
const filled = v !== undefined && v !== null && String(v).trim() !== '';
|
|
33
|
+
return filled ? String(v) : `**〔${key}〕**`;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 由模板生成的**任务正文**(#151):槽位按「没值留空」渲染成**纯文本**,
|
|
39
|
+
* 不再把模板身份写进 frontmatter —— 槽位概念的生命周期只到「任务内容生成前」,
|
|
40
|
+
* 下落到文本层(编辑器里的「模板/插槽」只读块)已被移除。
|
|
41
|
+
*
|
|
42
|
+
* 这是「模板 → 任务」的唯一入口(新建任务 / 参数页填写后 / 组页新建都走它):
|
|
43
|
+
* extra 是归属字段(board / project…),不传就是纯正文。
|
|
44
|
+
*
|
|
45
|
+
* 参数页填好的值可经 valuesOverride 传入(覆盖模板自带默认值)。
|
|
46
|
+
*/
|
|
47
|
+
export function templateDraftBody(
|
|
48
|
+
tpl: {
|
|
49
|
+
id?: string;
|
|
50
|
+
body?: unknown;
|
|
51
|
+
values?: Record<string, unknown> | null;
|
|
52
|
+
},
|
|
53
|
+
/** 同时要写的其它归属字段(board / project…) */
|
|
54
|
+
extra: Record<string, unknown> = {},
|
|
55
|
+
/** 参数页填写后的槽位值(覆盖 tpl.values);不传用模板默认值 */
|
|
56
|
+
valuesOverride?: Record<string, unknown> | null,
|
|
57
|
+
): string {
|
|
58
|
+
const values = valuesOverride !== undefined ? valuesOverride : tpl.values;
|
|
59
|
+
const body = renderTemplateBody(tpl.body, values);
|
|
60
|
+
const fields: Record<string, unknown> = { ...extra };
|
|
61
|
+
return Object.keys(fields).length ? withFrontmatter(body, fields) : body;
|
|
62
|
+
}
|