Skip to content

feat(bricks): add Export CSS button to admin panel - #119

Closed
kiro-agent[bot] wants to merge 4 commits into
audit-fixes-pre-freezefrom
feat/export-css
Closed

feat(bricks): add Export CSS button to admin panel#119
kiro-agent[bot] wants to merge 4 commits into
audit-fixes-pre-freezefrom
feat/export-css

Conversation

@kiro-agent

@kiro-agent kiro-agent Bot commented May 27, 2026

Copy link
Copy Markdown

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 autonomous agent


Summary

Adds a client-side CSS export feature to the Bricks admin panel so users can download a slashed-custom.css file containing only their non-default token overrides.\n\n## Changes\n\n- New file: src/lib/export.jsgenerateExportCSS(tokens) function that mirrors the PHP Slashed_Bricks_CSS_Generator logic on the client side. Covers all 8 token sections (colors, typography with fluid clamp(), spacing, radius, shadows, motion, zindex, contrast).\n- Updated: SaveBar.svelte — Added "Export CSS" button between Reset and Save. Uses Blob + anchor download pattern. Button is always visible but disabled when no overrides exist (hasOverrides() check).\n- Rebuilt dist assets (app.js, app.css)\n\n## Output format\n\ncss\n@layer slashed.overrides {\n :root {\n --sf-color-primary-light: oklch(0.55 0.18 280);\n --sf-radius-scale: 0;\n /* ...only changed values... */\n }\n}\n\n\n## Notes\n\n- Pure client-side — no PHP changes\n- Token→CSS property mapping matches PHP generator exactly\n- Svelte 5 runes syntax ($derived for canExport flag)"

kiro-agent and others added 4 commits May 27, 2026 09:02
- Fix rest_no_route error: REST controller was only loaded inside
  is_admin() block, but REST API requests are not admin requests.
  Added slashed_bricks_rest_init() to register routes on non-admin
  (API) requests.

- Add dark mode color UI: ColorTab now shows separate sections for
  light and dark mode brand/status colors. Dark mode fields are
  optional — the framework auto-derives from light when empty.

- Update CSS generator to emit --sf-color-X-dark declarations when
  dark overrides are set by the user.

- Update Token Defaults with dark mode placeholders and hex hints.

- Update LivePreview to include dark color overrides in generated CSS.

- Add --sf-color-{brand}-dark to cheatsheet data.

Co-authored-by: Jack Granatowski <contact@codeslash.net>
Replace the duplicated slashed_bricks_rest_init() (gated by !is_admin)
with a single rest_api_init hook. WordPress only fires rest_api_init
during REST dispatch, so this is both simpler and eliminates the risk
of dependency drift between admin and REST init paths.

Also removes the redundant REST controller instantiation from the
admin init — routes are now registered exclusively via rest_api_init.
…dark-mode

fix(bricks): resolve REST 404 and add dark mode colors
- New export.js module with generateExportCSS() mirroring PHP CSS generator logic
- Covers all token sections: colors, typography (clamp), spacing, radius, shadows, motion, zindex, contrast
- downloadCSS() in SaveBar triggers browser download of slashed-custom.css
- Export button disabled when no overrides exist, always visible regardless of dirty state
- Output format: @layer slashed.overrides { :root { ...only changed tokens... } }

Co-authored-by: Jack Granatowski <contact@codeslash.net>
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