Skip to content

feat(bricks): reBEMer tab with enable toggle, Colors launcher toggle, and container rename rows - #69

Merged
jackgranatowski merged 3 commits into
mainfrom
claude/rebemer-default-bem-names-agzxk7
Jun 21, 2026
Merged

feat(bricks): reBEMer tab with enable toggle, Colors launcher toggle, and container rename rows#69
jackgranatowski merged 3 commits into
mainfrom
claude/rebemer-default-bem-names-agzxk7

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Builds on the merged Bricks-settings consolidation (#68) with three user-requested additions, organised into a dedicated reBEMer tab.

The Bricks settings page now has three tabs:

Tab Contents
reBEMer (default) reBEMer enable/disable toggle + the element default-name list (now including layout containers), saved together
Options Color System launcher toggle, Class hints toggle
Filter hooks Bricks filter-hook reference

Changes

Enable/disable reBEMer — new rebemer_enabled plugin setting + toggle at the top of the reBEMer tab. The editor (main.js) gates the structure-panel BEM badge pipeline on cfg.rebemerEnabled; the colour tools stay independent (the Bricks probe still runs).

Enable/disable the bottom-right "Colors" launcher — new show_color_panel setting + toggle in the Options tab. class-editor-data.php uses that setting as the default for the existing slashed_bricks/show_color_panel filter (filter still wins for programmatic overrides); main.js already gated the launcher on showColorPanel.

Containers in the rename listsection / container / div / block now appear in the reBEMer element table. They default to their own Bricks type (placeholder) and an override wins: suggestContainerName consults the merged override map, so e.g. container → wrapper applies in the builder. Mirrored in the standalone admin SPA tab.

Tab restructure — renamed the old "Element names" tab to reBEMer (now the default) and moved the enable toggle into it above the element table; one form (handle_save_rebemer) persists both rebemer_enabled and the override map.

Plumbing: both new booleans are wired through the REST settings allow-list, save, and import paths; defaults added to PLUGIN_SETTING_DEFAULTS (required since the store whitelists keys).

Testing

  • element-types suite 23/23 green, including a new test that an admin override wins for a container while siblings keep their default.
  • php -l clean on all changed PHP; both Vite bundles (editor-app + admin-app) rebuilt and confirmed to carry rebemerEnabled.

Note: the repo's sync.test.js currently fails on main (readme.txt Stable tag 0.3.5 vs package.json 0.3.4) — a pre-existing release-tooling state in files this PR does not touch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE


Generated by Claude Code


Summary by cubic

Adds a dedicated reBEMer tab with an enable toggle and container rename support, plus an option to show/hide the bottom‑right Colors launcher. This gives admins quick control over BEM tooling and default names across all elements, including layout containers.

  • New Features

    • reBEMer tab (default): toggle rebemer_enabled to show/hide the BEM badges and panel in the builder; the editor gates on rebemerEnabled. The element default-name table now lists section/container/div/block; they default to their own type, and an override in rebemer_element_map wins. Both the toggle and table save together.
    • Options tab: new toggle for the Colors launcher (show_color_panel). Used as the default for the slashed_bricks/show_color_panel filter; the filter still overrides. Added both rebemer_enabled and show_color_panel to REST save/import and plugin defaults.
  • Bug Fixes

    • Synced plugin version to 0.3.5 across package.json, slashed.php, integrations/bricks/slashed-bricks.php, and integrations/gutenberg/slashed-gutenberg.php to clear release-tooling drift.

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

Review in cubic

Summary by CodeRabbit

  • New Features

    • New reBEMer tab in Bricks settings with enable/disable toggle and per-element BEM name overrides
    • Layout containers (section, container, div, block) now support default BEM name assignment
    • Added Colors launcher toggle in Bricks settings → Options
  • Documentation

    • Updated reBEMer documentation reflecting new settings tab and container naming support
  • Tests

    • Added test coverage for container name override functionality

claude added 2 commits June 21, 2026 13:44
- Bricks settings → Options: new toggles to enable/disable reBEMer (the
  in-builder BEM badges + panel) and the bottom-right "Colors" launcher pill.
  Backed by new rebemer_enabled / show_color_panel plugin settings; the editor
  bundle gates the badge pipeline on rebemerEnabled and the color launcher on
  showColorPanel (the latter still honors the slashed_bricks/show_color_panel
  filter, now defaulting to the setting).
- Element names table now lists the layout containers (section / container /
  div / block). They default to their own Bricks type; an override wins, and
  suggestContainerName consults the merged override map so it applies in the
  builder.
- Wire the two booleans through the REST settings allow-list, save, and import
  paths for parity; surface containers in the standalone admin SPA tab too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
Rename the "Element names" tab to "reBEMer" (now the default tab) and put
the reBEMer enable/disable toggle at the top of it, above the element
default-name table — both saved by a single form (handle_save_rebemer).
The Options tab keeps the Color System launcher and Class hints toggles.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Renames the Bricks Settings "Element names" tab to "reBEMer", adds a master rebemer_enabled toggle and a show_color_panel toggle for the Colors launcher pill. Extends element override coverage to include layout containers (section/container/div/block). Propagates both new boolean flags through plugin setting defaults, the PHP admin page save handler, REST API save/import endpoints, editor data localization, and the editor JS/Svelte UI.

Changes

reBEMer Settings & Toggle Wiring

Layer / File(s) Summary
Plugin setting defaults
SLASHED-for-WP/includes/class-token-store.php
Adds rebemer_enabled (default true) and show_color_panel (default true) to PLUGIN_SETTING_DEFAULTS, revising the layout-container comment to reflect override semantics.
Admin settings page: reBEMer tab & Options tab
SLASHED-for-WP/includes/class-bricks-settings-page.php
Renames nonce/action constants and save handler from names to rebemer; updates tab slug and hook registration; expands elements() to include layout containers; introduces handle_save_rebemer() saving rebemer_enabled + rebemer_map; adds show_color_panel to Options tab save and render; updates reBEMer tab UI with master enable checkbox; adjusts post-save redirect.
REST API: new boolean params for save & import
SLASHED-for-WP/includes/class-rest-controller.php
Registers rebemer_enabled and show_color_panel as optional boolean args on /settings; extends save_settings() and import_tokens() to read, null-check, and persist them.
Editor data localization
SLASHED-for-WP/integrations/bricks/includes/class-editor-data.php
Changes show_color_panel filter default from hardcoded true to the stored setting value; adds rebemerEnabled to the slashedBricksEditor localized payload.
Editor JS: rebemerEnabled gate & suggestContainerName override
SLASHED-for-WP/integrations/bricks/editor-app/src/...
main.js skips badge/structure-panel pipeline when cfg.rebemerEnabled === false; element-types.js returns merged admin override for layout container types when available.
Admin Svelte UI: layout containers in RebemerTab + bundled app.js
SLASHED-for-WP/integrations/bricks/admin-app/src/components/RebemerTab.svelte, SLASHED-for-WP/integrations/bricks/assets/admin-app/app.js
RebemerTab.svelte includes LAYOUT_CONTAINER_TYPES in defaults with container type as its own default; bundled app.js updated to include the mapping table scaffold and footer in the reBEMer tab template.
Tests, docs & changelog
tests/element-types.test.js, docs/rebemer.md, CHANGELOG.md
New suggestContainerName test verifies admin override precedence for container types; docs/rebemer.md updated for renamed tab and layout container coverage; CHANGELOG.md entries added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • codeslash-dev/SLASHED-Plugins#63: Directly modifies the same suggestContainerName() function in element-types.js and related layout container override logic that this PR extends.
  • codeslash-dev/SLASHED-Plugins#68: Modifies the same reBEMer/container-naming implementation files (RebemerTab.svelte, class-bricks-settings-page.php, element-types.js) that this PR builds upon, specifically around consolidating rebemer_container_mode settings.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the three main features added: reBEMer tab with enable toggle, Colors launcher toggle, and container rename rows.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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/rebemer-default-bem-names-agzxk7

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.

🧹 Nitpick comments (1)
SLASHED-for-WP/integrations/bricks/includes/class-editor-data.php (1)

86-91: 💤 Low value

Consider clarifying the container naming comment.

The comment on line 88 states "Layout containers are always named after their Bricks type", but with the new override functionality introduced in this PR, containers can be customized via the admin settings table. The word "always" may confuse future maintainers.

📝 Suggested clarification
 // reBEMer default-naming config: sparse type → BEM-name
 // overrides merged over the built-in map editor-side.
-// Layout containers are always named after their Bricks type.
+// Layout containers default to their Bricks type name (overridable).
 'rebemerElementMap' => isset( $plugin_settings['rebemer_element_map'] ) && is_array( $plugin_settings['rebemer_element_map'] )
🤖 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 `@SLASHED-for-WP/integrations/bricks/includes/class-editor-data.php` around
lines 86 - 91, Clarify the container naming comment in the editor data setup
because “always” is no longer accurate now that admin overrides can customize
container names. Update the comment near rebemerElementMap in
class-editor-data.php to reflect that the default is to use the Bricks type, but
it may be overridden by the plugin settings map. Keep the note aligned with the
new override behavior so future maintainers understand the naming source.
🤖 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.

Nitpick comments:
In `@SLASHED-for-WP/integrations/bricks/includes/class-editor-data.php`:
- Around line 86-91: Clarify the container naming comment in the editor data
setup because “always” is no longer accurate now that admin overrides can
customize container names. Update the comment near rebemerElementMap in
class-editor-data.php to reflect that the default is to use the Bricks type, but
it may be overridden by the plugin settings map. Keep the note aligned with the
new override behavior so future maintainers understand the naming source.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3336de8f-a279-4137-9b3d-32e064691fb9

📥 Commits

Reviewing files that changed from the base of the PR and between da68a3a and d0906c9.

📒 Files selected for processing (12)
  • CHANGELOG.md
  • SLASHED-for-WP/includes/class-bricks-settings-page.php
  • SLASHED-for-WP/includes/class-rest-controller.php
  • SLASHED-for-WP/includes/class-token-store.php
  • SLASHED-for-WP/integrations/bricks/admin-app/src/components/RebemerTab.svelte
  • SLASHED-for-WP/integrations/bricks/assets/admin-app/app.js
  • SLASHED-for-WP/integrations/bricks/assets/editor-app/app.js
  • SLASHED-for-WP/integrations/bricks/editor-app/src/lib/element-types.js
  • SLASHED-for-WP/integrations/bricks/editor-app/src/main.js
  • SLASHED-for-WP/integrations/bricks/includes/class-editor-data.php
  • docs/rebemer.md
  • tests/element-types.test.js

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 12 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

- Bump the plugin's own release version to 0.3.5 (package.json + plugin
  Version: headers + SLASHED_*_VERSION constants) so it matches the readme
  Stable tag main already declared, clearing the verify-sync drift failure.
- Clarify the editor-data + standalone admin-tab notes: layout containers
  default to their Bricks type but can be overridden (no longer "always").

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
@jackgranatowski
jackgranatowski merged commit d829363 into main Jun 21, 2026
10 checks passed
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