dsh-plugin-inspiration-workbench 0.6.0 → 0.8.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 -1
- package/lib/client.js +84 -29
- package/lib/client.js.map +2 -2
- package/package.json +1 -1
- package/src/client/board.js +48 -15
- package/src/client/index.jsx +2 -2
- package/src/client/styles.css +36 -10
package/README.md
CHANGED
|
@@ -38,6 +38,10 @@ DSH 一次只能打开一个会话:想同时看三条线的进展,只能来
|
|
|
38
38
|
|---|---|
|
|
39
39
|
|  |  |
|
|
40
40
|
|
|
41
|
+
| 端口在四边中点,随便哪个方向都能连 |
|
|
42
|
+
|---|
|
|
43
|
+
|  |
|
|
44
|
+
|
|
41
45
|
| 便签投递带标题和时间戳 | 便签可设为「只保留最新」 |
|
|
42
46
|
|---|---|
|
|
43
47
|
|  |  |
|
|
@@ -50,7 +54,7 @@ DSH 一次只能打开一个会话:想同时看三条线的进展,只能来
|
|
|
50
54
|
- 侧栏会话行的 `+` 把会话加成卡片;侧栏点击行为不变
|
|
51
55
|
- 拖动 / 缩放 / 叠成一摞 / 双击居中 / 点空白平移 / ⌘+滚轮缩放
|
|
52
56
|
- **命名画布**:保存当前这面墙、切换回之前保存的画布、覆盖 / 删除;数据存 Host,刷新不丢
|
|
53
|
-
-
|
|
57
|
+
- **流水线**:卡片四条边的中点各有一个端口,从任意一条边拖线到另一张卡即建立;**一条卡可连多个下游**(扇出),下游可以是会话卡,也可以是**便签卡**(结果按 `## 来自「卡片名」 · 时间` 分块写入;便签可选「追加」或「只保留最新一段」);点连线切换「自动发送 / 只填草稿」或删除
|
|
54
58
|
- 卡片头部操作常驻显示(流水线 / 大纲 / 搜索 / ⋯ / 关闭),次要操作用「⋯」收纳,窄卡片也不挤
|
|
55
59
|
- 便签卡(随手记)、钉住位置、未读圆点、复制为 Markdown、在原生会话打开
|
|
56
60
|
|
package/lib/client.js
CHANGED
|
@@ -142,7 +142,7 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
142
142
|
@keyframes iwb-sweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
|
|
143
143
|
|
|
144
144
|
.iwb-head {
|
|
145
|
-
flex: 0 0 auto; height:
|
|
145
|
+
flex: 0 0 auto; height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px;
|
|
146
146
|
border-bottom: .5px solid var(--dsw-alias-border-l1); cursor: grab; user-select: none;
|
|
147
147
|
}
|
|
148
148
|
.iwb-dragging .iwb-head { cursor: grabbing; }
|
|
@@ -199,7 +199,7 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
199
199
|
}
|
|
200
200
|
.iwb-dot.waiting { background: var(--dsw-alias-state-warn-primary); box-shadow: none; }
|
|
201
201
|
.iwb-card-workspace {
|
|
202
|
-
flex: 0
|
|
202
|
+
flex: 0 1 auto; max-width: 78px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
203
203
|
font-size: 10.5px; line-height: 16px; padding: 0 5px; border-radius: 5px;
|
|
204
204
|
color: var(--dsw-alias-label-tertiary); background: var(--dsw-alias-bg-layer-2);
|
|
205
205
|
border: .5px solid var(--dsw-alias-border-l2);
|
|
@@ -237,12 +237,15 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
237
237
|
.iwb-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
238
238
|
.iwb-model-desc { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
239
239
|
.iwb-check { flex: 0 0 auto; font-size: 11px; color: var(--dsw-alias-label-deep-diving); width: 12px; }
|
|
240
|
-
.iwb-elapsed { font-size: 10px; color: var(--dsw-alias-label-caption); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
|
|
240
|
+
.iwb-elapsed { font-size: 10px; color: var(--dsw-alias-label-caption); font-variant-numeric: tabular-nums; flex: 0 0 auto; opacity: .85; }
|
|
241
241
|
.iwb-stack-badge {
|
|
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 {
|
|
245
|
+
.iwb-actions {
|
|
246
|
+
display: flex; gap: 4px; flex: 0 0 auto; opacity: .92; transition: opacity .12s;
|
|
247
|
+
margin-left: 1px; padding-left: 6px; border-left: .5px solid var(--dsw-alias-border-l1);
|
|
248
|
+
}
|
|
246
249
|
.iwb-card:hover .iwb-actions,
|
|
247
250
|
.iwb-card:focus-within .iwb-actions,
|
|
248
251
|
.iwb-card.iwb-focus .iwb-actions { opacity: 1; }
|
|
@@ -256,6 +259,7 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
256
259
|
color: var(--dsw-alias-label-secondary); background: none; border: 0; cursor: pointer;
|
|
257
260
|
}
|
|
258
261
|
.iwb-actions button:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
262
|
+
.iwb-actions svg { width: 15px; height: 15px; }
|
|
259
263
|
.iwb-actions button:focus-visible { outline: 2px solid var(--dsw-alias-label-deep-diving); outline-offset: -1px; }
|
|
260
264
|
|
|
261
265
|
.iwb-body {
|
|
@@ -507,17 +511,24 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
507
511
|
.iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2; }
|
|
508
512
|
.iwb-links path.iwb-link-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
|
|
509
513
|
.iwb-links path.iwb-link-temp { fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 2; stroke-dasharray: 5 4; opacity: .9; }
|
|
514
|
+
/* Connection handles: one at the middle of each edge, always visible. */
|
|
510
515
|
.iwb-port {
|
|
511
|
-
position: absolute;
|
|
512
|
-
border
|
|
516
|
+
position: absolute; width: 16px; height: 16px; border-radius: 50%;
|
|
517
|
+
border: 2px solid var(--dsw-alias-label-deep-diving);
|
|
513
518
|
background: var(--dsw-alias-bg-layer-1); cursor: crosshair;
|
|
514
|
-
opacity: .
|
|
519
|
+
opacity: .62; transition: opacity .12s, transform .12s, background .12s; z-index: 3;
|
|
520
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 70%, transparent);
|
|
515
521
|
}
|
|
516
|
-
.iwb-card:hover .iwb-port, .iwb-card.iwb-focus .iwb-port
|
|
522
|
+
.iwb-card:hover .iwb-port, .iwb-card.iwb-focus .iwb-port { opacity: .95; }
|
|
523
|
+
.iwb-port:hover { opacity: 1; transform: scale(1.15); background: var(--dsw-alias-bg-layer-2); }
|
|
517
524
|
.iwb-port::after {
|
|
518
|
-
content: "
|
|
519
|
-
font-size:
|
|
525
|
+
content: "+"; position: absolute; inset: 0; display: grid; place-items: center;
|
|
526
|
+
font-size: 11px; line-height: 1; font-weight: 500; color: var(--dsw-alias-label-deep-diving);
|
|
520
527
|
}
|
|
528
|
+
.iwb-port[data-side="right"] { right: -8px; top: calc(50% - 8px); }
|
|
529
|
+
.iwb-port[data-side="left"] { left: -8px; top: calc(50% - 8px); }
|
|
530
|
+
.iwb-port[data-side="top"] { top: -8px; left: calc(50% - 8px); }
|
|
531
|
+
.iwb-port[data-side="bottom"] { bottom: -8px; left: calc(50% - 8px); }
|
|
521
532
|
.iwb-card.iwb-link-target { outline: 2px dashed var(--dsw-alias-label-deep-diving); outline-offset: 3px; }
|
|
522
533
|
.iwb-card-note.iwb-link-target { outline-style: solid; }
|
|
523
534
|
.iwb-link-menu { min-width: 230px; }
|
|
@@ -568,6 +579,21 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
568
579
|
.iwb-card.iwb-selected .iwb-head { border-bottom-color: color-mix(in srgb, var(--dsw-alias-label-deep-diving) 55%, transparent); }
|
|
569
580
|
.iwb-arrange { min-width: 190px; }
|
|
570
581
|
|
|
582
|
+
/* \u2500\u2500 narrow cards: keep the header breathable \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
583
|
+
.iwb-card { container-type: inline-size; }
|
|
584
|
+
@container (max-width: 430px) {
|
|
585
|
+
.iwb-head { gap: 6px; padding-right: 6px; }
|
|
586
|
+
.iwb-card-workspace { display: none; }
|
|
587
|
+
.iwb-meta { max-width: 96px; }
|
|
588
|
+
.iwb-pipe-badge { max-width: 68px; }
|
|
589
|
+
.iwb-actions { gap: 3px; padding-left: 4px; }
|
|
590
|
+
}
|
|
591
|
+
@container (max-width: 355px) {
|
|
592
|
+
.iwb-elapsed { display: none; }
|
|
593
|
+
.iwb-meta { max-width: 78px; }
|
|
594
|
+
.iwb-actions button { width: 21px; height: 21px; }
|
|
595
|
+
}
|
|
596
|
+
|
|
571
597
|
/* \u2500\u2500 keyboard focus \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 */
|
|
572
598
|
.iwb-card { outline: none; }
|
|
573
599
|
.iwb-card.iwb-focus,
|
|
@@ -3049,7 +3075,11 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3049
3075
|
node.dataset.sessionId = sessionId;
|
|
3050
3076
|
card.el = node;
|
|
3051
3077
|
world.appendChild(node);
|
|
3052
|
-
|
|
3078
|
+
for (const side of ["top", "right", "bottom", "left"]) {
|
|
3079
|
+
const port = el("span", "iwb-port");
|
|
3080
|
+
port.dataset.side = side;
|
|
3081
|
+
node.appendChild(port);
|
|
3082
|
+
}
|
|
3053
3083
|
node.querySelector(".iwb-card-title").textContent = card.title;
|
|
3054
3084
|
const bodyRegion = node.querySelector(".iwb-body");
|
|
3055
3085
|
bodyRegion.tabIndex = 0;
|
|
@@ -3770,25 +3800,42 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3770
3800
|
if (targetCard) return targetCard.title || t2("untitled");
|
|
3771
3801
|
return target?.id || "";
|
|
3772
3802
|
}
|
|
3773
|
-
function addPipeTarget(card, targetCard) {
|
|
3803
|
+
function addPipeTarget(card, targetCard, fromSide) {
|
|
3774
3804
|
const kind = targetCard.kind === "note" ? "note" : "session";
|
|
3775
3805
|
const id = kind === "note" ? targetCard.id : targetCard.sessionId;
|
|
3776
3806
|
if (!id || targetCard === card) return false;
|
|
3777
3807
|
const targets = pipeTargets(card).filter((target) => !(target.kind === kind && target.id === id));
|
|
3778
3808
|
const expanded = targets.length !== pipeTargets(card).length;
|
|
3779
|
-
targets.push({ kind, id, mode: "send" });
|
|
3809
|
+
targets.push({ kind, id, mode: "send", from: fromSide || "right" });
|
|
3780
3810
|
setPipeTargets(card, targets);
|
|
3781
3811
|
return !expanded;
|
|
3782
3812
|
}
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
}
|
|
3789
|
-
function
|
|
3790
|
-
|
|
3791
|
-
|
|
3813
|
+
const EDGE_NORMAL = {
|
|
3814
|
+
left: { x: -1, y: 0 },
|
|
3815
|
+
right: { x: 1, y: 0 },
|
|
3816
|
+
top: { x: 0, y: -1 },
|
|
3817
|
+
bottom: { x: 0, y: 1 }
|
|
3818
|
+
};
|
|
3819
|
+
function edgeAnchor(card, side) {
|
|
3820
|
+
if (side === "left") return { x: card.x, y: card.y + card.h / 2 };
|
|
3821
|
+
if (side === "top") return { x: card.x + card.w / 2, y: card.y };
|
|
3822
|
+
if (side === "bottom") return { x: card.x + card.w / 2, y: card.y + card.h };
|
|
3823
|
+
return { x: card.x + card.w, y: card.y + card.h / 2 };
|
|
3824
|
+
}
|
|
3825
|
+
function sideFacing(fromPoint, target) {
|
|
3826
|
+
const dx = target.x + target.w / 2 - fromPoint.x;
|
|
3827
|
+
const dy = target.y + target.h / 2 - fromPoint.y;
|
|
3828
|
+
if (Math.abs(dx) >= Math.abs(dy)) return dx > 0 ? "left" : "right";
|
|
3829
|
+
return dy > 0 ? "top" : "bottom";
|
|
3830
|
+
}
|
|
3831
|
+
function linkPath(from, to, fromSide, toSide) {
|
|
3832
|
+
const distance = Math.hypot(to.x - from.x, to.y - from.y);
|
|
3833
|
+
const bend = Math.max(36, Math.min(140, distance * 0.42));
|
|
3834
|
+
const fromNormal = EDGE_NORMAL[fromSide] || EDGE_NORMAL.right;
|
|
3835
|
+
const toNormal = EDGE_NORMAL[toSide] || EDGE_NORMAL.left;
|
|
3836
|
+
const c1 = { x: from.x + fromNormal.x * bend, y: from.y + fromNormal.y * bend };
|
|
3837
|
+
const c2 = { x: to.x + toNormal.x * bend, y: to.y + toNormal.y * bend };
|
|
3838
|
+
return "M " + from.x + " " + from.y + " C " + c1.x + " " + c1.y + ", " + c2.x + " " + c2.y + ", " + to.x + " " + to.y;
|
|
3792
3839
|
}
|
|
3793
3840
|
function renderPipelines() {
|
|
3794
3841
|
while (linkLayer.firstChild) linkLayer.removeChild(linkLayer.firstChild);
|
|
@@ -3796,7 +3843,10 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3796
3843
|
for (const target of pipeTargets(card)) {
|
|
3797
3844
|
const targetCard = cardOfPipeTarget(target);
|
|
3798
3845
|
if (!targetCard || targetCard === card) continue;
|
|
3799
|
-
const
|
|
3846
|
+
const fromSide = target.from || "right";
|
|
3847
|
+
const fromPoint = edgeAnchor(card, fromSide);
|
|
3848
|
+
const toSide = sideFacing(fromPoint, targetCard);
|
|
3849
|
+
const d = linkPath(fromPoint, edgeAnchor(targetCard, toSide), fromSide, toSide);
|
|
3800
3850
|
const hit = document.createElementNS(SVG_NS, "path");
|
|
3801
3851
|
hit.setAttribute("d", d);
|
|
3802
3852
|
hit.setAttribute("class", "iwb-link-hit");
|
|
@@ -3821,8 +3871,10 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3821
3871
|
});
|
|
3822
3872
|
}
|
|
3823
3873
|
function bindPort(card) {
|
|
3824
|
-
const
|
|
3825
|
-
|
|
3874
|
+
const ports = [...card.el.querySelectorAll(".iwb-port")];
|
|
3875
|
+
for (const port of ports) bindOnePort(card, port);
|
|
3876
|
+
}
|
|
3877
|
+
function bindOnePort(card, port) {
|
|
3826
3878
|
port.setAttribute("title", t2("pipe.port"));
|
|
3827
3879
|
port.setAttribute("aria-label", t2("pipe.port"));
|
|
3828
3880
|
port.addEventListener("pointerdown", (event) => {
|
|
@@ -3833,12 +3885,15 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3833
3885
|
x: (clientX - canvasRect.left - state.pan.x) / state.zoom,
|
|
3834
3886
|
y: (clientY - canvasRect.top - state.pan.y) / state.zoom
|
|
3835
3887
|
});
|
|
3888
|
+
const fromSide = port.dataset.side || "right";
|
|
3889
|
+
const fromPoint = edgeAnchor(card, fromSide);
|
|
3836
3890
|
const temp = document.createElementNS(SVG_NS, "path");
|
|
3837
3891
|
temp.setAttribute("class", "iwb-link-temp");
|
|
3838
3892
|
linkLayer.appendChild(temp);
|
|
3839
3893
|
let hovered = null;
|
|
3840
3894
|
const draw = (clientX, clientY) => {
|
|
3841
|
-
|
|
3895
|
+
const to = point(clientX, clientY);
|
|
3896
|
+
temp.setAttribute("d", linkPath(fromPoint, to, fromSide, sideFacing(fromPoint, { x: to.x, y: to.y, w: 0, h: 0 })));
|
|
3842
3897
|
};
|
|
3843
3898
|
draw(event.clientX, event.clientY);
|
|
3844
3899
|
try {
|
|
@@ -3866,7 +3921,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3866
3921
|
temp.remove();
|
|
3867
3922
|
if (hovered) {
|
|
3868
3923
|
hovered.el.classList.remove("iwb-link-target");
|
|
3869
|
-
const created = addPipeTarget(card, hovered);
|
|
3924
|
+
const created = addPipeTarget(card, hovered, fromSide);
|
|
3870
3925
|
renderPipeBadge(card);
|
|
3871
3926
|
schedulePipelines();
|
|
3872
3927
|
saveSoon();
|
|
@@ -6254,7 +6309,7 @@ var zh = {
|
|
|
6254
6309
|
"pipe.modeReplace": "\u4FBF\u7B7E\uFF1A\u53EA\u4FDD\u7559\u6700\u65B0\u4E00\u6BB5",
|
|
6255
6310
|
"pipe.notedReplaced": "\u5DF2\u8986\u76D6\u4FBF\u7B7E\u300C{name}\u300D\u4E3A\u6700\u65B0\u7ED3\u679C",
|
|
6256
6311
|
"pipe.removeNote": "\u5220\u9664\u8FD9\u6761\u4FBF\u7B7E\u6D41\u6C34\u7EBF",
|
|
6257
|
-
"pipe.port": "\
|
|
6312
|
+
"pipe.port": "\u6309\u4F4F\u62D6\u52A8\u5230\u53E6\u4E00\u5F20\u5361\u4E0A\uFF0C\u5EFA\u7ACB\u6D41\u6C34\u7EBF",
|
|
6258
6313
|
"pipe.created": "\u6D41\u6C34\u7EBF\u5DF2\u8FDE\u5230\u300C{name}\u300D",
|
|
6259
6314
|
"pipe.needTarget": "\u62D6\u5230\u53E6\u4E00\u5F20\u5361\uFF08\u4F1A\u8BDD\u5361\u6216\u4FBF\u7B7E\uFF09\u4E0A\u624D\u7B97\u8FDE\u7EBF",
|
|
6260
6315
|
"pipe.remove": "\u5220\u9664\u8FD9\u6761\u6D41\u6C34\u7EBF",
|
|
@@ -6553,7 +6608,7 @@ var en = {
|
|
|
6553
6608
|
"pipe.modeReplace": "Note: keep only the latest",
|
|
6554
6609
|
"pipe.notedReplaced": "Note \u201C{name}\u201D replaced with the latest result",
|
|
6555
6610
|
"pipe.removeNote": "Remove this note pipeline",
|
|
6556
|
-
"pipe.port": "Drag
|
|
6611
|
+
"pipe.port": "Drag onto another card to wire a pipeline",
|
|
6557
6612
|
"pipe.created": "Pipeline wired to \u201C{name}\u201D",
|
|
6558
6613
|
"pipe.needTarget": "Drop it on another card (session or note) to connect",
|
|
6559
6614
|
"pipe.remove": "Remove this pipeline",
|