Skip to content

The design language that makes your AI harness better at design.

JavaScript

Keep main's stripe-child side-tab form in file scans

Paul Bakausa70c7b21f34c
diff --git a/crates/detect/src/detect_text.rs b/crates/detect/src/detect_text.rs
index d9ac49c30..9872c6a3b 100644
--- a/crates/detect/src/detect_text.rs
+++ b/crates/detect/src/detect_text.rs
@@ -18,7 +18,8 @@ use crate::design_system::{check_source_design_system, DesignSystem};
use crate::profiler::{profile_findings, profile_step, DetectorProfile, ProfileMeta};
use crate::regex_matchers::{
analyzer_rule_id, is_neutral_authored_color, sass_sheet_corners,
- side_tab_known_square_in_sheet, side_tab_markup_known_square, side_tab_rounded_in_scope,
+ is_stripe_child_match, side_tab_known_square_in_sheet, side_tab_markup_known_square,
+ side_tab_rounded_in_scope,
MatchCtx, SourceText,
REGEX_ANALYZERS, REGEX_MATCHERS, TEXT_CONTENT_ANALYZER_IDS,
};
@@ -1751,7 +1752,7 @@ pub fn run_regex_matchers(
// declarations around the match read square, and in
// stylesheet text the stylesheet agrees.
if (matcher.test)(&m, &context)
- && (matcher.id != "side-tab" || {
+ && (matcher.id != "side-tab" || is_stripe_child_match(&m) || {
let source = source.get_or_init(|| SourceText::new(lines));
side_tab_rounded_in_scope(&m, source, i, sass)
|| sheet.is_some_and(|sheet| {
diff --git a/crates/detect/src/regex_matchers.rs b/crates/detect/src/regex_matchers.rs
index 36be99bc1..c120fedff 100644
--- a/crates/detect/src/regex_matchers.rs
+++ b/crates/detect/src/regex_matchers.rs
@@ -991,6 +991,17 @@ fn sass_scope_corners(source: &SourceText, i: usize, base: DeclaredCorners) -> D
corners
}
+/// Whether a `side-tab` match is the stripe-child form: a narrow coloured
+/// element drawn as the accent inside a card. Its own declarations are the
+/// stripe's, not the card's, so the rounded-card reading below cannot be
+/// taken off them; the form keeps the guards its matcher applies.
+pub fn is_stripe_child_match(m: &MatchCtx) -> bool {
+ let whole = m.whole();
+ SIDE_TAB_STRIPE_CHILD_TW_RE
+ .find(whole)
+ .is_some_and(|f| f.start() == 0 && f.end() == whole.len())
+}
+
/// Whether a `side-tab` match sits on a card rounded away from its stripe.
/// A utility class, a styled-system prop and a `style` attribute read the
/// markup tag they sit in; a CSS declaration or style-object property reads