you-dont-need-react

you-dont-need-react
git clone git://brookjeynes.dev/bjeynes/you-dont-need-react.git
Log | Files | Refs | README

hx-swap-flow.html (5823B)


      1 <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>From response to list</title><style>body{margin:0;background:#15181c;color:#f2f4f7;font-family:Arial,sans-serif}svg{display:block;width:100%;min-width:1200px;height:auto}main{overflow-x:auto}text{fill:#f2f4f7;font-family:Arial,sans-serif}.heading{font-size:25px;font-weight:bold}.label{font-size:16px;font-weight:bold;text-anchor:middle}.task{font-size:21px;text-anchor:middle}.code{font:18px 'Courier New',monospace;text-anchor:middle}.center{text-anchor:middle}.accent{fill:#87afaf}.target{fill:#c9b98f}</style></head><body><main><svg viewBox="0 0 1200 440" role="img" aria-labelledby="swap-1-title swap-1-desc" xmlns="http://www.w3.org/2000/svg"><title id="swap-1-title">01  The response arrives</title><desc id="swap-1-desc">The response comes to htmx, which finds the task list and appends a new list item before its end.</desc><defs><marker id="swap-1-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto"><path d="M0 0 L8 4 L0 8 Z" fill="#f2f4f7"/></marker></defs>
      2 <text x="80" y="48" class="heading">01  The response arrives</text><rect x="80" y="142" width="296" height="148" fill="none" stroke="#87afaf" stroke-width="2"/><text x="228" y="183" class="label">SERVER RESPONSE</text><text x="228" y="230" class="code accent">&lt;li&gt;Buy milk&lt;/li&gt;</text>
      3 <path d="M376 216 H468" fill="none" stroke="#f2f4f7" stroke-width="2" marker-end="url(#swap-1-arrow)"/><rect x="472" y="174" width="144" height="84" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="544" y="226" class="heading center">htmx</text><path d="M616 216 H716" fill="none" stroke="#f2f4f7" stroke-width="2" stroke-dasharray="8 6" marker-end="url(#swap-1-arrow)"/>
      4 <rect x="720" y="98" width="348" height="276" fill="none" stroke="#f2f4f7" stroke-width="2"/><path d="M720 154 H1068" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="884" y="135" class="label">PAGE  /  TO DO</text><rect x="744" y="190" width="300" height="152" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="894" y="220" class="code target">#task-list-todo</text><text x="888" y="269" class="task">Read book</text><text x="600" y="424" class="code target">HTML comes back from POST /task/new</text></svg><svg viewBox="0 0 1200 440" role="img" aria-labelledby="swap-2-title swap-2-desc" xmlns="http://www.w3.org/2000/svg"><title id="swap-2-title">02  Find the target</title><desc id="swap-2-desc">The response comes to htmx, which finds the task list and appends a new list item before its end.</desc><defs><marker id="swap-2-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto"><path d="M0 0 L8 4 L0 8 Z" fill="#f2f4f7"/></marker></defs>
      5 <text x="80" y="48" class="heading">02  Find the target</text><rect x="80" y="142" width="296" height="148" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="228" y="183" class="label">SERVER RESPONSE</text><text x="228" y="230" class="code accent">&lt;li&gt;Buy milk&lt;/li&gt;</text>
      6 <path d="M376 216 H468" fill="none" stroke="#f2f4f7" stroke-width="2" marker-end="url(#swap-2-arrow)"/><rect x="472" y="174" width="144" height="84" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="544" y="226" class="heading center">htmx</text><path d="M616 216 H716" fill="none" stroke="#f2f4f7" stroke-width="2" stroke-dasharray="8 6" marker-end="url(#swap-2-arrow)"/>
      7 <rect x="720" y="98" width="348" height="276" fill="none" stroke="#f2f4f7" stroke-width="2"/><path d="M720 154 H1068" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="884" y="135" class="label">PAGE  /  TO DO</text><rect x="744" y="190" width="300" height="152" fill="none" stroke="#c9b98f" stroke-width="2"/><text x="894" y="220" class="code target">#task-list-todo</text><text x="888" y="269" class="task">Read book</text><text x="600" y="424" class="code target">hx-target points to the list</text></svg><svg viewBox="0 0 1200 440" role="img" aria-labelledby="swap-3-title swap-3-desc" xmlns="http://www.w3.org/2000/svg"><title id="swap-3-title">03  Add the new item</title><desc id="swap-3-desc">The response comes to htmx, which finds the task list and appends a new list item before its end.</desc><defs><marker id="swap-3-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto"><path d="M0 0 L8 4 L0 8 Z" fill="#f2f4f7"/></marker></defs>
      8 <text x="80" y="48" class="heading">03  Add the new item</text><rect x="80" y="142" width="296" height="148" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="228" y="183" class="label">SERVER RESPONSE</text><text x="228" y="230" class="code accent">&lt;li&gt;Buy milk&lt;/li&gt;</text>
      9 <path d="M376 216 H468" fill="none" stroke="#f2f4f7" stroke-width="2" marker-end="url(#swap-3-arrow)"/><rect x="472" y="174" width="144" height="84" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="544" y="226" class="heading center">htmx</text><path d="M616 216 H716" fill="none" stroke="#f2f4f7" stroke-width="2"  marker-end="url(#swap-3-arrow)"/>
     10 <rect x="720" y="98" width="348" height="276" fill="none" stroke="#f2f4f7" stroke-width="2"/><path d="M720 154 H1068" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="884" y="135" class="label">PAGE  /  TO DO</text><rect x="744" y="190" width="300" height="152" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="894" y="220" class="code target">#task-list-todo</text><text x="888" y="269" class="task">Read book</text><rect x="768" y="300" width="240" height="44" fill="none" stroke="#87afaf" stroke-width="2"/><text x="888" y="329" class="task accent">Buy milk</text><text x="600" y="424" class="code target">hx-swap=&quot;beforeend&quot; adds inside the list</text></svg></main></body></html>