diff --git a/internal/check-legend-logical-insets.mjs b/internal/check-legend-logical-insets.mjs index 8f7bc5168..b365b4484 100644 --- a/internal/check-legend-logical-insets.mjs +++ b/internal/check-legend-logical-insets.mjs @@ -22,14 +22,26 @@ import { join, dirname } from 'node:path' import { fileURLToPath } from 'node:url' const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..') -const DIR = join(ROOT, 'library/components/legends') +// ★ THE SHARED CHROME, NOT ONLY THE LEGENDS. This check began as a legends check, and that scope is +// exactly why three physical declarations survived in ShareButton — the share menu is chrome every +// production map renders, but it lives one directory away and was never read. A reader in Arabic +// does not know which folder a control came from. Audited 2026-09-29: ShareButton had padding-left +// on the step list and margin-right on both the tab spacing and the auto-spacer, so under `ar` the +// gap fell on the wrong side of every share tab. +const DIRS = [ + join(ROOT, 'library/components/legends'), + join(ROOT, 'library/components/map-controls'), +] +// Files are addressed as "/" so two directories cannot collide on a base name and so +// the ALLOWED keys below stay unambiguous. +const shortOf = (dir, f) => `${dir.split('/').pop()}/${f}` // file -> substrings of declarations that may stay physical, each with its reason. const ALLOWED = { - 'LegendMobile.vue': [ + 'legends/LegendMobile.vue': [ ['.mapboxgl-ctrl-attrib.mapboxgl-compact{margin-right', "the engine's own attribution control, which the engine places"], ], - 'LegendProgressBar.vue': [ + 'legends/LegendProgressBar.vue': [ ['.lpb-pop{', 'the popover is placed by JS (popLeft) over the bar segment it describes'], ], } @@ -38,7 +50,19 @@ const PHYSICAL = /(^|[;{\s])((?:padding|margin)-(?:left|right)|left|right)\s*:\s function findings(file, src) { const out = [] - const styles = [...src.matchAll(/]*>([\s\S]*?)<\/style>|`([^`]*\{[^`]*\}[^`]*)`/g)].map((m) => m[1] ?? m[2]) + // ★ THE BACKTICK ARM USED TO MISS MOST OF A BIG SHADOW-CSS LITERAL, AND THAT IS HOW THREE PHYSICAL + // DECLARATIONS HID IN ShareButton. `([^`]*\{[^`]*\}[^`]*)` matches a literal containing ONE brace + // pair; a 600-line useShadowStyles(`…`) block has hundreds, so the scan captured 7 fragments + // totalling 7,003 chars of a 629-line file and never saw .share-tab's margin-right at all. The + // gate then reported PASS on a directory it was barely reading — the worst kind of green. + // A