@seanyeh77/ui-cli 0.52.0 → 0.53.0

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 (2) hide show
  1. package/dist/cli.js +27 -1
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -27,7 +27,8 @@ function measure() {
27
27
  small24: [],
28
28
  formMixed: [],
29
29
  centered: [],
30
- docScroll: ""
30
+ docScroll: "",
31
+ blockGaps: []
31
32
  };
32
33
  const describe = (el) => {
33
34
  let s = el.tagName.toLowerCase();
@@ -454,6 +455,30 @@ function measure() {
454
455
  const props = [...hits.keys()];
455
456
  out.unlayered.push(`${rule.selector} { ${props.slice(0, 4).join(", ")}${props.length > 4 ? ", …" : ""} } in ${rule.sheet} overrides ${[...new Set(hits.values())].slice(0, 2).join(", ")}`);
456
457
  }
458
+ {
459
+ const BLOCKS = ".ui-card, .ui-kpi, .ui-alert, .ui-settings-section, .ui-dangerzone";
460
+ const rects = [...document.querySelectorAll(BLOCKS)].filter((el) => visible(el) && !el.parentElement?.closest(BLOCKS) && !el.closest(".ui-console, [role=dialog], [role=alertdialog], [popover], .ui-console-kpis, .ui-tour")).map((el) => ({
461
+ el,
462
+ r: el.getBoundingClientRect()
463
+ }));
464
+ const seen = /* @__PURE__ */ new Map();
465
+ for (const a of rects) {
466
+ const below = rects.filter((b) => b !== a && b.r.top >= a.r.bottom - 1 && Math.min(a.r.right, b.r.right) - Math.max(a.r.left, b.r.left) > Math.min(a.r.width, b.r.width) / 2).sort((x, y) => x.r.top - y.r.top)[0];
467
+ if (!below) continue;
468
+ const gap = Math.round(below.r.top - a.r.bottom);
469
+ if (gap < 1 || gap >= 96) continue;
470
+ const x = (Math.max(a.r.left, below.r.left) + Math.min(a.r.right, below.r.right)) / 2;
471
+ const hit = document.elementFromPoint(x, (a.r.bottom + below.r.top) / 2);
472
+ if (hit && !(hit.contains(a.el) && hit.contains(below.el))) continue;
473
+ const cur = seen.get(gap);
474
+ if (cur) cur.n++;
475
+ else seen.set(gap, {
476
+ n: 1,
477
+ ex: `${describe(a.el)} → ${describe(below.el)}`
478
+ });
479
+ }
480
+ if (seen.size > 1) out.blockGaps = [...seen].sort((x, y) => y[1].n - x[1].n).map(([gap, v]) => `${gap} px ×${v.n} (${v.ex})`);
481
+ }
457
482
  return out;
458
483
  }
459
484
  // src/usage.ts
@@ -1276,6 +1301,7 @@ function problemsOf(res, phone, strict) {
1276
1301
  if (res.outside.length) problems.push("text outside its card: " + res.outside.join("; ") + ". Leave room inside the card (chart axis labels, long words).");
1277
1302
  if (res.mixed.length) problems.push("controls of different heights in one toolbar row: " + res.mixed.join("; ") + ". Use the system controls (Button, IconButton, SearchField, Select: 40 px) without your own height or padding.");
1278
1303
  if (res.formMixed.length) problems.push("fields of different heights in one form row: " + res.formMixed.join("; ") + ". Use the system fields (TextField, Select, MultiSelect, DatePicker: 40 px) without your own height or padding.");
1304
+ if (res.blockGaps.length) problems.push("blocks stacked at different distances: " + res.blockGaps.join("; ") + ". Stack cards with Page (a Page inside a Grid for one column of a Grid), with no wrapper div adding its own gap or margin: blocks are then always block-gap apart.");
1279
1305
  if (res.docScroll) problems.push(`the document scrolls around AppShell (${res.docScroll}): AppShell scrolls its own main area. Remove page margin or padding around the frame and keep content inside it.`);
1280
1306
  if (res.raised.length) problems.push("status badge with a shadow in a table or card: " + res.raised.join("; ") + ". Inside a table or card a Badge is a dot and text: remove your own box-shadow or chip styles.");
1281
1307
  if (res.unlayered.length) problems.push("page CSS outside a layer overrides components: " + res.unlayered.join("; ") + ". Put page resets and normalize CSS in @layer base (or another layer declared before ui), and delete starter CSS such as Vite's index.css.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanyeh77/ui-cli",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "description": "Checks a page against SeanYeh's design system, compares its screenshots with baselines and prints component docs: ui check, ui shots, ui docs, ui list.",
5
5
  "license": "MIT",
6
6
  "author": "Hsiu-An Yeh",
@@ -21,7 +21,7 @@
21
21
  "pixelmatch": "^8.0.0",
22
22
  "playwright": "1.65.0",
23
23
  "pngjs": "^7.0.0",
24
- "@seanyeh77/ui": "^0.52.0"
24
+ "@seanyeh77/ui": "^0.53.0"
25
25
  },
26
26
  "engines": {
27
27
  "node": ">=22"