Skip to content

feat(colors-panel): SF Colors picker panel — Quick Use + Palette, active swatch, border support, base rename - #201

Merged
jackgranatowski merged 2 commits into
mainfrom
claude/sf-colors-panel-behavior-0iqEz
Jun 3, 2026
Merged

feat(colors-panel): SF Colors picker panel — Quick Use + Palette, active swatch, border support, base rename#201
jackgranatowski merged 2 commits into
mainfrom
claude/sf-colors-panel-behavior-0iqEz

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

$(cat <<'EOF'

Summary

Full overhaul of the SF Colors panel and the --sf-color-base brand family rename.

SF Colors panel redesign

  • Two modes: badge launcher (reference/copy) and SF icon in Bricks color field (picker/apply)
  • Quick Use section: ~30 curated tokens in a 2-col grid grouped by role — Typography, Surfaces, Structure, Brand, Feedback
  • Palette section: Brand (6) + Status (5) families as a scanner table. Click to expand → base banner + aliases grid + scale strip + alpha strip
  • Active swatch feedback: after picking, the SF icon button fills with the chosen color (28×28 swatch); dot reverts to rainbow when field is cleared
  • Bricks preview swatch: patches the Bricks control-preview square to show the picked hex immediately (handles both standard and bricks-control-transparency-pattern variants)
  • Border/box-shadow support: fallback input selector covers controls without explicit type="text" attribute
  • Panel stays open: stopPropagation on click/mousedown prevents Bricks' click-outside handler from closing the settings panel while the color overlay is open
  • Dot persistence: injectSFButton re-reads the live input on every injection so the active swatch survives Bricks Vue re-renders
  • Scale strip hover: replaced border with inset box-shadow so hover highlight is clipped by the strip's overflow:hidden — no square corners bleeding through
  • SF button: 28×28px, rainbow dot 20×20px idle → fills button (28×28) after pick

--sf-color-base brand family revert

The surface brand family name was a mistake from a previous PR. Reverted across the full codebase:

  • --sf-color-base-light source knob, --sf-color-base resolved token
  • --sf-color-surface: var(--sf-color-base) restored as a semantic alias
  • Palette scale --sf-color-base-50--sf-color-base-950, alpha and shade aliases
  • PHP (class-token-defaults, class-css-generator, class-color-resolver), JS color model, tests, inventory all updated
  • Prose examples in README, CHANGELOG, docs updated

Docs / framework sync

  • docs/tokens.md, docs/registry.json regenerated (677 tokens)
  • scripts/gen-class-reference.js: fixed duplicate-class count bug — sf-link-external appears in both core/macros.css and core/print.css; generator now uses global Sets → 158 .sf-classes (was 159)
  • docs/classes.md, docs/demo.html corrected

Test plan

  • SF Colors panel opens from badge (reference/copy mode) and from SF icon in color field (picker mode)
  • Quick Use grid shows ~30 tokens in 5 groups; clicking copies/inserts var()
  • Palette scanner expands one family at a time; scale strip hover expands swatches cleanly
  • Background, text, gradient color fields: pick → var() written, Bricks preview swatch updates, SF dot shows picked color
  • Border and box-shadow color fields: same — panel stays open, dot updates, Bricks preview updates
  • Reopening a border/color field after picking: SF dot shows the previously set color (not rainbow)
  • Both-mode scale strip: hover highlight follows strip rounded corners (no square border bleed)
  • npm run audit:check → 677 tokens, 158 .sf-classes, 40 .is-classes

https://claude.ai/code/session_01HesqASnoEx3Amm4H7f17jj
EOF
)


Generated by Claude Code

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed color picker dialog event propagation issues with the editor interface
    • Restored active color state when reopening color picker with previous selection
  • New Features

    • Added smooth expand animation to color button visual feedback
    • Enhanced color preview styling with improved visual transitions

…x preview swatch

1. Stop click/mousedown propagation on ColorPanel root so Bricks' click-
   outside handler doesn't close the settings panel when the user picks
   a colour from our overlay panel.

2. Initialize SF button dot from current input value on every injection.
   Bricks Vue re-renders the color-input control after each value change,
   tearing out our old button. injectSFButton now reads the live input and
   re-arms the active swatch immediately so the dot persists across re-renders.

3. Active dot expands to fill the 28×28 button (was a 20px circle inset).
   After picking, the button becomes a full 28×28 colour swatch instead of
   a small dot inside a larger transparent area.

4. Bricks control-preview swatch: set both background and color (with
   !important) so the preview updates for both standard controls (which
   show a span hidden with display:none) and border/box-shadow controls
   (which use bricks-control-transparency-pattern with color:currentColor).

https://claude.ai/code/session_01HesqASnoEx3Amm4H7f17jj
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jackgranatowski, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 34 minutes and 16 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 023c4d13-fe02-41f0-a2c2-79be84fb1790

📥 Commits

Reviewing files that changed from the base of the PR and between bb31ecd and 6cb450c.

📒 Files selected for processing (2)
  • plugins/SLASHED-for-WP/integrations/bricks/assets/editor-app/app.css
  • plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/styles/panel.css
📝 Walkthrough

Walkthrough

The PR updates the Bricks editor color picker to restore and animate the active state of the "SF Colors" button when sf-color variables are already selected. Changes include animated CSS transitions for the expanding dot element, initialization logic to detect existing sf-color values and mark the button active, event propagation control on the ColorPanel dialog, and updated color property application to preview swatches.

Changes

SF Colors button state and visual updates

Layer / File(s) Summary
Active state styling and transitions
plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/styles/panel.css, plugins/SLASHED-for-WP/integrations/bricks/assets/editor-app/app.css
The .slashed-sf-color-btn__dot element now expands to 28×28px with a rounded-square border radius and animated width/height/border-radius transitions when the button is marked active, in both source and minified stylesheets.
Active state restoration on button injection
plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/lib/color-swatches.js
During SF Colors button creation, the current color input value is parsed to extract sf-color variables, matched against the hex map, and if found, the button's dot is styled with the hex color and the active CSS class is applied.
Dialog event propagation control
plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/components/ColorPanel.svelte
Click and mouse-down events on the ColorPanel dialog root are stopped from propagating to parent elements.
Preview swatch color property updates
plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/main.js
When a color is picked, both the background and CSS color properties (with !important) are applied to the preview swatch element to support currentColor-based transparency styling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#199: Both PRs modify the Bricks SF color picker UI feedback wiring and active button dot styling in app.css/panel.css and the preview updates in main.js.
  • codeslash-dev/SLASHED#191: Both PRs address the Bricks variable/color swatch picker flow by ensuring sf-color variables are properly resolved and displayed via the hex map lookup.
  • codeslash-dev/SLASHED#190: Both PRs target the Bricks SF colors swatch/variable picker by ensuring sf-color variables resolve correctly and the underlying hex-map entries exist for the picker to reference.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions multiple features (Quick Use, Palette, active swatch, border support, base rename) but the actual changes only show styling updates for the active swatch dot animation and event propagation fixes — none of the major panel redesign, Quick Use section, or Palette scanner features are evident in the code changes. Align the title with the actual changeset or ensure the PR includes all the changes described. The current changes appear to be part of a larger refactor — consider revising the title to focus only on what's actually included (e.g., 'fix: SF Colors button active state animation and event propagation').
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/sf-colors-panel-behavior-0iqEz

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/styles/panel.css (1)

630-639: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add width/height transitions to the base dot for smooth reverse animation.

The active state (line 645) transitions width, height, and border-radius when expanding the dot 20→28px, but the base state only transitions border-radius. When the active class is removed, the dot will snap from 28px back to 20px instantly while the border-radius animates smoothly, creating a jarring visual inconsistency.

🎨 Proposed fix
 .slashed-sf-color-btn__dot {
   display: inline-block;
   width: 20px;
   height: 20px;
   border-radius: 50%;
   background: conic-gradient(from 210deg, `#5b8cff`, `#b07cff`, `#ff6b6b`, `#ffd24a`, `#4ade80`, `#5b8cff`);
   box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
   flex-shrink: 0;
-  transition: border-radius 120ms;
+  transition: width 80ms, height 80ms, border-radius 120ms;
 }
🤖 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 `@plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/styles/panel.css`
around lines 630 - 639, The base .slashed-sf-color-btn__dot currently only
transitions border-radius, causing a snap when the active state shrinks
width/height back from 28px to 20px; update the .slashed-sf-color-btn__dot rule
to include width and height in the transition (matching the active state's
timing/duration) so width, height and border-radius animate smoothly in both
expand and collapse.
🤖 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 `@plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/styles/panel.css`:
- Around line 630-639: The base .slashed-sf-color-btn__dot currently only
transitions border-radius, causing a snap when the active state shrinks
width/height back from 28px to 20px; update the .slashed-sf-color-btn__dot rule
to include width and height in the transition (matching the active state's
timing/duration) so width, height and border-radius animate smoothly in both
expand and collapse.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 26df4a67-ea75-4258-81d7-6ba8f0f3a467

📥 Commits

Reviewing files that changed from the base of the PR and between 04c2393 and bb31ecd.

📒 Files selected for processing (6)
  • plugins/SLASHED-for-WP/integrations/bricks/assets/editor-app/app.css
  • plugins/SLASHED-for-WP/integrations/bricks/assets/editor-app/app.js
  • plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/components/ColorPanel.svelte
  • plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/lib/color-swatches.js
  • plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/main.js
  • plugins/SLASHED-for-WP/integrations/bricks/editor-app/src/styles/panel.css

…smooth shrink

Without this, removing the active class snapped the dot from 28→20px
while border-radius still animated, creating a jarring inconsistency.

https://claude.ai/code/session_01HesqASnoEx3Amm4H7f17jj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants