@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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.61.15 — a pill in a panned tile is not an overflowing pill
4
+
5
+ - Pill guard: the viewport judges only the part of the pill its clipping ancestors leave drawn, and
6
+ never a pill inside a transformed (translate/scale/rotate) ancestor or one wholly off screen.
7
+ A pill wider than its nearest clipping ancestor (overflow hidden/auto/scroll/clip) is now
8
+ reported as overflowing its clipping container. Measured: /board tiles panned off the canvas
9
+ logged "overflows the viewport". Guard cases added (off-screen and half-off-screen pill in a
10
+ translated tile: none; pill wider than its clipping tile: flagged).
11
+
12
+ No consumer action.
13
+
14
+ ## 0.61.14 — a page that scrolls down never hides an overflowing pill
15
+
16
+ - Pill guard: only a sideways TRACK (an ancestor that scrolls horizontally and not vertically)
17
+ exempts a pill from the overflow check. 0.61.12 exempted any ancestor with computed
18
+ `overflow-x: auto`, and a page body with `overflow-y: auto` computes that too — so no pill on a
19
+ scrolling page was ever judged (measured live on /education/overview). Guard case red on 0.61.13.
20
+
21
+ No consumer action.
22
+
3
23
  ## 0.61.13 — a pinned count badge is not an overflowing pill
4
24
 
5
25
  - Pill guard: a capsule positioned `absolute`/`fixed` (a count badge pinned to an icon's corner)
package/dist/index.cjs CHANGED
@@ -733,7 +733,7 @@ function findPillViolation(el, maxWidth = PILL_MAX_WIDTH_PX) {
733
733
  function overflowPast(el, rect, view) {
734
734
  for (let p = el.parentElement; p; p = p.parentElement) {
735
735
  const ox = view.getComputedStyle(p).overflowX;
736
- if (ox === "auto" || ox === "scroll") return null;
736
+ if ((ox === "auto" || ox === "scroll") && p.scrollWidth > p.clientWidth + 1 && p.scrollHeight <= p.clientHeight + 1) return null;
737
737
  }
738
738
  const pinned = ["absolute", "fixed"].includes(view.getComputedStyle(el).position);
739
739
  const parent = el.parentElement;
@@ -744,9 +744,48 @@ function overflowPast(el, rect, view) {
744
744
  if (by > 0.5) return { what: "its container", by };
745
745
  }
746
746
  }
747
- const vw = el.ownerDocument.documentElement.clientWidth || view.innerWidth;
747
+ let clip = null;
748
+ let transformed = false;
749
+ const root = el.ownerDocument.documentElement;
750
+ for (let p = el.parentElement; p && p !== root; p = p.parentElement) {
751
+ const pcs = view.getComputedStyle(p);
752
+ if (!clip && pcs.overflowX !== "visible" && pcs.overflowX !== "") clip = p;
753
+ if (pcs.transform && pcs.transform !== "none" || pcs.translate && pcs.translate !== "none" || pcs.scale && pcs.scale !== "none" || pcs.rotate && pcs.rotate !== "none") {
754
+ transformed = true;
755
+ }
756
+ }
757
+ if (clip && !pinned && clip !== parent) {
758
+ const cr = clip.getBoundingClientRect();
759
+ if (cr.width > 0) {
760
+ const by = Math.max(rect.right - cr.right, cr.left - rect.left);
761
+ if (by > 0.5) return { what: "its clipping container", by };
762
+ }
763
+ }
764
+ let left = rect.left;
765
+ let right = rect.right;
766
+ let top = rect.top;
767
+ let bottom = rect.bottom;
768
+ for (let p = el.parentElement; p && p !== root; p = p.parentElement) {
769
+ const pcs = view.getComputedStyle(p);
770
+ if (pcs.overflowX === "visible" && pcs.overflowY === "visible") continue;
771
+ const cr = p.getBoundingClientRect();
772
+ if (cr.width === 0 && cr.height === 0) continue;
773
+ if (pcs.overflowX !== "visible") {
774
+ left = Math.max(left, cr.left);
775
+ right = Math.min(right, cr.right);
776
+ }
777
+ if (pcs.overflowY !== "visible") {
778
+ top = Math.max(top, cr.top);
779
+ bottom = Math.min(bottom, cr.bottom);
780
+ }
781
+ }
782
+ const vw = root.clientWidth || view.innerWidth;
783
+ const vh = root.clientHeight || view.innerHeight;
784
+ if (transformed) return null;
785
+ if (vw > 0 && (right <= left || right <= 0 || left >= vw)) return null;
786
+ if (vh > 0 && (bottom <= top || bottom <= 0 || top >= vh)) return null;
748
787
  if (vw > 0) {
749
- const by = Math.max(rect.right - vw, -rect.left);
788
+ const by = Math.max(right - vw, -left);
750
789
  if (by > 0.5) return { what: "the viewport", by };
751
790
  }
752
791
  return null;