@rogieking/figui3 1.2.3 → 1.2.4

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 +6 -0
  2. package/package.json +1 -1
package/fig.js CHANGED
@@ -995,9 +995,15 @@ class FigInputText extends HTMLElement {
995
995
  sanitized
996
996
  );
997
997
  }
998
+ sanitized = this.#formatNumber(sanitized);
998
999
  }
999
1000
  return sanitized;
1000
1001
  }
1002
+ #formatNumber(num, precision = 2) {
1003
+ // Check if the number has any decimal places after rounding
1004
+ const rounded = Math.round(num * 100) / 100;
1005
+ return Number.isInteger(rounded) ? rounded : rounded.toFixed(precision);
1006
+ }
1001
1007
 
1002
1008
  static get observedAttributes() {
1003
1009
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {