fix(configurator): tabbed Basic/Advanced UI, dark-mode preview, display scale - #302
Conversation
…ay scale
- Resolve light-dark() per theme in the live preview + WCAG probes so dark
mode actually switches (inherited light-dark() does not re-evaluate from a
non-root color-scheme; mirrors the framework's [data-theme] re-declarations).
Extracted to lib/lightdark.js with unit tests.
- Scale generator: add the Display ramp (--sf-text-display-{s,m,l}) and a
'kinds' prop; keep the parity scale.js byte-for-byte identical.
- Restructure into domain tabs (Typography, Spacing, Colors, WCAG, Layout,
Borders, Shadows, Motion, More) with a global Basic/Advanced toggle, reaching
parity with the WP plugin admin app. Adds lib/domains.js, TabNav, DomainPanel.
- Re-sync configurator catalogue to framework v0.5.31; de-stale a test comment.
Co-authored-by: Jack Granatowski <contact@codeslash.net>
|
Warning Review limit reached
More reviews will be available in 39 minutes and 10 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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe configurator transitions from a token-list view driven by sidebar category selection to a domain-tabbed interface where each domain renders customized token editors and generators. Dark-mode CSS ChangesDomain-centric UI and preview system
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
- Restore Modified-only + Show-internal filters (lost with the Sidebar) to the Advanced panel header. - Clear the search query on tab switch so a stale filter never empties the next domain's list. - inferControl: treat composite values (box-shadow etc.) as non-color via a top-level-space check, so shadow tokens get a text editor not a dead swatch. - Tighten the shadows domain regex (anchor glow; drop redundant drop-shadow). - Only label group categories when more than one is present in a domain. - Lift the Light/Dark preview-theme toggle into the header so it works with the preview hidden and on the WCAG tab; update copy. - Drop the dead re-export and the duplicated double scroll container.
# Conflicts: # configurator/src/data/api-index.generated.json
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@configurator/src/lib/lightdark.js`:
- Around line 73-76: The current parentheses depth scan loop (using variables i,
value, depth) ignores quoted strings so parentheses inside quotes prematurely
change depth; modify the loop to track quote context (e.g., a variable like
inQuote or quoteChar) and toggle it when encountering unescaped single or double
quotes, ignore '(' and ')' when inQuote is set, and handle escape characters
(backslash) so escaped quotes don't toggle the quote state; update the loop that
advances i and adjusts depth to consult the quote state while preserving
existing behavior when not quoted.
🪄 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: b02db84e-49e4-4ed8-8b6b-cdc3952d160a
📒 Files selected for processing (15)
configurator/src/App.svelteconfigurator/src/components/DomainPanel.svelteconfigurator/src/components/Header.svelteconfigurator/src/components/Preview.svelteconfigurator/src/components/ScaleGenerator.svelteconfigurator/src/components/Sidebar.svelteconfigurator/src/components/TabNav.svelteconfigurator/src/components/WcagPanel.svelteconfigurator/src/lib/domains.jsconfigurator/src/lib/lightdark.jsconfigurator/src/lib/model.jsconfigurator/src/lib/preview.jsconfigurator/src/lib/store.svelte.jsconfigurator/tests/lightdark.test.jstests/api-index-sync.test.js
💤 Files with no reviewable changes (1)
- configurator/src/components/Sidebar.svelte
The depth-matching scan in resolveLightDark didn't track quote context, so a ')' inside a quoted string could terminate the parens scan early and corrupt the resolved output. splitTopLevelArgs already handled this correctly — bring resolveLightDark in line. Adds a regression test. Addresses CodeRabbit feedback on PR #302.
This pull request was created by @kiro-agent on behalf of @jackgranatowski 👻
Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro Web
Summary
Audit of the framework's sync state plus three configurator fixes the user asked for. Scope is the framework configurator only — the WP plugin is intentionally untouched (to be done in a later session).
1. Sync audit (findings)
0.5.30→ should be0.5.31). The v0.5.31 release commit bumped versions but didn't re-run a fullnpm run build(which runsconfigurator:sync). Re-synced here. CI'scheck-version-sync.jsalready guards this.api-index,token-index,registry, token/class references) regenerate with zero diff from source CSS — in sync..spec.jssuites need a browser and weren't run in this environment.2. Dark-mode preview fix
The preview seeded all
:rootlight-dark()defaults onto a non-root stage element and only flippedcolor-scheme. Per the framework's owncore/themes.css, inheritedlight-dark()custom properties are not re-evaluated that way — which is exactly why the framework re-declares every mode-sensitive token under[data-theme="dark"]. We now resolvelight-dark(light, dark)ourselves per theme (newlib/lightdark.js, unit-tested), reproducing the[data-theme]behavior on every engine. This also fixes dark-mode resolution in the WCAG probes.3. Scale generator — display fonts
Added the Display ramp (
--sf-text-display-{s,m,l}, base 2.4–3rem, indices 0/1/2 sharing the text ratio, matchingcore/tokens.css). The sharedscale.jsis a byte-for-byte parity module with the plugin, so display steps live in the component (exactly how the plugin does it) — parity preserved. A newkindsprop lets tabs scope the generator (Typography → type+display, Spacing → space).4. Tabbed Basic/Advanced restructure (parity with the plugin)
The plugin admin app already had tabs + advanced disclosure; the configurator was a flat token list. Brought it to parity:
lib/domains.jsclassifier covers 100% of tokens —Morecatches strays so nothing is hidden).TabNav(with per-domain override-count badges),DomainPanel. Reuses the existingTokenRow/TokenEditor/OklchPicker/WcagPanel. Removed the now-unusedSidebar.Testing
npm run build(framework + configurator) — clean, no Svelte warnings.check-version-syncOK.light-dark()(resolved) or derives from a base that does.Notes / limitations
npm run devinconfigurator/to eyeball the tabs and dark preview.scrollbar-*) may land in an adjacent tab. Easy to retune inlib/domains.js.Summary by CodeRabbit
New Features
Improvements