@rogieking/figui3 6.18.0 → 6.18.2

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/fig-lab.css CHANGED
@@ -168,6 +168,11 @@ propskit-color {
168
168
  background-color: transparent;
169
169
  box-shadow: none;
170
170
 
171
+ /* Field ::after owns hover chrome — don't double-outline the color control. */
172
+ &:hover:not(:focus):not(:focus-within):not(.has-popup-open) {
173
+ outline: none !important;
174
+ }
175
+
171
176
  > .input-combo {
172
177
  flex: 0 0 auto;
173
178
  width: auto;
@@ -1299,7 +1304,8 @@ fig-select::part(listbox) {
1299
1304
 
1300
1305
  z-index: var(--z-index);
1301
1306
  position: fixed;
1302
- inset: auto;
1307
+ /* Do not set inset here — ::part inset beats inline left/top and
1308
+ prevents edge clamping from moving the menu back into view. */
1303
1309
  margin: 0;
1304
1310
  border: 0;
1305
1311
  outline: 0;
package/fig-lab.js CHANGED
@@ -5354,16 +5354,26 @@ class FigSelect extends HTMLElement {
5354
5354
  let left = labelRect.left - selectedOffsetX;
5355
5355
  let top = labelRect.top - selectedOffsetY;
5356
5356
 
5357
+ // Keep the whole menu in-view when aligning over the selected option
5358
+ // would otherwise push it past a viewport edge (corners / far sides).
5357
5359
  const margins = this.#getViewportMargins();
5358
- const minLeft = margins.left;
5359
- const minTop = margins.top;
5360
- const maxLeft = window.innerWidth - popupRect.width - margins.right;
5361
- const maxTop = window.innerHeight - popupRect.height - margins.bottom;
5362
- left = Math.min(Math.max(left, minLeft), Math.max(minLeft, maxLeft));
5363
- top = Math.min(Math.max(top, minTop), Math.max(minTop, maxTop));
5364
-
5365
- popup.style.left = `${Math.round(left)}px`;
5366
- popup.style.top = `${Math.round(top)}px`;
5360
+ if (typeof popup.clampToViewport === "function") {
5361
+ ({ left, top } = popup.clampToViewport({ left, top }, popupRect, margins));
5362
+ } else {
5363
+ const minLeft = margins.left;
5364
+ const minTop = margins.top;
5365
+ const maxLeft = window.innerWidth - popupRect.width - margins.right;
5366
+ const maxTop = window.innerHeight - popupRect.height - margins.bottom;
5367
+ left = Math.min(Math.max(left, minLeft), Math.max(minLeft, maxLeft));
5368
+ top = Math.min(Math.max(top, minTop), Math.max(minTop, maxTop));
5369
+ }
5370
+
5371
+ // !important: fig-select::part(listbox) and dialog UA rules can otherwise
5372
+ // keep the menu at its static/anchor position past the viewport edge.
5373
+ popup.style.setProperty("right", "auto", "important");
5374
+ popup.style.setProperty("bottom", "auto", "important");
5375
+ popup.style.setProperty("left", `${Math.round(left)}px`, "important");
5376
+ popup.style.setProperty("top", `${Math.round(top)}px`, "important");
5367
5377
 
5368
5378
  // Nudge the panel scroller so the selected label stays over the trigger.
5369
5379
  const panel = this.#getPanel();
package/fig.js CHANGED
@@ -1600,6 +1600,11 @@ class FigDialog extends HTMLDialogElement {
1600
1600
 
1601
1601
  this._ensureHeader();
1602
1602
 
1603
+ // Markup `<dialog open>` (non-modal) never calls show() — still need a stack bump.
1604
+ if (this.open && !this.matches?.(":modal")) {
1605
+ this._assignStackingOrder();
1606
+ }
1607
+
1603
1608
  figNextFrame(this, () => {
1604
1609
  this._addCloseListeners();
1605
1610
  this._setupDragListeners();
@@ -1641,18 +1646,37 @@ class FigDialog extends HTMLDialogElement {
1641
1646
  requestAnimationFrame(() => target.focus?.());
1642
1647
  }
1643
1648
 
1649
+ _assignStackingOrder() {
1650
+ this.style.zIndex = String(figGetHighestZIndex() + 1);
1651
+ }
1652
+
1653
+ _clearStackingOrder() {
1654
+ this.style.zIndex = "";
1655
+ }
1656
+
1644
1657
  show() {
1645
1658
  this._captureFocusBeforeOpen();
1659
+ // Non-modal dialogs are position:fixed in normal paint order — bump above
1660
+ // other FigUI overlays (same helper as fig-popup).
1661
+ this._assignStackingOrder();
1646
1662
  this.addEventListener("close", this._boundRestoreFocus, { once: true });
1647
1663
  return super.show();
1648
1664
  }
1649
1665
 
1650
1666
  showModal() {
1651
1667
  this._captureFocusBeforeOpen();
1668
+ // Top layer owns stacking; clear any prior non-modal inline z-index.
1669
+ this._clearStackingOrder();
1652
1670
  this.addEventListener("close", this._boundRestoreFocus, { once: true });
1653
1671
  return super.showModal();
1654
1672
  }
1655
1673
 
1674
+ close(...args) {
1675
+ const result = super.close(...args);
1676
+ this._clearStackingOrder();
1677
+ return result;
1678
+ }
1679
+
1656
1680
  _handleIframeMouseLeave(event) {
1657
1681
  const iframe = event?.currentTarget;
1658
1682
  if (!(iframe instanceof HTMLIFrameElement)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "6.18.0",
3
+ "version": "6.18.2",
4
4
  "description": "A lightweight web components library for building Figma plugin and widget UIs with native look and feel",
5
5
  "author": "Rogie King",
6
6
  "license": "MIT",