@rogieking/figui3 2.31.1 → 2.32.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.
Files changed (2) hide show
  1. package/fig.js +11 -0
  2. package/package.json +1 -1
package/fig.js CHANGED
@@ -2400,6 +2400,7 @@ class FigSlider extends HTMLElement {
2400
2400
  #regenerateInnerHTML() {
2401
2401
  this.value = Number(this.getAttribute("value") || 0);
2402
2402
  this.type = this.getAttribute("type") || "range";
2403
+ this.variant = this.getAttribute("variant") || "default";
2403
2404
  this.text =
2404
2405
  this.hasAttribute("text") && this.getAttribute("text") !== "false";
2405
2406
  this.units = this.getAttribute("units") || "";
@@ -2620,6 +2621,7 @@ class FigSlider extends HTMLElement {
2620
2621
  "min",
2621
2622
  "max",
2622
2623
  "type",
2624
+ "variant",
2623
2625
  "disabled",
2624
2626
  "color",
2625
2627
  "units",
@@ -2682,6 +2684,7 @@ class FigSlider extends HTMLElement {
2682
2684
  case "max":
2683
2685
  case "step":
2684
2686
  case "type":
2687
+ case "variant":
2685
2688
  case "units":
2686
2689
  this[name] = newValue;
2687
2690
  this.#regenerateInnerHTML();
@@ -2737,6 +2740,8 @@ class FigInputText extends HTMLElement {
2737
2740
  this.type = this.getAttribute("type") || "text";
2738
2741
  this.placeholder = this.getAttribute("placeholder") || "";
2739
2742
  this.name = this.getAttribute("name") || null;
2743
+ this.readonly =
2744
+ this.hasAttribute("readonly") && this.getAttribute("readonly") !== "false";
2740
2745
 
2741
2746
  if (this.type === "number") {
2742
2747
  if (this.getAttribute("step")) {
@@ -2793,6 +2798,7 @@ class FigInputText extends HTMLElement {
2793
2798
  }
2794
2799
 
2795
2800
  this.input = this.querySelector("input,textarea");
2801
+ this.input.readOnly = this.readonly;
2796
2802
 
2797
2803
  if (this.type === "number") {
2798
2804
  if (this.getAttribute("min")) {
@@ -2928,6 +2934,7 @@ class FigInputText extends HTMLElement {
2928
2934
  "placeholder",
2929
2935
  "label",
2930
2936
  "disabled",
2937
+ "readonly",
2931
2938
  "type",
2932
2939
  "step",
2933
2940
  "min",
@@ -2944,6 +2951,10 @@ class FigInputText extends HTMLElement {
2944
2951
  this.disabled = this.input.disabled =
2945
2952
  newValue !== null && newValue !== "false";
2946
2953
  break;
2954
+ case "readonly":
2955
+ this.readonly = newValue !== null && newValue !== "false";
2956
+ this.input.readOnly = this.readonly;
2957
+ break;
2947
2958
  case "transform":
2948
2959
  if (this.type === "number") {
2949
2960
  this.transform = Number(newValue) || 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.31.1",
3
+ "version": "2.32.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",