react-science 24.0.0 → 24.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"split_pane_helpers.d.ts","sourceRoot":"","sources":["../../../src/components/split_pane/split_pane_helpers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAM3D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,aAAa,CAEtE"}
1
+ {"version":3,"file":"split_pane_helpers.d.ts","sourceRoot":"","sources":["../../../src/components/split_pane/split_pane_helpers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAW3D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,aAAa,CAEtE"}
@@ -1,7 +1,11 @@
1
1
  export function parseSize(size) {
2
- const value = Number(size);
3
- // remove numbers and dots from the string
2
+ // eslint-disable-next-line unicorn/prefer-number-coercion
3
+ const value = Number.parseFloat(size);
4
+ // Remove numbers and dots from the string.
4
5
  const type = size.replaceAll(/[\d .]/g, '');
6
+ if (Number.isNaN(value) || (type !== '%' && type !== 'px')) {
7
+ throw new Error('SplitPane size must be a number with "%" or "px" unit.');
8
+ }
5
9
  return { value, type };
6
10
  }
7
11
  export function serializeSize(size) {
@@ -1 +1 @@
1
- {"version":3,"file":"split_pane_helpers.js","sourceRoot":"","sources":["../../../src/components/split_pane/split_pane_helpers.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,0CAA0C;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,CAAkB,CAAC;IAE7D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAyB;IACrD,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AACrC,CAAC"}
1
+ {"version":3,"file":"split_pane_helpers.js","sourceRoot":"","sources":["../../../src/components/split_pane/split_pane_helpers.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,0DAA0D;IAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,2CAA2C;IAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAE5C,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAyB;IACrD,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AACrC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-science",
3
- "version": "24.0.0",
3
+ "version": "24.0.1",
4
4
  "description": "React components to build scientific applications UI",
5
5
  "type": "module",
6
6
  "exports": {
@@ -7,9 +7,14 @@ export interface ParsedSplitPaneSize {
7
7
  }
8
8
 
9
9
  export function parseSize(size: string): ParsedSplitPaneSize {
10
- const value = Number(size);
11
- // remove numbers and dots from the string
12
- const type = size.replaceAll(/[\d .]/g, '') as SplitPaneType;
10
+ // eslint-disable-next-line unicorn/prefer-number-coercion
11
+ const value = Number.parseFloat(size);
12
+ // Remove numbers and dots from the string.
13
+ const type = size.replaceAll(/[\d .]/g, '');
14
+
15
+ if (Number.isNaN(value) || (type !== '%' && type !== 'px')) {
16
+ throw new Error('SplitPane size must be a number with "%" or "px" unit.');
17
+ }
13
18
 
14
19
  return { value, type };
15
20
  }