@rogieking/figui3 2.0.6 → 2.0.7
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/components.css +7 -11
- package/fig.js +32 -16
- package/package.json +1 -1
package/components.css
CHANGED
|
@@ -2629,11 +2629,9 @@ fig-layer {
|
|
|
2629
2629
|
user-select: none;
|
|
2630
2630
|
border-radius: var(--radius-medium);
|
|
2631
2631
|
|
|
2632
|
-
|
|
2633
|
-
&:has(fig-layer)
|
|
2634
|
-
|
|
2635
|
-
visibility: visible;
|
|
2636
|
-
}
|
|
2632
|
+
/* Show chevron when layer has children */
|
|
2633
|
+
&:has(fig-layer) > .fig-layer-row > .fig-layer-chevron {
|
|
2634
|
+
visibility: visible;
|
|
2637
2635
|
}
|
|
2638
2636
|
|
|
2639
2637
|
&:not(:has(.fig-layer-icon)) {
|
|
@@ -2649,12 +2647,10 @@ fig-layer {
|
|
|
2649
2647
|
padding: var(--spacer-1) var(--spacer-2);
|
|
2650
2648
|
margin-left: var(--spacer-2);
|
|
2651
2649
|
border-radius: var(--radius-medium);
|
|
2652
|
-
cursor: pointer;
|
|
2653
2650
|
position: relative;
|
|
2654
2651
|
|
|
2655
|
-
/* Chevron
|
|
2656
|
-
|
|
2657
|
-
content: "";
|
|
2652
|
+
/* Chevron element - injected by JS when layer has children */
|
|
2653
|
+
.fig-layer-chevron {
|
|
2658
2654
|
mask-image: var(--icon-chevron);
|
|
2659
2655
|
mask-size: contain;
|
|
2660
2656
|
mask-repeat: no-repeat;
|
|
@@ -2685,6 +2681,7 @@ fig-layer {
|
|
|
2685
2681
|
width: var(--spacer-3);
|
|
2686
2682
|
height: var(--spacer-3);
|
|
2687
2683
|
color: var(--figma-color-icon-tertiary);
|
|
2684
|
+
margin-left: var(--spacer-1);
|
|
2688
2685
|
}
|
|
2689
2686
|
|
|
2690
2687
|
> label {
|
|
@@ -2693,7 +2690,6 @@ fig-layer {
|
|
|
2693
2690
|
overflow: hidden;
|
|
2694
2691
|
text-overflow: ellipsis;
|
|
2695
2692
|
white-space: nowrap;
|
|
2696
|
-
cursor: pointer;
|
|
2697
2693
|
color: var(--figma-color-text);
|
|
2698
2694
|
}
|
|
2699
2695
|
}
|
|
@@ -2724,7 +2720,7 @@ fig-layer {
|
|
|
2724
2720
|
}
|
|
2725
2721
|
|
|
2726
2722
|
/* Rotate chevron when open */
|
|
2727
|
-
&[open]:not([open="false"]) .fig-layer-row
|
|
2723
|
+
&[open]:not([open="false"]) > .fig-layer-row > .fig-layer-chevron {
|
|
2728
2724
|
transform: rotate(0deg);
|
|
2729
2725
|
}
|
|
2730
2726
|
|
package/fig.js
CHANGED
|
@@ -345,7 +345,7 @@ class FigTooltip extends HTMLElement {
|
|
|
345
345
|
this.popup.style.pointerEvents = "none";
|
|
346
346
|
this.popup.append(content);
|
|
347
347
|
content.innerText = this.getAttribute("text");
|
|
348
|
-
|
|
348
|
+
|
|
349
349
|
// If tooltip is inside a dialog, append to dialog to stay in top layer
|
|
350
350
|
const parentDialog = this.closest("dialog");
|
|
351
351
|
if (parentDialog && parentDialog.open) {
|
|
@@ -353,7 +353,7 @@ class FigTooltip extends HTMLElement {
|
|
|
353
353
|
} else {
|
|
354
354
|
document.body.append(this.popup);
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
|
|
357
357
|
const text = content.childNodes[0];
|
|
358
358
|
if (text) {
|
|
359
359
|
const range = document.createRange();
|
|
@@ -3563,26 +3563,42 @@ class FigLayer extends HTMLElement {
|
|
|
3563
3563
|
return ["open", "visible"];
|
|
3564
3564
|
}
|
|
3565
3565
|
|
|
3566
|
+
#chevron = null;
|
|
3567
|
+
#boundHandleChevronClick = null;
|
|
3568
|
+
|
|
3566
3569
|
connectedCallback() {
|
|
3567
|
-
//
|
|
3568
|
-
|
|
3570
|
+
// Use requestAnimationFrame to ensure child elements have rendered
|
|
3571
|
+
requestAnimationFrame(() => {
|
|
3572
|
+
this.#injectChevron();
|
|
3573
|
+
});
|
|
3569
3574
|
}
|
|
3570
3575
|
|
|
3571
3576
|
disconnectedCallback() {
|
|
3572
|
-
this
|
|
3577
|
+
if (this.#chevron && this.#boundHandleChevronClick) {
|
|
3578
|
+
this.#chevron.removeEventListener("click", this.#boundHandleChevronClick);
|
|
3579
|
+
}
|
|
3573
3580
|
}
|
|
3574
3581
|
|
|
3575
|
-
#
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3582
|
+
#injectChevron() {
|
|
3583
|
+
const row = this.querySelector(":scope > .fig-layer-row");
|
|
3584
|
+
if (!row) return;
|
|
3585
|
+
|
|
3586
|
+
// Check if chevron already exists
|
|
3587
|
+
if (row.querySelector(".fig-layer-chevron")) return;
|
|
3588
|
+
|
|
3589
|
+
// Always create chevron element - CSS handles visibility via :has(fig-layer)
|
|
3590
|
+
this.#chevron = document.createElement("span");
|
|
3591
|
+
this.#chevron.className = "fig-layer-chevron";
|
|
3592
|
+
row.prepend(this.#chevron);
|
|
3593
|
+
|
|
3594
|
+
// Add click listener to chevron only
|
|
3595
|
+
this.#boundHandleChevronClick = this.#handleChevronClick.bind(this);
|
|
3596
|
+
this.#chevron.addEventListener("click", this.#boundHandleChevronClick);
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3599
|
+
#handleChevronClick(e) {
|
|
3600
|
+
e.stopPropagation();
|
|
3601
|
+
this.open = !this.open;
|
|
3586
3602
|
}
|
|
3587
3603
|
|
|
3588
3604
|
get open() {
|