@rogieking/figui3 6.16.0 → 6.17.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/fig.js CHANGED
@@ -2845,10 +2845,16 @@ class FigPopup extends HTMLDialogElement {
2845
2845
  if (closedby === "none" || closedby === "closerequest") return;
2846
2846
  const target = event.target;
2847
2847
  if (!(target instanceof Node)) return;
2848
+
2849
+ // Prefer composedPath so slotted light-DOM content (e.g. fig-select options)
2850
+ // counts as inside — Node.contains() is false for slotted nodes.
2851
+ const path =
2852
+ typeof event.composedPath === "function" ? event.composedPath() : [];
2853
+ if (path.includes(this)) return;
2848
2854
  if (this.contains(target)) return;
2849
2855
 
2850
2856
  const anchor = this.resolveAnchor();
2851
- if (anchor?.contains && anchor.contains(target)) return;
2857
+ if (anchor && (path.includes(anchor) || anchor.contains?.(target))) return;
2852
2858
 
2853
2859
  if (this.isInsideDescendantPopup(target)) return;
2854
2860
 
@@ -17186,11 +17192,40 @@ class FigMenuItem extends HTMLElement {
17186
17192
  }
17187
17193
  customElements.define("fig-menu-item", FigMenuItem);
17188
17194
 
17195
+ /**
17196
+ * Visual divider between menu item groups.
17197
+ * @attr {string} label - Optional group label shown in secondary text under the line.
17198
+ */
17189
17199
  class FigMenuSeparator extends HTMLElement {
17200
+ static get observedAttributes() {
17201
+ return ["label"];
17202
+ }
17203
+
17204
+ get label() {
17205
+ return this.getAttribute("label") ?? "";
17206
+ }
17207
+
17208
+ set label(value) {
17209
+ if (value == null || value === "") this.removeAttribute("label");
17210
+ else this.setAttribute("label", String(value));
17211
+ }
17212
+
17190
17213
  connectedCallback() {
17214
+ this.#sync();
17215
+ }
17216
+
17217
+ attributeChangedCallback(name, oldValue, newValue) {
17218
+ if (oldValue === newValue) return;
17219
+ this.#sync();
17220
+ }
17221
+
17222
+ #sync() {
17191
17223
  if (!this.hasAttribute("role")) {
17192
17224
  this.setAttribute("role", "separator");
17193
17225
  }
17226
+ const label = this.label.trim();
17227
+ if (label) this.setAttribute("aria-label", label);
17228
+ else this.removeAttribute("aria-label");
17194
17229
  }
17195
17230
  }
17196
17231
  customElements.define("fig-menu-separator", FigMenuSeparator);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "6.16.0",
3
+ "version": "6.17.0",
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",