@jsenv/navi 0.7.1 → 0.7.3

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/dist/jsenv_navi.js +11 -14
  2. package/package.json +2 -2
@@ -823,20 +823,15 @@ const normalizeNumber = (value, context, unit, propertyName) => {
823
823
  return value;
824
824
  }
825
825
  if (typeof value === "string") {
826
- if (value === "auto") {
827
- return "auto";
828
- }
829
- if (value === "none") {
830
- return "none";
831
- }
832
- const numericValue = parseFloat(value);
833
- if (isNaN(numericValue)) {
834
- console.warn(
835
- `"${propertyName}": ${value} cannot be converted to number, returning value as-is.`,
836
- );
837
- return value;
826
+ // For js context, only convert px values to numbers
827
+ if (unit === "px" && value.endsWith("px")) {
828
+ const numericValue = parseFloat(value);
829
+ if (!isNaN(numericValue)) {
830
+ return numericValue;
831
+ }
838
832
  }
839
- return numericValue;
833
+ // Keep all other strings as-is (including %, em, rem, auto, none, etc.)
834
+ return value;
840
835
  }
841
836
  return value;
842
837
  };
@@ -1073,6 +1068,8 @@ const mergeStyles = (stylesA, stylesB, context = "js") => {
1073
1068
  }
1074
1069
  const result = {};
1075
1070
  const aKeys = Object.keys(stylesA);
1071
+ // in case stylesB is a string we first parse it
1072
+ stylesB = normalizeStyles(stylesB, context);
1076
1073
  const bKeyToVisitSet = new Set(Object.keys(stylesB));
1077
1074
  for (const aKey of aKeys) {
1078
1075
  const bHasKey = bKeyToVisitSet.has(aKey);
@@ -1084,7 +1081,7 @@ const mergeStyles = (stylesA, stylesB, context = "js") => {
1084
1081
  }
1085
1082
  }
1086
1083
  for (const bKey of bKeyToVisitSet) {
1087
- result[bKey] = normalizeStyle(stylesB[bKey], bKey, context);
1084
+ result[bKey] = stylesB[bKey];
1088
1085
  }
1089
1086
  return result;
1090
1087
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Library of components including navigation to create frontend applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "prepublishOnly": "npm run build"
35
35
  },
36
36
  "dependencies": {
37
- "@jsenv/dom": "0.5.1",
37
+ "@jsenv/dom": "0.5.3",
38
38
  "@jsenv/humanize": "1.6.0"
39
39
  },
40
40
  "devDependencies": {