Fix JS-NATIVE-01 violations in checkbox_multiselect
Add SCSS class scoping enforcement, move modal to lib, cleanup legacy files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -209,17 +209,33 @@ class Scss_ManifestModule extends ManifestModule_Abstract
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if SCSS file has a single top-level class that qualifies as an ID
|
||||
* Detect if SCSS file has a single top-level class wrapper
|
||||
*
|
||||
* The SCSS file gets an 'id' if:
|
||||
* 1. All rules are contained within a single top-level class selector
|
||||
* 2. The class name matches a Blade view ID, JS class extending Component, or jqhtml template
|
||||
* 3. No other SCSS file already has this ID
|
||||
* Sets scss_wrapper_class if all rules are contained within a single top-level
|
||||
* class selector (e.g., .Frontend_Dashboard { ... }).
|
||||
*
|
||||
* SCSS variable declarations ($var: value;) are allowed outside the wrapper
|
||||
* and are stripped before checking. Files containing only variables/comments
|
||||
* are considered valid (scss_variables_only = true).
|
||||
*
|
||||
* Additionally sets 'id' if the wrapper class matches a Blade view ID,
|
||||
* JS class extending Component, or jqhtml template in the manifest.
|
||||
*/
|
||||
protected function detect_scss_id(string $clean_content, array &$metadata): void
|
||||
{
|
||||
// Remove SCSS variable declarations ($var: value;) - these are allowed outside wrapper
|
||||
// This regex matches: $variable-name: any value until semicolon;
|
||||
$content_without_vars = preg_replace('/\$[a-zA-Z_][\w-]*\s*:[^;]+;/', '', $clean_content);
|
||||
|
||||
// Remove all whitespace and newlines for easier parsing
|
||||
$compact = preg_replace('/\s+/', ' ', trim($clean_content));
|
||||
$compact = preg_replace('/\s+/', ' ', trim($content_without_vars));
|
||||
|
||||
// If content is empty after removing variables (only variables and comments),
|
||||
// mark as variables-only file - no wrapper needed
|
||||
if (empty($compact)) {
|
||||
$metadata['scss_variables_only'] = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if content starts with a single class selector and everything is inside it
|
||||
// Pattern: .ClassName { ... everything ... }
|
||||
@@ -240,7 +256,10 @@ class Scss_ManifestModule extends ManifestModule_Abstract
|
||||
return;
|
||||
}
|
||||
|
||||
// Now check if this class name matches something in the manifest
|
||||
// Always set scss_wrapper_class when file is fully enclosed in a single class
|
||||
$metadata['scss_wrapper_class'] = $class_name;
|
||||
|
||||
// Now check if this class name matches something in the manifest for setting 'id'
|
||||
// During build, we need to access the in-memory manifest data
|
||||
// The get_all() method returns the cached data, not the in-progress build
|
||||
// We need a different approach - access the static data directly
|
||||
|
||||
Reference in New Issue
Block a user