@hrnec06/react_utils 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hrnec06/react_utils",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "A debugger component for react.",
5
5
  "exports": {
6
6
  ".": "./src/index.tsx"
@@ -19,7 +19,20 @@ export default function ParseValueSimple({
19
19
  const numStr = value.toString();
20
20
 
21
21
  if (numStr.length > MAX_LENGTH)
22
- return <ValueKeyword value={typeof value} />;
22
+ {
23
+ const parts = numStr.split('.');
24
+
25
+ if (parts[0].length > MAX_LENGTH || parts.length < 2)
26
+ return <ValueKeyword value={typeof value} />;
27
+
28
+
29
+ let decimals, short = parts[0];
30
+
31
+ if ((decimals = parts[1].substring(0, MAX_LENGTH - short.length - 1)) && decimals.length > 0)
32
+ short += '.' + decimals;
33
+
34
+ return <ValueKeyword value={short} />;
35
+ }
23
36
 
24
37
  return <ValueNumber value={value} />
25
38
  }
@@ -19,7 +19,7 @@ export class Signal<T>
19
19
  {
20
20
  }
21
21
 
22
- public set value(value: T)
22
+ public set value(value: T | ((prev: T) => T))
23
23
  {
24
24
  this.setState(value);
25
25
  }
@@ -28,4 +28,5 @@ export class Signal<T>
28
28
  {
29
29
  return this._value;
30
30
  }
31
+
31
32
  }