From 9ef6ae03c69a8b343bc8f05dac832876b9ea184e Mon Sep 17 00:00:00 2001 From: Ku6epXBOCTuK Date: Sat, 29 Aug 2026 09:08:09 +0500 Subject: [PATCH] feat: fix tools pages, dom audit fix --- package.json | 3 +- web/audit/dom-report.json | 236 +-------------- web/audit/dom-report.md | 46 +-- web/scripts/audit-dom.mjs | 48 +-- web/src/lib/components/kit/ToolView.svelte | 281 ++++++++++++++++++ web/src/lib/preview/tool-views.ts | 178 +++++++++++ web/src/routes/preview/+layout.svelte | 10 +- .../routes/preview/tools/[id]/+page.svelte | 234 +-------------- 8 files changed, 530 insertions(+), 506 deletions(-) create mode 100644 web/src/lib/components/kit/ToolView.svelte create mode 100644 web/src/lib/preview/tool-views.ts diff --git a/package.json b/package.json index 3d58cef..9311346 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "dev": "pnpm --dir web dev", "build": "pnpm --dir web build", "format": "pnpm --dir web format", - "html": "pnpm --dir refs build && node scripts/extract-static.mjs refs/.next/server/app refs-html" + "html": "pnpm --dir refs build && node scripts/extract-static.mjs refs/.next/server/app refs-html", + "dom-audit": "pnpm --dir web refs-dom-audit" }, "keywords": [], "author": "Ku6epXBOCTuK", diff --git a/web/audit/dom-report.json b/web/audit/dom-report.json index 228128a..98def96 100644 --- a/web/audit/dom-report.json +++ b/web/audit/dom-report.json @@ -1,5 +1,5 @@ { - "generatedAt": "2026-08-29T02:50:59.952Z", + "generatedAt": "2026-08-29T04:04:14.643Z", "reports": [ { "route": "/preview/demo", @@ -30,233 +30,27 @@ { "route": "/preview/tools/linear-gradient-png", "ref": "gradient.html", - "deltas": [ - { - "path": "body > main:1 > div:2 > section:1", - "type": "tagMismatch", - "ours": "section", - "ref": "div" - }, - { - "path": "body > main:1 > div:2 > section:1", - "type": "textMismatch", - "ours": "", - "ref": "PNG PROCESSING SINGLE TOOL" - }, - { - "path": "body > main:1 > div:2 > section:1 > section:1", - "type": "added", - "tag": "section", - "text": "", - "nodes": 145 - }, - { - "path": "body > main:1 > div:2 > section:1 > span:1", - "type": "removed", - "tag": "span", - "text": "/", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2", - "type": "tagMismatch", - "ours": "section", - "ref": "div" - }, - { - "path": "body > main:1 > div:2 > section:2 > header:1", - "type": "added", - "tag": "header", - "text": "", - "nodes": 5 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > div:1", - "type": "added", - "tag": "div", - "text": "", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > div:2", - "type": "added", - "tag": "div", - "text": "", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > h1:1", - "type": "removed", - "tag": "h1", - "text": "Gradient background.", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > p:2", - "type": "removed", - "tag": "p", - "text": "Create a clean, export-ready gradient with precise control over color, direction and transparency.", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2 > span:2", - "type": "removed", - "tag": "span", - "text": "LIVE PREVIEW", - "nodes": 2 - }, - { - "path": "body > main:1 > div:2 > div:3", - "type": "removed", - "tag": "div", - "text": "", - "nodes": 66 - }, - { - "path": "body > main:1 > footer:3 > span:2", - "type": "added", - "tag": "span", - "text": "pipeline is local-only", - "nodes": 2 - }, - { - "path": "body > main:1 > footer:3 > span:2", - "type": "removed", - "tag": "span", - "text": "gradient tool · local-only", - "nodes": 1 - } - ], + "deltas": [], "counts": { - "added": 5, - "removed": 6, - "tagMismatch": 2, - "textMismatch": 1, - "nodesAdded": 154, - "nodesRemoved": 72 + "added": 0, + "removed": 0, + "tagMismatch": 0, + "textMismatch": 0, + "nodesAdded": 0, + "nodesRemoved": 0 } }, { "route": "/preview/tools/remove-background-png", "ref": "background-remover.html", - "deltas": [ - { - "path": "body > main:1 > div:2 > section:1", - "type": "tagMismatch", - "ours": "section", - "ref": "div" - }, - { - "path": "body > main:1 > div:2 > section:1", - "type": "textMismatch", - "ours": "", - "ref": "PNG PROCESSING SINGLE TOOL" - }, - { - "path": "body > main:1 > div:2 > section:1 > section:1", - "type": "added", - "tag": "section", - "text": "", - "nodes": 138 - }, - { - "path": "body > main:1 > div:2 > section:1 > span:1", - "type": "removed", - "tag": "span", - "text": "/", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2", - "type": "tagMismatch", - "ours": "section", - "ref": "div" - }, - { - "path": "body > main:1 > div:2 > section:2 > header:1", - "type": "added", - "tag": "header", - "text": "", - "nodes": 5 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > div:1", - "type": "added", - "tag": "div", - "text": "", - "nodes": 4 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > div:2", - "type": "added", - "tag": "div", - "text": "", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > div:3", - "type": "added", - "tag": "div", - "text": "", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > h1:1", - "type": "removed", - "tag": "h1", - "text": "Remove background.", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2 > div:2 > p:2", - "type": "removed", - "tag": "p", - "text": "Select a background color and tune the edge detection. Changes are processed automatically in your browser.", - "nodes": 1 - }, - { - "path": "body > main:1 > div:2 > section:2 > span:2", - "type": "removed", - "tag": "span", - "text": "LIVE PREVIEW", - "nodes": 2 - }, - { - "path": "body > main:1 > div:2 > div:3", - "type": "removed", - "tag": "div", - "text": "", - "nodes": 71 - }, - { - "path": "body > main:1 > footer:3 > span:2", - "type": "added", - "tag": "span", - "text": "pipeline is local-only", - "nodes": 2 - }, - { - "path": "body > main:1 > footer:3 > span:2", - "type": "removed", - "tag": "span", - "text": "background remover · local-only", - "nodes": 1 - }, - { - "path": "body > div:2", - "type": "added", - "tag": "div", - "text": "", - "nodes": 1 - } - ], + "deltas": [], "counts": { - "added": 7, - "removed": 6, - "tagMismatch": 2, - "textMismatch": 1, - "nodesAdded": 152, - "nodesRemoved": 77 + "added": 0, + "removed": 0, + "tagMismatch": 0, + "textMismatch": 0, + "nodesAdded": 0, + "nodesRemoved": 0 } } ] diff --git a/web/audit/dom-report.md b/web/audit/dom-report.md index 1ee9408..2178da9 100644 --- a/web/audit/dom-report.md +++ b/web/audit/dom-report.md @@ -1,6 +1,6 @@ # DOM audit (phase A) -_2026-08-29T02:50:59.953Z_ +_2026-08-29T04:04:14.645Z_ ## Сводка @@ -8,8 +8,8 @@ _2026-08-29T02:50:59.953Z_ |---|---|---|---|---|---| | `/preview/demo` | demo.html | 0 | 0 | 0 | 0 | | `/preview/list-tools` | list-tools.html | 0 | 0 | 0 | 0 | -| `/preview/tools/linear-gradient-png` | gradient.html | 5 | 6 | 2 | 1 | -| `/preview/tools/remove-background-png` | background-remover.html | 7 | 6 | 2 | 1 | +| `/preview/tools/linear-gradient-png` | gradient.html | 0 | 0 | 0 | 0 | +| `/preview/tools/remove-background-png` | background-remover.html | 0 | 0 | 0 | 0 | ## /preview/demo (vs demo.html) @@ -31,45 +31,17 @@ _расхождений нет_ ## /preview/tools/linear-gradient-png (vs gradient.html) -- added: **5** (≈154 узл.), removed: **6** (≈72 узл.), tag: **2**, text: **1** +- added: **0** (≈0 узл.), removed: **0** (≈0 узл.), tag: **0**, text: **0** -### Расхождения (топ 14) +### Расхождения (топ 0) -- `body > main:1 > div:2 > section:1` **tag**: ours `section` → ref `div` -- `body > main:1 > div:2 > section:1` **text**: ours `` → ref `PNG PROCESSING SINGLE TOOL` -- `body > main:1 > div:2 > section:1 > section:1` **added** (`section` · 145 узл.) -- `body > main:1 > div:2 > section:1 > span:1` **removed** (`span` "/" · 1 узл.) -- `body > main:1 > div:2 > section:2` **tag**: ours `section` → ref `div` -- `body > main:1 > div:2 > section:2 > header:1` **added** (`header` · 5 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > div:1` **added** (`div` · 1 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > div:2` **added** (`div` · 1 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > h1:1` **removed** (`h1` "Gradient background." · 1 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > p:2` **removed** (`p` "Create a clean, export-ready gradient with precise control over color, direction and transparency." · 1 узл.) -- `body > main:1 > div:2 > section:2 > span:2` **removed** (`span` "LIVE PREVIEW" · 2 узл.) -- `body > main:1 > div:2 > div:3` **removed** (`div` · 66 узл.) -- `body > main:1 > footer:3 > span:2` **added** (`span` "pipeline is local-only" · 2 узл.) -- `body > main:1 > footer:3 > span:2` **removed** (`span` "gradient tool · local-only" · 1 узл.) +_расхождений нет_ ## /preview/tools/remove-background-png (vs background-remover.html) -- added: **7** (≈152 узл.), removed: **6** (≈77 узл.), tag: **2**, text: **1** +- added: **0** (≈0 узл.), removed: **0** (≈0 узл.), tag: **0**, text: **0** -### Расхождения (топ 16) +### Расхождения (топ 0) -- `body > main:1 > div:2 > section:1` **tag**: ours `section` → ref `div` -- `body > main:1 > div:2 > section:1` **text**: ours `` → ref `PNG PROCESSING SINGLE TOOL` -- `body > main:1 > div:2 > section:1 > section:1` **added** (`section` · 138 узл.) -- `body > main:1 > div:2 > section:1 > span:1` **removed** (`span` "/" · 1 узл.) -- `body > main:1 > div:2 > section:2` **tag**: ours `section` → ref `div` -- `body > main:1 > div:2 > section:2 > header:1` **added** (`header` · 5 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > div:1` **added** (`div` · 4 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > div:2` **added** (`div` · 1 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > div:3` **added** (`div` · 1 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > h1:1` **removed** (`h1` "Remove background." · 1 узл.) -- `body > main:1 > div:2 > section:2 > div:2 > p:2` **removed** (`p` "Select a background color and tune the edge detection. Changes are processed automatically in your browser." · 1 узл.) -- `body > main:1 > div:2 > section:2 > span:2` **removed** (`span` "LIVE PREVIEW" · 2 узл.) -- `body > main:1 > div:2 > div:3` **removed** (`div` · 71 узл.) -- `body > main:1 > footer:3 > span:2` **added** (`span` "pipeline is local-only" · 2 узл.) -- `body > main:1 > footer:3 > span:2` **removed** (`span` "background remover · local-only" · 1 узл.) -- `body > div:2` **added** (`div` · 1 узл.) +_расхождений нет_ diff --git a/web/scripts/audit-dom.mjs b/web/scripts/audit-dom.mjs index a14fce3..34b8e3a 100644 --- a/web/scripts/audit-dom.mjs +++ b/web/scripts/audit-dom.mjs @@ -6,7 +6,6 @@ import { chromium } from "playwright"; import { spawn } from "node:child_process"; import { readFileSync, writeFileSync, mkdirSync, readdirSync } from "node:fs"; -import { pathToFileURL } from "node:url"; import { resolve, join } from "node:path"; const args = (() => { @@ -145,6 +144,9 @@ const snapshot = (page) => const walk = (el) => { const tag = el.tagName.toLowerCase(); if (["script", "style", "noscript", "template"].includes(tag)) return null; + // SvelteKit ін'єктить #svelte-announcer (aria-live) прямо в ; + // у рефа (Next.js) його немає — це фреймворк-шум, не збіг дизайну. + if (el.id === "svelte-announcer") return null; // Пропускаем не отображаемые узлы (Next-боилерплейт: