@datarails-ai/dr-appspace-cli 0.12.45 → 0.12.46
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.
- package/README.md +25 -2
- package/dist/cli.js +163 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -333,8 +333,8 @@ command calls a model: the builders write `contract.json` themselves and run
|
|
|
333
333
|
`app-space test --screenshot` draws, after the usual checks, every page of the
|
|
334
334
|
pushed package once per declared role in headless Google Chrome, and writes
|
|
335
335
|
`<out>/<page>.<role>.png` plus an `index.json` that a judge can read (page,
|
|
336
|
-
role, file, size, which handlers the page called, which had no fixture)
|
|
337
|
-
|
|
336
|
+
role, file, size, which handlers the page called, which had no fixture), and
|
|
337
|
+
then reads each laid-out page back for the `look-*` findings below.
|
|
338
338
|
|
|
339
339
|
| Flag | What it does | Default |
|
|
340
340
|
| --- | --- | --- |
|
|
@@ -343,6 +343,7 @@ judges nothing yet; the `look-*` findings come later.
|
|
|
343
343
|
| `--role <name>` | only this declared role (repeatable, or `a,b`) | every declared role (`default` for an app with none) |
|
|
344
344
|
| `--width <px>` / `--height <px>` | the window | `1400` × `900` |
|
|
345
345
|
| `--full` | grow the window to the page's full height (one extra load per picture) | off |
|
|
346
|
+
| `--no-look` | skip the look load (see below) | look on |
|
|
346
347
|
| `--shelf <path>` | serve `vendor/` and `ui-kit/` from this dr-app-space checkout | the server the app is pushed to |
|
|
347
348
|
| `--screenshot-budget <ms>` | the whole phase's ceiling; each picture is capped at 60 s | `180000` |
|
|
348
349
|
|
|
@@ -362,6 +363,28 @@ comes from the server the app is pushed to (its public `/vendor/*` and
|
|
|
362
363
|
`/ui-kit/*`, fetched once per run). Use `--shelf` with a checkout to work
|
|
363
364
|
offline.
|
|
364
365
|
|
|
366
|
+
**What the look load reports.** One more headless load per picture (the
|
|
367
|
+
same load `--full` measures on, when it is given) reads the laid-out page
|
|
368
|
+
back. Three things a builder can change in `contract.json` become **warnings**
|
|
369
|
+
in Findings, which `--strict` never counts. They are said once per page and
|
|
370
|
+
problem, with every role that saw it:
|
|
371
|
+
|
|
372
|
+
| Finding | What the page shows |
|
|
373
|
+
| --- | --- |
|
|
374
|
+
| `look-text-clipped` | a label or title wider than its box, cut by an ellipsis or a clip, or more lines than a line clamp shows |
|
|
375
|
+
| `look-band-underfilled` | a band whose tiles sit in one row and cover under 60% of it (B6: a titled `kpi_strip` on dr-app-runtime 1.13.1); a grid band whose own spans ask for less of the row is left alone |
|
|
376
|
+
| `look-page-overflow` | the page scrolls sideways, or something ends past the window's right edge with nothing scrolling it |
|
|
377
|
+
|
|
378
|
+
Each picture's `look` row in `index.json` also carries three more, which go
|
|
379
|
+
in the table's `look:` line and not in Findings: `low-contrast` (text under
|
|
380
|
+
WCAG's 4.5:1, once per colour pair: usually a platform colour, not the
|
|
381
|
+
app's), `empty-band` (a band heading with no tile, often only an empty
|
|
382
|
+
fixture) and `text-overlap`. The pictures are drawn on fixture data, not
|
|
383
|
+
the tenant's rows, so a page can lay out differently with real data. Without
|
|
384
|
+
`--full` the look loads run once every picture is taken, on what is left of
|
|
385
|
+
`--screenshot-budget`, so they never cost a picture; one with less than 5 s
|
|
386
|
+
left is skipped and its row says why in `lookSkipped`.
|
|
387
|
+
|
|
365
388
|
Chrome is found through `CHROME_PATH`, then `google-chrome`, `chromium` or
|
|
366
389
|
`chrome` on `PATH`, then the macOS app bundle and the usual Linux paths. With
|
|
367
390
|
none, the command exits 2 before anything runs. No browser is ever
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "@datarails-ai/dr-appspace-cli",
|
|
16
|
-
version: "0.12.
|
|
16
|
+
version: "0.12.46",
|
|
17
17
|
description: "Datarails App Space CLI \u2014 build, try, push and publish App Space apps",
|
|
18
18
|
type: "module",
|
|
19
19
|
engines: {
|
|
@@ -57,7 +57,7 @@ var package_default = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// src/buildInfo.ts
|
|
60
|
-
var BUILD_TIME = "2026-10-
|
|
60
|
+
var BUILD_TIME = "2026-10-28T21:01:12.571Z";
|
|
61
61
|
function formatBuildTime(iso) {
|
|
62
62
|
if (iso === "") return "";
|
|
63
63
|
const d = new Date(iso);
|
|
@@ -35354,6 +35354,8 @@ var VIRTUAL_TIME_MS = 8e3;
|
|
|
35354
35354
|
var ATTEMPT_MS = 25e3;
|
|
35355
35355
|
var MEASURE_MS = 15e3;
|
|
35356
35356
|
var FULL_HEIGHT_CAP = 8e3;
|
|
35357
|
+
var LOOK_MIN_MS = 5e3;
|
|
35358
|
+
var BAND_FILL_MIN = 0.6;
|
|
35357
35359
|
var NO_ROLE = "default";
|
|
35358
35360
|
var CHROME_MISSING = "app-space test --screenshot needs Google Chrome: install Google Chrome or set CHROME_PATH to a Chrome or Chromium binary. Nothing is downloaded.";
|
|
35359
35361
|
var CHROME_APP_PATHS = [
|
|
@@ -35583,11 +35585,32 @@ var Shelf = class {
|
|
|
35583
35585
|
return missing;
|
|
35584
35586
|
}
|
|
35585
35587
|
};
|
|
35586
|
-
var
|
|
35587
|
-
function
|
|
35588
|
+
var MEASURE_BODY = 'var d=document.documentElement,b=document.body||d,extra=0;document.querySelectorAll("*").forEach(function(e){var s=getComputedStyle(e).overflowY;if((s==="auto"||s==="scroll")&&e.scrollHeight>e.clientHeight)extra=Math.max(extra,e.scrollHeight-e.clientHeight)});var h=Math.max(d.scrollHeight,b.scrollHeight,innerHeight+extra);var m=document.createElement("meta");m.id="dr-shot-height";m.content=String(h);document.head.appendChild(m);';
|
|
35589
|
+
var LOOK_BODY = 'var R=[],vw=innerWidth,D=document.documentElement,N={};function nth(k){N[k]=(N[k]||0)+1;return N[k]}function tx(e){return (e.innerText||e.textContent||"").trim().replace(/\\s+/g," ").slice(0,80)}function vis(e){var r=e.getBoundingClientRect(),s=getComputedStyle(e);return r.width>0&&r.height>0&&s.visibility!=="hidden"&&s.display!=="none"}function own(e){return [].some.call(e.childNodes,function(n){return n.nodeType===3&&n.textContent.trim()!==""})}function ownW(e){var r=e.getBoundingClientRect(),x=r.left+e.clientLeft,m=0;[].forEach.call(e.childNodes,function(n){if(n.nodeType!==3||n.textContent.trim()==="")return;var g=document.createRange();g.selectNodeContents(n);m=Math.max(m,g.getBoundingClientRect().right-x)});return Math.ceil(m)}function rgb(c){var m=/rgba?\\(([^)]+)\\)/.exec(c);if(!m)return null;var p=m[1].split(/[\\s,\\/]+/).filter(Boolean).map(Number);return p.length>=3&&p.slice(0,3).every(isFinite)?[p[0],p[1],p[2],p.length>3&&isFinite(p[3])?p[3]:1]:null}function lum(c){return [c[0],c[1],c[2]].map(function(v){v/=255;return v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4)}).reduce(function(a,v,i){return a+v*[.2126,.7152,.0722][i]},0)}function bgOf(e){for(var p=e;p&&p.nodeType===1;p=p.parentElement){var s=getComputedStyle(p);if(s.backgroundImage!=="none")return null;var c=rgb(s.backgroundColor);if(c&&c[3]>=1)return c}return [255,255,255,1]}var all=[].filter.call(document.querySelectorAll("body *"),vis),pairs={};all.forEach(function(e){if(!own(e))return;var s=getComputedStyle(e);if(e.clientWidth>2&&e.clientHeight>2){var need=e.children.length===0?e.scrollWidth:ownW(e);if(need>e.clientWidth+1&&(s.textOverflow==="ellipsis"||s.overflowX==="hidden"||s.overflowX==="clip"))R.push({rule:"text-clipped",text:tx(e),n:nth("c|"+tx(e)),shown:e.clientWidth,needs:need});else if(s.webkitLineClamp&&s.webkitLineClamp!=="none"&&e.scrollHeight>e.clientHeight+1)R.push({rule:"text-clipped",text:tx(e),n:nth("c|"+tx(e)),shown:e.clientHeight,needs:e.scrollHeight,lines:true})}var f=rgb(s.color),b=bgOf(e);if(!f||!b)return;var a=f[3],fc=[f[0]*a+b[0]*(1-a),f[1]*a+b[1]*(1-a),f[2]*a+b[2]*(1-a)],L1=lum(fc),L2=lum(b),cr=(Math.max(L1,L2)+.05)/(Math.min(L1,L2)+.05),px=parseFloat(s.fontSize),big=px>=24||(px>=18.66&&Number(s.fontWeight)>=700);if(cr<(big?3:4.5)){var k=s.color+"|"+b.join(",");if(pairs[k])pairs[k].count++;else{pairs[k]={rule:"low-contrast",text:tx(e),ratio:Math.round(cr*100)/100,color:s.color,background:"rgb("+b.slice(0,3).join(", ")+")",count:1};R.push(pairs[k])}}});if(D.scrollWidth>vw+1)R.push({rule:"page-overflow",text:"",right:D.scrollWidth,viewport:vw});var off=0;all.forEach(function(e){if(off>=5)return;var r=e.getBoundingClientRect(),s=getComputedStyle(e);if(r.right<=vw+1||s.position==="fixed")return;var p=e.parentElement;if(p&&p!==document.body&&p!==D&&p.getBoundingClientRect().right>vw+1)return;for(var q=p;q&&q!==document.body&&q!==D;q=q.parentElement){if(getComputedStyle(q).overflowX!=="visible")return}off++;R.push({rule:"page-overflow",text:tx(e),n:nth("o|"+tx(e)),right:Math.round(r.right),viewport:vw})});document.querySelectorAll(".dr-app-band").forEach(function(b){if(!vis(b))return;var cs=[].filter.call(b.querySelectorAll(".dr-app-cell"),function(c){return vis(c)&&c.closest(".dr-app-band")===b});var hd=b.querySelector(".dr-app-band-head"),name=hd?tx(hd):"";if(cs.length===0){if(hd)R.push({rule:"empty-band",band:name});return}if(cs.length<2)return;if((b.getAttribute("data-dr-layout")||"grid")==="grid"&&cs.reduce(function(a,c){return a+(Number(c.getAttribute("data-dr-span"))||12)},0)<12*' + String(BAND_FILL_MIN) + ")return;var top=cs[0].getBoundingClientRect().top;if(!cs.every(function(c){return Math.abs(c.getBoundingClientRect().top-top)<2}))return;var w=cs.reduce(function(a,c){return a+c.getBoundingClientRect().width},0),bw=b.getBoundingClientRect().width;if(bw>0&&w<bw*" + String(BAND_FILL_MIN) + ')R.push({rule:"band-underfilled",band:name,filled:Math.round(100*w/bw),tiles:cs.length,tileWidth:Math.round(cs[0].getBoundingClientRect().width),bandWidth:Math.round(bw)})});var lv=all.filter(function(e){return e.children.length===0&&own(e)}).slice(0,400);for(var i=0;i<lv.length;i++)for(var j=i+1;j<lv.length;j++){var x=lv[i].getBoundingClientRect(),y=lv[j].getBoundingClientRect();if(Math.min(x.right,y.right)-Math.max(x.left,y.left)>4&&Math.min(x.bottom,y.bottom)-Math.max(x.top,y.top)>4)R.push({rule:"text-overlap",a:tx(lv[i]),b:tx(lv[j])})}var lm=document.createElement("meta");lm.id="dr-shot-look";lm.content=encodeURIComponent(JSON.stringify(R));document.head.appendChild(lm);';
|
|
35590
|
+
function probeScript(shot) {
|
|
35591
|
+
const body = (shot.measure === true ? MEASURE_BODY : "") + (shot.look === true ? LOOK_BODY : "");
|
|
35592
|
+
return `<script>addEventListener("load",function(){setTimeout(function(){${body}},3000)})</script>`;
|
|
35593
|
+
}
|
|
35594
|
+
function injectProbe(html, shot) {
|
|
35595
|
+
const script = probeScript(shot);
|
|
35588
35596
|
const head = /<head\b[^>]*>/i.exec(html);
|
|
35589
|
-
if (head === null) return
|
|
35590
|
-
return html.slice(0, head.index + head[0].length) +
|
|
35597
|
+
if (head === null) return script + html;
|
|
35598
|
+
return html.slice(0, head.index + head[0].length) + script + html.slice(head.index + head[0].length);
|
|
35599
|
+
}
|
|
35600
|
+
var LOOK_RULES = /* @__PURE__ */ new Set(["text-clipped", "band-underfilled", "page-overflow", "text-overlap", "low-contrast", "empty-band"]);
|
|
35601
|
+
function parseLook(dom) {
|
|
35602
|
+
const found = [...dom.matchAll(/id="dr-shot-look"[^>]*content="([^"]*)"|content="([^"]*)"[^>]*id="dr-shot-look"/g)].at(-1);
|
|
35603
|
+
const raw = found?.[1] ?? found?.[2];
|
|
35604
|
+
if (raw === void 0) return null;
|
|
35605
|
+
try {
|
|
35606
|
+
const rows2 = JSON.parse(decodeURIComponent(raw));
|
|
35607
|
+
if (!Array.isArray(rows2)) return null;
|
|
35608
|
+
return rows2.filter(
|
|
35609
|
+
(row) => typeof row === "object" && row !== null && LOOK_RULES.has(row.rule)
|
|
35610
|
+
);
|
|
35611
|
+
} catch {
|
|
35612
|
+
return null;
|
|
35613
|
+
}
|
|
35591
35614
|
}
|
|
35592
35615
|
function send(res, status, type, body) {
|
|
35593
35616
|
res.writeHead(status, { "Content-Type": type, "Cache-Control": "no-store" });
|
|
@@ -35652,8 +35675,8 @@ async function startStubServer(opts) {
|
|
|
35652
35675
|
const body = Object.prototype.hasOwnProperty.call(opts.files, entry) ? opts.files[entry] : void 0;
|
|
35653
35676
|
if (body === void 0) return send(res, 404, "text/plain", "no such UI file");
|
|
35654
35677
|
const type = contentType(entry);
|
|
35655
|
-
if (shot.measure === true && type.startsWith("text/html")) {
|
|
35656
|
-
return send(res, 200, type,
|
|
35678
|
+
if ((shot.measure === true || shot.look === true) && type.startsWith("text/html")) {
|
|
35679
|
+
return send(res, 200, type, injectProbe(body.toString(), shot));
|
|
35657
35680
|
}
|
|
35658
35681
|
return send(res, 200, type, body);
|
|
35659
35682
|
}
|
|
@@ -35804,6 +35827,7 @@ async function runScreenshots(opts) {
|
|
|
35804
35827
|
const started = now();
|
|
35805
35828
|
const budgetUntil = started + opts.budgetMs;
|
|
35806
35829
|
const shotTimeout = opts.shotTimeoutMs ?? SHOT_TIMEOUT_MS;
|
|
35830
|
+
const look = opts.look !== false;
|
|
35807
35831
|
await mkdir8(opts.outDir, { recursive: true });
|
|
35808
35832
|
const answers = fixtureAnswers(opts.cases);
|
|
35809
35833
|
const shelf2 = new Shelf(opts.shelf, opts.fetchImpl);
|
|
@@ -35820,6 +35844,29 @@ async function runScreenshots(opts) {
|
|
|
35820
35844
|
for (const entry of opts.pages) for (const role of opts.roles) plan.push({ entry, role });
|
|
35821
35845
|
const shots = new Array(plan.length);
|
|
35822
35846
|
let nextId = 0;
|
|
35847
|
+
const toLook = [];
|
|
35848
|
+
const lookAt = async (index2) => {
|
|
35849
|
+
const { entry, role } = plan[index2];
|
|
35850
|
+
const shot = shots[index2];
|
|
35851
|
+
const left = Math.min(shotTimeout, budgetUntil - now());
|
|
35852
|
+
let seen;
|
|
35853
|
+
if (left < LOOK_MIN_MS) {
|
|
35854
|
+
seen = { look: null, skipped: "the screenshot budget ran out" };
|
|
35855
|
+
} else {
|
|
35856
|
+
const lid = nextId++;
|
|
35857
|
+
stub.register(lid, { role, look: true });
|
|
35858
|
+
const probed = await runChrome({
|
|
35859
|
+
chrome: opts.chrome,
|
|
35860
|
+
url: stub.urlFor(lid, entry),
|
|
35861
|
+
width: opts.width,
|
|
35862
|
+
height: opts.height,
|
|
35863
|
+
timeoutMs: Math.min(MEASURE_MS, left)
|
|
35864
|
+
});
|
|
35865
|
+
const rows2 = parseLook(probed.stdout);
|
|
35866
|
+
seen = rows2 === null ? { look: null, skipped: probed.error ?? "the page never settled" } : { look: rows2 };
|
|
35867
|
+
}
|
|
35868
|
+
shots[index2] = { ...shot, look: seen.look, ...seen.skipped === void 0 ? {} : { lookSkipped: seen.skipped } };
|
|
35869
|
+
};
|
|
35823
35870
|
const one = async (index2) => {
|
|
35824
35871
|
const { entry, role } = plan[index2];
|
|
35825
35872
|
const file = `${pageName(entry)}.${safeRole(role)}.png`;
|
|
@@ -35849,9 +35896,10 @@ async function runScreenshots(opts) {
|
|
|
35849
35896
|
const pageUntil = Math.min(t0 + shotTimeout, budgetUntil);
|
|
35850
35897
|
const attemptMs = () => Math.max(500, Math.min(ATTEMPT_MS, Math.ceil(shotTimeout / 2), pageUntil - now()));
|
|
35851
35898
|
let height = opts.height;
|
|
35899
|
+
let seen;
|
|
35852
35900
|
if (opts.full) {
|
|
35853
35901
|
const mid = nextId++;
|
|
35854
|
-
stub.register(mid, { role, measure: true });
|
|
35902
|
+
stub.register(mid, { role, measure: true, look });
|
|
35855
35903
|
const measured = await runChrome({
|
|
35856
35904
|
chrome: opts.chrome,
|
|
35857
35905
|
url: stub.urlFor(mid, entry),
|
|
@@ -35864,6 +35912,10 @@ async function runScreenshots(opts) {
|
|
|
35864
35912
|
);
|
|
35865
35913
|
const tall = Number(found?.[1] ?? found?.[2] ?? NaN);
|
|
35866
35914
|
if (Number.isFinite(tall)) height = Math.min(FULL_HEIGHT_CAP, Math.max(opts.height, tall));
|
|
35915
|
+
if (look) {
|
|
35916
|
+
const rows2 = parseLook(measured.stdout);
|
|
35917
|
+
seen = rows2 === null ? { look: null, skipped: measured.error ?? "the page never settled" } : { look: rows2 };
|
|
35918
|
+
}
|
|
35867
35919
|
}
|
|
35868
35920
|
const out = join17(opts.outDir, file);
|
|
35869
35921
|
let id = -1;
|
|
@@ -35900,7 +35952,14 @@ async function runScreenshots(opts) {
|
|
|
35900
35952
|
return;
|
|
35901
35953
|
}
|
|
35902
35954
|
const bytes = await readFile12(out);
|
|
35903
|
-
|
|
35955
|
+
if (look && seen === void 0) toLook.push(index2);
|
|
35956
|
+
shots[index2] = {
|
|
35957
|
+
...entryOut,
|
|
35958
|
+
path: file,
|
|
35959
|
+
size: pngSize(bytes),
|
|
35960
|
+
bytes: bytes.length,
|
|
35961
|
+
...seen === void 0 ? {} : { look: seen.look, ...seen.skipped === void 0 ? {} : { lookSkipped: seen.skipped } }
|
|
35962
|
+
};
|
|
35904
35963
|
};
|
|
35905
35964
|
try {
|
|
35906
35965
|
let cursor = 0;
|
|
@@ -35911,6 +35970,13 @@ async function runScreenshots(opts) {
|
|
|
35911
35970
|
}
|
|
35912
35971
|
});
|
|
35913
35972
|
await Promise.all(workers);
|
|
35973
|
+
toLook.sort((a, b) => a - b);
|
|
35974
|
+
let lookCursor = 0;
|
|
35975
|
+
await Promise.all(
|
|
35976
|
+
Array.from({ length: Math.max(1, Math.min(opts.concurrency ?? SHOT_CONCURRENCY, toLook.length)) }, async () => {
|
|
35977
|
+
while (lookCursor < toLook.length) await lookAt(toLook[lookCursor++]);
|
|
35978
|
+
})
|
|
35979
|
+
);
|
|
35914
35980
|
} finally {
|
|
35915
35981
|
await stub.close();
|
|
35916
35982
|
}
|
|
@@ -35925,6 +35991,7 @@ async function runScreenshots(opts) {
|
|
|
35925
35991
|
fixtures: Object.fromEntries([...answers].map(([name, answer]) => [name, answer.from])),
|
|
35926
35992
|
createdAt: new Date(started).toISOString(),
|
|
35927
35993
|
ms: now() - started,
|
|
35994
|
+
look,
|
|
35928
35995
|
shots
|
|
35929
35996
|
};
|
|
35930
35997
|
await writeFile9(join17(opts.outDir, "index.json"), JSON.stringify(index, null, 2) + "\n");
|
|
@@ -35978,10 +36045,50 @@ screenshots \u2192 ${outDir} (${String(written)} of ${String(index.shots.length
|
|
|
35978
36045
|
out += ` not on the shelf (${index.shelf.kind === "server" ? index.shelf.url : index.shelf.path}): ${index.shelfMisses.slice(0, 5).join(", ")}${index.shelfMisses.length > 5 ? ", \u2026" : ""}
|
|
35979
36046
|
`;
|
|
35980
36047
|
}
|
|
36048
|
+
out += lookLine(index);
|
|
35981
36049
|
out += ` index: ${join17(outDir, "index.json")}
|
|
35982
36050
|
`;
|
|
35983
36051
|
return out;
|
|
35984
36052
|
}
|
|
36053
|
+
var LOOK_LABELS = {
|
|
36054
|
+
"text-clipped": "text cut short",
|
|
36055
|
+
"band-underfilled": "underfilled band",
|
|
36056
|
+
"page-overflow": "past the right edge",
|
|
36057
|
+
"text-overlap": "text over text",
|
|
36058
|
+
"low-contrast": "low-contrast colour pair",
|
|
36059
|
+
"empty-band": "band with no tile"
|
|
36060
|
+
};
|
|
36061
|
+
function lookLine(index) {
|
|
36062
|
+
if (!index.look) return "";
|
|
36063
|
+
const checked = index.shots.filter((shot) => Array.isArray(shot.look));
|
|
36064
|
+
const notChecked3 = index.shots.filter((shot) => shot.path !== null && !Array.isArray(shot.look)).length;
|
|
36065
|
+
const seen = /* @__PURE__ */ new Map();
|
|
36066
|
+
for (const shot of checked) {
|
|
36067
|
+
for (const row of shot.look ?? []) {
|
|
36068
|
+
const key = row.rule === "low-contrast" ? `${row.color}|${row.background}` : `${shot.page}|${lookKey(row)}`;
|
|
36069
|
+
const keys2 = seen.get(row.rule) ?? /* @__PURE__ */ new Set();
|
|
36070
|
+
keys2.add(key);
|
|
36071
|
+
seen.set(row.rule, keys2);
|
|
36072
|
+
}
|
|
36073
|
+
}
|
|
36074
|
+
const counts = Object.keys(LOOK_LABELS).filter((rule) => (seen.get(rule)?.size ?? 0) > 0).map((rule) => `${String(seen.get(rule)?.size ?? 0)} ${LOOK_LABELS[rule]}`);
|
|
36075
|
+
const skipped = notChecked3 === 0 ? "" : ` (${String(notChecked3)} picture(s) not checked)`;
|
|
36076
|
+
return ` look: ${counts.length === 0 ? "nothing seen" : counts.join(", ")}${skipped}
|
|
36077
|
+
`;
|
|
36078
|
+
}
|
|
36079
|
+
function lookKey(row) {
|
|
36080
|
+
switch (row.rule) {
|
|
36081
|
+
case "band-underfilled":
|
|
36082
|
+
case "empty-band":
|
|
36083
|
+
return `${row.rule}|${row.band}`;
|
|
36084
|
+
case "text-overlap":
|
|
36085
|
+
return `${row.rule}|${row.a}|${row.b}`;
|
|
36086
|
+
case "low-contrast":
|
|
36087
|
+
return `${row.rule}|${row.color}|${row.background}`;
|
|
36088
|
+
default:
|
|
36089
|
+
return `${row.rule}|${row.text}|${String(row.n ?? 1)}`;
|
|
36090
|
+
}
|
|
36091
|
+
}
|
|
35985
36092
|
|
|
35986
36093
|
// src/commands/appspace/_roles.ts
|
|
35987
36094
|
var PREVIEW_ROLE_HEADER = "x-app-space-preview-role";
|
|
@@ -37532,6 +37639,47 @@ function formatFindings(findings) {
|
|
|
37532
37639
|
`;
|
|
37533
37640
|
return out;
|
|
37534
37641
|
}
|
|
37642
|
+
function lookFindings(index) {
|
|
37643
|
+
if (index === null || index === void 0) return [];
|
|
37644
|
+
const fixable = (row) => row.rule === "text-clipped" || row.rule === "band-underfilled" || row.rule === "page-overflow";
|
|
37645
|
+
const byKey2 = /* @__PURE__ */ new Map();
|
|
37646
|
+
for (const shot of index.shots) {
|
|
37647
|
+
for (const row of shot.look ?? []) {
|
|
37648
|
+
if (!fixable(row)) continue;
|
|
37649
|
+
const key = `${shot.page}|${lookKey(row)}`;
|
|
37650
|
+
const one = byKey2.get(key);
|
|
37651
|
+
if (one === void 0) byKey2.set(key, { page: shot.page, row, roles: [shot.role] });
|
|
37652
|
+
else if (!one.roles.includes(shot.role)) one.roles.push(shot.role);
|
|
37653
|
+
}
|
|
37654
|
+
}
|
|
37655
|
+
return [...byKey2.values()].map(({ page, row, roles }) => {
|
|
37656
|
+
const where2 = `ui/${page}${roles.length === 1 && roles[0] === NO_ROLE ? "" : ` (as ${roles.join(", ")})`}`;
|
|
37657
|
+
const base = { where: where2, see: SEE.pages, severity: "warning" };
|
|
37658
|
+
switch (row.rule) {
|
|
37659
|
+
case "text-clipped":
|
|
37660
|
+
return {
|
|
37661
|
+
...base,
|
|
37662
|
+
code: "look-text-clipped",
|
|
37663
|
+
message: row.lines === true ? `"${row.text}" needs ${String(row.needs)} px of height and shows ${String(row.shown)}, so its last lines are cut` : `"${row.text}" needs ${String(row.needs)} px and has ${String(row.shown)}, so it is cut short`,
|
|
37664
|
+
fix: "Shorten the label, or give its card more room: a wider span, or a grid band instead of a kpi_strip"
|
|
37665
|
+
};
|
|
37666
|
+
case "band-underfilled":
|
|
37667
|
+
return {
|
|
37668
|
+
...base,
|
|
37669
|
+
code: "look-band-underfilled",
|
|
37670
|
+
message: `the band${row.band === "" ? "" : ` "${row.band}"`} draws ${String(row.tiles)} tiles ${String(row.tileWidth)} px wide, ${String(row.filled)}% of its ${String(row.bandWidth)} px row`,
|
|
37671
|
+
fix: "Give its elements spans that fill the row; a titled kpi_strip fills its row from dr-app-runtime 1.13.2, so compile it again with the current CLI"
|
|
37672
|
+
};
|
|
37673
|
+
default:
|
|
37674
|
+
return {
|
|
37675
|
+
...base,
|
|
37676
|
+
code: "look-page-overflow",
|
|
37677
|
+
message: row.text === "" ? `the page is ${String(row.right)} px wide in a ${String(row.viewport)} px window, so it scrolls sideways` : `"${row.text}" ends at ${String(row.right)} px, past the ${String(row.viewport)} px window`,
|
|
37678
|
+
fix: "Narrow what is named, or give wide content (a long table, a row of many controls) a card of its own"
|
|
37679
|
+
};
|
|
37680
|
+
}
|
|
37681
|
+
});
|
|
37682
|
+
}
|
|
37535
37683
|
|
|
37536
37684
|
// src/commands/appspace/test.ts
|
|
37537
37685
|
function positiveInt(raw, fallback, flag) {
|
|
@@ -38404,6 +38552,9 @@ function registerTestCommand(parent) {
|
|
|
38404
38552
|
"With --screenshot: draw only this declared role (repeatable, or comma-separated). Default: every declared role.",
|
|
38405
38553
|
collectRoles
|
|
38406
38554
|
).option("--width <px>", "With --screenshot: the window width.", "1400").option("--height <px>", "With --screenshot: the window height.", "900").option("--full", "With --screenshot: grow the window to the page\u2019s full height (one extra load per picture).").option(
|
|
38555
|
+
"--no-look",
|
|
38556
|
+
"With --screenshot: skip the look load (one more load per picture that reports text cut short, an underfilled band and content past the window edge as look-* warnings)."
|
|
38557
|
+
).option(
|
|
38407
38558
|
"--shelf <path>",
|
|
38408
38559
|
"With --screenshot: serve vendor/ and ui-kit/ from this dr-app-space checkout instead of the server the app is pushed to (for offline use)."
|
|
38409
38560
|
).option(
|
|
@@ -38607,9 +38758,11 @@ function registerTestCommand(parent) {
|
|
|
38607
38758
|
width: shotSize.width,
|
|
38608
38759
|
height: shotSize.height,
|
|
38609
38760
|
full: opts.full === true,
|
|
38761
|
+
look: opts.look !== false,
|
|
38610
38762
|
budgetMs: shotSize.budget
|
|
38611
38763
|
});
|
|
38612
38764
|
shots = { index, outDir };
|
|
38765
|
+
findings.push(...lookFindings(index));
|
|
38613
38766
|
}
|
|
38614
38767
|
const handlerFailures = outcomes.filter((o) => !o.ok).length;
|
|
38615
38768
|
const smokeFailures = runs.reduce(
|