@rogieking/figui3 6.10.0 → 6.11.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.
package/fig.js CHANGED
@@ -9132,6 +9132,7 @@ customElements.define("fig-input-palette", FigInputPalette);
9132
9132
  /**
9133
9133
  * A gradient-only fill input built on top of fig-fill-picker.
9134
9134
  * @attr {string} value - JSON string with gradient fill data
9135
+ * @attr {string} size - Passed through to the internal fig-swatch (e.g. "large")
9135
9136
  * @attr {boolean} disabled - Whether the input is disabled
9136
9137
  * @fires input - When the gradient value changes
9137
9138
  * @fires change - When the gradient value is committed
@@ -9160,7 +9161,7 @@ class FigInputGradient extends HTMLElement {
9160
9161
  }
9161
9162
 
9162
9163
  static get observedAttributes() {
9163
- return ["value", "disabled", "edit", "mode"];
9164
+ return ["value", "disabled", "edit", "mode", "size"];
9164
9165
  }
9165
9166
 
9166
9167
  get #editMode() {
@@ -9367,6 +9368,18 @@ class FigInputGradient extends HTMLElement {
9367
9368
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
9368
9369
  }
9369
9370
 
9371
+ #swatchSizeAttr() {
9372
+ const size = this.getAttribute("size");
9373
+ return size ? ` size="${size}"` : "";
9374
+ }
9375
+
9376
+ #syncSwatchSize() {
9377
+ if (!this.#swatch) return;
9378
+ const size = this.getAttribute("size");
9379
+ if (size) this.#swatch.setAttribute("size", size);
9380
+ else this.#swatch.removeAttribute("size");
9381
+ }
9382
+
9370
9383
  #buildStopHandles() {
9371
9384
  const disabled = this.hasAttribute("disabled");
9372
9385
  const tipAttr = this.#stopHandleMode === "tip" ? ' tip="color"' : "";
@@ -9391,7 +9404,7 @@ class FigInputGradient extends HTMLElement {
9391
9404
  const gradientValue = JSON.stringify(this.value);
9392
9405
  this.innerHTML = `
9393
9406
  <fig-fill-picker mode="gradient"${expAttr} value='${gradientValue}'${disabled ? " disabled" : ""}>
9394
- <fig-swatch background="${this.#buildGradientCSS()}"${disabled ? " disabled" : ""}></fig-swatch>
9407
+ <fig-swatch background="${this.#buildGradientCSS()}"${this.#swatchSizeAttr()}${disabled ? " disabled" : ""}></fig-swatch>
9395
9408
  </fig-fill-picker>`;
9396
9409
  this.#swatch = this.querySelector("fig-swatch");
9397
9410
  this.#track = null;
@@ -9401,7 +9414,7 @@ class FigInputGradient extends HTMLElement {
9401
9414
  }
9402
9415
 
9403
9416
  this.innerHTML = `
9404
- <fig-swatch background="${this.#buildGradientCSS()}"${disabled ? " disabled" : ""}></fig-swatch>
9417
+ <fig-swatch background="${this.#buildGradientCSS()}"${this.#swatchSizeAttr()}${disabled ? " disabled" : ""}></fig-swatch>
9405
9418
  ${mode === "true" || mode === "picker" ? `<div class="fig-input-gradient-track">${this.#buildStopHandles()}</div>` : ""}`;
9406
9419
  this.#swatch = this.querySelector("fig-swatch");
9407
9420
  this.#track = this.querySelector(".fig-input-gradient-track");
@@ -9711,6 +9724,7 @@ class FigInputGradient extends HTMLElement {
9711
9724
  #syncSwatch() {
9712
9725
  if (!this.#swatch) return;
9713
9726
  this.#swatch.setAttribute("background", this.#buildGradientCSS());
9727
+ this.#syncSwatchSize();
9714
9728
  }
9715
9729
 
9716
9730
  #setupEventListeners() {
@@ -9967,6 +9981,9 @@ class FigInputGradient extends HTMLElement {
9967
9981
  case "mode":
9968
9982
  this.#syncHandleMode();
9969
9983
  break;
9984
+ case "size":
9985
+ this.#syncSwatchSize();
9986
+ break;
9970
9987
  }
9971
9988
  }
9972
9989
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "6.10.0",
3
+ "version": "6.11.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",