@rogieking/figui3 2.26.0 → 2.27.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.
Files changed (3) hide show
  1. package/components.css +9 -0
  2. package/fig.js +12 -2
  3. package/package.json +1 -1
package/components.css CHANGED
@@ -1280,6 +1280,7 @@ fig-easing-curve {
1280
1280
  .fig-easing-curve-svg-container {
1281
1281
  border-radius: var(--radius-medium);
1282
1282
  background: var(--figma-color-bg-secondary);
1283
+ padding: var(--spacer-2);
1283
1284
  }
1284
1285
  .fig-easing-curve-diagonal,
1285
1286
  .fig-easing-curve-bounds,
@@ -1291,6 +1292,8 @@ fig-easing-curve {
1291
1292
  .fig-easing-curve-diagonal {
1292
1293
  stroke: var(--figma-color-bordertranslucent);
1293
1294
  stroke-width: var(--stroke-width);
1295
+ stroke-linejoin: round;
1296
+ stroke-linecap: round;
1294
1297
  }
1295
1298
  .fig-easing-curve-bounds {
1296
1299
  fill: transparent;
@@ -1298,15 +1301,21 @@ fig-easing-curve {
1298
1301
  .fig-easing-curve-arm {
1299
1302
  stroke: var(--figma-color-border-strong);
1300
1303
  stroke-width: var(--stroke-width);
1304
+ stroke-linejoin: round;
1305
+ stroke-linecap: round;
1301
1306
  }
1302
1307
  .fig-easing-curve-path {
1303
1308
  fill: none;
1304
1309
  stroke: var(--figma-color-text);
1305
1310
  stroke-width: var(--stroke-width);
1311
+ stroke-linejoin: round;
1312
+ stroke-linecap: round;
1306
1313
  }
1307
1314
  .fig-easing-curve-target {
1308
1315
  stroke: var(--figma-color-bordertranslucent);
1309
1316
  stroke-width: var(--stroke-width);
1317
+ stroke-linejoin: round;
1318
+ stroke-linecap: round;
1310
1319
  }
1311
1320
  .fig-easing-curve-handle {
1312
1321
  fill: var(--figma-color-border-strong);
package/fig.js CHANGED
@@ -1085,7 +1085,9 @@ class FigPopup extends HTMLDialogElement {
1085
1085
  super();
1086
1086
  this.#boundReposition = this.#queueReposition.bind(this);
1087
1087
  this.#boundScroll = (e) => {
1088
- if (this.open && !this.contains(e.target)) this.#positionPopup();
1088
+ if (this.open && !this.contains(e.target) && this.#shouldAutoReposition()) {
1089
+ this.#positionPopup();
1090
+ }
1089
1091
  };
1090
1092
  this.#boundOutsidePointerDown = this.#handleOutsidePointerDown.bind(this);
1091
1093
  this.#boundPointerDown = this.#handlePointerDown.bind(this);
@@ -1222,6 +1224,7 @@ class FigPopup extends HTMLDialogElement {
1222
1224
 
1223
1225
  this.#setupObservers();
1224
1226
  document.addEventListener("pointerdown", this.#boundOutsidePointerDown, true);
1227
+ this.#wasDragged = false;
1225
1228
  this.#queueReposition();
1226
1229
  this.#isPopupActive = true;
1227
1230
 
@@ -1234,6 +1237,7 @@ class FigPopup extends HTMLDialogElement {
1234
1237
  if (anchor) anchor.classList.remove("has-popup-open");
1235
1238
 
1236
1239
  this.#isPopupActive = false;
1240
+ this.#wasDragged = false;
1237
1241
  this.#teardownObservers();
1238
1242
  document.removeEventListener(
1239
1243
  "pointerdown",
@@ -1404,6 +1408,7 @@ class FigPopup extends HTMLDialogElement {
1404
1408
  if (dx > this.#dragThreshold || dy > this.#dragThreshold) {
1405
1409
  this.#isDragging = true;
1406
1410
  this.#dragPending = false;
1411
+ this.#wasDragged = true;
1407
1412
  this.setPointerCapture(e.pointerId);
1408
1413
  this.style.cursor = "grabbing";
1409
1414
 
@@ -1808,7 +1813,7 @@ class FigPopup extends HTMLDialogElement {
1808
1813
  }
1809
1814
 
1810
1815
  #queueReposition() {
1811
- if (!this.open) return;
1816
+ if (!this.open || !this.#shouldAutoReposition()) return;
1812
1817
  if (this.#rafId !== null) return;
1813
1818
 
1814
1819
  this.#rafId = requestAnimationFrame(() => {
@@ -1816,6 +1821,11 @@ class FigPopup extends HTMLDialogElement {
1816
1821
  this.#positionPopup();
1817
1822
  });
1818
1823
  }
1824
+
1825
+ #shouldAutoReposition() {
1826
+ if (!(this.drag && this.#wasDragged)) return true;
1827
+ return !this.#resolveAnchor();
1828
+ }
1819
1829
  }
1820
1830
  customElements.define("fig-popup", FigPopup, { extends: "dialog" });
1821
1831
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.26.0",
3
+ "version": "2.27.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",