@seanyeh77/ui-cli 0.5.0 → 0.6.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 +12 -4
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -13,7 +13,8 @@ function measure() {
13
13
  nested: [],
14
14
  markdown: [],
15
15
  native: [],
16
- wrapped: []
16
+ wrapped: [],
17
+ escaped: []
17
18
  };
18
19
  const describe = (el) => {
19
20
  let s = el.tagName.toLowerCase();
@@ -63,8 +64,14 @@ function measure() {
63
64
  for (const pe of ["::before", "::after"]) {
64
65
  const ps = getComputedStyle(el, pe);
65
66
  if (ps.content && ps.content !== "none" && ps.position === "absolute" && ps.pointerEvents !== "none") {
66
- w = Math.max(w, parseFloat(ps.width) || 0);
67
- h = Math.max(h, parseFloat(ps.height) || 0);
67
+ const pw = parseFloat(ps.width) || 0;
68
+ const ph = parseFloat(ps.height) || 0;
69
+ if (cs.position === "static" || pw > Math.max(r.width, 48) + 1 || ph > Math.max(r.height, 48) + 1) {
70
+ if (out.escaped.length < 8) out.escaped.push(`${describe(el)}${pe} ${Math.round(pw)} x ${Math.round(ph)} px`);
71
+ continue;
72
+ }
73
+ w = Math.max(w, pw);
74
+ h = Math.max(h, ph);
68
75
  }
69
76
  }
70
77
  if (w >= 47.5 && h >= 47.5) continue;
@@ -126,7 +133,7 @@ function measure() {
126
133
  // src/cli.ts
127
134
  const HELP = `ui check <file or URL>... [--shots DIR] [--strict] [--wait MS]
128
135
  Opens each page at 390 px and 1280 px, light and dark, and fails (exit 1) on:
129
- console errors, horizontal overflow at 390 px, touch targets under 48 px, a card inside a card,
136
+ console errors, horizontal overflow at 390 px, touch targets under 48 px, touch areas that spill past their control, a card inside a card,
130
137
  raw Markdown, native controls the design system replaces, and wrapped buttons, tabs, headers or headings.
131
138
  Exits 2 when a page cannot be checked at all: it does not load, or the check itself crashes.
132
139
  ui docs [Name] prints the README of a component (Button, DataTable…) or a guide (guidelines, layout, motion)
@@ -226,6 +233,7 @@ async function check(targets, opts) {
226
233
  if (res.wrapped.length) problems.push("text that must stay on one line wraps: " + res.wrapped.join("; "));
227
234
  if (phone) {
228
235
  if (res.overflow.length) problems.push("horizontal overflow: " + res.overflow.join("; "));
236
+ if (res.escaped.length) problems.push("touch area larger than its control (covers other controls): " + res.escaped.join("; "));
229
237
  if (res.small.length) problems.push(`touch targets under 48 px: ${res.small.slice(0, 12).join("; ")}${res.small.length > 12 ? ` (+${res.small.length - 12} more)` : ""}`);
230
238
  if (res.inline.length && opts.strict) problems.push("inline targets under 48 px: " + res.inline.slice(0, 12).join("; "));
231
239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanyeh77/ui-cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Checks a page against SeanYeh's design system and prints component docs: ui check, ui docs, ui list.",
5
5
  "license": "MIT",
6
6
  "author": "Hsiu-An Yeh",
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "playwright": "^1.65.0",
21
- "@seanyeh77/ui": "^0.5.0"
21
+ "@seanyeh77/ui": "^0.6.0"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=22"