@rogieking/figui3 6.28.0 → 6.28.1

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.js CHANGED
@@ -10987,6 +10987,7 @@ class FigInputGradient extends HTMLElement {
10987
10987
  #arrowTooltipTimer = null;
10988
10988
  #colorObserver = null;
10989
10989
  #repositionRAF = null;
10990
+ #pickerDefinitionPromise = null;
10990
10991
  #gradient = {
10991
10992
  type: "linear",
10992
10993
  angle: 90,
@@ -11060,11 +11061,22 @@ class FigInputGradient extends HTMLElement {
11060
11061
  connectedCallback() {
11061
11062
  this.#parseValue();
11062
11063
  this.#render();
11064
+ this.#renderPickerWhenAvailable();
11063
11065
  this.removeEventListener("keydown", this.#onPickerKeyDown);
11064
11066
  this.addEventListener("keydown", this.#onPickerKeyDown);
11065
11067
  if (this.#isEditable) document.addEventListener("keydown", this.#onKeyDown);
11066
11068
  }
11067
11069
 
11070
+ #renderPickerWhenAvailable() {
11071
+ if (this.#editMode !== "picker" || hasFigFillPicker()) return;
11072
+ this.#pickerDefinitionPromise ??= customElements
11073
+ .whenDefined("fig-fill-picker")
11074
+ .then(() => {
11075
+ if (!this.isConnected || this.#editMode !== "picker") return;
11076
+ this.#render();
11077
+ });
11078
+ }
11079
+
11068
11080
  disconnectedCallback() {
11069
11081
  document.removeEventListener("keydown", this.#onKeyDown);
11070
11082
  this.removeEventListener("keydown", this.#onPickerKeyDown);
@@ -11851,6 +11863,7 @@ class FigInputGradient extends HTMLElement {
11851
11863
  break;
11852
11864
  case "edit":
11853
11865
  this.#render();
11866
+ this.#renderPickerWhenAvailable();
11854
11867
  if (this.#isEditable) {
11855
11868
  document.addEventListener("keydown", this.#onKeyDown);
11856
11869
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "6.28.0",
3
+ "version": "6.28.1",
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",