simplified code across the app and consolidated duplicated helpers

This commit is contained in:
2026-09-27 17:29:54 +02:00
parent 3e856d0b1c
commit ee1240f71a
155 changed files with 1772 additions and 2546 deletions
+9
View File
@@ -325,3 +325,12 @@ class PmUnknown extends PmNode {
const PmUnknown({required this.rawType, this.children = const []});
}
final RegExp _cssLength = RegExp(r'^(\d+(?:\.\d+)?)(px|%|em|rem)$');
/// Splits a CSS length like `12px` / `1.5em` / `50%` into value and unit.
({double value, String unit})? parsePmCssLength(String raw) {
final match = _cssLength.firstMatch(raw);
if (match == null) return null;
return (value: double.parse(match.group(1)!), unit: match.group(2)!);
}