@rogieking/figui3 2.33.4 → 2.34.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 +45 -3
  2. package/fig.js +16 -1
  3. package/package.json +1 -1
package/components.css CHANGED
@@ -1439,10 +1439,18 @@ fig-3d-rotate {
1439
1439
  gap: var(--spacer-2);
1440
1440
  width: 100%;
1441
1441
  --aspect-ratio: 1 / 1;
1442
+ --perspective: 20rem;
1442
1443
  --gradient-start-color: light-dark(
1443
1444
  rgba(0, 0, 0, 0.05),
1444
1445
  rgba(255, 255, 255, 0.05)
1445
1446
  );
1447
+ --border-width: 1px;
1448
+ --border-start-color: light-dark(
1449
+ rgba(0, 0, 0, 0.15),
1450
+ rgba(255, 255, 255, 0.15)
1451
+ );
1452
+ --border-end-color: transparent;
1453
+ --border-end-color: transparent;
1446
1454
  --gradient-end-color: transparent;
1447
1455
  --figma-3d-rotate-handle-size: 6px;
1448
1456
  --front-face-bg: light-dark(var(--figma-color-bg), #555);
@@ -1484,7 +1492,8 @@ fig-3d-rotate {
1484
1492
  aspect-ratio: 1 / 1;
1485
1493
  max-height: max(3.5rem, 50%);
1486
1494
  max-width: max(3.5rem, 50%);
1487
- perspective: 20rem;
1495
+ perspective: var(--perspective, 20rem);
1496
+ container-type: inline-size;
1488
1497
  }
1489
1498
 
1490
1499
  .fig-3d-rotate-cube {
@@ -1493,6 +1502,7 @@ fig-3d-rotate {
1493
1502
  position: relative;
1494
1503
  aspect-ratio: 1 / 1;
1495
1504
  transform-style: preserve-3d;
1505
+ transform-origin: 50% 50% -50cqi;
1496
1506
  }
1497
1507
 
1498
1508
  .fig-3d-rotate-face {
@@ -1531,8 +1541,8 @@ fig-3d-rotate {
1531
1541
  rotateY(-0.25turn);
1532
1542
  background: linear-gradient(
1533
1543
  to bottom,
1534
- var(--gradient-start-color),
1535
- var(--gradient-start-color)
1544
+ var(--border-start-color),
1545
+ var(--border-end-color)
1536
1546
  );
1537
1547
  border-radius: var(--radius-medium);
1538
1548
  }
@@ -1544,6 +1554,14 @@ fig-3d-rotate {
1544
1554
  var(--gradient-start-color),
1545
1555
  var(--gradient-end-color)
1546
1556
  );
1557
+ border-width: var(--border-width) 0;
1558
+ border-style: solid;
1559
+ border-image: linear-gradient(
1560
+ to right,
1561
+ var(--border-start-color),
1562
+ var(--border-end-color)
1563
+ )
1564
+ 1;
1547
1565
  }
1548
1566
  &.left {
1549
1567
  transform-origin: 100% 50%;
@@ -1553,6 +1571,14 @@ fig-3d-rotate {
1553
1571
  var(--gradient-start-color),
1554
1572
  var(--gradient-end-color)
1555
1573
  );
1574
+ border-width: var(--border-width) 0;
1575
+ border-style: solid;
1576
+ border-image: linear-gradient(
1577
+ to left,
1578
+ var(--border-start-color),
1579
+ var(--border-end-color)
1580
+ )
1581
+ 1;
1556
1582
  }
1557
1583
  &.top {
1558
1584
  translate: 0 -100%;
@@ -1563,6 +1589,14 @@ fig-3d-rotate {
1563
1589
  var(--gradient-start-color),
1564
1590
  var(--gradient-end-color)
1565
1591
  );
1592
+ border-width: 0 var(--border-width);
1593
+ border-style: solid;
1594
+ border-image: linear-gradient(
1595
+ to top,
1596
+ var(--border-start-color),
1597
+ var(--border-end-color)
1598
+ )
1599
+ 1;
1566
1600
  }
1567
1601
  &.bottom {
1568
1602
  top: 100%;
@@ -1574,6 +1608,14 @@ fig-3d-rotate {
1574
1608
  var(--gradient-start-color),
1575
1609
  var(--gradient-end-color)
1576
1610
  );
1611
+ border-width: 0 var(--border-width);
1612
+ border-style: solid;
1613
+ border-image: linear-gradient(
1614
+ to bottom,
1615
+ var(--border-start-color),
1616
+ var(--border-end-color)
1617
+ )
1618
+ 1;
1577
1619
  }
1578
1620
  }
1579
1621
  }
package/fig.js CHANGED
@@ -6462,12 +6462,13 @@ class Fig3DRotate extends HTMLElement {
6462
6462
  #fieldInputs = {};
6463
6463
 
6464
6464
  static get observedAttributes() {
6465
- return ["value", "precision", "aspect-ratio", "fields"];
6465
+ return ["value", "precision", "aspect-ratio", "fields", "perspective"];
6466
6466
  }
6467
6467
 
6468
6468
  connectedCallback() {
6469
6469
  this.#precision = parseInt(this.getAttribute("precision") || "1");
6470
6470
  this.#syncAspectRatioVar(this.getAttribute("aspect-ratio"));
6471
+ this.#syncPerspectiveVar(this.getAttribute("perspective"));
6471
6472
  this.#parseFields(this.getAttribute("fields"));
6472
6473
  const val = this.getAttribute("value");
6473
6474
  if (val) this.#parseValue(val);
@@ -6490,6 +6491,14 @@ class Fig3DRotate extends HTMLElement {
6490
6491
  }
6491
6492
  }
6492
6493
 
6494
+ #syncPerspectiveVar(value) {
6495
+ if (value && value.trim()) {
6496
+ this.style.setProperty("--perspective", value.trim());
6497
+ } else {
6498
+ this.style.removeProperty("--perspective");
6499
+ }
6500
+ }
6501
+
6493
6502
  #parseFields(str) {
6494
6503
  if (!str || !str.trim()) {
6495
6504
  this.#fields = [];
@@ -6507,6 +6516,10 @@ class Fig3DRotate extends HTMLElement {
6507
6516
  this.#syncAspectRatioVar(newValue);
6508
6517
  return;
6509
6518
  }
6519
+ if (name === "perspective") {
6520
+ this.#syncPerspectiveVar(newValue);
6521
+ return;
6522
+ }
6510
6523
  if (name === "fields") {
6511
6524
  this.#parseFields(newValue);
6512
6525
  if (this.#cube) this.#render();
@@ -6669,10 +6682,12 @@ class Fig3DRotate extends HTMLElement {
6669
6682
  this.#rx = this.#snapToIncrement(startRx - dy * 0.5);
6670
6683
  this.#updateCube();
6671
6684
  this.#syncFieldInputs();
6685
+ this.setAttribute("value", this.value);
6672
6686
  this.#emit("input");
6673
6687
  };
6674
6688
 
6675
6689
  const onUp = () => {
6690
+ this.setAttribute("value", this.value);
6676
6691
  this.#isDragging = false;
6677
6692
  this.#container.classList.remove("dragging");
6678
6693
  document.removeEventListener("pointermove", onMove);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.33.4",
3
+ "version": "2.34.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",