@seanyeh77/ui-cli 0.52.1 → 0.54.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 +28 -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();
@@ -190,6 +191,7 @@ function measure() {
190
191
  for (const el of document.body.querySelectorAll("*")) {
191
192
  if (out.nested.length >= 6) break;
192
193
  if (!cardLike(el) || !visible(el)) continue;
194
+ if (el.matches("[role=tooltip], [popover], .ui-chart-tip, .ui-fp-tip")) continue;
193
195
  for (let a = el.parentElement; a && a !== document.body; a = a.parentElement) {
194
196
  if (getComputedStyle(a).position === "fixed") break;
195
197
  if (cardLike(a)) {
@@ -454,6 +456,30 @@ function measure() {
454
456
  const props = [...hits.keys()];
455
457
  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
458
  }
459
+ {
460
+ const BLOCKS = ".ui-card, .ui-kpi, .ui-alert, .ui-settings-section, .ui-dangerzone";
461
+ 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) => ({
462
+ el,
463
+ r: el.getBoundingClientRect()
464
+ }));
465
+ const seen = /* @__PURE__ */ new Map();
466
+ for (const a of rects) {
467
+ 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];
468
+ if (!below) continue;
469
+ const gap = Math.round(below.r.top - a.r.bottom);
470
+ if (gap < 1 || gap >= 96) continue;
471
+ const x = (Math.max(a.r.left, below.r.left) + Math.min(a.r.right, below.r.right)) / 2;
472
+ const hit = document.elementFromPoint(x, (a.r.bottom + below.r.top) / 2);
473
+ if (hit && !(hit.contains(a.el) && hit.contains(below.el))) continue;
474
+ const cur = seen.get(gap);
475
+ if (cur) cur.n++;
476
+ else seen.set(gap, {
477
+ n: 1,
478
+ ex: `${describe(a.el)} → ${describe(below.el)}`
479
+ });
480
+ }
481
+ 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})`);
482
+ }
457
483
  return out;
458
484
  }
459
485
  // src/usage.ts
@@ -1276,6 +1302,7 @@ function problemsOf(res, phone, strict) {
1276
1302
  if (res.outside.length) problems.push("text outside its card: " + res.outside.join("; ") + ". Leave room inside the card (chart axis labels, long words).");
1277
1303
  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
1304
  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.");
1305
+ 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
1306
  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
1307
  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
1308
  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.1",
3
+ "version": "0.54.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.1"
24
+ "@seanyeh77/ui": "^0.54.0"
25
25
  },
26
26
  "engines": {
27
27
  "node": ">=22"