mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-11 23:49:01 +02:00
fix(design): print and alternate stylesheets are not scanned as page CSS; no cross-run dump sweep; probe-state and design-system caveats in prose
- The dump inlined every linked sheet's rules as active CSS, so a print sheet's 12pt black text or an alternate theme produced tiny-text and palette findings the user never sees; disabled and alternate sheets are skipped and a media-scoped sheet is wrapped in its @media block. - The cross-run dump sweep is gone: two same-day reviews shared REPORT_DIR and one run's sweep deleted the other's dumps mid-audit. Dumps stay per run, owner-only, deleted after Phase 9 unless --keep-dom (now defined in the prose), and an interrupted run's dumps wait for the user. - Prose: design-system-* rows in DOM mode compare the page to THIS repo's DESIGN.md and apply only to the repo's own app; an empty scan JSON with exit 0 means the probe state changed since Setup (read stderr); the persist block names a missing dump instead of mislabeling it as a redaction block. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
69b0856d42
commit
3f207247a8
@@ -50,8 +50,14 @@ export const DOM_DUMP_SCRIPT = String.raw`() => {
|
||||
liveLinks.forEach((link, i) => {
|
||||
const sheet = link.sheet;
|
||||
if (!sheet) return;
|
||||
if (link.disabled || (link.getAttribute("rel") || "").indexOf("alternate") !== -1) {
|
||||
if (cloneLinks[i]) cloneLinks[i].remove(); // not active CSS: never scanned as page styles
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const text = Array.from(sheet.cssRules).map((rule) => rule.cssText).join("\n");
|
||||
let text = Array.from(sheet.cssRules).map((rule) => rule.cssText).join("\n");
|
||||
const media = sheet.media && sheet.media.mediaText;
|
||||
if (media && media !== "all") text = "@media " + media + " {\n" + text + "\n}"; // a print sheet stays a print sheet
|
||||
inlined.push("/* gstack-dom-dump: " + (sheet.href || "link") + " */\n" + text);
|
||||
if (cloneLinks[i]) cloneLinks[i].remove();
|
||||
} catch (err) {
|
||||
|
||||
+7
-1
@@ -8,8 +8,14 @@
|
||||
liveLinks.forEach((link, i) => {
|
||||
const sheet = link.sheet;
|
||||
if (!sheet) return;
|
||||
if (link.disabled || (link.getAttribute("rel") || "").indexOf("alternate") !== -1) {
|
||||
if (cloneLinks[i]) cloneLinks[i].remove(); // not active CSS: never scanned as page styles
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const text = Array.from(sheet.cssRules).map((rule) => rule.cssText).join("\n");
|
||||
let text = Array.from(sheet.cssRules).map((rule) => rule.cssText).join("\n");
|
||||
const media = sheet.media && sheet.media.mediaText;
|
||||
if (media && media !== "all") text = "@media " + media + " {\n" + text + "\n}"; // a print sheet stays a print sheet
|
||||
inlined.push("/* gstack-dom-dump: " + (sheet.href || "link") + " */\n" + text);
|
||||
if (cloneLinks[i]) cloneLinks[i].remove();
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user