Feat/reactive islands#42
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds reactive HTML islands to SibuJS — a third rendering mode that attaches fine-grained reactivity to server-rendered HTML with no build step, no JSX, no virtual DOM, and no dependencies. The whole islands runtime is ~5.2 KB gzipped. Additive and backward-compatible — nothing existing changes.
enhance(target, setup)— attach reactivity to existing DOM without re-rendering it (alongsidemountandhydrate, which replace markup). TheEnhanceContextdrives server markup in place:text,attr(a11y-correct literal booleans),classed,show(toggles the standardhiddenproperty, so it reveals server-hiddenelements),model(two-way; checkbox / number /<select multiple>),on,ref/refs,cleanup. Targets resolve via@name→data-ref="name"or a raw selector. Returns a dispose tied to the element. PlusenhanceAll(selector, setup).registerIsland(name, setup)+mountIslands(root?). Declare islands withdata-sibu-island="name"and choose when each activates viadata-sibu-load:load·idle·visible·interaction·media.lazyIsland(() => import("./island.js"))fetches a module only when its island activates, so a page ships ~0 JS for islands that never trigger.window.SibuCDN global → runs from a single<script>tag.docs/islands.md, runnableexamples/islands.html+examples/islands-strategies.html, andbench/islands-size.mjs(the 5.2 KB measurement).Tests: 30 new jsdom unit tests (full suite 3997 passing) plus a real-browser Playwright suite — 15/15 across Chromium, Firefox, and WebKit validating every strategy (real IntersectionObserver / requestIdleCallback / matchMedia / interaction timing) and lazy
import()over HTTP. CHANGELOG[3.4.0]added; version bumped to 3.4.0.Related Issue
Closes #
Type of Change
Checklist