@rogieking/figui3 11.4.0 → 11.4.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/CHANGELOG.md +14 -0
- package/components.css +4 -1
- package/dist/components.css +1 -1
- package/dist/fig-editor.css +1 -1
- package/dist/fig-editor.js +1 -1
- package/dist/fig.css +1 -1
- package/dist/fig.js +1 -1
- package/fig-editor.css +1 -5
- package/fig-editor.js +13 -0
- package/fig.js +3 -6
- package/package.json +1 -1
package/fig-editor.css
CHANGED
|
@@ -141,13 +141,9 @@ dialog[is="fig-toast"] {
|
|
|
141
141
|
|
|
142
142
|
/* Palette Editor */
|
|
143
143
|
.fig-palette-editor-popup {
|
|
144
|
-
width:
|
|
144
|
+
width: 12rem;
|
|
145
145
|
padding: 0;
|
|
146
146
|
pointer-events: auto;
|
|
147
|
-
|
|
148
|
-
& > fig-content {
|
|
149
|
-
padding-top: 0;
|
|
150
|
-
}
|
|
151
147
|
}
|
|
152
148
|
|
|
153
149
|
fig-palette-editor {
|
package/fig-editor.js
CHANGED
|
@@ -539,6 +539,17 @@ class FigPaletteEditor extends HTMLElement {
|
|
|
539
539
|
this.#emit("change");
|
|
540
540
|
};
|
|
541
541
|
|
|
542
|
+
#focusColorValue(index) {
|
|
543
|
+
requestAnimationFrame(() => {
|
|
544
|
+
if (!this.isConnected) return;
|
|
545
|
+
const input = this.querySelector(
|
|
546
|
+
`.fig-palette-editor-color-row[data-index="${index}"] .fig-palette-editor-color fig-input-text input`,
|
|
547
|
+
);
|
|
548
|
+
input?.focus();
|
|
549
|
+
input?.select();
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
|
|
542
553
|
#render() {
|
|
543
554
|
const reorder = figEditorCreateElement(
|
|
544
555
|
"fig-reorder",
|
|
@@ -567,6 +578,7 @@ class FigPaletteEditor extends HTMLElement {
|
|
|
567
578
|
);
|
|
568
579
|
addButton.addEventListener("click", () => {
|
|
569
580
|
if (this.#disabled || this.#colors.length >= this.#max) return;
|
|
581
|
+
const addedIndex = this.#colors.length;
|
|
570
582
|
this.#colors.push(
|
|
571
583
|
figEditorAveragePaletteEntries(
|
|
572
584
|
this.#colors.at(-2),
|
|
@@ -577,6 +589,7 @@ class FigPaletteEditor extends HTMLElement {
|
|
|
577
589
|
this.#render();
|
|
578
590
|
this.#emit("input");
|
|
579
591
|
this.#emit("change");
|
|
592
|
+
this.#focusColorValue(addedIndex);
|
|
580
593
|
});
|
|
581
594
|
children.push(figEditorCreateElement("fig-field", {}, addButton));
|
|
582
595
|
}
|
package/fig.js
CHANGED
|
@@ -11181,9 +11181,9 @@ class FigInputPalette extends HTMLElement {
|
|
|
11181
11181
|
|
|
11182
11182
|
const popup = document.createElement("dialog", { is: "fig-popup" });
|
|
11183
11183
|
popup.setAttribute("is", "fig-popup");
|
|
11184
|
-
popup.setAttribute("
|
|
11185
|
-
popup.setAttribute("position", "
|
|
11186
|
-
popup.setAttribute("offset", "8
|
|
11184
|
+
popup.setAttribute("aria-label", "Edit palette");
|
|
11185
|
+
popup.setAttribute("position", "bottom left");
|
|
11186
|
+
popup.setAttribute("offset", "0 8");
|
|
11187
11187
|
popup.setAttribute("viewport-margin", "8");
|
|
11188
11188
|
popup.setAttribute("popover", "manual");
|
|
11189
11189
|
popup.className = "fig-palette-editor-popup";
|
|
@@ -11224,9 +11224,6 @@ class FigInputPalette extends HTMLElement {
|
|
|
11224
11224
|
popup.addEventListener("toggle", this.#boundPickerClosed);
|
|
11225
11225
|
|
|
11226
11226
|
(figGetOverlayRoot() ?? document.body).append(popup);
|
|
11227
|
-
popup
|
|
11228
|
-
.querySelector(":scope > fig-header")
|
|
11229
|
-
?.setAttribute("borderless", "");
|
|
11230
11227
|
this.#pickerPopup = popup;
|
|
11231
11228
|
this.#pickerEditor = editor;
|
|
11232
11229
|
this.querySelector(".palette-colors-inline")?.setAttribute(
|
package/package.json
CHANGED