feat(rebemer): smarter default BEM names + configurable type mapping - #63
Conversation
Reduce how often the reBEMer panel pre-fills weak defaults ("item",
"content") that the user has to retype.
- Expand ELEMENT_TYPE_LABEL_MAP and SOLE_CHILD_LABEL_OVERRIDES to cover
many more Bricks element types (divider, social-icons, post-*,
progress-bar, breadcrumbs, etc.) so far fewer rows fall to "item".
- Add a version-tolerant getElementTypeLabel() seam in bricks-api that
reads Bricks' element registry; BemPanel uses the slugified human label
as a smarter fallback than "item" for unmapped, non-container types.
Containers still go through child-aware role inference so we never emit
block__container.
- Add an admin "reBEMer" tab that persists a sparse element-type -> BEM
name override map (rebemer_element_map) and a container-naming mode
(rebemer_container_mode: role | generic). Stored in
slashed_bricks_settings, sanitized against the same BEM grammar as
validate.js, localized onto window.slashedBricksEditor, and merged over
the frozen built-in map at panel-open time.
Extends tests/element-types.test.js and updates docs/rebemer.md. Rebuilt
editor-app and admin-app bundles.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
📝 WalkthroughWalkthroughAdds a new "reBEMer" configuration feature end-to-end: two new plugin settings ( ChangesreBEMer Configurable Defaults
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
readme.txt's Stable tag was left at 0.3.1 while package.json and the plugin headers are already at 0.3.4, tripping the verify-sync drift check in tests/sync.test.js. Pre-existing drift on main, surfaced here because CI runs the check on every PR. Fix is `npm run version-sync`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
Reduce how often the reBEMer panel pre-fills weak defaults ("item",
"content") that the user has to retype.
many more Bricks element types (divider, social-icons, post-*,
progress-bar, breadcrumbs, etc.) so far fewer rows fall to "item".
reads Bricks' element registry; BemPanel uses the slugified human label
as a smarter fallback than "item" for unmapped, non-container types.
Containers still go through child-aware role inference so we never emit
block__container.
name override map (rebemer_element_map) and a container-naming mode
(rebemer_container_mode: role | generic). Stored in
slashed_bricks_settings, sanitized against the same BEM grammar as
validate.js, localized onto window.slashedBricksEditor, and merged over
the frozen built-in map at panel-open time.
Extends tests/element-types.test.js and updates docs/rebemer.md. Rebuilt
editor-app and admin-app bundles.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01HtPN4CvQjMTdvPLALAW3GE
Summary by cubic
Smarter default BEM names for reBEMer with broader type coverage, a fallback to Bricks’ human labels, and a new admin tab to override type→name defaults and choose container naming mode. This reduces “item”/“content” pre-fills and speeds up naming.
New Features
ELEMENT_TYPE_LABEL_MAPandSOLE_CHILD_LABEL_OVERRIDESto cover more Bricks types (e.g.,divider,social-icons,post-*,progress-bar,breadcrumbs).bricks-api.getElementTypeLabel()to read Bricks’ element registry and use the slugified human label when a type isn’t mapped; containers still use child‑aware role inference (noblock__container).rebemer_element_map(sparse overrides) andrebemer_container_mode(role|generic) inslashed_bricks_settings, sanitized to the BEM grammar and exposed onwindow.slashedBricksEditorfor merge at panel open.Bug Fixes
readme.txtStable tag to0.3.4to fix CI drift with package/plugin versions.Written for commit 98e9f0c. Summary will update on new commits.
Summary by CodeRabbit
New Features
Tests