@rogieking/figui3 2.26.0 → 2.28.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 +13 -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
@@ -1080,12 +1080,15 @@ class FigPopup extends HTMLDialogElement {
1080
1080
  #boundPointerDown;
1081
1081
  #boundPointerMove;
1082
1082
  #boundPointerUp;
1083
+ #wasDragged = false;
1083
1084
 
1084
1085
  constructor() {
1085
1086
  super();
1086
1087
  this.#boundReposition = this.#queueReposition.bind(this);
1087
1088
  this.#boundScroll = (e) => {
1088
- if (this.open && !this.contains(e.target)) this.#positionPopup();
1089
+ if (this.open && !this.contains(e.target) && this.#shouldAutoReposition()) {
1090
+ this.#positionPopup();
1091
+ }
1089
1092
  };
1090
1093
  this.#boundOutsidePointerDown = this.#handleOutsidePointerDown.bind(this);
1091
1094
  this.#boundPointerDown = this.#handlePointerDown.bind(this);
@@ -1222,6 +1225,7 @@ class FigPopup extends HTMLDialogElement {
1222
1225
 
1223
1226
  this.#setupObservers();
1224
1227
  document.addEventListener("pointerdown", this.#boundOutsidePointerDown, true);
1228
+ this.#wasDragged = false;
1225
1229
  this.#queueReposition();
1226
1230
  this.#isPopupActive = true;
1227
1231
 
@@ -1234,6 +1238,7 @@ class FigPopup extends HTMLDialogElement {
1234
1238
  if (anchor) anchor.classList.remove("has-popup-open");
1235
1239
 
1236
1240
  this.#isPopupActive = false;
1241
+ this.#wasDragged = false;
1237
1242
  this.#teardownObservers();
1238
1243
  document.removeEventListener(
1239
1244
  "pointerdown",
@@ -1404,6 +1409,7 @@ class FigPopup extends HTMLDialogElement {
1404
1409
  if (dx > this.#dragThreshold || dy > this.#dragThreshold) {
1405
1410
  this.#isDragging = true;
1406
1411
  this.#dragPending = false;
1412
+ this.#wasDragged = true;
1407
1413
  this.setPointerCapture(e.pointerId);
1408
1414
  this.style.cursor = "grabbing";
1409
1415
 
@@ -1808,7 +1814,7 @@ class FigPopup extends HTMLDialogElement {
1808
1814
  }
1809
1815
 
1810
1816
  #queueReposition() {
1811
- if (!this.open) return;
1817
+ if (!this.open || !this.#shouldAutoReposition()) return;
1812
1818
  if (this.#rafId !== null) return;
1813
1819
 
1814
1820
  this.#rafId = requestAnimationFrame(() => {
@@ -1816,6 +1822,11 @@ class FigPopup extends HTMLDialogElement {
1816
1822
  this.#positionPopup();
1817
1823
  });
1818
1824
  }
1825
+
1826
+ #shouldAutoReposition() {
1827
+ if (!(this.drag && this.#wasDragged)) return true;
1828
+ return !this.#resolveAnchor();
1829
+ }
1819
1830
  }
1820
1831
  customElements.define("fig-popup", FigPopup, { extends: "dialog" });
1821
1832
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.26.0",
3
+ "version": "2.28.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",