feat(configurator): add Components tab for .sf-btn/.sf-card, fix preview mirror - #547
Conversation
…iew mirror - New ComponentsPanel.svelte: sliders/button-groups for all 22 --sf-btn-*/ --sf-card-* tokens, grouped by component, each with its own live preview using the real .sf-btn/.sf-card classes (not a hand-copied mirror). Variant/style/size are preview-only pickers, not overrides — SLASHED's .sf-btn variants reuse the same 3 rule-local custom property names across every colour family, so a global override can't target one variant independently without a CSS architecture change (out of scope here). - Wire the new "Components" domain everywhere it needs to exist: sidebar nav, DomainPanel routing, App/CommandPalette label maps, Home screen tile + its own separate override-count patterns, and domain-patterns.json (inserted before "borders"/"shadows" so their looser "radius"/"shadow" substrings don't steal btn/card tokens first-match-wins). - Remove the 5 btn/card rows BordersPanel.svelte was already duplicating under "Component shape" (renamed to "Field shape", now field-only). - main.ts: load optional/tokens.components.css + components.css so the new panel's preview can use real classes in the host document, the same way every other panel's inline preview already reads live token overrides. - PreviewPanel.svelte: replace the .pv-btn/.pv-card mirror with the real .sf-btn/.sf-card classes in all three demo templates — the iframe already loads the full compiled bundle, so the mirror's "stays isolated from whichever bundle is loaded" rationale no longer applied. Required splitting every "pv-card sf-stack" combo into a card + inner wrapper, since the real .sf-card sets display:block in @layer slashed.components, which outranks .sf-stack's display:flex in the earlier slashed.layout layer regardless of specificity — same failure mode the old unlayered .pv-card avoided differently (by never setting display at all). - EffectsPanel.svelte: extend text-shadow presets to xs/xl (was s/m/l only) and add a drop-shadow section (previously absent entirely), using the real .sf-drop-shadow-* utility classes for the preview swatches. - TypographyPanel.svelte: add --sf-link-external-label next to the existing --sf-link-external-marker control, mirroring its (unquoted) value handling for consistency rather than introducing a different convention. - tests-e2e/shell.spec.js: add 'Components' to the expected nav labels. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NwTgVgva9FeiQjddgVaC4H
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review 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 refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (13)
✨ 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 configurator Components domain for .sf-btn/.sf-card and use real classes in preview
AI Description
Diagram
High-Level Assessment
Files changed (13)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
12 rules 1.
|
- EffectsPanel.svelte: stop trimming the text-shadow/drop-shadow inputs' value before persisting it on every keystroke — trim() was only meant to decide onSet vs onReset, but was also applied to the stored value, so a space typed mid-value (e.g. "drop-shadow(0 ") was stripped immediately by the controlled input's re-render, making space-separated CSS effectively impossible to type interactively. Affected both the new drop-shadow inputs and the pre-existing text-shadow inputs (same bug, same fix). - HomePanel.svelte: replace the panel's own independent-per-domain substring matching (DOMAIN_MATCH/domainCount) with the same domainOf() classification everything else in the app already uses. The substring lists checked each domain in isolation, so a token like --sf-btn-radius matched both "components" (via "btn-") and "borders" (via the pre-existing generic "radius" pattern) at the same time, double-counting it on the Home screen's tile badges. domainOf() is ordered/first-match-wins, so this can't happen again for any future domain addition either. - main.ts: drop the redundant explicit tokens.components.css import — optional/components.css already @imports it, so importing both risked shipping the token layer twice in the bundle. Confirmed via build output (CSS bundle shrank from 170.31kB to 169.17kB after removing it). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NwTgVgva9FeiQjddgVaC4H
Summary
Follow-up to #544 (
.sf-btn/.sf-cardshipped) and #545 (utility classes + shadow xs/xl + link a11y): the configurator's data layer was already fully synced (auto-generated), but its UI never caught up — only 5 of the 22--sf-btn-*/--sf-card-*tokens had controls, scattered under the wrong categories, and the global preview rendered a hand-copied.pv-btn/.pv-cardmirror instead of the real classes.ComponentsPanel.svelte) — every--sf-btn-*/--sf-card-*token as a slider/button-group, grouped by component, each with its own live preview using the real.sf-btn/.sf-cardclasses (not a mirror). Variant/style/size are preview-only pickers — SLASHED's button variants reuse the same 3 rule-local custom property names across every colour family, so a global override can't target one variant independently without a CSS architecture change (discussed and deliberately deferred, see conversation).CommandPalette.svelteand a third duplicate pattern list inHomePanel.sveltethat would've double-counted badges if left alone), anddomain-patterns.json(ordered beforeborders/shadowsso their looser substrings don't steal btn/card tokens first).BordersPanel.sveltewas already duplicating.PreviewPanelmirror: swapped.pv-btn/.pv-cardfor the real classes in all three demo templates — the iframe already loads the full compiled bundle, so the mirror's isolation rationale was stale. This required splitting everypv-card sf-stackcombo into a card + inner wrapper, since the real.sf-cardsetsdisplay:blockin@layer slashed.components, which outranks.sf-stack'sdisplay:flexin the earlierslashed.layoutlayer regardless of specificity..sf-drop-shadow-*utility classes for preview.--sf-link-external-labelnext to the existing--sf-link-external-markercontrol.Test plan
npm run build(configurator) — clean, 0 errorsnpx svelte-check— 0 errors, 0 warnings across 4008 filesnpx vitest run tests/— 90/90 passed (includingcuration.test.js)npx vitest run tests-components/— 23/23 passed.sf-btn/.sf-card, sliders update it live (radius, padding, etc.), variant/style/size pickers and card modifier checkboxes workPreviewPanel: verified the cascade-layer fix directly —.sf-cardcomputesdisplay: block, the inner.sf-stackwrapper correctly computesdisplay: flex; flex-direction: columnin both the Marketing and Stylescape templates, light and darktests-e2e/(Playwright) — couldn't run vianpx playwright testin this sandbox (missingchrome-headless-shellbinary, pre-existing environment limitation unrelated to this change); the equivalent assertions were verified manually as above using the full Chromium binary directly🤖 Generated with Claude Code
https://claude.ai/code/session_01NwTgVgva9FeiQjddgVaC4H
Generated by Claude Code