@seanyeh77/ui-cli 0.47.1 → 0.48.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.
- package/dist/cli.js +20 -3
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -76,6 +76,7 @@ function measure() {
|
|
|
76
76
|
};
|
|
77
77
|
const targets = [];
|
|
78
78
|
const inText = (el, cs) => isInline(el, cs) || cs.display === "inline" || !!el.closest(".ui-md");
|
|
79
|
+
const inSentence = (el, cs) => isInline(el, cs) || el.matches(".ui-term.is-word, .ui-term.is-inline");
|
|
79
80
|
for (const el of new Set(document.querySelectorAll(sel))) {
|
|
80
81
|
if (el.closest("[aria-hidden=\"true\"], [inert]")) continue;
|
|
81
82
|
const cs = getComputedStyle(el);
|
|
@@ -119,7 +120,7 @@ function measure() {
|
|
|
119
120
|
r,
|
|
120
121
|
w,
|
|
121
122
|
h,
|
|
122
|
-
inline: inText(el, cs)
|
|
123
|
+
inline: inText(el, cs) || inSentence(el, cs)
|
|
123
124
|
});
|
|
124
125
|
if (w >= 47.5 && h >= 47.5) continue;
|
|
125
126
|
if (wholeRow(el)) {
|
|
@@ -130,7 +131,7 @@ function measure() {
|
|
|
130
131
|
out.inline.push(`${describe(el)} line`);
|
|
131
132
|
continue;
|
|
132
133
|
}
|
|
133
|
-
(
|
|
134
|
+
(inSentence(el, cs) ? out.inline : out.small).push(`${describe(el)} ${Math.round(w)} x ${Math.round(h)} px`);
|
|
134
135
|
}
|
|
135
136
|
for (const t of targets) {
|
|
136
137
|
if (out.small24.length >= 60) break;
|
|
@@ -239,7 +240,23 @@ function measure() {
|
|
|
239
240
|
if (parent.closest("[class*=\"sr-only\"], [class*=\"visually-hidden\"]") || getComputedStyle(parent).position === "fixed") continue;
|
|
240
241
|
const range = document.createRange();
|
|
241
242
|
range.selectNodeContents(n);
|
|
242
|
-
const
|
|
243
|
+
const clipTo = (r) => {
|
|
244
|
+
let { left, right, top, bottom } = r;
|
|
245
|
+
for (let a = parent; a && a !== card; a = a.parentElement) {
|
|
246
|
+
const cs = getComputedStyle(a);
|
|
247
|
+
const ab = a.getBoundingClientRect();
|
|
248
|
+
if (/hidden|clip/.test(cs.overflowX)) {
|
|
249
|
+
left = Math.max(left, ab.left);
|
|
250
|
+
right = Math.min(right, ab.right);
|
|
251
|
+
}
|
|
252
|
+
if (/hidden|clip/.test(cs.overflowY)) {
|
|
253
|
+
top = Math.max(top, ab.top);
|
|
254
|
+
bottom = Math.min(bottom, ab.bottom);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return new DOMRect(left, top, Math.max(0, right - left), Math.max(0, bottom - top));
|
|
258
|
+
};
|
|
259
|
+
const r = [...range.getClientRects()].map(clipTo).find(past);
|
|
243
260
|
if (r) {
|
|
244
261
|
out.outside.push(`${describe(card)}: "${n.textContent.trim().slice(0, 24)}" ${Math.round(Math.max(box.left - r.left, r.right - box.right, box.top - r.top, r.bottom - box.bottom))} px outside`);
|
|
245
262
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seanyeh77/ui-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.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.
|
|
24
|
+
"@seanyeh77/ui": "^0.48.0"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=22"
|