Skip to content

CycleWire v1.2.0

Choose a tag to compare

@github-actions github-actions released this 26 Sep 19:48
· 19 commits to main since this release

Added

  • cyclewire/early (0.4 kB brotli), a script to inline at the top of <head>. Until
    CycleWire starts, it keeps the clicks, typing and changes on bound elements, and marks
    a tapped control cw-pending at once; start() then runs them in order. Links and
    forms are left to the browser, and where CycleWire would have taken the place of their
    default (a submit button, a link with cw-prevent), the action does not run as well.
    earlyScript(prefix) returns the script for a server to inline, dist/early.min.js
    is the same for the default prefix, and the Vite plugin adds it with early: true.
  • cyclewire/request (3.6 kB brotli): links, forms and buttons that fetch HTML and
    put it into the page, declared in markup. cw-get, cw-post, cw-put, cw-patch and
    cw-delete name the method and URL (empty, the element's own), cw-target where the
    answer goes (a selector, or closest …), cw-swap how (inner, outer, before,
    after, prepend, append, morph, remove or none, and transition), and
    cw-select which part of it. It is an action, registered like any other, so it loads
    when first used and runs with the element's debounce, concurrency, trigger and pending
    state. It sends a form's fields and the CSRF token of <meta name="csrf-token">, asks
    the page's own origin only, shows 422 answers, applies the <cw-stream> messages in an
    answer, and never runs its scripts. The full classic-script build registers it with
    "request": true.
  • An empty cw-prefetch fetches the element's own URL: its cw-get, or a link's href.
  • apply() from cyclewire/stream also takes nodes already parsed.
  • cyclewire check reports cw-swap values CycleWire does not know (invalid-swap).

Changed

  • A page pays a listener only for the events it uses. click, submit, input and
    change are delegated as before; keydown, keyup, focusin, focusout,
    pointerdown, toggle and command once a binding needs them: in the page at start,
    added later, or on an element the pointer or focus reaches. The benchmark page goes
    from 14 listeners to 6. Code that sets such a binding on an element already in the page
    and dispatches the event itself straight away should call scan(element) in between.

Install

npm install cyclewire@1.2.0
<script src="https://cdn.jsdelivr.net/npm/cyclewire@1.2.0/dist/cyclewire.global.min.js"
        integrity="sha384-LB5rG5EnqCzbgXKqv4aZR90JCdI+OQ/Qp/EwDM6QmxGWrxJ7gBOyXfltIoEbw9Ay"
        crossorigin="anonymous" defer></script>

Subresource Integrity

File SRI
cyclewire.global.min.js sha384-LB5rG5EnqCzbgXKqv4aZR90JCdI+OQ/Qp/EwDM6QmxGWrxJ7gBOyXfltIoEbw9Ay
cyclewire.full.global.min.js sha384-tVykjF4uUQzUHqNbCTi+rimJv2zQdxLeQRN53cpJz+x4/y/BUD2w39R4eeiGIa2L
cyclewire.min.js sha384-X+xpeGCZnpXpEsy+iDS1eB//CO7vsS7d9cOueUSEPhb/SIMLHgpgbM5IEYJsySEU
bootstrap.min.js sha384-ZweZRQaKSz68KB2+ID2rgSxdG0CtKO0sGSY+n1E/fStm6ahQK2Qe4WY6Toi+ljoi
css.min.js sha384-PCGShIcejnAaiIWEJxJogTbBgmAn1oeiRgIlFk/H1dcoub6GjBn1zKruj8Oa5+cF
devtools.min.js sha384-wc3wDRHE7TzGHI8MWal2IcXpuBYV8iNQDsQuOZn4RfUFtE8KfL7duAqOLKV+KHS3
dom.min.js sha384-Z0dmGaC64+GM24a1GfmMYuXv2TJsgmSmQiJqlhoswPzp5P6Khwun6KcDhS4oxSen
early.min.js sha384-bBIpoHFCRqKlBZGNm+Vir5V0mI73L0GEijiYoT/uJKkb5XalHKCdSMn95SoIeHGn
morph.min.js sha384-p2vljSe2SFY1gfzrnDGkpxefYonJvgT1YBVGk4OKAbP2gn3h/bX3AIHZtQUx8g4U
prefetch.min.js sha384-DhUTU+rcQEVBF1hS0lT3TEHJWNnz/Fnox0hho/kNr/Z1IRjX88FdVaeI4zkwU3rD
request.min.js sha384-5xhUXfO2VvzqbxG+AnIiEVO8D6hJFcxM9j6ulUC8TmMKb/ltJ4VAHvgp+6azNRn8
signals.min.js sha384-m6pX1z/WtpDBK+C0Zeef63vfcj2sRyQozW3lOryWewA7CNlSQKuuFQE9P4pcxP4f
stream.min.js sha384-ptWx306rCxxnwwl/sSg4CT3DM8kMQ0NJpPBcZJ/ovXGAoX00c6Z8aBem6d9Ukxzq

Full changelog: CHANGELOG.md