Add .sf-bg background-layer primitive with layout tokens - #436
Conversation
A1 — .sf-bg background-layer primitive (core/layout.css): absolutely-positioned cover media that sits behind a parent's content. The parent is auto-promoted to a positioned, isolated stacking context via :has(> .sf-bg), so .sf-bg composes natively under .sf-scrim (background -> scrim gradient -> content). Works as a bare <img class="sf-bg"> or as a wrapper with nested > img / > video. New knobs (core/tokens.layout.css): --sf-bg-inset (single length; the layer size is derived from it so a non-zero inset still fills correctly), --sf-bg-fit, --sf-bg-position, --sf-bg-radius, --sf-bg-z. B1/B2 — staged utility helpers in optional/utilities.css, commented out like optional/components.css: .sf-balance / .sf-pretty (text-wrap) and .sf-object-cover / -contain / -top / -center / -bottom (object-fit / object-position). The file stays a non-activated, BEM-first stub — it is NOT wired into registry-sources / api-index / class-reference and the architecture.md doctrine is unchanged. Uncomment to activate. Docs/registry regenerated; llm-guide (8.5) + layout.md updated; token API snapshot relocked (+5 --sf-bg-* names); CHANGELOG entries added. Gates pass (build, check:version/llm-guide/registry/macros, unit tests, token-api snapshot). Verified .sf-bg in a real Chromium render; confirmed the commented utilities emit no active CSS in any bundle. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014hXatkgKcqrCaeUuQiretY
The new --sf-bg-{fit,inset,position,z} knobs matched no DOMAIN_PATTERNS
entry, so the configurator curation test (tests/curation.test.js — "no
public knob falls through to the Misc fallback bucket") failed. Add a
"-bg-" substring pattern to the layout domain in both check-curation.mjs
and domains.ts so all five --sf-bg-* tokens (including --sf-bg-radius,
which previously fell into borders) group with the .sf-bg layout
primitive. Verified with scripts/check-curation.mjs (OK).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014hXatkgKcqrCaeUuQiretY
- Wrap :has(> .sf-bg) in :where() so the parent auto-setup rule carries zero specificity, preventing it from overriding consumer position/isolation declarations via source-order wins - Add pointer-events: none to .sf-bg > img and .sf-bg > video so nested media is non-interactive like the wrapper itself - Add .sf-bg demo block to docs/demo.html to satisfy the selector coverage regression test (every core class must appear in demo.html) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U8MyeHDL2kAHLo5uBbx32h
|
Warning Review limit reached
More reviews will be available in 47 minutes and 54 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds the ChangesAdd .sf-bg background-layer primitive
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoAdd .sf-bg background-layer primitive and --sf-bg-* layout tokens Description
Diagram
High-Level Assessment
Files changed (22)
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/api-index.json`:
- Around line 20854-20878: The sf-bg metadata entry in the curated API index has
an empty group and a truncated description, so update the sf-bg object in
docs/api-index.json to use the same non-empty layout group convention as the
other layout primitives and replace the clipped description with the full
intended text in the class metadata. Make the fix in the sf-bg record itself so
the generated configurator data inherits the corrected group and complete
description from the authoritative source.
- Around line 848-987: The five background tokens in the docs index are all
inheriting the same inset-only description, which is incorrect for
`--sf-bg-fit`, `--sf-bg-position`, `--sf-bg-radius`, and `--sf-bg-z`. Fix this
upstream by adding distinct per-token documentation for each `--sf-bg-*`
property in `core/tokens.layout.css` so the generator can emit the right
descriptions, or update the curated docs metadata fallback used by the
generator. Make sure the generated entries for `--sf-bg-fit`, `--sf-bg-inset`,
`--sf-bg-position`, `--sf-bg-radius`, and `--sf-bg-z` each have token-specific
text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: db06f6af-9bdd-490d-b8d2-1ef18a984f8a
📒 Files selected for processing (22)
CHANGELOG.mdbadges/badge-optimal.jsonconfigurator/scripts/check-curation.mjsconfigurator/src/data/api-index.generated.jsonconfigurator/src/data/classes.generated.jsonconfigurator/src/data/token-registry.generated.jsonconfigurator/src/lib/domains.tscore/layout.csscore/tokens.layout.cssdocs/api-index.jsondocs/api-index.mddocs/classes.mddocs/demo.htmldocs/layout.mddocs/llm-guide.mddocs/registry.jsondocs/token-index.jsondocs/token-index.mddocs/tokens.mdoptional/utilities.csstests/token-api.snapshot.jsontoken-registry.json
Code Review by Qodo
Context used✅ Compliance rules (platform):
6 rules 1.
|
…tions - Extend .sf-bg > :is(img, video, picture) and .sf-bg > picture > img so responsive <picture> markup gets the same fill sizing, object-fit, object-position, border-radius, and pointer-events: none treatment as direct img/video children (Qodo review finding) - Add per-token descriptions for all five --sf-bg-* knobs in docs/token-annotations.json so the generator emits distinct, accurate hints instead of repeating the shared section banner (CodeRabbit finding) - Complete the sf-bg class description (was truncated mid-sentence) and set group: "Background" to match the non-empty convention used by all other layout primitives in the configurator cheatsheet (CodeRabbit finding) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U8MyeHDL2kAHLo5uBbx32h
Introduces a new layout primitive
.sf-bgfor absolutely-positioned cover media that sits behind a parent's content, along with five new layout tokens to control its appearance and behavior.Summary
This PR adds the
.sf-bgbackground-layer primitive to SLASHED, enabling composable background imagery that works natively under.sf-scrimfor layered designs (background → gradient → content). The parent element automatically promotes itself to a positioned, isolated stacking context via:has().Changes
New layout primitive:
.sf-bg— absolutely-positioned cover layer with automatic parent positioning via:has()<img class="sf-bg">and wrapper patterns with nested> img/> videoNew layout tokens (5):
--sf-bg-inset(default:0) — single length applied to all edges; layer size derived from it--sf-bg-fit(default:cover) — object-fit value for media--sf-bg-position(default:50% 50%) — object-position value for media--sf-bg-radius(default:0) — border-radius for the layer--sf-bg-z(default:-2) — z-index positioning (behind content, above parent background)Documentation & API updates:
.sf-bgto demo.html with usage examplesStaged utilities:
Implementation details
:where(:has(> .sf-bg))to avoid specificity issuescalc(100% - 2 * var(--sf-bg-inset))to maintain correct sizing with non-zero insets.sf-bgelements and nested children (> img,> video) respect the same tokens-2ensures the layer sits behind content but above the parent's backgroundhttps://claude.ai/code/session_01U8MyeHDL2kAHLo5uBbx32h
Summary by CodeRabbit
New Features
Documentation