@monoes/monodesign 1.2.20 → 1.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +2 -2
  2. package/cli/engine/design-system-checks.mjs +381 -0
  3. package/cli/engine/design-system-parse.mjs +433 -0
  4. package/cli/engine/design-system.mjs +20 -736
  5. package/cli/engine/engines/regex/detect-text-matchers.mjs +371 -0
  6. package/cli/engine/engines/regex/detect-text-run.mjs +186 -0
  7. package/cli/engine/engines/regex/detect-text.mjs +11 -523
  8. package/cli/engine/engines/static-html/css-cascade-color.mjs +219 -0
  9. package/cli/engine/engines/static-html/css-cascade-static-data.mjs +138 -0
  10. package/cli/engine/engines/static-html/css-cascade-static-dom.mjs +132 -0
  11. package/cli/engine/engines/static-html/css-cascade-static-parse.mjs +393 -0
  12. package/cli/engine/engines/static-html/css-cascade.mjs +24 -837
  13. package/cli/lib/monodesign-config-consent.mjs +93 -0
  14. package/cli/lib/monodesign-config-core.mjs +37 -0
  15. package/cli/lib/monodesign-config-detection.mjs +133 -0
  16. package/cli/lib/monodesign-config-filter.mjs +198 -0
  17. package/cli/lib/monodesign-config-ignore-value.mjs +212 -0
  18. package/cli/lib/monodesign-config.mjs +21 -623
  19. package/package.json +2 -2
  20. package/skill/scripts/context-fields.mjs +65 -0
  21. package/skill/scripts/context-resolve.mjs +425 -0
  22. package/skill/scripts/context-update.mjs +151 -0
  23. package/skill/scripts/context-utils.mjs +68 -0
  24. package/skill/scripts/context-workspace.mjs +245 -0
  25. package/skill/scripts/context.mjs +17 -891
  26. package/skill/scripts/hook-admin-config.mjs +152 -0
  27. package/skill/scripts/hook-admin-ignore.mjs +131 -0
  28. package/skill/scripts/hook-admin-manifest.mjs +292 -0
  29. package/skill/scripts/hook-admin.mjs +8 -541
  30. package/skill/scripts/hook-lib-cache.mjs +145 -0
  31. package/skill/scripts/hook-lib-config.mjs +292 -0
  32. package/skill/scripts/hook-lib-detector.mjs +72 -0
  33. package/skill/scripts/hook-lib-events.mjs +182 -0
  34. package/skill/scripts/hook-lib-findings.mjs +201 -0
  35. package/skill/scripts/hook-lib-ignore.mjs +205 -0
  36. package/skill/scripts/hook-lib-render.mjs +273 -0
  37. package/skill/scripts/hook-lib-run.mjs +281 -0
  38. package/skill/scripts/hook-lib-scan-targets.mjs +128 -0
  39. package/skill/scripts/hook-lib.mjs +71 -1747
  40. package/skill/scripts/lib/design-parser-colors.mjs +182 -0
  41. package/skill/scripts/lib/design-parser-extract.mjs +333 -0
  42. package/skill/scripts/lib/design-parser-sections.mjs +214 -0
  43. package/skill/scripts/lib/design-parser-yaml.mjs +135 -0
  44. package/skill/scripts/lib/design-parser.mjs +10 -783
  45. package/skill/scripts/live/manual-apply-chunk.mjs +151 -0
  46. package/skill/scripts/live/manual-apply-compact.mjs +122 -0
  47. package/skill/scripts/live/manual-apply-evidence.mjs +115 -0
  48. package/skill/scripts/live/manual-apply-log.mjs +179 -0
  49. package/skill/scripts/live/manual-apply-transaction.mjs +122 -0
  50. package/skill/scripts/live/manual-apply.mjs +65 -640
  51. package/skill/scripts/live/svelte-component-accept.mjs +248 -0
  52. package/skill/scripts/live/svelte-component-css.mjs +230 -0
  53. package/skill/scripts/live/svelte-component-markup.mjs +104 -0
  54. package/skill/scripts/live/svelte-component-scaffold.mjs +118 -0
  55. package/skill/scripts/live/svelte-component-session.mjs +158 -0
  56. package/skill/scripts/live/svelte-component.mjs +32 -792
  57. package/skill/scripts/live-accept-mutate.mjs +152 -0
  58. package/skill/scripts/live-accept-parse.mjs +370 -0
  59. package/skill/scripts/live-accept-scrub.mjs +59 -0
  60. package/skill/scripts/live-accept-search.mjs +58 -0
  61. package/skill/scripts/live-accept.mjs +15 -631
  62. package/skill/scripts/live-commit-manual-edits-paths.mjs +27 -0
  63. package/skill/scripts/live-commit-manual-edits-repair.mjs +166 -0
  64. package/skill/scripts/live-commit-manual-edits-rollback.mjs +231 -0
  65. package/skill/scripts/live-commit-manual-edits-utils.mjs +167 -0
  66. package/skill/scripts/live-commit-manual-edits-verify.mjs +356 -0
  67. package/skill/scripts/live-commit-manual-edits.mjs +24 -881
  68. package/skill/scripts/live-copy-edit-agent.mjs +16 -551
  69. package/skill/scripts/live-copy-edit-compact.mjs +137 -0
  70. package/skill/scripts/live-copy-edit-post-apply.mjs +175 -0
  71. package/skill/scripts/live-copy-edit-runners.mjs +297 -0
  72. package/skill/scripts/live-inject-csp.mjs +132 -0
  73. package/skill/scripts/live-inject-files.mjs +229 -0
  74. package/skill/scripts/live-inject-tag.mjs +114 -0
  75. package/skill/scripts/live-inject.mjs +13 -440
  76. package/skill/scripts/live-server-poll.mjs +232 -0
  77. package/skill/scripts/live-server-routes.mjs +449 -0
  78. package/skill/scripts/live-server-state.mjs +361 -0
  79. package/skill/scripts/live-server.mjs +10 -946
  80. package/skill/scripts/live-wrap-css.mjs +132 -0
  81. package/skill/scripts/live-wrap-manual-edit.mjs +153 -0
  82. package/skill/scripts/live-wrap-search.mjs +247 -0
  83. package/skill/scripts/live-wrap.mjs +21 -484
  84. package/skill/scripts/palette-seeds.mjs +401 -0
  85. package/skill/scripts/palette.mjs +1 -395
package/README.md CHANGED
@@ -81,7 +81,7 @@ console.log(radius.lg); // 12px
81
81
 
82
82
  ## Antipattern Detection (51 Rules)
83
83
 
84
- Source: [`cli/engine/registry/antipatterns.mjs`](packages/@monoes/monodesign/cli/engine/registry/antipatterns.mjs) — 564 lines, 51 entries.
84
+ Source: [`cli/engine/registry/antipatterns.mjs`](packages/@monoes/monodesign/cli/engine/registry/antipatterns.mjs) (entry point, re-exports from `antipatterns-slop.mjs`, `antipatterns-quality.mjs` and `antipatterns-provider.mjs`) — 51 entries.
85
85
 
86
86
  ### Rule Categories
87
87
 
@@ -178,7 +178,7 @@ Manage via `monomind design ignores` or `/monodesign hooks <on|off|status|ignore
178
178
 
179
179
  ## Design System Consistency
180
180
 
181
- Source: [`cli/engine/design-system.mjs`](packages/@monoes/monodesign/cli/engine/design-system.mjs) — 815 lines
181
+ Source: [`cli/engine/design-system.mjs`](packages/@monoes/monodesign/cli/engine/design-system.mjs) (entry point, split across `design-system-parse.mjs` and `design-system-checks.mjs`)
182
182
 
183
183
  Parses `DESIGN.md` / `.monodesign/design.json` to enforce consistency rules (`design-system-font`, `design-system-color`, `design-system-radius`, `design-system-font-size`). The skill writes `DESIGN.md`; the detector reads it for drift detection.
184
184
 
@@ -0,0 +1,381 @@
1
+ // Design-system enforcement: is-this-value-allowed checks, regex source
2
+ // scanning, and static-DOM (computed style) findings collection. Split out
3
+ // of design-system.mjs (file-size sweep — pure move, no behaviour change).
4
+
5
+ import { finding } from './findings.mjs';
6
+ import { GENERIC_FONTS } from './shared/constants.mjs';
7
+ import { resolveLengthPx } from './rules/checks.mjs';
8
+ import {
9
+ primaryFont,
10
+ colorsClose,
11
+ parseDesignColor,
12
+ cssColorLabel,
13
+ normalizeFontName,
14
+ FONT_SIZE_LITERAL_RE,
15
+ } from './design-system-parse.mjs';
16
+ import { dedupeDesignFindings } from './design-system.mjs';
17
+
18
+ const RADIUS_TOLERANCE_PX = 0.5;
19
+ const FONT_SIZE_TOLERANCE_PX = 0.5;
20
+
21
+ const CSS_COLOR_RE = /#[0-9a-f]{3,8}\b|rgba?\([^)]+\)|oklch\([^)]+\)|hsla?\([^)]+\)/gi;
22
+ const FONT_DECL_RE = /font-family\s*:\s*([^;}\n]+)/gi;
23
+ const FONT_JS_RE = /fontFamily\s*[:=]\s*["'`]([^"'`]+)["'`]/g;
24
+ const GOOGLE_FONT_RE = /fonts\.googleapis\.com\/css2?\?[^"'\s)<>]*/gi;
25
+ const BORDER_RADIUS_RE = /border-radius\s*:\s*([^;}\n]+)/gi;
26
+ const BORDER_RADIUS_JS_RE = /borderRadius\s*[:=]\s*["'`]([^"'`]+)["'`]/g;
27
+ const FONT_SIZE_DECL_RE = /font-size\s*:\s*([^;}\n]+)/gi;
28
+ const FONT_SIZE_JS_RE = /fontSize\s*[:=]\s*["'`]([^"'`]+)["'`]/g;
29
+ const TAILWIND_FONT_SIZE_RE = /\btext-\[(-?[\d.]+(?:px|rem))\]/g;
30
+ const STATIC_DESIGN_SKIP_TAGS = new Set(['head', 'title', 'meta', 'link', 'style', 'script', 'noscript', 'template', 'source']);
31
+
32
+ function isAllowedFont(font, designSystem) {
33
+ if (!font || GENERIC_FONTS.has(font)) return true;
34
+ if (!designSystem?.hasFonts) return true;
35
+ return designSystem.allowedFonts.has(font);
36
+ }
37
+
38
+ function isAllowedColorRaw(raw, designSystem) {
39
+ if (!designSystem?.hasColors) return true;
40
+ const text = String(raw || '').trim().toLowerCase();
41
+ if (!text || text === 'transparent' || text === 'currentcolor' || text === 'inherit' || text === 'initial') return true;
42
+ if (text.includes('var(')) return true;
43
+ const parsed = parseDesignColor(text);
44
+ if (!parsed) return true;
45
+ if ((parsed.a ?? 1) <= 0.05) return true;
46
+ for (const entry of designSystem.allowedColorKeys.values()) {
47
+ if (colorsClose(parsed, entry.color)) return true;
48
+ }
49
+ return false;
50
+ }
51
+
52
+ function isAllowedRadiusRaw(raw, designSystem) {
53
+ if (!designSystem?.hasRadii) return true;
54
+ const text = String(raw || '').trim().toLowerCase();
55
+ if (!text || text === '0' || text === 'none' || text === 'initial' || text === 'inherit') return true;
56
+ if (text.includes('var(') || text.includes('%')) return true;
57
+ const px = resolveLengthPx(text, 16);
58
+ if (px == null || !Number.isFinite(px) || px <= RADIUS_TOLERANCE_PX) return true;
59
+ if (designSystem.hasPillRadius && px >= 99) return true;
60
+ return designSystem.allowedRadii.some(entry => Math.abs(entry.px - px) <= RADIUS_TOLERANCE_PX);
61
+ }
62
+
63
+ function isAllowedFontSizeRaw(raw, designSystem) {
64
+ if (!designSystem?.hasFontSizes) return true;
65
+ const text = String(raw || '').trim().toLowerCase().replace(/\s*!important\s*$/, '');
66
+ if (!FONT_SIZE_LITERAL_RE.test(text)) return true;
67
+ const px = resolveLengthPx(text, 16);
68
+ if (px == null || !Number.isFinite(px) || px <= 0) return true;
69
+ return designSystem.allowedFontSizes.some(
70
+ entry => Math.abs(entry.px - px) <= FONT_SIZE_TOLERANCE_PX,
71
+ );
72
+ }
73
+
74
+ function lineLooksCommented(line) {
75
+ const trimmed = String(line || '').trim();
76
+ return trimmed.startsWith('//') || trimmed.startsWith('/*') || trimmed.startsWith('*') || trimmed.startsWith('<!--');
77
+ }
78
+
79
+ function isProbablyColorLiteral(line, match) {
80
+ const raw = match?.[0] || '';
81
+ const index = match.index ?? -1;
82
+ if (index < 0) return false;
83
+ if (isInsideCssAttributeSelector(line, index)) return false;
84
+
85
+ const before = line.slice(0, index);
86
+ const after = line.slice(index + raw.length);
87
+
88
+ if (raw.startsWith('#')) {
89
+ if (before.endsWith('&')) return false; // HTML numeric entity, e.g. &#8596;
90
+
91
+ const prevNonSpace = before.match(/\S(?=\s*$)/)?.[0] || '';
92
+ const nextNonSpace = after.match(/^\s*(\S)/)?.[1] || '';
93
+ if (prevNonSpace === '>' && nextNonSpace === '<') return false; // plain text, e.g. PR #155
94
+ }
95
+
96
+ const styleContext = /(?:^|[{\s;"'`(,])(?:color|background(?:-color|-image)?|border(?:-(?:top|right|bottom|left))?(?:-color)?|outline(?:-color)?|box-shadow|text-shadow|fill|stroke)\s*:\s*[^;{}"'`]*/i.test(before);
97
+ const cssFunctionContext = /(?:linear-gradient|radial-gradient|conic-gradient|color-mix)\([^)]*$/i.test(before);
98
+ const jsColorKeyContext = /(?:^|[,{]\s*)(?:color|background|backgroundColor|borderColor|outlineColor|fill|stroke|boxShadow|textShadow)\s*[:=]\s*["'`]?[^"'`,}]*/i.test(before);
99
+
100
+ return styleContext || cssFunctionContext || jsColorKeyContext;
101
+ }
102
+
103
+ function isInsideCssAttributeSelector(line, index) {
104
+ if (index < 0) return false;
105
+ const before = line.slice(0, index);
106
+ const lastOpen = before.lastIndexOf('[');
107
+ if (lastOpen === -1) return false;
108
+ const lastClose = before.lastIndexOf(']');
109
+ if (lastClose > lastOpen) return false;
110
+ const after = line.slice(index);
111
+ const close = after.indexOf(']');
112
+ const block = after.indexOf('{');
113
+ return close !== -1 && (block === -1 || close < block);
114
+ }
115
+
116
+ function makeDesignFinding(id, filePath, snippet, line = 0, extras = {}) {
117
+ return { ...finding(id, filePath, snippet, line), ...extras };
118
+ }
119
+
120
+ function decodeGoogleFamily(value) {
121
+ const family = String(value || '').split(':')[0].replace(/\+/g, ' ');
122
+ try {
123
+ return decodeURIComponent(family);
124
+ } catch {
125
+ return family;
126
+ }
127
+ }
128
+
129
+ function checkFontStack(stack, filePath, line, designSystem, context) {
130
+ const primary = primaryFont(stack);
131
+ if (!primary || isAllowedFont(primary, designSystem)) return [];
132
+ const display = primary.replace(/\b\w/g, ch => ch.toUpperCase());
133
+ return [makeDesignFinding(
134
+ 'design-system-font',
135
+ filePath,
136
+ `${context}: ${display} is not declared in DESIGN.md typography`,
137
+ line,
138
+ { ignoreValue: display },
139
+ )];
140
+ }
141
+
142
+ function extractRadiusTokens(value) {
143
+ return String(value || '')
144
+ .replace(/\s*\/\s*/g, ' ')
145
+ .split(/\s+/)
146
+ .map(token => token.trim())
147
+ .filter(Boolean);
148
+ }
149
+
150
+ function checkRadiusValue(value, filePath, line, designSystem, context) {
151
+ const findings = [];
152
+ for (const token of extractRadiusTokens(value)) {
153
+ if (isAllowedRadiusRaw(token, designSystem)) continue;
154
+ findings.push(makeDesignFinding(
155
+ 'design-system-radius',
156
+ filePath,
157
+ `${context}: ${token} is outside the DESIGN.md rounded scale`,
158
+ line,
159
+ { ignoreValue: token },
160
+ ));
161
+ }
162
+ return findings;
163
+ }
164
+
165
+ function checkFontSizeValue(value, filePath, line, designSystem, context) {
166
+ const token = String(value || '').trim();
167
+ if (isAllowedFontSizeRaw(token, designSystem)) return [];
168
+ return [makeDesignFinding(
169
+ 'design-system-font-size',
170
+ filePath,
171
+ `${context}: ${token} is off the DESIGN.md type ramp`,
172
+ line,
173
+ { ignoreValue: token },
174
+ )];
175
+ }
176
+
177
+ function checkSourceDesignSystem(content, filePath, options = {}) {
178
+ const designSystem = options.designSystem;
179
+ if (!designSystem?.present) return [];
180
+
181
+ const findings = [];
182
+ const lines = String(content || '').split('\n');
183
+ for (let i = 0; i < lines.length; i++) {
184
+ const line = lines[i];
185
+ const lineNum = i + 1;
186
+ if (lineLooksCommented(line)) continue;
187
+
188
+ if (designSystem.hasFonts) {
189
+ for (const match of line.matchAll(FONT_DECL_RE)) {
190
+ findings.push(...checkFontStack(match[1], filePath, lineNum, designSystem, 'font-family'));
191
+ }
192
+ for (const match of line.matchAll(FONT_JS_RE)) {
193
+ findings.push(...checkFontStack(match[1], filePath, lineNum, designSystem, 'fontFamily'));
194
+ }
195
+ for (const match of line.matchAll(GOOGLE_FONT_RE)) {
196
+ const url = match[0];
197
+ for (const familyMatch of url.matchAll(/[?&]family=([^&]+)/g)) {
198
+ const font = normalizeFontName(decodeGoogleFamily(familyMatch[1]));
199
+ if (!font || isAllowedFont(font, designSystem)) continue;
200
+ const display = decodeGoogleFamily(familyMatch[1]);
201
+ findings.push(makeDesignFinding(
202
+ 'design-system-font',
203
+ filePath,
204
+ `Google Fonts: ${display} is not declared in DESIGN.md typography`,
205
+ lineNum,
206
+ { ignoreValue: display },
207
+ ));
208
+ }
209
+ }
210
+ }
211
+
212
+ if (designSystem.hasColors) {
213
+ for (const match of line.matchAll(CSS_COLOR_RE)) {
214
+ if (!isProbablyColorLiteral(line, match)) continue;
215
+ const raw = cssColorLabel(match[0]);
216
+ if (isAllowedColorRaw(raw, designSystem)) continue;
217
+ findings.push(makeDesignFinding(
218
+ 'design-system-color',
219
+ filePath,
220
+ `Undocumented color ${raw} is outside DESIGN.md colors`,
221
+ lineNum,
222
+ { ignoreValue: raw },
223
+ ));
224
+ }
225
+ }
226
+
227
+ if (designSystem.hasRadii) {
228
+ for (const match of line.matchAll(BORDER_RADIUS_RE)) {
229
+ findings.push(...checkRadiusValue(match[1], filePath, lineNum, designSystem, 'border-radius'));
230
+ }
231
+ for (const match of line.matchAll(BORDER_RADIUS_JS_RE)) {
232
+ findings.push(...checkRadiusValue(match[1], filePath, lineNum, designSystem, 'borderRadius'));
233
+ }
234
+ }
235
+
236
+ if (designSystem.hasFontSizes) {
237
+ for (const match of line.matchAll(FONT_SIZE_DECL_RE)) {
238
+ findings.push(...checkFontSizeValue(match[1], filePath, lineNum, designSystem, 'font-size'));
239
+ }
240
+ for (const match of line.matchAll(FONT_SIZE_JS_RE)) {
241
+ findings.push(...checkFontSizeValue(match[1], filePath, lineNum, designSystem, 'fontSize'));
242
+ }
243
+ for (const match of line.matchAll(TAILWIND_FONT_SIZE_RE)) {
244
+ findings.push(...checkFontSizeValue(match[1], filePath, lineNum, designSystem, 'text-[…] class'));
245
+ }
246
+ }
247
+ }
248
+
249
+ return dedupeDesignFindings(findings);
250
+ }
251
+
252
+ function hasDirectText(el) {
253
+ return Array.from(el.childNodes || []).some(node => node.nodeType === 3 && node.textContent.trim().length > 0);
254
+ }
255
+
256
+ function sampleText(el) {
257
+ const text = String(el.textContent || '').replace(/\s+/g, ' ').trim();
258
+ return text ? ` "${text.slice(0, 40)}"` : '';
259
+ }
260
+
261
+ // Font-size design-system checks are source-scan-only (see checkSourceDesignSystem).
262
+ // Computed font-size cascades and clamp() ramps resolve to off-ramp px in the browser.
263
+ function collectStaticDesignSystemFindings(document, window, filePath, designSystem) {
264
+ if (!designSystem?.present) return [];
265
+ const findings = [];
266
+ const seenFonts = new Set();
267
+ const seenColors = new Set();
268
+ const seenRadii = new Set();
269
+
270
+ for (const el of document.querySelectorAll('*')) {
271
+ if (shouldSkipStaticDesignElement(el, window)) continue;
272
+ const tag = el.tagName?.toLowerCase?.() || 'unknown';
273
+ const style = window.getComputedStyle(el);
274
+
275
+ if (designSystem.hasFonts && hasDirectText(el)) {
276
+ const font = primaryFont(style.fontFamily || '');
277
+ if (font && !seenFonts.has(font) && !isAllowedFont(font, designSystem)) {
278
+ seenFonts.add(font);
279
+ findings.push(makeDesignFinding(
280
+ 'design-system-font',
281
+ filePath,
282
+ `${tag}${sampleText(el)} uses ${font}; not declared in DESIGN.md typography`,
283
+ 0,
284
+ { ignoreValue: font },
285
+ ));
286
+ }
287
+ }
288
+
289
+ if (designSystem.hasColors) {
290
+ const colorChecks = [];
291
+ if (hasDirectText(el)) colorChecks.push(['text color', style.color]);
292
+ if (!isTransparentCss(style.backgroundColor)) colorChecks.push(['background', style.backgroundColor]);
293
+ for (const side of ['Top', 'Right', 'Bottom', 'Left']) {
294
+ if ((parseFloat(style[`border${side}Width`]) || 0) > 0) {
295
+ colorChecks.push([`border-${side.toLowerCase()}`, style[`border${side}Color`]]);
296
+ }
297
+ }
298
+ if ((parseFloat(style.outlineWidth) || 0) > 0) colorChecks.push(['outline', style.outlineColor]);
299
+
300
+ for (const [kind, raw] of colorChecks) {
301
+ const label = cssColorLabel(raw);
302
+ if (isAllowedColorRaw(label, designSystem)) continue;
303
+ const key = `${kind}:${label}`;
304
+ if (seenColors.has(key)) continue;
305
+ seenColors.add(key);
306
+ findings.push(makeDesignFinding(
307
+ 'design-system-color',
308
+ filePath,
309
+ `${kind} ${label} on ${tag}${sampleText(el)} is outside DESIGN.md colors`,
310
+ 0,
311
+ { ignoreValue: label },
312
+ ));
313
+ }
314
+ }
315
+
316
+ if (designSystem.hasRadii) {
317
+ const rawRadius = String(style.borderRadius || '').trim();
318
+ if (!rawRadius) continue;
319
+ for (const token of extractRadiusTokens(rawRadius)) {
320
+ if (isAllowedRadiusRaw(token, designSystem)) continue;
321
+ if (seenRadii.has(token)) continue;
322
+ seenRadii.add(token);
323
+ findings.push(makeDesignFinding(
324
+ 'design-system-radius',
325
+ filePath,
326
+ `border-radius ${token} on ${tag}${sampleText(el)} is outside the DESIGN.md rounded scale`,
327
+ 0,
328
+ { ignoreValue: token },
329
+ ));
330
+ }
331
+ }
332
+ }
333
+
334
+ return findings;
335
+ }
336
+
337
+ function shouldSkipStaticDesignElement(el, window) {
338
+ const tag = el.tagName?.toLowerCase?.() || '';
339
+ if (STATIC_DESIGN_SKIP_TAGS.has(tag)) return true;
340
+
341
+ let current = el;
342
+ while (current) {
343
+ if (current.getAttribute?.('hidden') !== null || current.getAttribute?.('aria-hidden') === 'true') return true;
344
+ const style = window.getComputedStyle(current);
345
+ const display = String(style.display || '').toLowerCase();
346
+ const visibility = String(style.visibility || '').toLowerCase();
347
+ if (display === 'none' || visibility === 'hidden' || visibility === 'collapse') return true;
348
+ current = current.parentElement;
349
+ }
350
+ return false;
351
+ }
352
+
353
+ function isTransparentCss(value) {
354
+ const text = String(value || '').trim().toLowerCase();
355
+ if (!text || text === 'transparent') return true;
356
+ const parsed = parseDesignColor(text);
357
+ return parsed ? (parsed.a ?? 1) <= 0.05 : false;
358
+ }
359
+
360
+
361
+ export {
362
+ isAllowedFont,
363
+ isAllowedColorRaw,
364
+ isAllowedRadiusRaw,
365
+ isAllowedFontSizeRaw,
366
+ lineLooksCommented,
367
+ isProbablyColorLiteral,
368
+ isInsideCssAttributeSelector,
369
+ makeDesignFinding,
370
+ decodeGoogleFamily,
371
+ checkFontStack,
372
+ extractRadiusTokens,
373
+ checkRadiusValue,
374
+ checkFontSizeValue,
375
+ checkSourceDesignSystem,
376
+ hasDirectText,
377
+ sampleText,
378
+ collectStaticDesignSystemFindings,
379
+ shouldSkipStaticDesignElement,
380
+ isTransparentCss,
381
+ };