For AI agents: the complete documentation index is available at https://lazygophers.github.io/pamphlet/llms.txt, the full documentation bundle is available at https://lazygophers.github.io/pamphlet/llms-full.txt, and this page is available as Markdown at https://lazygophers.github.io/pamphlet/write/diagrams/swimlane.md.
  • 简体中文
  • 泳道图

    这是什么

    流程按「谁负责」横向分成几条道,每一步落在负责它的那条道上。

    什么时候用

    跨部门、跨服务的流程——没有泳道就说不清「这一步归谁」。

    怎么写

    Pamphlet 自己的写法——先列声明、再列关系,十七种图共用这副骨架:

    :::swimlane[下单流程]
    lanes:
      user = "用户"
      order = "订单服务"
      pay = "支付服务"
    steps:
      user : 提交订单
      order : 锁库存
      pay : 扣款
      order : 出单
    :::

    这一种 Mermaid 画不了,所以没有「另一种写法」——它的 SVG 由 Pamphlet 自己算布局、自己生成。

    出来是什么样

    编译时就画好内联进产物,读者那边不下载任何绘图库、也不联网。颜色走那六个图表变量(--pf-diagram-bg / line / fill / text / accent / muted),所以换主题时它跟着变。

    文字宽度是按字符估算的(中日韩字符算一个字宽,其余算 0.55),不量真实字体——换来的是这一种图不需要浏览器也能编译。

    坑

    • lanes: 里每条道一行,steps: 里写 道名 : 这一步做什么
    • 步骤按写的顺序从左往右排,箭头自动连上一步
    • 道名写错会报 DIAG-306 并列出已经声明的道