dsh-plugin-inspiration-workbench 0.7.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 +61 -25
- 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 +13 -6
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
|
@@ -511,17 +511,24 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
|
|
|
511
511
|
.iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2; }
|
|
512
512
|
.iwb-links path.iwb-link-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
|
|
513
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. */
|
|
514
515
|
.iwb-port {
|
|
515
|
-
position: absolute;
|
|
516
|
-
border
|
|
516
|
+
position: absolute; width: 16px; height: 16px; border-radius: 50%;
|
|
517
|
+
border: 2px solid var(--dsw-alias-label-deep-diving);
|
|
517
518
|
background: var(--dsw-alias-bg-layer-1); cursor: crosshair;
|
|
518
|
-
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);
|
|
519
521
|
}
|
|
520
|
-
.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); }
|
|
521
524
|
.iwb-port::after {
|
|
522
|
-
content: "
|
|
523
|
-
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);
|
|
524
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); }
|
|
525
532
|
.iwb-card.iwb-link-target { outline: 2px dashed var(--dsw-alias-label-deep-diving); outline-offset: 3px; }
|
|
526
533
|
.iwb-card-note.iwb-link-target { outline-style: solid; }
|
|
527
534
|
.iwb-link-menu { min-width: 230px; }
|
|
@@ -3068,7 +3075,11 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3068
3075
|
node.dataset.sessionId = sessionId;
|
|
3069
3076
|
card.el = node;
|
|
3070
3077
|
world.appendChild(node);
|
|
3071
|
-
|
|
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
|
+
}
|
|
3072
3083
|
node.querySelector(".iwb-card-title").textContent = card.title;
|
|
3073
3084
|
const bodyRegion = node.querySelector(".iwb-body");
|
|
3074
3085
|
bodyRegion.tabIndex = 0;
|
|
@@ -3789,25 +3800,42 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3789
3800
|
if (targetCard) return targetCard.title || t2("untitled");
|
|
3790
3801
|
return target?.id || "";
|
|
3791
3802
|
}
|
|
3792
|
-
function addPipeTarget(card, targetCard) {
|
|
3803
|
+
function addPipeTarget(card, targetCard, fromSide) {
|
|
3793
3804
|
const kind = targetCard.kind === "note" ? "note" : "session";
|
|
3794
3805
|
const id = kind === "note" ? targetCard.id : targetCard.sessionId;
|
|
3795
3806
|
if (!id || targetCard === card) return false;
|
|
3796
3807
|
const targets = pipeTargets(card).filter((target) => !(target.kind === kind && target.id === id));
|
|
3797
3808
|
const expanded = targets.length !== pipeTargets(card).length;
|
|
3798
|
-
targets.push({ kind, id, mode: "send" });
|
|
3809
|
+
targets.push({ kind, id, mode: "send", from: fromSide || "right" });
|
|
3799
3810
|
setPipeTargets(card, targets);
|
|
3800
3811
|
return !expanded;
|
|
3801
3812
|
}
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
}
|
|
3808
|
-
function
|
|
3809
|
-
|
|
3810
|
-
|
|
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;
|
|
3811
3839
|
}
|
|
3812
3840
|
function renderPipelines() {
|
|
3813
3841
|
while (linkLayer.firstChild) linkLayer.removeChild(linkLayer.firstChild);
|
|
@@ -3815,7 +3843,10 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3815
3843
|
for (const target of pipeTargets(card)) {
|
|
3816
3844
|
const targetCard = cardOfPipeTarget(target);
|
|
3817
3845
|
if (!targetCard || targetCard === card) continue;
|
|
3818
|
-
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);
|
|
3819
3850
|
const hit = document.createElementNS(SVG_NS, "path");
|
|
3820
3851
|
hit.setAttribute("d", d);
|
|
3821
3852
|
hit.setAttribute("class", "iwb-link-hit");
|
|
@@ -3840,8 +3871,10 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3840
3871
|
});
|
|
3841
3872
|
}
|
|
3842
3873
|
function bindPort(card) {
|
|
3843
|
-
const
|
|
3844
|
-
|
|
3874
|
+
const ports = [...card.el.querySelectorAll(".iwb-port")];
|
|
3875
|
+
for (const port of ports) bindOnePort(card, port);
|
|
3876
|
+
}
|
|
3877
|
+
function bindOnePort(card, port) {
|
|
3845
3878
|
port.setAttribute("title", t2("pipe.port"));
|
|
3846
3879
|
port.setAttribute("aria-label", t2("pipe.port"));
|
|
3847
3880
|
port.addEventListener("pointerdown", (event) => {
|
|
@@ -3852,12 +3885,15 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3852
3885
|
x: (clientX - canvasRect.left - state.pan.x) / state.zoom,
|
|
3853
3886
|
y: (clientY - canvasRect.top - state.pan.y) / state.zoom
|
|
3854
3887
|
});
|
|
3888
|
+
const fromSide = port.dataset.side || "right";
|
|
3889
|
+
const fromPoint = edgeAnchor(card, fromSide);
|
|
3855
3890
|
const temp = document.createElementNS(SVG_NS, "path");
|
|
3856
3891
|
temp.setAttribute("class", "iwb-link-temp");
|
|
3857
3892
|
linkLayer.appendChild(temp);
|
|
3858
3893
|
let hovered = null;
|
|
3859
3894
|
const draw = (clientX, clientY) => {
|
|
3860
|
-
|
|
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 })));
|
|
3861
3897
|
};
|
|
3862
3898
|
draw(event.clientX, event.clientY);
|
|
3863
3899
|
try {
|
|
@@ -3885,7 +3921,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
|
|
|
3885
3921
|
temp.remove();
|
|
3886
3922
|
if (hovered) {
|
|
3887
3923
|
hovered.el.classList.remove("iwb-link-target");
|
|
3888
|
-
const created = addPipeTarget(card, hovered);
|
|
3924
|
+
const created = addPipeTarget(card, hovered, fromSide);
|
|
3889
3925
|
renderPipeBadge(card);
|
|
3890
3926
|
schedulePipelines();
|
|
3891
3927
|
saveSoon();
|
|
@@ -6273,7 +6309,7 @@ var zh = {
|
|
|
6273
6309
|
"pipe.modeReplace": "\u4FBF\u7B7E\uFF1A\u53EA\u4FDD\u7559\u6700\u65B0\u4E00\u6BB5",
|
|
6274
6310
|
"pipe.notedReplaced": "\u5DF2\u8986\u76D6\u4FBF\u7B7E\u300C{name}\u300D\u4E3A\u6700\u65B0\u7ED3\u679C",
|
|
6275
6311
|
"pipe.removeNote": "\u5220\u9664\u8FD9\u6761\u4FBF\u7B7E\u6D41\u6C34\u7EBF",
|
|
6276
|
-
"pipe.port": "\
|
|
6312
|
+
"pipe.port": "\u6309\u4F4F\u62D6\u52A8\u5230\u53E6\u4E00\u5F20\u5361\u4E0A\uFF0C\u5EFA\u7ACB\u6D41\u6C34\u7EBF",
|
|
6277
6313
|
"pipe.created": "\u6D41\u6C34\u7EBF\u5DF2\u8FDE\u5230\u300C{name}\u300D",
|
|
6278
6314
|
"pipe.needTarget": "\u62D6\u5230\u53E6\u4E00\u5F20\u5361\uFF08\u4F1A\u8BDD\u5361\u6216\u4FBF\u7B7E\uFF09\u4E0A\u624D\u7B97\u8FDE\u7EBF",
|
|
6279
6315
|
"pipe.remove": "\u5220\u9664\u8FD9\u6761\u6D41\u6C34\u7EBF",
|
|
@@ -6572,7 +6608,7 @@ var en = {
|
|
|
6572
6608
|
"pipe.modeReplace": "Note: keep only the latest",
|
|
6573
6609
|
"pipe.notedReplaced": "Note \u201C{name}\u201D replaced with the latest result",
|
|
6574
6610
|
"pipe.removeNote": "Remove this note pipeline",
|
|
6575
|
-
"pipe.port": "Drag
|
|
6611
|
+
"pipe.port": "Drag onto another card to wire a pipeline",
|
|
6576
6612
|
"pipe.created": "Pipeline wired to \u201C{name}\u201D",
|
|
6577
6613
|
"pipe.needTarget": "Drop it on another card (session or note) to connect",
|
|
6578
6614
|
"pipe.remove": "Remove this pipeline",
|