dsh-plugin-inspiration-workbench 0.7.0 → 0.9.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 CHANGED
@@ -38,6 +38,10 @@ DSH 一次只能打开一个会话:想同时看三条线的进展,只能来
38
38
  |---|---|
39
39
  | ![fanout](docs/screenshots/pipeline-fanout.png) | ![note target](docs/screenshots/pipeline-note.png) |
40
40
 
41
+ | 端口在四边中点,静止时是极淡的小点 | 悬停卡片后展开成带光环的把手 |
42
+ |---|---|
43
+ | ![ports](docs/screenshots/pipeline-ports-dark.png) | ![ports hover](docs/screenshots/pipeline-ports-hover.png) |
44
+
41
45
  | 便签投递带标题和时间戳 | 便签可设为「只保留最新」 |
42
46
  |---|---|
43
47
  | ![note template](docs/screenshots/pipeline-note-template.png) | ![note replace](docs/screenshots/pipeline-note-replace.png) |
@@ -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
@@ -505,25 +505,62 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
505
505
  overflow: visible; pointer-events: none; z-index: 1;
506
506
  }
507
507
  .iwb-links path.iwb-link {
508
- fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.6;
509
- opacity: .55; pointer-events: stroke; cursor: pointer;
508
+ fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.5;
509
+ stroke-linecap: round; opacity: .5; pointer-events: stroke; cursor: pointer;
510
+ transition: opacity .15s ease, stroke-width .15s ease;
510
511
  }
511
- .iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2; }
512
+ .iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2.2; }
512
513
  .iwb-links path.iwb-link-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
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
+ .iwb-links path.iwb-link-temp {
515
+ fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.8;
516
+ stroke-dasharray: 3 5; stroke-linecap: round; opacity: .75;
517
+ animation: iwb-flow 1s linear infinite;
518
+ }
519
+ .iwb-links path.iwb-link-arrow {
520
+ fill: var(--dsw-alias-label-deep-diving); opacity: .45; pointer-events: none;
521
+ }
522
+ .iwb-links path.iwb-link.iwb-link-active {
523
+ stroke-width: 2; opacity: .8;
524
+ stroke-dasharray: 7 7; animation: iwb-flow 1.1s linear infinite;
525
+ }
526
+ @keyframes iwb-flow { to { stroke-dashoffset: -28; } }
527
+ /* Connection handles: a whisper by default, a crisp ring on card hover. */
514
528
  .iwb-port {
515
- position: absolute; right: -5px; top: 33px; width: 12px; height: 12px;
516
- border-radius: 50%; border: 1.5px solid var(--dsw-alias-label-deep-diving);
517
- background: var(--dsw-alias-bg-layer-1); cursor: crosshair;
518
- opacity: .55; transition: opacity .12s, transform .12s; z-index: 3;
529
+ position: absolute; width: 10px; height: 10px; border-radius: 50%;
530
+ border: 0; background: var(--dsw-alias-label-deep-diving);
531
+ opacity: .38; transform: scale(.9); cursor: crosshair; z-index: 3;
532
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 55%, transparent);
533
+ transition: opacity .18s ease, transform .18s cubic-bezier(.2, .8, .3, 1.2), box-shadow .18s ease, background .18s ease;
534
+ }
535
+ .iwb-card:hover .iwb-port,
536
+ .iwb-card.iwb-focus .iwb-port {
537
+ width: 12px; height: 12px; opacity: .95; transform: scale(1);
538
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 16%, transparent);
539
+ }
540
+ .iwb-port:hover {
541
+ background: var(--dsw-alias-label-deep-diving);
542
+ transform: scale(1.25);
543
+ box-shadow: 0 0 0 4px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 20%, transparent);
519
544
  }
520
- .iwb-card:hover .iwb-port, .iwb-card.iwb-focus .iwb-port, .iwb-port:hover { opacity: 1; }
521
545
  .iwb-port::after {
522
- content: "\u2192"; position: absolute; inset: 0; display: grid; place-items: center;
523
- font-size: 8px; line-height: 1; color: var(--dsw-alias-label-deep-diving);
546
+ content: ""; position: absolute; inset: 0; border-radius: 50%;
547
+ box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 65%, transparent);
548
+ }
549
+ .iwb-port[data-side="right"] { right: -5px; top: calc(50% - 5px); }
550
+ .iwb-port[data-side="left"] { left: -5px; top: calc(50% - 5px); }
551
+ .iwb-port[data-side="top"] { top: -5px; left: calc(50% - 5px); }
552
+ .iwb-port[data-side="bottom"] { bottom: -5px; left: calc(50% - 5px); }
553
+ .iwb-card:hover .iwb-port[data-side="right"] { right: -6px; top: calc(50% - 6px); }
554
+ .iwb-card:hover .iwb-port[data-side="left"] { left: -6px; top: calc(50% - 6px); }
555
+ .iwb-card:hover .iwb-port[data-side="top"] { top: -6px; left: calc(50% - 6px); }
556
+ .iwb-card:hover .iwb-port[data-side="bottom"] { bottom: -6px; left: calc(50% - 6px); }
557
+
558
+ .iwb-card.iwb-link-target {
559
+ outline: 1.5px solid color-mix(in srgb, var(--dsw-alias-label-deep-diving) 60%, transparent);
560
+ outline-offset: 4px;
561
+ box-shadow: 0 0 0 8px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 7%, transparent);
524
562
  }
525
- .iwb-card.iwb-link-target { outline: 2px dashed var(--dsw-alias-label-deep-diving); outline-offset: 3px; }
526
- .iwb-card-note.iwb-link-target { outline-style: solid; }
563
+ .iwb-card-note.iwb-link-target { outline-color: color-mix(in srgb, var(--dsw-alias-label-deep-diving) 55%, transparent); }
527
564
  .iwb-link-menu { min-width: 230px; }
528
565
  .iwb-link-remove .iwb-model-name { color: var(--dsw-alias-state-error-primary); }
529
566
 
@@ -3068,7 +3105,11 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3068
3105
  node.dataset.sessionId = sessionId;
3069
3106
  card.el = node;
3070
3107
  world.appendChild(node);
3071
- node.appendChild(el("span", "iwb-port"));
3108
+ for (const side of ["top", "right", "bottom", "left"]) {
3109
+ const port = el("span", "iwb-port");
3110
+ port.dataset.side = side;
3111
+ node.appendChild(port);
3112
+ }
3072
3113
  node.querySelector(".iwb-card-title").textContent = card.title;
3073
3114
  const bodyRegion = node.querySelector(".iwb-body");
3074
3115
  bodyRegion.tabIndex = 0;
@@ -3789,25 +3830,51 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3789
3830
  if (targetCard) return targetCard.title || t2("untitled");
3790
3831
  return target?.id || "";
3791
3832
  }
3792
- function addPipeTarget(card, targetCard) {
3833
+ function addPipeTarget(card, targetCard, fromSide) {
3793
3834
  const kind = targetCard.kind === "note" ? "note" : "session";
3794
3835
  const id = kind === "note" ? targetCard.id : targetCard.sessionId;
3795
3836
  if (!id || targetCard === card) return false;
3796
3837
  const targets = pipeTargets(card).filter((target) => !(target.kind === kind && target.id === id));
3797
3838
  const expanded = targets.length !== pipeTargets(card).length;
3798
- targets.push({ kind, id, mode: "send" });
3839
+ targets.push({ kind, id, mode: "send", from: fromSide || "right" });
3799
3840
  setPipeTargets(card, targets);
3800
3841
  return !expanded;
3801
3842
  }
3802
- function portAnchor(card) {
3803
- return { x: card.x + card.w, y: card.y + 30 };
3804
- }
3805
- function targetAnchor(card) {
3806
- return { x: card.x, y: card.y + 30 };
3807
- }
3808
- function linkPath(from, to) {
3809
- const dx = Math.max(40, Math.abs(to.x - from.x) * 0.45);
3810
- return "M " + from.x + " " + from.y + " C " + (from.x + dx) + " " + from.y + ", " + (to.x - dx) + " " + to.y + ", " + to.x + " " + to.y;
3843
+ const EDGE_NORMAL = {
3844
+ left: { x: -1, y: 0 },
3845
+ right: { x: 1, y: 0 },
3846
+ top: { x: 0, y: -1 },
3847
+ bottom: { x: 0, y: 1 }
3848
+ };
3849
+ function edgeAnchor(card, side) {
3850
+ if (side === "left") return { x: card.x, y: card.y + card.h / 2 };
3851
+ if (side === "top") return { x: card.x + card.w / 2, y: card.y };
3852
+ if (side === "bottom") return { x: card.x + card.w / 2, y: card.y + card.h };
3853
+ return { x: card.x + card.w, y: card.y + card.h / 2 };
3854
+ }
3855
+ function sideFacing(fromPoint, target) {
3856
+ const dx = target.x + target.w / 2 - fromPoint.x;
3857
+ const dy = target.y + target.h / 2 - fromPoint.y;
3858
+ if (Math.abs(dx) >= Math.abs(dy)) return dx > 0 ? "left" : "right";
3859
+ return dy > 0 ? "top" : "bottom";
3860
+ }
3861
+ function arrowPath(point, side) {
3862
+ const normal = EDGE_NORMAL[side] || EDGE_NORMAL.left;
3863
+ const perp = { x: -normal.y, y: normal.x };
3864
+ const tip = { x: point.x - normal.x * 1, y: point.y - normal.y * 1 };
3865
+ const base = { x: point.x + normal.x * 7, y: point.y + normal.y * 7 };
3866
+ const left = { x: base.x + perp.x * 3.2, y: base.y + perp.y * 3.2 };
3867
+ const right = { x: base.x - perp.x * 3.2, y: base.y - perp.y * 3.2 };
3868
+ return "M " + tip.x + " " + tip.y + " L " + left.x + " " + left.y + " L " + right.x + " " + right.y + " Z";
3869
+ }
3870
+ function linkPath(from, to, fromSide, toSide) {
3871
+ const distance = Math.hypot(to.x - from.x, to.y - from.y);
3872
+ const bend = Math.max(36, Math.min(140, distance * 0.42));
3873
+ const fromNormal = EDGE_NORMAL[fromSide] || EDGE_NORMAL.right;
3874
+ const toNormal = EDGE_NORMAL[toSide] || EDGE_NORMAL.left;
3875
+ const c1 = { x: from.x + fromNormal.x * bend, y: from.y + fromNormal.y * bend };
3876
+ const c2 = { x: to.x + toNormal.x * bend, y: to.y + toNormal.y * bend };
3877
+ return "M " + from.x + " " + from.y + " C " + c1.x + " " + c1.y + ", " + c2.x + " " + c2.y + ", " + to.x + " " + to.y;
3811
3878
  }
3812
3879
  function renderPipelines() {
3813
3880
  while (linkLayer.firstChild) linkLayer.removeChild(linkLayer.firstChild);
@@ -3815,7 +3882,10 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3815
3882
  for (const target of pipeTargets(card)) {
3816
3883
  const targetCard = cardOfPipeTarget(target);
3817
3884
  if (!targetCard || targetCard === card) continue;
3818
- const d = linkPath(portAnchor(card), targetAnchor(targetCard));
3885
+ const fromSide = target.from || "right";
3886
+ const fromPoint = edgeAnchor(card, fromSide);
3887
+ const toSide = sideFacing(fromPoint, targetCard);
3888
+ const d = linkPath(fromPoint, edgeAnchor(targetCard, toSide), fromSide, toSide);
3819
3889
  const hit = document.createElementNS(SVG_NS, "path");
3820
3890
  hit.setAttribute("d", d);
3821
3891
  hit.setAttribute("class", "iwb-link-hit");
@@ -3825,9 +3895,12 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3825
3895
  });
3826
3896
  const path = document.createElementNS(SVG_NS, "path");
3827
3897
  path.setAttribute("d", d);
3828
- path.setAttribute("class", "iwb-link");
3898
+ path.setAttribute("class", "iwb-link" + (card.running ? " iwb-link-active" : ""));
3829
3899
  if (target.mode === "draft") path.setAttribute("stroke-dasharray", "4 4");
3830
- linkLayer.append(hit, path);
3900
+ const arrow = document.createElementNS(SVG_NS, "path");
3901
+ arrow.setAttribute("d", arrowPath(edgeAnchor(targetCard, toSide), toSide));
3902
+ arrow.setAttribute("class", "iwb-link-arrow");
3903
+ linkLayer.append(hit, path, arrow);
3831
3904
  }
3832
3905
  }
3833
3906
  }
@@ -3840,8 +3913,10 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3840
3913
  });
3841
3914
  }
3842
3915
  function bindPort(card) {
3843
- const port = card.el.querySelector(".iwb-port");
3844
- if (!port) return;
3916
+ const ports = [...card.el.querySelectorAll(".iwb-port")];
3917
+ for (const port of ports) bindOnePort(card, port);
3918
+ }
3919
+ function bindOnePort(card, port) {
3845
3920
  port.setAttribute("title", t2("pipe.port"));
3846
3921
  port.setAttribute("aria-label", t2("pipe.port"));
3847
3922
  port.addEventListener("pointerdown", (event) => {
@@ -3852,12 +3927,15 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3852
3927
  x: (clientX - canvasRect.left - state.pan.x) / state.zoom,
3853
3928
  y: (clientY - canvasRect.top - state.pan.y) / state.zoom
3854
3929
  });
3930
+ const fromSide = port.dataset.side || "right";
3931
+ const fromPoint = edgeAnchor(card, fromSide);
3855
3932
  const temp = document.createElementNS(SVG_NS, "path");
3856
3933
  temp.setAttribute("class", "iwb-link-temp");
3857
3934
  linkLayer.appendChild(temp);
3858
3935
  let hovered = null;
3859
3936
  const draw = (clientX, clientY) => {
3860
- temp.setAttribute("d", linkPath(portAnchor(card), point(clientX, clientY)));
3937
+ const to = point(clientX, clientY);
3938
+ temp.setAttribute("d", linkPath(fromPoint, to, fromSide, sideFacing(fromPoint, { x: to.x, y: to.y, w: 0, h: 0 })));
3861
3939
  };
3862
3940
  draw(event.clientX, event.clientY);
3863
3941
  try {
@@ -3885,7 +3963,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3885
3963
  temp.remove();
3886
3964
  if (hovered) {
3887
3965
  hovered.el.classList.remove("iwb-link-target");
3888
- const created = addPipeTarget(card, hovered);
3966
+ const created = addPipeTarget(card, hovered, fromSide);
3889
3967
  renderPipeBadge(card);
3890
3968
  schedulePipelines();
3891
3969
  saveSoon();
@@ -6273,7 +6351,7 @@ var zh = {
6273
6351
  "pipe.modeReplace": "\u4FBF\u7B7E\uFF1A\u53EA\u4FDD\u7559\u6700\u65B0\u4E00\u6BB5",
6274
6352
  "pipe.notedReplaced": "\u5DF2\u8986\u76D6\u4FBF\u7B7E\u300C{name}\u300D\u4E3A\u6700\u65B0\u7ED3\u679C",
6275
6353
  "pipe.removeNote": "\u5220\u9664\u8FD9\u6761\u4FBF\u7B7E\u6D41\u6C34\u7EBF",
6276
- "pipe.port": "\u62D6\u8FD9\u6761\u7EBF\u5230\u53E6\u4E00\u5F20\u5361\uFF0C\u5EFA\u7ACB\u6D41\u6C34\u7EBF",
6354
+ "pipe.port": "\u6309\u4F4F\u62D6\u52A8\u5230\u53E6\u4E00\u5F20\u5361\u4E0A\uFF0C\u5EFA\u7ACB\u6D41\u6C34\u7EBF",
6277
6355
  "pipe.created": "\u6D41\u6C34\u7EBF\u5DF2\u8FDE\u5230\u300C{name}\u300D",
6278
6356
  "pipe.needTarget": "\u62D6\u5230\u53E6\u4E00\u5F20\u5361\uFF08\u4F1A\u8BDD\u5361\u6216\u4FBF\u7B7E\uFF09\u4E0A\u624D\u7B97\u8FDE\u7EBF",
6279
6357
  "pipe.remove": "\u5220\u9664\u8FD9\u6761\u6D41\u6C34\u7EBF",
@@ -6572,7 +6650,7 @@ var en = {
6572
6650
  "pipe.modeReplace": "Note: keep only the latest",
6573
6651
  "pipe.notedReplaced": "Note \u201C{name}\u201D replaced with the latest result",
6574
6652
  "pipe.removeNote": "Remove this note pipeline",
6575
- "pipe.port": "Drag this line onto another card to wire a pipeline",
6653
+ "pipe.port": "Drag onto another card to wire a pipeline",
6576
6654
  "pipe.created": "Pipeline wired to \u201C{name}\u201D",
6577
6655
  "pipe.needTarget": "Drop it on another card (session or note) to connect",
6578
6656
  "pipe.remove": "Remove this pipeline",