From f19f8482a775476e93ccde9749b94528e3139604 Mon Sep 17 00:00:00 2001 From: Kiro Agent <244629292+kiro-agent@users.noreply.github.com> Date: Wed, 27 May 2026 21:09:44 +0000 Subject: [PATCH 1/2] fix(bricks): natural-sort tokens so -50 lands before -500 in palette MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Bricks color palette dropdown was rendering shades in lexicographic order, so users saw primary-100, primary-200, ..., primary-50, primary-500, primary-600 — with -50 stranded between -400 and -500 instead of right after the base color. Same issue affected alpha shades (a5 after a40) and any other numeric-suffix token (space-2 after space-10 etc.). Switch every CSS-name sort to SORT_NATURAL | SORT_FLAG_CASE so numeric suffixes order intuitively. Five sites in three files: - includes/class-css-parser.php (variables, class names) - includes/class-inventory.php (sanitize_inventory, two in get_variables_by_category) - scripts/gen-bricks-inventory.js (generator, regenerated output) The PHP sort is what feeds Bricks' Color Manager, so this is the only required change for the user-visible bug. The JS generator is updated in lockstep so the committed fallback inventory.json reads in the same order — a cosmetic improvement (sanitize_inventory always re-sorts on read). The token-api snapshot test is unaffected: it does its own JS-side [...names].sort() of declared tokens and compares against the locked snapshot. Lex-sort there is fine — that contract is about the *set* of tokens, not the order. Also extends docs/rebemer.md with the v1 design refinements approved in design review: - Goal #9: element-aware row pre-fills, sibling auto-numbering, per-row skip toggle (without breaking apply atomicity) - §6.2: skip-toggle column documented in the panel sketch - §6.3: migrate-mode preview chip strip - §7.1/7.2: new lib/element-types.js module + tests - §9: Operation gains skip and suggestedFrom fields - §9.2: sibling auto-numbering rule (plan-local, excludes skipped) - §9.3: element-type pre-fill + provenance tracking - §11.3: nameCollisions entries gain recommendedAction hint (attach / rename / replace) for one-click 'use existing' - §20: unused-class read-only report added to v1.1 candidates Co-authored-by: Jack Granatowski --- docs/rebemer.md | 117 +++++++++++++++++- integrations/bricks/data/inventory.json | 28 ++--- .../bricks/includes/class-css-parser.php | 9 +- .../bricks/includes/class-inventory.php | 12 +- scripts/gen-bricks-inventory.js | 11 +- 5 files changed, 151 insertions(+), 26 deletions(-) diff --git a/docs/rebemer.md b/docs/rebemer.md index 13d10ff6..f91d8a5c 100644 --- a/docs/rebemer.md +++ b/docs/rebemer.md @@ -50,6 +50,12 @@ SLASHED-shaped equivalent — free, scoped, and safer. only in the Bricks builder context, gated by capability. 8. **i18n + a11y from day one** — every string translatable, every control a real `