Conversation
Stateless image component that wraps a native <img> in shadow DOM with a skeleton shimmer placeholder, fade-in on load, optional aspect ratio to prevent layout shift, a default or slotted error fallback, and enforced alt hygiene. Ships with model unit tests, browser integration tests, docs, and a demo with a live editor + a11y state readout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
clj-kondo CI check surfaced an unused-refer warning which failed the lint job. The macro was imported but every deftest uses async polling loops rather than nested testing blocks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
x-image, a stateless image component that wraps a native<img>in open shadow DOM with a skeleton shimmer placeholder, fade-in on load, optional aspect-ratio box (ratio="16:9"etc.) to prevent CLS, a default or slotted error fallback, and an enforcedalthygiene warning.src,alt,decorative,ratio,fit,position,loading; properties mirror attributes plus read-onlynaturalWidth/naturalHeight/state; eventsx-image-loadandx-image-error(both bubbles + composed, non-cancelable).Test plan
npx shadow-cljs watch test→ http://localhost:8021 — allbaredom.components.x-image.*deftests green.npx shadow-cljs watch app→ http://localhost:8000 — walk the demo: ratio variants reserve space (no CLS), fit variants render as expected, decorative toggle flips the a11y readout, default 404 fallback renders, slotted<div slot="error">fallback renders, event log showsx-image-load/x-image-errorwith detail payloads.prefers-reduced-motion: reduce→ shimmer static, fade-in instant;prefers-color-scheme: dark→ surface background adapts.npm run build— clean Closure Advanced release, 0 warnings,dist/x-image.jsemitted.🤖 Generated with Claude Code