fix: three bugs in configurator colors panel - #390
Conversation
- OklchPicker: switchMode now converts OKLCH↔OKLab channel state before changing mode, so sliders stay consistent and the emitted color doesn't jump to a stale/wrong value when the user switches color spaces. - OklchPicker: onHexChange no longer fires on 3-char hex; only 6- and 8-digit hex are accepted. The old 3-char match was causing the $effect to overwrite hexInput mid-typing, making it impossible to finish a full 6-char hex without the field being interrupted. - BrandColorRow: pickerValue is now kept in sync via $effect, so typing in the text input while the OklchPicker is open updates the picker's sliders rather than leaving it showing the stale opening value. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013M6i4qstSh8vRPchkfm6Fy
- ContrastBadge: track per-property override changes with full loop (void overrides alone misses value mutations on existing keys) - DomainPreview: use correct token --sf-color-text--on-primary instead of the non-existent --sf-color-on-primary (always fell through to #fff) - SmartSettings: apply full override cascade to gradient card swatches so var(--sf-color-*) refs in gradient values resolve from overrides rather than the global :root (which never receives user overrides) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013M6i4qstSh8vRPchkfm6Fy
…t tab
Load core/layout.css in the configurator (safe — all rules are .sf-*
prefixed opt-in classes, no element or reset selectors, no conflict with
chrome styles). This lets the Layout preview tab demonstrate actual
framework primitives instead of custom inline-style simulations.
Every layout section now uses real classes:
- sf-stack / sf-stack--{size} / sf-stack--center/end/stretch
- sf-cluster / sf-cluster--{size} / --center / --between
- sf-grid / sf-grid--{tier} (uses real --sf-grid-min-* tokens)
- sf-grid-cols-{2,3,4} / sf-grid-cols-1-2 / sf-grid-cols-1-3
(wrapped in sf-cq to provide the required container context)
- sf-equal / sf-equal--{2,3,4,6}
- sf-sidebar / sf-sidebar--right / sf-sidebar--narrow
- sf-switcher, sf-cover + sf-cover__center, sf-frame--video
- sf-bento--3 + sf-bento-featured / sf-bento-wide span modifiers
- sf-divider / sf-divider--{soft,strong,dashed,dotted,gradient}
Remove dead pv__lp-stack and pv__lp-cluster simulation classes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013M6i4qstSh8vRPchkfm6Fy
… framework classes
The Macros tab was demonstrating sf-prose, sf-truncate, sf-line-clamp-*,
sf-surface--*, sf-scroll-shadow, sf-overflow-fade, sf-link--*, sf-tabular-nums,
sf-text-gradient, sf-text-protect, and sf-flow using custom pv__* CSS rules
that manually recreated the framework's visual behavior — meaning user overrides
to color tokens had no effect on the demo output.
Replace every simulation with the real framework class:
- pv__surface-{c} → sf-surface--{c} (full-color contextual surface macro)
- pv__text-grad → sf-text-gradient (background-clip: text via --sf-gradient-primary)
- pv__text-protect → sf-text-protect (text-shadow halo from --sf-scrim-text-shadow)
- pv__truncate → sf-truncate
- pv__clamp2/3/n → sf-line-clamp-2/3/N with --sf-line-clamp for the N variant
- pv__prose-demo + pv__prose-*/pv__not-prose → sf-prose / sf-not-prose on real HTML
- pv__flow-demo → sf-flow (lobotomized owl via --sf-flow-space)
- pv__scroll-shadow → sf-scroll-shadow (mask-image fade)
- pv__overflow-fade → sf-overflow-fade (end-edge horizontal mask)
- pv__link-*/pv__link-ext → sf-link--subtle / sf-link--reverse / sf-link-external
- pv__tbl (font-variant-numeric) → sf-tabular-nums class alongside pv__tbl layout
Import core/macros.css in main.js (safe: all .sf-* selectors in @layer
slashed.macros, no global effects) so the real macro classes are available
in the preview stage. Remove all replaced pv__* CSS simulation rules.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013M6i4qstSh8vRPchkfm6Fy
📝 WalkthroughWalkthroughThe PR refactors the configurator's Layout and Macros preview tabs to use ChangesConfigurator Preview and Color Picker Updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
configurator/src/components/OklchPicker.svelte (1)
134-141: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDon't accept 8-digit HEX until alpha can round-trip.
Line 136 now accepts
#RRGGBBAA, buthexToLinearRgb()only consumes the first 6 digits andemit()persists an opaqueoklch()/oklab()string. Typing an 8-digit HEX therefore drops transparency beforeTokenEditorstores the override, which changes the color semantics.✂️ Safer stopgap
- if (/^#?[0-9a-fA-F]{6}$/.test(v) || /^#?[0-9a-fA-F]{8}$/.test(v)) { + if (/^#?[0-9a-fA-F]{6}$/.test(v)) {🤖 Prompt for 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. In `@configurator/src/components/OklchPicker.svelte` around lines 134 - 141, The onHexChange handler in OklchPicker.svelte is incorrectly accepting 8-digit HEX input even though the alpha channel is not preserved through hexToLinearRgb, applyOklch, and emit. Restrict the validation in onHexChange to 6-digit HEX only, or otherwise reject 8-digit values until alpha can be round-tripped end to end, so TokenEditor does not store a color override with lost transparency.
🤖 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.
Outside diff comments:
In `@configurator/src/components/OklchPicker.svelte`:
- Around line 134-141: The onHexChange handler in OklchPicker.svelte is
incorrectly accepting 8-digit HEX input even though the alpha channel is not
preserved through hexToLinearRgb, applyOklch, and emit. Restrict the validation
in onHexChange to 6-digit HEX only, or otherwise reject 8-digit values until
alpha can be round-tripped end to end, so TokenEditor does not store a color
override with lost transparency.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6d076273-0b88-4640-b66f-c8803d4d8ee2
📒 Files selected for processing (7)
configurator/src/components/BrandColorRow.svelteconfigurator/src/components/ContrastBadge.svelteconfigurator/src/components/DomainPreview.svelteconfigurator/src/components/OklchPicker.svelteconfigurator/src/components/Preview.svelteconfigurator/src/components/SmartSettings.svelteconfigurator/src/main.js
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e56365406
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <p style="margin:0">First (no top margin)</p> | ||
| <p style="margin:0">Second (gets --sf-flow-space top margin via * + *)</p> | ||
| <p style="margin:0">Third (same)</p> |
There was a problem hiding this comment.
Let sf-flow control the paragraph spacing
In the Macros tab, these inline margin:0 styles prevent the newly imported .sf-flow class from demonstrating its behavior: the framework rule in core/macros.css only adds margin-block-start to > * + *, but the inline margin on each paragraph wins in the cascade, so the second and third lines render with no flow gap despite the label saying they get --sf-flow-space. Removing the child inline margins (or only resetting the first child without overriding block-start on siblings) lets the live preview reflect the real macro.
Useful? React with 👍 / 👎.
OklchPicker: switchMode now converts OKLCH↔OKLab channel state before
changing mode, so sliders stay consistent and the emitted color doesn't
jump to a stale/wrong value when the user switches color spaces.
OklchPicker: onHexChange no longer fires on 3-char hex; only 6- and
8-digit hex are accepted. The old 3-char match was causing the $effect
to overwrite hexInput mid-typing, making it impossible to finish a full
6-char hex without the field being interrupted.
BrandColorRow: pickerValue is now kept in sync via $effect, so typing
in the text input while the OklchPicker is open updates the picker's
sliders rather than leaving it showing the stale opening value.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_013M6i4qstSh8vRPchkfm6Fy
Summary by CodeRabbit
New Features
Bug Fixes