Skip to content

roxorlt/UEmaster / skills/flow-walkthrough

flow-walkthrough

Verified

三栏流程联动原型——左侧流程图节点可点击,右侧同步展示对应原型页面,中间自动切换手机框/后台宽窗口。触发:流程联动原型、点流程节点看页面、评审演示页、需求走查 demo、过流程用的演示、流程图和原型联动、flow walkthrough、clickable flowchart linked to prototype pages、prototype walkthrough / product review demo。不适用:只要流程图(用 flow-canvas)、只要原型页面无流程联动诉求。

templates/walkthrough.html

View on GitHub
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>__TITLE__</title>
<style>
:root {
  --wt-bg: #f7f7f7; --wt-white: #ffffff;
  --wt-border: #c0c0c0; --wt-border-light: #e0e0e0;
  --wt-text: #333333; --wt-dim: #888888; --wt-light: #aaaaaa;
  --wt-fill: #e8e8e8; --wt-accent: #555555;
__CSS_VARS__
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; background: var(--wt-bg); color: var(--wt-text);
  font-family: -apple-system, PingFang SC, Segoe UI, Microsoft YaHei, sans-serif; }
.layout { display: flex; min-height: 100vh; gap: 18px; padding: 20px; justify-content: center; align-items: flex-start; }

/* 左:流程画布 */
.flow-panel { width: 520px; flex-shrink: 0; position: sticky; top: 20px;
  height: calc(100vh - 40px); display: flex; flex-direction: column; }
.flow-panel.fs { position: fixed; inset: 0; z-index: 300; width: auto; height: 100vh;
  padding: 16px 20px; background: var(--wt-bg); }
.fp-title { font-size: 16px; font-weight: 700; border-bottom: 2px solid var(--wt-text);
  padding-bottom: 6px; margin-bottom: 8px; }
.fp-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 11px; color: var(--wt-dim); }
.zb { padding: 2px 10px; border: 1px solid var(--wt-border); border-radius: 4px; cursor: pointer;
  background: var(--wt-white); user-select: none; color: var(--wt-text); }
.zv { min-width: 40px; text-align: center; }
.flow-svg { flex: 1; min-height: 0; overflow: hidden; border: 1px solid var(--wt-border-light);
  border-radius: 6px; background: var(--wt-white); cursor: grab; touch-action: none; user-select: none; }
.flow-svg:active { cursor: grabbing; }
.flow-canvas-inner { transform-origin: 0 0; will-change: transform; }
.flow-svg svg { width: 100%; height: auto; display: block; }
.flow-svg g[data-node] { cursor: pointer; }
.flow-svg g[data-node]:hover rect, .flow-svg g[data-node]:hover polygon { stroke-width: 2.5px; }

/* 中:设备框 */
.stage { flex-shrink: 0; position: sticky; top: 20px; }
.frame-phone { width: 375px; min-height: 680px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--wt-white); border: 1px solid var(--wt-border); border-radius: 12px; }
.frame-phone::-webkit-scrollbar { width: 0; }
.frame-wide { width: 690px; background: var(--wt-white); border: 1px solid var(--wt-border); border-radius: 8px; overflow: hidden; }
.hidden { display: none !important; }
.page { display: none; padding-bottom: 24px; background: var(--wt-white); }
.page.active { display: block; }

/* 右:标注 */
.anno-panel { width: 300px; flex-shrink: 0; position: sticky; top: 20px;
  max-height: calc(100vh - 40px); overflow-y: auto; }
.anno-card { padding: 12px; border: 1px solid var(--wt-border-light); border-radius: 4px;
  background: var(--wt-white); margin-bottom: 14px; }
.anno-card-title { font-size: 11px; font-weight: 600; color: var(--wt-dim); letter-spacing: 1px; margin-bottom: 10px; }
#anno-node-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.anno-item { font-size: 12px; color: var(--wt-dim); line-height: 1.65; margin-bottom: 10px; }
.anno-item:last-child { margin-bottom: 0; }
.anno-item b { display: block; color: var(--wt-text); margin-bottom: 2px; }
.st-title { font-size: 12px; color: var(--wt-text); margin-bottom: 8px; }
.st-group { display: flex; flex-wrap: wrap; gap: 6px; }
.st-btn { padding: 4px 10px; border: 1px solid var(--wt-border); border-radius: 12px; font-size: 12px;
  background: var(--wt-white); color: var(--wt-text); cursor: pointer; font-family: inherit; }
.st-btn:hover { border-color: var(--wt-accent); }
.st-btn.cur { background: var(--wt-accent); color: var(--wt-white); border-color: var(--wt-accent); cursor: default; }

/* 页面片段可用的基础组件样式 */
.wt-titlebar { display: flex; align-items: center; height: 44px; padding: 0 12px;
  border-bottom: 1px solid var(--wt-border); font-size: 15px; font-weight: 600; justify-content: center; }
.wt-body { padding: 16px; }
.wt-input { width: 100%; padding: 9px 10px; border: 1px solid var(--wt-border); border-radius: 5px;
  font-size: 13px; background: var(--wt-white); margin-bottom: 12px; }
.wt-btn { display: block; width: 100%; padding: 9px 0; border: none; border-radius: 18px;
  font-size: 13px; text-align: center; cursor: pointer; background: var(--wt-accent); color: var(--wt-white); }
.wt-card { margin: 12px; padding: 12px; border: 1px solid var(--wt-border); border-radius: 6px; background: var(--wt-white); }
.wt-badge { display: inline-block; padding: 2px 8px; border: 1px solid var(--wt-border); border-radius: 3px;
  font-size: 11px; color: var(--wt-dim); background: var(--wt-fill); }
.wt-dimtext { font-size: 12px; color: var(--wt-dim); line-height: 1.6; }

/* 页面片段可用的扩展组件:手机页面骨架、列表、弹窗与提示、后台页面(用法见 references/page-guide.md) */
.wt-screen { position: relative; min-height: 680px; margin-bottom: -24px; }
.wt-statusbar { display: flex; align-items: center; justify-content: space-between; height: 24px; padding: 0 14px;
  font-size: 11px; color: var(--wt-dim); }
.wt-sb-icons { position: relative; width: 22px; height: 10px; border: 1px solid var(--wt-light); border-radius: 2px; }
.wt-sb-icons::after { content: ""; position: absolute; right: -4px; top: 2px; width: 2px; height: 4px; background: var(--wt-light); }
.wt-nav { position: relative; display: flex; align-items: center; height: 44px; padding: 0 12px;
  border-bottom: 1px solid var(--wt-border-light); font-size: 13px; }
.wt-nav-title { position: absolute; left: 60px; right: 60px; text-align: center; font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.wt-nav-back { width: 10px; height: 10px; margin-left: 4px; border-left: 2px solid var(--wt-text);
  border-bottom: 2px solid var(--wt-text); transform: rotate(45deg); cursor: pointer; }
.wt-nav-action { margin-left: auto; color: var(--wt-dim); cursor: pointer; }
.wt-tabs { display: flex; padding: 0 8px; border-bottom: 1px solid var(--wt-border-light); }
.wt-tab { padding: 10px 10px 8px; font-size: 13px; color: var(--wt-dim); border-bottom: 2px solid transparent; cursor: pointer; }
.wt-tab.wt-on { color: var(--wt-text); font-weight: 600; border-bottom-color: var(--wt-accent); }
.wt-section { padding: 14px 16px 6px; font-size: 13px; font-weight: 600; }
.wt-list { margin: 0 16px; }
.wt-list-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--wt-border-light); }
.wt-list-item:last-child { border-bottom: none; }
.wt-li-main { flex: 1; min-width: 0; }
.wt-li-title { font-size: 14px; }
.wt-li-sub { margin-top: 2px; font-size: 12px; color: var(--wt-dim); }
.wt-li-extra { font-size: 12px; color: var(--wt-dim); }
.wt-li-arrow { width: 7px; height: 7px; border-top: 1.5px solid var(--wt-light); border-right: 1.5px solid var(--wt-light); transform: rotate(45deg); }
.wt-img { display: flex; align-items: center; justify-content: center; min-height: 60px; border: 1px solid var(--wt-border-light);
  border-radius: 4px; background: var(--wt-fill); color: var(--wt-light); font-size: 11px; }
.wt-empty { padding: 48px 16px; text-align: center; font-size: 13px; color: var(--wt-dim); }
.wt-empty::before { content: ""; display: block; width: 56px; height: 56px; margin: 0 auto 12px;
  border: 1.5px dashed var(--wt-border); border-radius: 50%; }
.wt-btn.wt-btn-ghost { background: var(--wt-white); color: var(--wt-text); border: 1px solid var(--wt-border); }
.wt-btn.wt-btn-sm { display: inline-block; width: auto; padding: 3px 10px; font-size: 11px; border-radius: 12px; }
.wt-bottombar { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px 18px;
  border-top: 1px solid var(--wt-border-light); background: var(--wt-white); }
.wt-modal { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.35); }
.wt-dialog { width: 270px; padding: 18px 16px 14px; border-radius: 10px; background: var(--wt-white); text-align: center; }
.wt-dialog-title { margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.wt-dialog-body { margin-bottom: 14px; font-size: 13px; line-height: 1.6; color: var(--wt-dim); }
.wt-dialog-actions { display: flex; gap: 10px; }
.wt-dialog-actions .wt-btn { flex: 1; }
.wt-toast { position: absolute; left: 50%; top: 46%; z-index: 6; max-width: 260px; padding: 10px 16px; transform: translate(-50%, -50%);
  border-radius: 8px; background: rgba(0, 0, 0, 0.75); color: var(--wt-white); font-size: 13px; line-height: 1.5; text-align: center; }
.wt-browserbar { display: flex; align-items: center; gap: 5px; padding: 10px 12px; border-bottom: 1px solid var(--wt-border-light); }
.wt-browserbar i { width: 9px; height: 9px; border: 1px solid var(--wt-border); border-radius: 50%; }
.wt-browserbar span { flex: 1; margin-left: 8px; padding: 4px 12px; border-radius: 4px; background: var(--wt-fill);
  font-size: 11px; color: var(--wt-dim); }
.wt-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.wt-table th { padding: 7px 8px; background: var(--wt-fill); color: var(--wt-dim); font-size: 10px; font-weight: 600; text-align: left; }
.wt-table td { padding: 9px 8px; border-top: 1px solid var(--wt-border-light); }
</style>
</head>
<body>
<div class="layout">

<aside class="flow-panel">
  <div class="fp-title">__TITLE__</div>
  <div class="fp-bar">
    <span class="zb" onclick="setZoom(-1)">&#65293;</span>
    <span class="zv" id="zv">100%</span>
    <span class="zb" onclick="setZoom(1)">&#65291;</span>
    <span class="zb" onclick="setZoom(0)">适宽</span>
    <span class="zb" id="fs-btn" onclick="toggleFs()">全屏</span>
    <span style="margin-left:auto;">点击节点联动右侧页面</span>
  </div>
  <div class="flow-svg" id="flow-svg"><div class="flow-canvas-inner" id="flow-canvas-inner">__SVG__</div></div>
</aside>

<div class="stage">
  <div class="frame-phone" id="frame-phone">
__PAGES_PHONE__
  </div>
  <div class="frame-wide hidden" id="frame-wide">
__PAGES_WIDE__
  </div>
</div>

<aside class="anno-panel">
  <div class="anno-card">
    <div class="anno-card-title">当前节点</div>
    <div id="anno-node-title"></div>
    <div id="anno-body"></div>
  </div>
  <div class="anno-card hidden" id="state-card">
    <div class="anno-card-title">页面状态切换</div>
    <div id="state-body"></div>
  </div>
  <div class="anno-card">
    <div class="anno-card-title">使用说明</div>
    <div class="anno-item">左侧流程图节点可点击,右侧同步切换到该节点对应的页面;画布可拖拽平移、按钮缩放,「适宽」复位视图。</div>
    <div class="anno-item">中间页面有多个状态时,右侧出现「页面状态切换」,点其他状态切到对应节点;单状态页面不显示。</div>
    <div class="anno-item">支持 #node=节点id 直达。</div>
  </div>
</aside>

</div>

<script>
var NODES = __NODES_JSON__;
var PAGE_FRAME = __PAGE_FRAME_JSON__;
var STATE_GROUPS = __STATE_GROUPS_JSON__;
var currentNode = null;

function renderStates(n) {
  var card = document.getElementById("state-card"), body = document.getElementById("state-body");
  var st = n.state ? String(n.state).split("/") : null;
  var grp = st && STATE_GROUPS[st[0]];
  if (!grp || !grp.states || grp.states.length < 2) {
    body.innerHTML = ""; card.classList.add("hidden"); return;
  }
  var h = grp.title ? '<div class="st-title">' + grp.title + "</div>" : "";
  h += '<div class="st-group">';
  grp.states.forEach(function (s) {
    if (s.id === st[1]) h += '<span class="st-btn cur">' + s.label + "(当前)</span>";
    else h += '<button class="st-btn" onclick="goNode(\'' + s.node + '\')">' + s.label + "</button>";
  });
  body.innerHTML = h + "</div>"; card.classList.remove("hidden");
}

function setViewByNode(nodeId) {
  var n = NODES[nodeId];
  if (!n) return;
  currentNode = nodeId;
  var frame = PAGE_FRAME[n.page] || "phone";
  document.getElementById("frame-phone").classList.toggle("hidden", frame !== "phone");
  document.getElementById("frame-wide").classList.toggle("hidden", frame !== "wide");
  document.querySelectorAll(".page").forEach(function (p) {
    p.classList.toggle("active", p.id === n.page);
  });
  var ring = document.getElementById("sel-ring");
  var target = document.querySelector('.flow-svg g[data-node="' + nodeId + '"]');
  if (ring) {
    if (target) {
      var bb = target.getBBox();
      ring.setAttribute("x", bb.x - 7); ring.setAttribute("y", bb.y - 7);
      ring.setAttribute("width", bb.width + 14); ring.setAttribute("height", bb.height + 14);
      ring.setAttribute("visibility", "visible");
    } else {
      ring.setAttribute("visibility", "hidden");
    }
  }
  document.getElementById("anno-node-title").textContent = n.title || nodeId;
  var body = "";
  (n.anno || []).forEach(function (pair) {
    body += '<div class="anno-item"><b>' + pair[0] + "</b>" + pair[1] + "</div>";
  });
  document.getElementById("anno-body").innerHTML = body;
  renderStates(n);
  var ph = document.getElementById("frame-phone");
  if (ph.scrollTo) ph.scrollTo(0, 0);
}
window.goNode = setViewByNode;

document.querySelectorAll('.flow-svg g[data-node]').forEach(function (g) {
  g.addEventListener("click", function () { setViewByNode(g.getAttribute("data-node")); });
});

var zoomPct = 100, panX = 0, panY = 0;
function applyPan() {
  document.getElementById("flow-canvas-inner").style.transform = "translate(" + panX + "px," + panY + "px)";
}
function setZoom(dir) {
  zoomPct = dir === 0 ? 100 : Math.min(300, Math.max(100, zoomPct + dir * 40));
  if (dir === 0) { panX = 0; panY = 0; applyPan(); }
  var svg = document.querySelector("#flow-svg svg");
  if (svg) svg.style.width = zoomPct + "%";
  document.getElementById("zv").textContent = zoomPct + "%";
}
(function () {
  var fs = document.getElementById("flow-svg");
  var dragging = false, movedFlag = false, sx = 0, sy = 0, ox = 0, oy = 0;
  fs.addEventListener("pointerdown", function (e) {
    dragging = true; movedFlag = false;
    sx = e.clientX; sy = e.clientY; ox = panX; oy = panY;
  });
  window.addEventListener("pointermove", function (e) {
    if (!dragging) return;
    var dx = e.clientX - sx, dy = e.clientY - sy;
    if (Math.abs(dx) > 4 || Math.abs(dy) > 4) movedFlag = true;
    panX = ox + dx; panY = oy + dy; applyPan();
  });
  window.addEventListener("pointerup", function () { dragging = false; });
  fs.addEventListener("click", function (e) {
    if (movedFlag) { e.stopPropagation(); e.preventDefault(); movedFlag = false; }
  }, true);
})();

/* 流程画布全屏:按钮切换,ESC 退出,进出时回适宽基准 */
function toggleFs(force) {
  var p = document.querySelector(".flow-panel");
  var on = force !== undefined ? force : !p.classList.contains("fs");
  p.classList.toggle("fs", on);
  document.getElementById("fs-btn").textContent = on ? "退出全屏" : "全屏";
  setZoom(0);
}
window.addEventListener("keydown", function (e) {
  if (e.key === "Escape" && document.querySelector(".flow-panel").classList.contains("fs")) toggleFs(false);
});

var initNode = (location.hash.match(/node=([\w-]+)/) || [])[1];
setViewByNode(NODES[initNode] ? initNode : "__DEFAULT__");
</script>
</body>
</html>
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall