Skip to content

Expand button & card documentation; add shade ramp preview - #380

Closed
jackgranatowski wants to merge 1 commit into
mainfrom
claude/festive-ride-xbz0bo
Closed

Expand button & card documentation; add shade ramp preview#380
jackgranatowski wants to merge 1 commit into
mainfrom
claude/festive-ride-xbz0bo

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Significantly expands the CSS documentation for .sf-button and .sf-card components in optional/components.css, adds a new ShadeRamp.svelte component to the configurator for visualizing brand color shade ramps, and introduces two new layout utility classes for sticky header offset handling.

Key changes

  • Button documentation — Restructured and expanded with detailed sections covering:

    • Base styles and element support (<button>, <a>, <input>, <label>)
    • Colour variants (primary, secondary, ghost, danger, neutral) with hover/active states
    • Size variants (s, m, l) using logical padding properties
    • Shape variants (icon, pill, full)
    • Disabled state handling
    • Improved token naming (--sf-button-padding-block/inline replaces --sf-button-pad-x/y)
  • Card documentation — Restructured with sections for:

    • Concentric radius explanation
    • Semantic section wrappers (__header, __body, __footer)
    • Style variants (bordered, elevated, interactive, glow, flat)
    • Layout variants (horizontal, no-pad, divided)
    • Interactive hover-lift and active states
  • New layout utilities — Added to core/layout.css:

    • .sf-scroll-target — Applies scroll-margin-block-start to anchor targets so they stay visible under sticky headers
    • .sf-section--offset-header — Extends section padding to account for sticky header height
  • Configurator enhancements:

    • New ShadeRamp.svelte component displays the full 7-step shade ramp (superlight → superdark) for each brand color (primary, secondary, tertiary, action, neutral, base)
    • Resolves tokens reactively against the preview theme
    • Added shade ramp disclosure panel to DomainPanel.svelte
    • Enhanced DomainPreview.svelte with a font pairing specimen box showing heading + body text together
  • API documentation — Updated counts reflect 2 new classes (+2 sf-classes, +2 total elements)

Implementation notes

  • Button and card documentation uses consistent formatting with subsection headers and code examples
  • Shade ramp component uses measureBackground() to resolve CSS custom properties at runtime
  • New layout classes follow existing naming conventions and integrate with --sf-sticky-offset token
  • All changes are additive; no breaking modifications to existing styles

https://claude.ai/code/session_01VHJYtgospEruriwQSDmofr


Summary by cubic

Expands .sf-button and .sf-card docs, adds a brand shade ramp preview in the configurator, and introduces layout utilities for sticky header offsets. Also adds a font pairing specimen in the typography preview.

  • New Features
    • Added ShadeRamp.svelte and a “Shade ramp” panel to visualize the 7-step brand scales (superlight→superdark), resolving tokens reactively against the preview theme.
    • Added a font pairing specimen in DomainPreview.svelte and a new “Specimen” group in domainPreviews.js to preview heading + body together.
    • New layout utilities in core/layout.css: .sf-scroll-target and .sf-section--offset-header to keep anchor targets visible under sticky headers via --sf-sticky-offset.
    • Expanded commented stubs in optional/components.css for .sf-button and .sf-card: clearer structure, correct token names (--sf-button-padding-block/inline), color/size/shape variants, disabled handling, and card layout variants (bordered/elevated/interactive/glow/flat, horizontal/no-pad/divided).
    • Updated API docs/registry counts (+2 .sf-* classes; 927 elements total) and gzip size badges (dist/badge-*.json).

Written for commit b9dc3f6. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added shade ramp visualization for brand colors, displaying a 7-step color scale preview
    • Added type specimen preview capability for typography tokens, showcasing text rendering and metadata
  • Layout Improvements

    • Added new layout utilities to properly offset content beneath sticky/fixed headers and improve anchor link navigation visibility
  • Documentation

    • Updated API documentation to reflect new layout utilities

…stubs

Layout (core/layout.css):
- .sf-section--offset-header: extends padding-block-start by --sf-sticky-offset
  so content clears a sticky header on first load and hash navigation.
- .sf-scroll-target: sets scroll-margin-block-start for anchor targets under
  a sticky header.

Configurator — shade ramp (configurator/src/components/ShadeRamp.svelte):
- New ShadeRamp component: resolves and displays the 7-step shade ramp
  (superlight → superdark) for all 6 brand color families via the probe host;
  live-updates on override or theme change.
- Integrated into DomainPanel.svelte as a collapsible "Shade ramp" card in
  the Colors domain.

Configurator — font pairing specimen:
- DomainPreview.svelte: renders a live heading + body paragraph pairing when
  group.section === 'Specimen', using --sf-font-heading and --sf-font-body.
- domainPreviews.js: adds 'Specimen' group to the typography domain.

Components (optional/components.css) — stubs only, all still commented out:
- .sf-button: rewrote stub with correct token names (padding-block/inline not
  pad-y/pad-x), all 5 colour variants with hover/active states, s/l size
  variants, icon/pill/full shape variants, disabled state without
  pointer-events:none (keeps focus reachable for a11y tooltips).
- .sf-card: rewrote stub with concentric-radius note, no overflow:hidden on
  the base rule (avoids clipping tooltips/dropdowns), all style variants
  (bordered/elevated/interactive/glow/flat), layout variants
  (horizontal/no-pad/divided), fixed .sf-card--divided to use only
  padding (not padding + margin) for header/footer separators.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHJYtgospEruriwQSDmofr
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a ShadeRamp configurator component that resolves and renders a 7-step brand-color swatch grid, integrates it into DomainPanel as a collapsible card, extends the typography preview with a type-specimen branch, introduces two new core layout CSS classes for sticky-header offsetting (sf-scroll-target, sf-section--offset-header), updates all generated API docs, and expands commented component specs for .sf-button and .sf-card.

Changes

Configurator: ShadeRamp and Type Specimen previews

Layer / File(s) Summary
ShadeRamp component and DomainPanel integration
configurator/src/components/ShadeRamp.svelte, configurator/src/components/DomainPanel.svelte
New ShadeRamp.svelte resolves CSS token RGB values against the active preview theme using measureBackground(), populates a reactive resolved map, and renders a 7-column swatch grid per brand family with perceived-lightness–based base-dot styling. DomainPanel imports it, adds showShadeRamp state, and renders it inside a new collapsible "Shade ramp" card in the brand-colors settings area.
Type specimen preview branch
configurator/src/lib/domainPreviews.js, configurator/src/components/DomainPreview.svelte
domainPreviews.js adds a Specimen section under typography with --sf-h2-size and --sf-leading-normal token entries. DomainPreview.svelte adds a template branch that renders a heading/body specimen box with token-variable metadata tags when spec.kind === 'type' and group.section === 'Specimen', plus scoped .dp__specimen-* CSS rules.

Core sticky-header layout primitives and generated docs

Layer / File(s) Summary
New layout CSS rules
core/layout.css
Inserts .sf-section--offset-header (increases padding-block-start by --sf-sticky-offset) and .sf-scroll-target (sets scroll-margin-block-start to --sf-sticky-offset) to keep hash-anchor targets visible beneath sticky headers.
Generated documentation updates
docs/api-index.json, docs/api-index.md, docs/classes.md, docs/registry.json
All generated API index and class registry files are updated with entries for sf-scroll-target and sf-section--offset-header, and element/class counts are adjusted throughout.

Expanded optional component specs

Layer / File(s) Summary
.sf-button and .sf-card spec expansion
optional/components.css
Replaces stub commented blocks with detailed specs: .sf-button gains colour variants, size/shape modifiers, focus/motion/loading/disabled guidance; .sf-card gains docs on concentric radius/padding, overflow rules, and new variants (glow/flat, horizontal, no-pad, divided header/footer).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#191: Modifies --sf-header-height and :target scroll-offset logic, which directly underpins the new .sf-scroll-target / .sf-section--offset-header classes in this PR.
  • codeslash-dev/SLASHED#369: Also modifies DomainPanel.svelte in the brand-colors area to add collapsible disclosure-based color preview UI (ColorAssignments swatches), the same area extended here with ShadeRamp.
  • codeslash-dev/SLASHED#371: Extends the same domainPreviews.js and DomainPreview.svelte token-preview infrastructure this PR further modifies with the new Specimen section.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: expanding button and card documentation in optional/components.css and adding a shade ramp preview feature to the configurator.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/festive-ride-xbz0bo

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.

@jackgranatowski

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
configurator/src/components/DomainPanel.svelte (1)

334-342: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Lazy-mount the shade ramp content when collapsed.

Line 341 keeps ShadeRamp mounted even when the disclosure is closed, so its reactive probe work still runs on every override/theme change. Gate rendering by showShadeRamp to avoid hidden measureBackground churn.

💡 Suggested change
         <details class="cfg-card panel__card" bind:open={showShadeRamp}>
           <summary class="panel__card-head panel__expand-summary">
             <span class="panel__expand-chev" aria-hidden="true">›</span>
             <span class="panel__card-title">Shade ramp</span>
             <span class="panel__expand-count">7-step scale per brand color</span>
           </summary>
-          <ShadeRamp />
+          {`#if` showShadeRamp}
+            <ShadeRamp />
+          {/if}
         </details>
🤖 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/DomainPanel.svelte` around lines 334 - 342, The
ShadeRamp component is always mounted inside the details element even when
showShadeRamp is false, causing its reactive probe work (like measureBackground)
to run unnecessarily on every override/theme change. Gate the rendering of the
ShadeRamp component by wrapping it with a conditional check that only renders it
when showShadeRamp is true, using Svelte's conditional rendering syntax to avoid
the hidden component's performance churn.
🤖 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.md`:
- Around line 858-864: The entries for .sf-scroll-target and
.sf-section--offset-header are incorrectly categorized as "Collapse modifier" in
the table. Update the category column for .sf-scroll-target to reflect it as a
scroll utility rather than a collapse modifier, and update
.sf-section--offset-header to be categorized as a "Section variant" instead of a
"Collapse modifier" to accurately represent their actual purpose and function.

In `@docs/classes.md`:
- Around line 6-11: Locate and remove all references to the `.sf-scroll-snap`
class from the documentation files since this class no longer exists in the
source code. Search the documentation for mentions of `.sf-scroll-snap` and
delete those references to keep the documentation synchronized with the actual
codebase.

---

Nitpick comments:
In `@configurator/src/components/DomainPanel.svelte`:
- Around line 334-342: The ShadeRamp component is always mounted inside the
details element even when showShadeRamp is false, causing its reactive probe
work (like measureBackground) to run unnecessarily on every override/theme
change. Gate the rendering of the ShadeRamp component by wrapping it with a
conditional check that only renders it when showShadeRamp is true, using
Svelte's conditional rendering syntax to avoid the hidden component's
performance churn.
🪄 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: a1ae8928-399d-4bac-b59f-07e4eac9d367

📥 Commits

Reviewing files that changed from the base of the PR and between 1462341 and b9dc3f6.

⛔ Files ignored due to path filters (2)
  • dist/badge-essential.json is excluded by !**/dist/**
  • dist/badge-optimal.json is excluded by !**/dist/**
📒 Files selected for processing (10)
  • configurator/src/components/DomainPanel.svelte
  • configurator/src/components/DomainPreview.svelte
  • configurator/src/components/ShadeRamp.svelte
  • configurator/src/lib/domainPreviews.js
  • core/layout.css
  • docs/api-index.json
  • docs/api-index.md
  • docs/classes.md
  • docs/registry.json
  • optional/components.css

Comment thread docs/api-index.md
Comment on lines +858 to +864
| `.sf-scroll-target` | PUBLIC | layout | Collapse modifier | Anchor targets (#id links) stay visible under a sticky header. Browsers scroll the element to the viewport top; this pushes the effective snap point down by the header height. Use on any element with an id= that serves as a scroll destination: <section id="features"… |
| `.sf-section` | PUBLIC | layout | Section | Full-width page section with vertical padding (--sf-section-pad-default). Use to create visually distinct content bands. |
| `.sf-section--2xl` | PUBLIC | layout | Section | Section variant with 2xl vertical padding. |
| `.sf-section--collapse` | PUBLIC | layout | Collapse modifier | Section variant that removes vertical padding (zero-padding section for adjacent same-color blocks). |
| `.sf-section--l` | PUBLIC | layout | Section | Section variant with large (l) vertical padding. |
| `.sf-section--m` | PUBLIC | layout | Section | Section variant with medium (m) vertical padding. |
| `.sf-section--offset-header` | PUBLIC | layout | Collapse modifier | Extends padding-block-start by --sf-sticky-offset so the section's top content clears a sticky/fixed header on first load and after hash navigation. Pairs with .sf-scroll-target below. Override the offset per-section: style="--sf-sticky-offset: 4rem" |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Retag these entries as scroll/layout variants, not collapse modifiers.

sf-scroll-target is a scroll utility, and sf-section--offset-header is a section variant. Grouping both under Collapse modifier makes the generated taxonomy misleading.

🤖 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 `@docs/api-index.md` around lines 858 - 864, The entries for .sf-scroll-target
and .sf-section--offset-header are incorrectly categorized as "Collapse
modifier" in the table. Update the category column for .sf-scroll-target to
reflect it as a scroll utility rather than a collapse modifier, and update
.sf-section--offset-header to be categorized as a "Section variant" instead of a
"Collapse modifier" to accurately represent their actual purpose and function.

Comment thread docs/classes.md
Comment on lines +6 to +11
**185 .sf-classes, 40 .is-classes.** Every `.sf-*` layout/macro class and `.is-*` state class.
See [architecture.md](architecture.md) for layer order and naming conventions.

## Layout primitives (`core/layout.css`)

126 classes.
128 classes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n --no-heading '\.sf-scroll-snap\b' core/layout.css docs/classes.md docs/api-index.md docs/registry.json

Repository: codeslash-dev/SLASHED

Length of output: 394


Remove stale .sf-scroll-snap references from documentation.

The class .sf-scroll-snap no longer exists in core/layout.css, but it still appears in docs/classes.md (line 170) and docs/api-index.md (line 913). These references should be removed to keep the documentation in sync with the source.

🤖 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 `@docs/classes.md` around lines 6 - 11, Locate and remove all references to the
`.sf-scroll-snap` class from the documentation files since this class no longer
exists in the source code. Search the documentation for mentions of
`.sf-scroll-snap` and delete those references to keep the documentation
synchronized with the actual codebase.

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