@ai-matrx/design-system 0.61.11 → 0.61.12
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/CHANGELOG.md +9 -0
- package/dist/index.cjs +24 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -385,6 +385,10 @@ function findPillViolation(el, maxWidth = PILL_MAX_WIDTH_PX) {
|
|
|
385
385
|
if (rect.width > maxWidth + 0.5) {
|
|
386
386
|
return `pill is ${Math.round(rect.width)}px wide (budget ${maxWidth}px) holding "${describe(el)}" \u2014 a pill holds a short label: clamp it (Badge, or truncate + max-w + title) or render a list row.`;
|
|
387
387
|
}
|
|
388
|
+
const past = overflowPast(el, rect, view);
|
|
389
|
+
if (past) {
|
|
390
|
+
return `pill overflows ${past.what} by ${Math.round(past.by)}px holding "${describe(el)}" \u2014 a pill never runs past its row or the page gutter: let the row wrap and give the pill max-w-full with a truncating label.`;
|
|
391
|
+
}
|
|
388
392
|
const lines = lineCount(el, own, cs, rect.height);
|
|
389
393
|
if (lines > 1) {
|
|
390
394
|
return `pill wraps to ${lines} lines holding "${describe(el)}" \u2014 a pill is one line: clamp it (Badge, or truncate + max-w + title) or render a list row.`;
|
|
@@ -395,6 +399,26 @@ function findPillViolation(el, maxWidth = PILL_MAX_WIDTH_PX) {
|
|
|
395
399
|
}
|
|
396
400
|
return null;
|
|
397
401
|
}
|
|
402
|
+
function overflowPast(el, rect, view) {
|
|
403
|
+
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
404
|
+
const ox = view.getComputedStyle(p).overflowX;
|
|
405
|
+
if (ox === "auto" || ox === "scroll") return null;
|
|
406
|
+
}
|
|
407
|
+
const parent = el.parentElement;
|
|
408
|
+
if (parent) {
|
|
409
|
+
const pr = parent.getBoundingClientRect();
|
|
410
|
+
if (pr.width > 0) {
|
|
411
|
+
const by = Math.max(rect.right - pr.right, pr.left - rect.left);
|
|
412
|
+
if (by > 0.5) return { what: "its container", by };
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
const vw = el.ownerDocument.documentElement.clientWidth || view.innerWidth;
|
|
416
|
+
if (vw > 0) {
|
|
417
|
+
const by = Math.max(rect.right - vw, -rect.left);
|
|
418
|
+
if (by > 0.5) return { what: "the viewport", by };
|
|
419
|
+
}
|
|
420
|
+
return null;
|
|
421
|
+
}
|
|
398
422
|
function stretchSlack(el, own, cs, width, view) {
|
|
399
423
|
const range = el.ownerDocument.createRange?.();
|
|
400
424
|
if (!range || typeof range.getClientRects !== "function") return null;
|