Anchored Auto Layout
npm

Hover or focus a box to measure it. Click its tag, or press ] and [, to pin one. Esc unpins.

    Legend
    • Anchor: a box with data-⚓️-name
    • Placed by anchors: out of flow
    • Gap from the anchor's edge, in px
    • Edges of the box you're inspecting

    Every tag, line and number here is itself placed by data-⚓️-* attributes. JS only measures.

    Resizable heat-map that re-flows

    A GitHub-style contribution calendar: drag the handle and the weeks wrap into bands while 371 day squares glide to their new spots (data-⚓️-fill + data-⚓️-transition="glide", one scoped --day name per cell).

    Full page
    <header class="intro">
      <h1>A heat-map that re-flows</h1>
      <p>
        Drag the handle (or focus it and use the arrow keys). The weeks are a plain wrapping CSS grid
        that re-flows <em>instantly</em>; every day square is anchored to its invisible cell with
        <code>data-⚓️-fill</code> + <code>data-⚓️-transition="glide"</code> and slides to its new band.
        Month labels ride <code>data-⚓️-side="above"</code> their first week, the handle sits
        <code>data-⚓️-side="after"</code> the frame, and the tooltip glides between days because
        hovering just moves the <code>--hot</code> anchor name (near the right edge
        <code>data-⚓️-try="flip-x"</code> flips it to end-align). JS only builds the data and tracks the pointer.
      </p>
      <div class="controls">
        <p class="total" id="total">&nbsp;</p>
        <label class="xray-toggle"><input type="checkbox" name="xray"> X-ray</label>
      </div>
    </header>
    
    <div class="stage" data-⚓️-root>
      <section class="frame" data-⚓️-name="--frame" aria-labelledby="total">
        <div class="weeks" id="weeks" tabindex="0" aria-label="Daily contributions. Arrow keys move between days." aria-describedby="tip"></div>
        <div class="legend" aria-hidden="true">
          Less <i data-l="0"></i><i data-l="1"></i><i data-l="2"></i><i data-l="3"></i><i data-l="4"></i> More
        </div>
      </section>
    
      <button class="handle" type="button" data-⚓️-to="--frame" data-⚓️-side="after" data-⚓️-align-y="center" aria-label="Resize heat-map (left and right arrow keys)"></button>
    
      <div id="months"></div>
    
      <p class="tip" id="tip" role="status" data-⚓️-to="--hot" data-⚓️-side="above" data-⚓️-align-leading data-⚓️-try="flip-x" data-⚓️-transition="glide"><span class="tip-text"></span></p>
    </div>

    data-⚓️-align-leadingdata-⚓️-align-ydata-⚓️-filldata-⚓️-namedata-⚓️-rootdata-⚓️-scope-namedata-⚓️-sidedata-⚓️-todata-⚓️-transitiondata-⚓️-try

    Copied