feat: frontend overlay configurator — edit tokens on any page - #86
Conversation
Injects the full SLASHED token editor as a collapsible floating panel on any WordPress frontend page for users with manage_options access. The current page acts as the live preview — token changes inject CSS custom properties directly into the page's own <head> via the existing #sf-parent-overrides mechanism, so every slider/color adjustment is visible in real time without an iframe. Activation: "/ Design" button in the WordPress admin bar dispatches `slashed:toggle-overlay` which the Svelte app listens for. Panel state (open/closed, last active domain) is persisted in localStorage and survives navigation between pages. Changes: - admin-app/src/AppOverlay.svelte — new overlay-mode Svelte component: collapsible right-side drawer (420 × calc(100vh-32px)), compact header with undo/redo/import/export/reset, full SidebarNav + DomainPanel, Ctrl+K command palette, slide-in/out CSS transition - admin-app/src/plugin-main.ts — plugin-specific entry point that runs main.ts (upstream configurator) then mounts AppOverlay if the overlay container element is present - admin-app/vite.config.js — entry changed from main.ts to plugin-main.ts - admin-app/.syncignore — AppOverlay.svelte + plugin-main.ts protected from upstream wipe - includes/class-frontend-configurator.php — new WordPress class: enqueues the shared admin-app bundle on the frontend, hydrates window.slashedApp (REST URL + nonce + current overrides), adds the admin bar node, outputs the #slashed-frontend-overlay mount div - slashed.php — registers Slashed_Frontend_Configurator on plugins_loaded Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GPdw3Lch2xPWK8rVR1Jh3C
|
Warning Review limit reached
More reviews will be available in 38 minutes and 16 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate 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 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 (5)
📝 WalkthroughWalkthroughAdds a floating token-editor overlay for WordPress public frontend pages. A new PHP class ChangesWordPress Frontend Token Overlay
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 frontend token editor overlay (admin-bar toggle + live CSS injection) Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1.
|
- Remove alignment padding from constructor add_action calls - Fix ternary operator spacing (single space before ? and :) - Align 'rest' array key with 'overrides' key in wp_localize_script - Expand inline lambda in slashed.php to multi-line form Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GPdw3Lch2xPWK8rVR1Jh3C
4c3d331 to
953c949
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@SLASHED-for-WP/admin-app/src/AppOverlay.svelte`:
- Around line 190-195: The collapsed drawer in AppOverlay.svelte still remains
focusable when isOpen is false, so make the drawer truly inert when closed by
applying an inert state or equivalent focus-blocking behavior to the overlay
container alongside the existing aria-hidden and translate classes. Update the
main drawer element in AppOverlay so its interactive descendants cannot receive
keyboard focus while collapsed, and ensure the open state restores normal
interaction.
- Around line 153-157: The undo/redo shortcut handling in keydown should
normalize e.key before comparisons so uppercase key values are matched
consistently. Update the logic in AppOverlay.svelte’s keydown handler to use a
lowercase-normalized key for both the undo and redo branches, keeping the
Ctrl/Cmd+K handling consistent with that approach.
🪄 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: d909e6ae-c9d9-4314-96b9-ec80fb81ff0c
📒 Files selected for processing (8)
SLASHED-for-WP/admin-app/.syncignoreSLASHED-for-WP/admin-app/src/AppOverlay.svelteSLASHED-for-WP/admin-app/src/plugin-main.tsSLASHED-for-WP/admin-app/vite.config.jsSLASHED-for-WP/assets/admin-app/app.cssSLASHED-for-WP/assets/admin-app/app.jsSLASHED-for-WP/includes/class-frontend-configurator.phpSLASHED-for-WP/slashed.php
- Mount frontend overlay into shadow root (attachShadow) so Tailwind's
global base/reset styles don't bleed onto the live-preview page; CSS
custom properties (--sf-*) still inherit through the shadow boundary
- Pass cssUrl in window.slashedApp; remove global wp_enqueue_style call
for the overlay so app.css is only loaded inside the shadow root
- Add inert={!isOpen} and pointer-events-none to the closed drawer so
its buttons are removed from the keyboard focus order when collapsed
- Normalize e.key to lowercase before undo/redo/palette comparisons so
Ctrl+Shift+Z works even when the browser reports 'Z' instead of 'z'
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GPdw3Lch2xPWK8rVR1Jh3C
Injects the full SLASHED token editor as a collapsible floating panel on
any WordPress frontend page for users with manage_options access. The
current page acts as the live preview — token changes inject CSS custom
properties directly into the page's own via the existing
#sf-parent-overrides mechanism, so every slider/color adjustment is
visible in real time without an iframe.
Activation: "/ Design" button in the WordPress admin bar dispatches
slashed:toggle-overlaywhich the Svelte app listens for. Panel state(open/closed, last active domain) is persisted in localStorage and
survives navigation between pages.
Changes:
collapsible right-side drawer (420 × calc(100vh-32px)), compact header
with undo/redo/import/export/reset, full SidebarNav + DomainPanel,
Ctrl+K command palette, slide-in/out CSS transition
main.ts (upstream configurator) then mounts AppOverlay if the overlay
container element is present
from upstream wipe
enqueues the shared admin-app bundle on the frontend, hydrates
window.slashedApp (REST URL + nonce + current overrides), adds the
admin bar node, outputs the #slashed-frontend-overlay mount div
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01GPdw3Lch2xPWK8rVR1Jh3C
Summary by CodeRabbit
New Features
Bug Fixes