dsh-plugin-inspiration-workbench 0.2.0 → 0.3.0
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.md +5 -4
- package/lib/client.js +204 -54
- package/lib/client.js.map +2 -2
- package/package.json +1 -1
- package/src/client/board.js +158 -51
- package/src/client/icons.js +5 -0
- package/src/client/index.jsx +18 -0
- package/src/client/popovers.js +2 -0
- package/src/client/styles.css +31 -3
package/README.md
CHANGED
|
@@ -30,9 +30,9 @@ DSH 一次只能打开一个会话:想同时看三条线的进展,只能来
|
|
|
30
30
|
|---|---|
|
|
31
31
|
|  |  |
|
|
32
32
|
|
|
33
|
-
| 保存 / 切换画布 |
|
|
34
|
-
|
|
35
|
-
|  |
|
|
33
|
+
| 保存 / 切换画布 | 流水线:直接连线 |
|
|
34
|
+
|---|---|
|
|
35
|
+
|  |  |
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
@@ -42,6 +42,7 @@ DSH 一次只能打开一个会话:想同时看三条线的进展,只能来
|
|
|
42
42
|
- 侧栏会话行的 `+` 把会话加成卡片;侧栏点击行为不变
|
|
43
43
|
- 拖动 / 缩放 / 叠成一摞 / 双击居中 / 点空白平移 / ⌘+滚轮缩放
|
|
44
44
|
- **命名画布**:保存当前这面墙、切换回之前保存的画布、覆盖 / 删除;数据存 Host,刷新不丢
|
|
45
|
+
- **流水线**:从卡片右侧端口拖一条线到另一张卡即建立;点连线切换「自动发送 / 只填草稿」或删除
|
|
45
46
|
- 卡片头部操作常驻显示(流水线 / 大纲 / 搜索 / ⋯ / 关闭),次要操作用「⋯」收纳,窄卡片也不挤
|
|
46
47
|
- 便签卡(随手记)、钉住位置、未读圆点、复制为 Markdown、在原生会话打开
|
|
47
48
|
|
|
@@ -56,7 +57,7 @@ DSH 一次只能打开一个会话:想同时看三条线的进展,只能来
|
|
|
56
57
|
- 批量选择(⌘/Shift 点击)+ 叠放 / 对齐 / 铺开 / 关闭
|
|
57
58
|
- 排列策略:网格 / 按工作区 / 按最近活动
|
|
58
59
|
- 看板分栏:按状态 / 工作区 / 活跃度,退出恢复原位
|
|
59
|
-
-
|
|
60
|
+
- 流水线:上游卡一轮跑完,自动把结果送进下游卡;**在画布上直接拖线连接**,点线可切模式/删除(发送 or 只填草稿,3 跳防环)
|
|
60
61
|
|
|
61
62
|
**工程能力**
|
|
62
63
|
- Host 侧持久化 + SSE 多窗口同步(清站点数据可从 Host 恢复)
|
package/lib/client.js
CHANGED
|
@@ -242,7 +242,7 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
242
242
|
font-size: 10px; line-height: 15px; padding: 0 4px; flex: 0 0 auto; color: var(--dsw-alias-label-secondary);
|
|
243
243
|
background: var(--dsw-alias-bg-layer-2); border: .5px solid var(--dsw-alias-border-l2); border-radius: 5px;
|
|
244
244
|
}
|
|
245
|
-
.iwb-actions { display: flex; gap: 0; flex: 0 0 auto; opacity: .
|
|
245
|
+
.iwb-actions { display: flex; gap: 0; flex: 0 0 auto; opacity: .92; transition: opacity .12s; }
|
|
246
246
|
.iwb-card:hover .iwb-actions,
|
|
247
247
|
.iwb-card:focus-within .iwb-actions,
|
|
248
248
|
.iwb-card.iwb-focus .iwb-actions { opacity: 1; }
|
|
@@ -252,10 +252,11 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
252
252
|
.iwb-more .iwb-model-row { gap: 8px; }
|
|
253
253
|
.iwb-more-ico { display: inline-flex; color: var(--dsw-alias-label-tertiary); }
|
|
254
254
|
.iwb-actions button {
|
|
255
|
-
width:
|
|
256
|
-
color: var(--dsw-alias-label-
|
|
255
|
+
width: 23px; height: 23px; border-radius: 6px; display: grid; place-items: center;
|
|
256
|
+
color: var(--dsw-alias-label-secondary); background: none; border: 0; cursor: pointer;
|
|
257
257
|
}
|
|
258
258
|
.iwb-actions button:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
259
|
+
.iwb-actions button:focus-visible { outline: 2px solid var(--dsw-alias-label-deep-diving); outline-offset: -1px; }
|
|
259
260
|
|
|
260
261
|
.iwb-body {
|
|
261
262
|
flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 12px 4px;
|
|
@@ -494,6 +495,33 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
494
495
|
}
|
|
495
496
|
.iwb-msg-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
496
497
|
|
|
498
|
+
/* \u2500\u2500 pipeline edges \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
499
|
+
.iwb-links {
|
|
500
|
+
position: absolute; left: 0; top: 0; width: 1px; height: 1px;
|
|
501
|
+
overflow: visible; pointer-events: none; z-index: 1;
|
|
502
|
+
}
|
|
503
|
+
.iwb-links path.iwb-link {
|
|
504
|
+
fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.6;
|
|
505
|
+
opacity: .55; pointer-events: stroke; cursor: pointer;
|
|
506
|
+
}
|
|
507
|
+
.iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2; }
|
|
508
|
+
.iwb-links path.iwb-link-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
|
|
509
|
+
.iwb-links path.iwb-link-temp { fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 2; stroke-dasharray: 5 4; opacity: .9; }
|
|
510
|
+
.iwb-port {
|
|
511
|
+
position: absolute; right: -7px; top: 30px; width: 14px; height: 14px;
|
|
512
|
+
border-radius: 50%; border: 1.5px solid var(--dsw-alias-label-deep-diving);
|
|
513
|
+
background: var(--dsw-alias-bg-layer-1); cursor: crosshair;
|
|
514
|
+
opacity: .55; transition: opacity .12s, transform .12s; z-index: 3;
|
|
515
|
+
}
|
|
516
|
+
.iwb-card:hover .iwb-port, .iwb-card.iwb-focus .iwb-port, .iwb-port:hover { opacity: 1; }
|
|
517
|
+
.iwb-port::after {
|
|
518
|
+
content: "\u2192"; position: absolute; inset: 0; display: grid; place-items: center;
|
|
519
|
+
font-size: 9px; line-height: 1; color: var(--dsw-alias-label-deep-diving);
|
|
520
|
+
}
|
|
521
|
+
.iwb-card.iwb-link-target { outline: 2px dashed var(--dsw-alias-label-deep-diving); outline-offset: 3px; }
|
|
522
|
+
.iwb-link-menu { min-width: 230px; }
|
|
523
|
+
.iwb-link-remove .iwb-model-name { color: var(--dsw-alias-state-error-primary); }
|
|
524
|
+
|
|
497
525
|
/* \u2500\u2500 pipeline \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
498
526
|
.iwb-pipe-badge {
|
|
499
527
|
flex: 0 0 auto; font-size: 10px; padding: 1px 5px; border-radius: 5px;
|
|
@@ -858,6 +886,11 @@ function el(tag, className, html) {
|
|
|
858
886
|
// src/client/icons.js
|
|
859
887
|
var ICONS = {
|
|
860
888
|
plus: '<path d="M12 5v14M5 12h14"/>',
|
|
889
|
+
flow: '<path d="M4 7h9l-2-2"/><path d="M13 7l-2 2"/><circle cx="18" cy="7" r="2.4"/><path d="M4 17h9l-2-2"/><path d="M13 17l-2 2"/><circle cx="18" cy="17" r="2.4"/>',
|
|
890
|
+
more: '<circle cx="5" cy="12" r="1.7"/><circle cx="12" cy="12" r="1.7"/><circle cx="19" cy="12" r="1.7"/>',
|
|
891
|
+
canvas: '<rect x="3" y="7" width="14" height="14" rx="2"/><path d="M7 7V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-2"/>',
|
|
892
|
+
quote: '<path d="M7 7h5v5a4 4 0 0 1-4 4H7"/><path d="M15 7h5v5a4 4 0 0 1-4 4h-1"/>',
|
|
893
|
+
board: '<rect x="3" y="4" width="5.5" height="16" rx="1.4"/><rect x="9.5" y="4" width="5.5" height="11" rx="1.4"/><rect x="16" y="4" width="5" height="7" rx="1.4"/>',
|
|
861
894
|
arrange: '<rect x="3" y="3" width="7" height="7" rx="1.6"/><rect x="14" y="3" width="7" height="7" rx="1.6"/><rect x="3" y="14" width="7" height="7" rx="1.6"/><rect x="14" y="14" width="7" height="7" rx="1.6"/>',
|
|
862
895
|
fit: '<path d="M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 1 2 2v3M8 21H5a2 2 0 0 1-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"/>',
|
|
863
896
|
open: '<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><path d="M15 3h6v6"/><path d="M10 14L21 3"/>',
|
|
@@ -2154,7 +2187,8 @@ function createArrangeMenu(deps) {
|
|
|
2154
2187
|
toast,
|
|
2155
2188
|
defaultSize,
|
|
2156
2189
|
gap,
|
|
2157
|
-
anchor
|
|
2190
|
+
anchor,
|
|
2191
|
+
afterArrange
|
|
2158
2192
|
} = deps;
|
|
2159
2193
|
const el2 = el;
|
|
2160
2194
|
const DEFAULT_W2 = defaultSize.w;
|
|
@@ -2209,6 +2243,7 @@ function createArrangeMenu(deps) {
|
|
|
2209
2243
|
}
|
|
2210
2244
|
saveSoon();
|
|
2211
2245
|
void fitView();
|
|
2246
|
+
afterArrange?.();
|
|
2212
2247
|
toast(t2("arrange.done"));
|
|
2213
2248
|
}
|
|
2214
2249
|
function openArrangeMenu() {
|
|
@@ -2610,6 +2645,11 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
2610
2645
|
canvas.setAttribute("aria-label", t2("a11y.canvas"));
|
|
2611
2646
|
const world = el("div", "iwb-world");
|
|
2612
2647
|
canvas.appendChild(world);
|
|
2648
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
2649
|
+
const linkLayer = document.createElementNS(SVG_NS, "svg");
|
|
2650
|
+
linkLayer.setAttribute("class", "iwb-links");
|
|
2651
|
+
linkLayer.setAttribute("aria-hidden", "true");
|
|
2652
|
+
world.appendChild(linkLayer);
|
|
2613
2653
|
const emptyState = el(
|
|
2614
2654
|
"div",
|
|
2615
2655
|
"iwb-empty",
|
|
@@ -2642,7 +2682,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
2642
2682
|
tools.closeRefPicker();
|
|
2643
2683
|
}
|
|
2644
2684
|
});
|
|
2645
|
-
const arrangeMenu = createArrangeMenu({ t: t2, state, canvas, fitView, saveSoon, toast, defaultSize: { w: DEFAULT_W, h: DEFAULT_H }, gap: GAP, anchor: btnArrange });
|
|
2685
|
+
const arrangeMenu = createArrangeMenu({ t: t2, state, canvas, fitView, saveSoon, toast, defaultSize: { w: DEFAULT_W, h: DEFAULT_H }, gap: GAP, anchor: btnArrange, afterArrange: () => schedulePipelines() });
|
|
2646
2686
|
const workspaceMenu = createWorkspaceMenu({
|
|
2647
2687
|
t: t2,
|
|
2648
2688
|
adapter,
|
|
@@ -2788,6 +2828,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
2788
2828
|
function layoutStack(stack) {
|
|
2789
2829
|
const cards = stackCards(stack);
|
|
2790
2830
|
if (!cards.length) return;
|
|
2831
|
+
schedulePipelines();
|
|
2791
2832
|
state.zTop += cards.length + 1;
|
|
2792
2833
|
const base = state.zTop;
|
|
2793
2834
|
const inStack = cards.length > 1;
|
|
@@ -2910,7 +2951,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
2910
2951
|
return { x: 0, y: (state.cards.length + 1) * (DEFAULT_H + GAP) };
|
|
2911
2952
|
}
|
|
2912
2953
|
function cardMarkup(card) {
|
|
2913
|
-
return '<div class="iwb-progress"></div><header class="iwb-head"><span class="iwb-dot" title="' + t2("state.idle") + '"></span><span class="iwb-card-title"></span><span class="iwb-card-workspace" hidden></span><span class="iwb-status" hidden></span><span class="iwb-unread" hidden></span><button type="button" class="iwb-meta"></button><span class="iwb-elapsed"></span><span class="iwb-stack-badge" hidden></span><span class="iwb-pipe-badge" hidden></span><span class="iwb-actions"><button type="button" data-act="
|
|
2954
|
+
return '<div class="iwb-progress"></div><header class="iwb-head"><span class="iwb-dot" title="' + t2("state.idle") + '"></span><span class="iwb-card-title"></span><span class="iwb-card-workspace" hidden></span><span class="iwb-status" hidden></span><span class="iwb-unread" hidden></span><button type="button" class="iwb-meta"></button><span class="iwb-elapsed"></span><span class="iwb-stack-badge" hidden></span><span class="iwb-pipe-badge" hidden></span><span class="iwb-actions"><button type="button" data-act="outline" title="' + t2("card.outline") + '" aria-label="' + t2("card.outline") + '">' + icon("list") + '</button><button type="button" data-act="search" title="' + t2("card.search") + '" aria-label="' + t2("card.search") + '">' + icon("search") + '</button><button type="button" data-act="more" class="iwb-act-more" title="' + t2("card.more") + '" aria-label="' + t2("card.more") + '">' + icon("more") + '</button><button type="button" data-act="close" title="' + t2("remove") + '" aria-label="' + t2("remove") + '">' + icon("close") + '</button><span class="iwb-acts-more" hidden><button type="button" data-act="pin" title="' + t2("card.pin") + '" aria-label="' + t2("card.pin") + '">' + icon("pin") + '</button><button type="button" data-act="copy" title="' + t2("card.copy") + '" aria-label="' + t2("card.copy") + '">' + icon("copy") + '</button><button type="button" data-act="detach" title="' + t2("detach") + '" aria-label="' + t2("detach") + '" style="display:none">' + icon("layers") + '</button><button type="button" data-act="open" title="' + t2("openNative") + '" aria-label="' + t2("openNative") + '">' + icon("open") + '</button></span></span></header><div class="iwb-search" hidden><input class="iwb-search-input" type="text" /><span class="iwb-search-count"></span></div><div class="iwb-body"></div><div class="iwb-queue" hidden></div><div class="iwb-foot"></div><div class="iwb-resize"></div>';
|
|
2914
2955
|
}
|
|
2915
2956
|
function noteBody(card) {
|
|
2916
2957
|
const body = card.el.querySelector(".iwb-body");
|
|
@@ -3007,18 +3048,21 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3007
3048
|
node.dataset.sessionId = sessionId;
|
|
3008
3049
|
card.el = node;
|
|
3009
3050
|
world.appendChild(node);
|
|
3051
|
+
node.appendChild(el("span", "iwb-port"));
|
|
3010
3052
|
node.querySelector(".iwb-card-title").textContent = card.title;
|
|
3011
3053
|
const bodyRegion = node.querySelector(".iwb-body");
|
|
3012
3054
|
bodyRegion.tabIndex = 0;
|
|
3013
3055
|
bodyRegion.setAttribute("role", "log");
|
|
3014
3056
|
bodyRegion.setAttribute("aria-label", t2("a11y.body"));
|
|
3015
3057
|
bindCard(card);
|
|
3058
|
+
bindPort(card);
|
|
3016
3059
|
for (const [boardKey, value] of expandedTurns) {
|
|
3017
3060
|
if (!boardKey.startsWith(sessionId + ":")) continue;
|
|
3018
3061
|
card.toolOpen.set("turn:" + boardKey.slice(sessionId.length + 1), value);
|
|
3019
3062
|
}
|
|
3020
3063
|
renderFoot(card);
|
|
3021
3064
|
renderPipeBadge(card);
|
|
3065
|
+
schedulePipelines();
|
|
3022
3066
|
state.cards.push(card);
|
|
3023
3067
|
updateCounts();
|
|
3024
3068
|
updateEmptyState();
|
|
@@ -3617,6 +3661,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3617
3661
|
});
|
|
3618
3662
|
saveSoon();
|
|
3619
3663
|
void fitView();
|
|
3664
|
+
schedulePipelines();
|
|
3620
3665
|
}
|
|
3621
3666
|
function exitKanban() {
|
|
3622
3667
|
state.board.active = false;
|
|
@@ -3632,6 +3677,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3632
3677
|
state.board.saved.clear();
|
|
3633
3678
|
saveSoon();
|
|
3634
3679
|
void fitView();
|
|
3680
|
+
schedulePipelines();
|
|
3635
3681
|
btnBoard.classList.remove("iwb-btn-active");
|
|
3636
3682
|
}
|
|
3637
3683
|
function enterKanban(key, label) {
|
|
@@ -3699,6 +3745,99 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3699
3745
|
function sessionCardOf(sessionId) {
|
|
3700
3746
|
return state.cards.find((card) => card.sessionId === sessionId) || null;
|
|
3701
3747
|
}
|
|
3748
|
+
function portAnchor(card) {
|
|
3749
|
+
return { x: card.x + card.w, y: card.y + 30 };
|
|
3750
|
+
}
|
|
3751
|
+
function targetAnchor(card) {
|
|
3752
|
+
return { x: card.x, y: card.y + 30 };
|
|
3753
|
+
}
|
|
3754
|
+
function linkPath(from, to) {
|
|
3755
|
+
const dx = Math.max(40, Math.abs(to.x - from.x) * 0.45);
|
|
3756
|
+
return "M " + from.x + " " + from.y + " C " + (from.x + dx) + " " + from.y + ", " + (to.x - dx) + " " + to.y + ", " + to.x + " " + to.y;
|
|
3757
|
+
}
|
|
3758
|
+
function renderPipelines() {
|
|
3759
|
+
while (linkLayer.firstChild) linkLayer.removeChild(linkLayer.firstChild);
|
|
3760
|
+
for (const card of state.cards) {
|
|
3761
|
+
const target = card.pipeline?.targetSessionId ? sessionCardOf(card.pipeline.targetSessionId) : null;
|
|
3762
|
+
if (!target || target === card) continue;
|
|
3763
|
+
const d = linkPath(portAnchor(card), targetAnchor(target));
|
|
3764
|
+
const hit = document.createElementNS(SVG_NS, "path");
|
|
3765
|
+
hit.setAttribute("d", d);
|
|
3766
|
+
hit.setAttribute("class", "iwb-link-hit");
|
|
3767
|
+
hit.addEventListener("pointerdown", (event) => {
|
|
3768
|
+
event.stopPropagation();
|
|
3769
|
+
openPipeMenu(card, event.currentTarget);
|
|
3770
|
+
});
|
|
3771
|
+
const path = document.createElementNS(SVG_NS, "path");
|
|
3772
|
+
path.setAttribute("d", d);
|
|
3773
|
+
path.setAttribute("class", "iwb-link");
|
|
3774
|
+
if (card.pipeline.mode === "draft") path.setAttribute("stroke-dasharray", "4 4");
|
|
3775
|
+
linkLayer.append(hit, path);
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
let pipelineFrame = 0;
|
|
3779
|
+
function schedulePipelines() {
|
|
3780
|
+
if (pipelineFrame) return;
|
|
3781
|
+
pipelineFrame = requestAnimationFrame(() => {
|
|
3782
|
+
pipelineFrame = 0;
|
|
3783
|
+
renderPipelines();
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
function bindPort(card) {
|
|
3787
|
+
const port = card.el.querySelector(".iwb-port");
|
|
3788
|
+
if (!port) return;
|
|
3789
|
+
port.setAttribute("title", t2("pipe.port"));
|
|
3790
|
+
port.setAttribute("aria-label", t2("pipe.port"));
|
|
3791
|
+
port.addEventListener("pointerdown", (event) => {
|
|
3792
|
+
event.preventDefault();
|
|
3793
|
+
event.stopPropagation();
|
|
3794
|
+
const canvasRect = canvas.getBoundingClientRect();
|
|
3795
|
+
const point = (clientX, clientY) => ({
|
|
3796
|
+
x: (clientX - canvasRect.left - state.pan.x) / state.zoom,
|
|
3797
|
+
y: (clientY - canvasRect.top - state.pan.y) / state.zoom
|
|
3798
|
+
});
|
|
3799
|
+
const temp = document.createElementNS(SVG_NS, "path");
|
|
3800
|
+
temp.setAttribute("class", "iwb-link-temp");
|
|
3801
|
+
linkLayer.appendChild(temp);
|
|
3802
|
+
let hovered = null;
|
|
3803
|
+
const draw = (clientX, clientY) => {
|
|
3804
|
+
temp.setAttribute("d", linkPath(portAnchor(card), point(clientX, clientY)));
|
|
3805
|
+
};
|
|
3806
|
+
draw(event.clientX, event.clientY);
|
|
3807
|
+
port.setPointerCapture?.(event.pointerId);
|
|
3808
|
+
const onMove = (moveEvent) => {
|
|
3809
|
+
draw(moveEvent.clientX, moveEvent.clientY);
|
|
3810
|
+
const under = document.elementFromPoint(moveEvent.clientX, moveEvent.clientY);
|
|
3811
|
+
const candidate = under?.closest?.(".iwb-card");
|
|
3812
|
+
const targetCard = candidate ? state.cards.find((entry) => entry.el === candidate) : null;
|
|
3813
|
+
if (hovered && hovered !== targetCard) hovered.el.classList.remove("iwb-link-target");
|
|
3814
|
+
hovered = targetCard && targetCard !== card && targetCard.sessionId ? targetCard : null;
|
|
3815
|
+
if (hovered) hovered.el.classList.add("iwb-link-target");
|
|
3816
|
+
};
|
|
3817
|
+
const finish = (upEvent) => {
|
|
3818
|
+
port.releasePointerCapture?.(event.pointerId);
|
|
3819
|
+
port.removeEventListener("pointermove", onMove);
|
|
3820
|
+
port.removeEventListener("pointerup", finish);
|
|
3821
|
+
port.removeEventListener("pointercancel", cancel);
|
|
3822
|
+
temp.remove();
|
|
3823
|
+
if (hovered) {
|
|
3824
|
+
hovered.el.classList.remove("iwb-link-target");
|
|
3825
|
+
card.pipeline = { targetSessionId: hovered.sessionId, mode: card.pipeline?.mode || "send" };
|
|
3826
|
+
renderPipeBadge(card);
|
|
3827
|
+
schedulePipelines();
|
|
3828
|
+
saveSoon();
|
|
3829
|
+
toast(t2("pipe.created").replace("{name}", hovered.title || t2("untitled")));
|
|
3830
|
+
} else if (upEvent) {
|
|
3831
|
+
toast(t2("pipe.needTarget"));
|
|
3832
|
+
}
|
|
3833
|
+
hovered = null;
|
|
3834
|
+
};
|
|
3835
|
+
const cancel = () => finish(null);
|
|
3836
|
+
port.addEventListener("pointermove", onMove);
|
|
3837
|
+
port.addEventListener("pointerup", finish);
|
|
3838
|
+
port.addEventListener("pointercancel", cancel);
|
|
3839
|
+
});
|
|
3840
|
+
}
|
|
3702
3841
|
function renderPipeBadge(card) {
|
|
3703
3842
|
const badge = card.el?.querySelector(".iwb-pipe-badge");
|
|
3704
3843
|
if (!badge) return;
|
|
@@ -3796,70 +3935,60 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3796
3935
|
closePipeMenu();
|
|
3797
3936
|
return;
|
|
3798
3937
|
}
|
|
3799
|
-
const
|
|
3800
|
-
|
|
3938
|
+
const target = sessionCardOf(card.pipeline?.targetSessionId);
|
|
3939
|
+
if (!target) return;
|
|
3940
|
+
const pop = el("div", "iwb-popover iwb-link-menu");
|
|
3801
3941
|
pop.setAttribute("role", "dialog");
|
|
3802
3942
|
pop.setAttribute("aria-label", t2("pipe.title"));
|
|
3803
3943
|
const head = el("div", "iwb-popover-head");
|
|
3804
3944
|
head.textContent = t2("pipe.title");
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3945
|
+
const status = el("div", "iwb-popover-note");
|
|
3946
|
+
status.textContent = t2("pipe.linked").replace("{name}", target.title || t2("untitled"));
|
|
3947
|
+
pop.append(head, status);
|
|
3948
|
+
const mode = card.pipeline.mode === "draft" ? "draft" : "send";
|
|
3949
|
+
const modes = [
|
|
3950
|
+
{ id: "send", label: t2("pipe.send"), hint: t2("pipe.sendHint") },
|
|
3951
|
+
{ id: "draft", label: t2("pipe.draft"), hint: t2("pipe.draftHint") }
|
|
3952
|
+
];
|
|
3953
|
+
for (const option of modes) {
|
|
3954
|
+
const row = el("button", "iwb-model-row" + (mode === option.id ? " current" : ""));
|
|
3814
3955
|
row.type = "button";
|
|
3815
|
-
row.innerHTML = '<span class="iwb-model-main"><span class="iwb-model-name"></span><span class="iwb-model-desc"></span></span>' + (
|
|
3816
|
-
row.querySelector(".iwb-model-name").textContent = label;
|
|
3817
|
-
row.querySelector(".iwb-model-desc").textContent =
|
|
3956
|
+
row.innerHTML = '<span class="iwb-model-main"><span class="iwb-model-name"></span><span class="iwb-model-desc"></span></span>' + (mode === option.id ? '<span class="iwb-check">\u2713</span>' : "");
|
|
3957
|
+
row.querySelector(".iwb-model-name").textContent = option.label;
|
|
3958
|
+
row.querySelector(".iwb-model-desc").textContent = option.hint;
|
|
3818
3959
|
row.addEventListener("click", (event) => {
|
|
3819
3960
|
event.stopPropagation();
|
|
3961
|
+
card.pipeline = { ...card.pipeline, mode: option.id };
|
|
3962
|
+
renderPipeBadge(card);
|
|
3963
|
+
schedulePipelines();
|
|
3964
|
+
saveSoon();
|
|
3820
3965
|
closePipeMenu();
|
|
3821
|
-
|
|
3966
|
+
toast(option.id === "draft" ? t2("pipe.modeDraft") : t2("pipe.modeSend"));
|
|
3822
3967
|
});
|
|
3823
3968
|
pop.appendChild(row);
|
|
3824
|
-
};
|
|
3825
|
-
for (const target of targets) {
|
|
3826
|
-
addRow(
|
|
3827
|
-
target.title || t2("untitled"),
|
|
3828
|
-
target.workspace || t2("workspace.none"),
|
|
3829
|
-
() => {
|
|
3830
|
-
card.pipeline = { targetSessionId: target.sessionId, mode: card.pipeline?.mode || "send" };
|
|
3831
|
-
renderPipeBadge(card);
|
|
3832
|
-
saveSoon();
|
|
3833
|
-
toast(t2("pipe.linked").replace("{name}", target.title || t2("untitled")));
|
|
3834
|
-
},
|
|
3835
|
-
current === target.sessionId
|
|
3836
|
-
);
|
|
3837
|
-
}
|
|
3838
|
-
if (card.pipeline?.targetSessionId) {
|
|
3839
|
-
addRow(
|
|
3840
|
-
card.pipeline.mode === "draft" ? t2("pipe.send") : t2("pipe.draft"),
|
|
3841
|
-
card.pipeline.mode === "draft" ? t2("pipe.modeDraftHint") : t2("pipe.modeSendHint"),
|
|
3842
|
-
() => {
|
|
3843
|
-
card.pipeline = { ...card.pipeline, mode: card.pipeline.mode === "draft" ? "send" : "draft" };
|
|
3844
|
-
saveSoon();
|
|
3845
|
-
toast(card.pipeline.mode === "draft" ? t2("pipe.draft") : t2("pipe.send"));
|
|
3846
|
-
},
|
|
3847
|
-
false
|
|
3848
|
-
);
|
|
3849
|
-
addRow(t2("pipe.off"), "", () => {
|
|
3850
|
-
card.pipeline = null;
|
|
3851
|
-
renderPipeBadge(card);
|
|
3852
|
-
saveSoon();
|
|
3853
|
-
}, false);
|
|
3854
3969
|
}
|
|
3970
|
+
const remove = el("button", "iwb-model-row iwb-link-remove");
|
|
3971
|
+
remove.type = "button";
|
|
3972
|
+
remove.innerHTML = '<span class="iwb-model-main"><span class="iwb-model-name"></span></span>';
|
|
3973
|
+
remove.querySelector(".iwb-model-name").textContent = t2("pipe.remove");
|
|
3974
|
+
remove.addEventListener("click", (event) => {
|
|
3975
|
+
event.stopPropagation();
|
|
3976
|
+
card.pipeline = null;
|
|
3977
|
+
renderPipeBadge(card);
|
|
3978
|
+
schedulePipelines();
|
|
3979
|
+
saveSoon();
|
|
3980
|
+
closePipeMenu();
|
|
3981
|
+
toast(t2("pipe.removed"));
|
|
3982
|
+
});
|
|
3983
|
+
pop.appendChild(remove);
|
|
3855
3984
|
const rect = anchor.getBoundingClientRect();
|
|
3856
|
-
pop.style.left = Math.round(Math.max(8, Math.min(rect.left -
|
|
3857
|
-
pop.style.top = Math.round(rect.
|
|
3985
|
+
pop.style.left = Math.round(Math.max(8, Math.min(rect.left + rect.width / 2 - 110, window.innerWidth - 240))) + "px";
|
|
3986
|
+
pop.style.top = Math.round(rect.top + rect.height + 8) + "px";
|
|
3858
3987
|
document.body.appendChild(pop);
|
|
3859
3988
|
pipePop = pop;
|
|
3860
3989
|
const measured = pop.getBoundingClientRect();
|
|
3861
3990
|
if (measured.bottom > window.innerHeight - 8) {
|
|
3862
|
-
pop.style.top = Math.max(8, Math.round(rect.top - measured.height -
|
|
3991
|
+
pop.style.top = Math.max(8, Math.round(rect.top - measured.height - 8)) + "px";
|
|
3863
3992
|
}
|
|
3864
3993
|
}
|
|
3865
3994
|
function syncApprovalSessions() {
|
|
@@ -3879,6 +4008,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3879
4008
|
} catch {
|
|
3880
4009
|
}
|
|
3881
4010
|
state.cards = state.cards.filter((c) => c !== card);
|
|
4011
|
+
schedulePipelines();
|
|
3882
4012
|
if (state.selected.delete(card.id)) renderBatchBar();
|
|
3883
4013
|
if (state.focusedId === card.id) {
|
|
3884
4014
|
state.focusedId = null;
|
|
@@ -4510,6 +4640,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
4510
4640
|
node.style.left = nx + "px";
|
|
4511
4641
|
node.style.top = ny + "px";
|
|
4512
4642
|
}
|
|
4643
|
+
schedulePipelines();
|
|
4513
4644
|
};
|
|
4514
4645
|
const up = () => {
|
|
4515
4646
|
interactionActive = false;
|
|
@@ -4656,6 +4787,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
4656
4787
|
updateEmptyState();
|
|
4657
4788
|
syncApprovalSessions();
|
|
4658
4789
|
updateTodoBar();
|
|
4790
|
+
schedulePipelines();
|
|
4659
4791
|
clearTimeout(saveTimer);
|
|
4660
4792
|
saveTimer = 0;
|
|
4661
4793
|
void syncFromRemote().then(() => startRemoteSync());
|
|
@@ -5992,6 +6124,15 @@ var zh = {
|
|
|
5992
6124
|
"pipe.linked": "\u6D41\u6C34\u7EBF\u5DF2\u6307\u5411\u300C{name}\u300D",
|
|
5993
6125
|
"pipe.modeSendHint": "\u5F53\u524D\uFF1A\u5B8C\u6210\u540E\u81EA\u52A8\u53D1\u9001",
|
|
5994
6126
|
"pipe.modeDraftHint": "\u5F53\u524D\uFF1A\u53EA\u586B\u5165\u8349\u7A3F",
|
|
6127
|
+
"pipe.port": "\u62D6\u8FD9\u6761\u7EBF\u5230\u53E6\u4E00\u5F20\u5361\uFF0C\u5EFA\u7ACB\u6D41\u6C34\u7EBF",
|
|
6128
|
+
"pipe.created": "\u6D41\u6C34\u7EBF\u5DF2\u8FDE\u5230\u300C{name}\u300D",
|
|
6129
|
+
"pipe.needTarget": "\u62D6\u5230\u53E6\u4E00\u5F20\u4F1A\u8BDD\u5361\u4E0A\u624D\u7B97\u8FDE\u7EBF",
|
|
6130
|
+
"pipe.remove": "\u5220\u9664\u8FD9\u6761\u6D41\u6C34\u7EBF",
|
|
6131
|
+
"pipe.removed": "\u6D41\u6C34\u7EBF\u5DF2\u5220\u9664",
|
|
6132
|
+
"pipe.sendHint": "\u5B8C\u6210\u540E\u81EA\u52A8\u628A\u7ED3\u679C\u53D1\u8FC7\u53BB",
|
|
6133
|
+
"pipe.draftHint": "\u53EA\u586B\u8FDB\u4E0B\u6E38\u8F93\u5165\u6846\uFF0C\u7B49\u4EBA\u786E\u8BA4",
|
|
6134
|
+
"pipe.modeSend": "\u5DF2\u5207\u5230\uFF1A\u81EA\u52A8\u53D1\u9001",
|
|
6135
|
+
"pipe.modeDraft": "\u5DF2\u5207\u5230\uFF1A\u53EA\u586B\u8349\u7A3F",
|
|
5995
6136
|
"pipe.title": "\u6D41\u6C34\u7EBF\uFF1A\u5B8C\u6210\u540E\u628A\u7ED3\u679C\u9001\u5230\u4E0B\u6E38\u5361",
|
|
5996
6137
|
"pipe.to": "\u4E0B\u6E38\u5361\u7247",
|
|
5997
6138
|
"pipe.send": "\u81EA\u52A8\u53D1\u9001\u5230\u4E0B\u6E38",
|
|
@@ -6268,6 +6409,15 @@ var en = {
|
|
|
6268
6409
|
"pipe.linked": "Pipeline points at \u201C{name}\u201D",
|
|
6269
6410
|
"pipe.modeSendHint": "Currently: auto-send on completion",
|
|
6270
6411
|
"pipe.modeDraftHint": "Currently: draft only",
|
|
6412
|
+
"pipe.port": "Drag this line onto another card to wire a pipeline",
|
|
6413
|
+
"pipe.created": "Pipeline wired to \u201C{name}\u201D",
|
|
6414
|
+
"pipe.needTarget": "Drop it on another session card to connect",
|
|
6415
|
+
"pipe.remove": "Remove this pipeline",
|
|
6416
|
+
"pipe.removed": "Pipeline removed",
|
|
6417
|
+
"pipe.sendHint": "Send the result downstream when the turn finishes",
|
|
6418
|
+
"pipe.draftHint": "Only fill the downstream composer",
|
|
6419
|
+
"pipe.modeSend": "Mode: auto-send",
|
|
6420
|
+
"pipe.modeDraft": "Mode: draft only",
|
|
6271
6421
|
"pipe.title": "Pipeline: forward this card's result downstream",
|
|
6272
6422
|
"pipe.to": "Downstream card",
|
|
6273
6423
|
"pipe.send": "Auto-send downstream",
|