@ai-matrx/design-system 0.61.13 → 0.61.15
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 +20 -0
- package/dist/index.cjs +42 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -402,7 +402,7 @@ function findPillViolation(el, maxWidth = PILL_MAX_WIDTH_PX) {
|
|
|
402
402
|
function overflowPast(el, rect, view) {
|
|
403
403
|
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
404
404
|
const ox = view.getComputedStyle(p).overflowX;
|
|
405
|
-
if (ox === "auto" || ox === "scroll") return null;
|
|
405
|
+
if ((ox === "auto" || ox === "scroll") && p.scrollWidth > p.clientWidth + 1 && p.scrollHeight <= p.clientHeight + 1) return null;
|
|
406
406
|
}
|
|
407
407
|
const pinned = ["absolute", "fixed"].includes(view.getComputedStyle(el).position);
|
|
408
408
|
const parent = el.parentElement;
|
|
@@ -413,9 +413,48 @@ function overflowPast(el, rect, view) {
|
|
|
413
413
|
if (by > 0.5) return { what: "its container", by };
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
|
|
416
|
+
let clip = null;
|
|
417
|
+
let transformed = false;
|
|
418
|
+
const root = el.ownerDocument.documentElement;
|
|
419
|
+
for (let p = el.parentElement; p && p !== root; p = p.parentElement) {
|
|
420
|
+
const pcs = view.getComputedStyle(p);
|
|
421
|
+
if (!clip && pcs.overflowX !== "visible" && pcs.overflowX !== "") clip = p;
|
|
422
|
+
if (pcs.transform && pcs.transform !== "none" || pcs.translate && pcs.translate !== "none" || pcs.scale && pcs.scale !== "none" || pcs.rotate && pcs.rotate !== "none") {
|
|
423
|
+
transformed = true;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (clip && !pinned && clip !== parent) {
|
|
427
|
+
const cr = clip.getBoundingClientRect();
|
|
428
|
+
if (cr.width > 0) {
|
|
429
|
+
const by = Math.max(rect.right - cr.right, cr.left - rect.left);
|
|
430
|
+
if (by > 0.5) return { what: "its clipping container", by };
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
let left = rect.left;
|
|
434
|
+
let right = rect.right;
|
|
435
|
+
let top = rect.top;
|
|
436
|
+
let bottom = rect.bottom;
|
|
437
|
+
for (let p = el.parentElement; p && p !== root; p = p.parentElement) {
|
|
438
|
+
const pcs = view.getComputedStyle(p);
|
|
439
|
+
if (pcs.overflowX === "visible" && pcs.overflowY === "visible") continue;
|
|
440
|
+
const cr = p.getBoundingClientRect();
|
|
441
|
+
if (cr.width === 0 && cr.height === 0) continue;
|
|
442
|
+
if (pcs.overflowX !== "visible") {
|
|
443
|
+
left = Math.max(left, cr.left);
|
|
444
|
+
right = Math.min(right, cr.right);
|
|
445
|
+
}
|
|
446
|
+
if (pcs.overflowY !== "visible") {
|
|
447
|
+
top = Math.max(top, cr.top);
|
|
448
|
+
bottom = Math.min(bottom, cr.bottom);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
const vw = root.clientWidth || view.innerWidth;
|
|
452
|
+
const vh = root.clientHeight || view.innerHeight;
|
|
453
|
+
if (transformed) return null;
|
|
454
|
+
if (vw > 0 && (right <= left || right <= 0 || left >= vw)) return null;
|
|
455
|
+
if (vh > 0 && (bottom <= top || bottom <= 0 || top >= vh)) return null;
|
|
417
456
|
if (vw > 0) {
|
|
418
|
-
const by = Math.max(
|
|
457
|
+
const by = Math.max(right - vw, -left);
|
|
419
458
|
if (by > 0.5) return { what: "the viewport", by };
|
|
420
459
|
}
|
|
421
460
|
return null;
|