@rogieking/figui3 11.1.1 → 11.1.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-editor.css CHANGED
@@ -394,7 +394,7 @@ fig-fill-picker {
394
394
  background-color: var(--figma-color-bg-transparent-hover);
395
395
  }
396
396
 
397
- &:has(.fig-fill-picker-gradient-space:focus-within) > fig-button {
397
+ &:has(.fig-fill-picker-gradient-space[data-focus-visible]) > fig-button {
398
398
  outline: var(--figma-focus-outline);
399
399
  outline-offset: var(--figma-focus-outline-offset);
400
400
  }
package/fig-editor.js CHANGED
@@ -532,6 +532,17 @@ class FigSelect extends HTMLElement {
532
532
  #syncingOptions = false;
533
533
  #menuAnchorRef = null;
534
534
  #boundTriggerClick = this.#handleTriggerClick.bind(this);
535
+ #boundTriggerFocus = () => {
536
+ queueMicrotask(() => {
537
+ if (!this.#button?.matches(":focus-within")) return;
538
+ this.toggleAttribute(
539
+ "data-focus-visible",
540
+ this.#button.hasAttribute("data-focus-visible") ||
541
+ this.#button.matches(":focus-visible"),
542
+ );
543
+ });
544
+ };
545
+ #boundTriggerBlur = () => this.removeAttribute("data-focus-visible");
535
546
  #boundOptionClick = this.#handleOptionClick.bind(this);
536
547
  #boundOptionPointerOver = this.#handleOptionPointerOver.bind(this);
537
548
  #boundKeydown = this.#handleKeydown.bind(this);
@@ -1294,6 +1305,8 @@ class FigSelect extends HTMLElement {
1294
1305
  #setupListeners() {
1295
1306
  this.#button?.addEventListener("click", this.#boundTriggerClick);
1296
1307
  this.#button?.addEventListener("keydown", this.#boundKeydown);
1308
+ this.#button?.addEventListener("focus", this.#boundTriggerFocus);
1309
+ this.#button?.addEventListener("blur", this.#boundTriggerBlur);
1297
1310
  // Host click: slotted options stay in light DOM (not dialog.contains).
1298
1311
  this.addEventListener("click", this.#boundOptionClick);
1299
1312
  this.addEventListener("pointerover", this.#boundOptionPointerOver);
@@ -1305,6 +1318,9 @@ class FigSelect extends HTMLElement {
1305
1318
  #teardownListeners() {
1306
1319
  this.#button?.removeEventListener("click", this.#boundTriggerClick);
1307
1320
  this.#button?.removeEventListener("keydown", this.#boundKeydown);
1321
+ this.#button?.removeEventListener("focus", this.#boundTriggerFocus);
1322
+ this.#button?.removeEventListener("blur", this.#boundTriggerBlur);
1323
+ this.removeAttribute("data-focus-visible");
1308
1324
  this.removeEventListener("click", this.#boundOptionClick);
1309
1325
  this.removeEventListener("pointerover", this.#boundOptionPointerOver);
1310
1326
  this.#popup?.removeEventListener("keydown", this.#boundKeydown);
package/fig-lab.css CHANGED
@@ -603,51 +603,77 @@ fig-canvas-control {
603
603
  }
604
604
  }
605
605
 
606
- /* Oscillator Input */
607
- fig-reorder {
608
- display: contents;
609
- }
606
+ /* Drag to Reorder */
607
+ fig-reorder {
608
+ display: contents;
610
609
 
611
- fig-reorder:not([handle]):is(:not([disabled]), [disabled="false"]) > [data-reorder-item] {
612
- cursor: grab;
613
- }
610
+ &:not([handle]):is(:not([disabled]), [disabled="false"])
611
+ > [data-reorder-item] {
612
+ cursor: grab;
614
613
 
615
- fig-reorder:not([handle]):is(:not([disabled]), [disabled="false"]) > [data-reorder-item] > fig-header,
616
- fig-reorder:not([handle]):is(:not([disabled]), [disabled="false"]) > [data-reorder-item] > fig-header *,
617
- fig-reorder:not([handle]):is(:not([disabled]), [disabled="false"]) > [data-reorder-item] > label {
618
- cursor: grab;
619
- }
614
+ > fig-header,
615
+ > fig-header *,
616
+ > label {
617
+ cursor: grab;
618
+ }
619
+ }
620
620
 
621
- fig-reorder > .dragging {
622
- background-color: var(--figma-color-bg-secondary);
623
- }
621
+ > .dragging {
622
+ background-color: var(--figma-color-bg-secondary);
623
+ }
624
624
 
625
- [data-reorder-handle] {
626
- cursor: grab;
627
- }
625
+ &[disabled]:not([disabled="false"]) [data-reorder-handle] {
626
+ cursor: inherit;
627
+ }
628
+ }
628
629
 
629
- fig-reorder[disabled]:not([disabled="false"]) [data-reorder-handle] {
630
- cursor: inherit;
631
- }
630
+ [data-reorder-handle] {
631
+ cursor: grab;
632
+ }
632
633
 
633
- body.fig-reorder-dragging,
634
- body.fig-reorder-dragging * {
635
- user-select: none !important;
636
- -webkit-user-select: none !important;
637
- cursor: grabbing !important;
638
- }
634
+ body.fig-reorder-dragging {
635
+ &,
636
+ & * {
637
+ user-select: none !important;
638
+ -webkit-user-select: none !important;
639
+ cursor: grabbing !important;
640
+ }
641
+ }
639
642
 
640
- .fig-reorder-indicator {
641
- position: fixed;
642
- pointer-events: none;
643
- z-index: 1000000;
644
- background: var(--figma-color-border-strong);
645
- }
643
+ .fig-reorder-indicator {
644
+ position: fixed;
645
+ pointer-events: none;
646
+ z-index: 1000000;
647
+ border-radius: 1px;
648
+ &::before{
649
+ content: "";
650
+ position: absolute;
651
+ top: 0;
652
+ left: var(--spacer-1);
653
+ width: 100%;
654
+ height: 100%;
655
+ background: var(--figma-color-border-selected);
656
+ }
646
657
 
647
- .fig-reorder-indicator[data-axis="vertical"] {
648
- height: 2px;
649
- }
658
+ &.fig-reorder-indicator-ring {
659
+ &::after{
660
+ content: "";
661
+ position: absolute;
662
+ top: 1px;
663
+ left: 0;
664
+ transform: translate(-50%, -50%);
665
+ width: var(--spacer-2);
666
+ height: var(--spacer-2);
667
+ border: 2px solid var(--figma-color-border-selected);
668
+ border-radius: 50%;
669
+ }
670
+ }
650
671
 
651
- .fig-reorder-indicator[data-axis="horizontal"] {
652
- width: 2px;
653
- }
672
+ &[data-axis="vertical"] {
673
+ height: 2px;
674
+ }
675
+
676
+ &[data-axis="horizontal"] {
677
+ width: 2px;
678
+ }
679
+ }
package/fig-lab.js CHANGED
@@ -2903,8 +2903,21 @@ class FigCanvasControl extends HTMLElement {
2903
2903
  }
2904
2904
  figLabDefineElement("fig-canvas-control", FigCanvasControl);
2905
2905
  /* Reorder wrapper */
2906
+ /**
2907
+ * @attr {string} axis - Reorder direction: "vertical" (default) or "horizontal"
2908
+ * @attr {string} handle - Selector for the drag handle within each item
2909
+ * @attr {string} items - Selector limiting which direct children are reorderable
2910
+ * @attr {string} indicator - Drop indicator style: "default" or "ring"
2911
+ * @attr {boolean} disabled - Disable reordering
2912
+ */
2906
2913
  class FigReorder extends HTMLElement {
2907
- static observedAttributes = ["axis", "handle", "items", "disabled"];
2914
+ static observedAttributes = [
2915
+ "axis",
2916
+ "handle",
2917
+ "items",
2918
+ "indicator",
2919
+ "disabled",
2920
+ ];
2908
2921
 
2909
2922
  static #DRAG_THRESHOLD = 6;
2910
2923
 
@@ -2970,9 +2983,10 @@ class FigReorder extends HTMLElement {
2970
2983
  this.#liveRegion = null;
2971
2984
  }
2972
2985
 
2973
- attributeChangedCallback() {
2986
+ attributeChangedCallback(name) {
2974
2987
  if (this.isConnected) {
2975
2988
  if (this.#disabled) this.#cancelDrag();
2989
+ if (name === "indicator") this.#syncIndicatorStyle();
2976
2990
  this.#syncAttributeObserver();
2977
2991
  this.#syncChildren();
2978
2992
  }
@@ -3025,6 +3039,10 @@ class FigReorder extends HTMLElement {
3025
3039
  return (this.getAttribute("items") || "").trim();
3026
3040
  }
3027
3041
 
3042
+ get #indicatorStyle() {
3043
+ return (this.getAttribute("indicator") || "default").trim().toLowerCase();
3044
+ }
3045
+
3028
3046
  #getAllElementChildren() {
3029
3047
  return [...this.children].filter(
3030
3048
  (node) =>
@@ -3409,11 +3427,22 @@ class FigReorder extends HTMLElement {
3409
3427
  const indicator = document.createElement("div");
3410
3428
  indicator.className = "fig-reorder-indicator";
3411
3429
  indicator.setAttribute("data-axis", this.#axis);
3430
+ indicator.classList.toggle(
3431
+ "fig-reorder-indicator-ring",
3432
+ this.#indicatorStyle === "ring",
3433
+ );
3412
3434
  document.body.appendChild(indicator);
3413
3435
  this.#indicator = indicator;
3414
3436
  return indicator;
3415
3437
  }
3416
3438
 
3439
+ #syncIndicatorStyle() {
3440
+ this.#indicator?.classList.toggle(
3441
+ "fig-reorder-indicator-ring",
3442
+ this.#indicatorStyle === "ring",
3443
+ );
3444
+ }
3445
+
3417
3446
  #updateIndicator(index, item) {
3418
3447
  const items = this.#getElementChildren();
3419
3448
  if (!this.#shouldShowIndicator(item, index)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "11.1.1",
3
+ "version": "11.1.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": "SEE LICENSE IN LICENSE",