@thi.ng/hiccup-css 2.2.20 → 2.3.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-12-11T10:07:09Z
3
+ - **Last updated**: 2023-12-19T11:01:47Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,17 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ## [2.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-css@2.3.0) (2023-12-18)
13
+
14
+ #### 🚀 Features
15
+
16
+ - update float value formatter, add tests ([00ee4f7](https://github.com/thi-ng/umbrella/commit/00ee4f7))
17
+
18
+ #### 🩹 Bug fixes
19
+
20
+ - update conditional formatting ([f126005](https://github.com/thi-ng/umbrella/commit/f126005))
21
+ - add tests
22
+
12
23
  ### [2.2.14](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-css@2.2.14) (2023-11-09)
13
24
 
14
25
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -117,7 +117,7 @@ For Node.js REPL:
117
117
  const hiccupCss = await import("@thi.ng/hiccup-css");
118
118
  ```
119
119
 
120
- Package sizes (brotli'd, pre-treeshake): ESM: 2.08 KB
120
+ Package sizes (brotli'd, pre-treeshake): ESM: 2.13 KB
121
121
 
122
122
  ## Dependencies
123
123
 
package/conditional.js CHANGED
@@ -18,9 +18,9 @@ const formatCond = (cond) => {
18
18
  if (cond.hasOwnProperty(c)) {
19
19
  let v = cond[c];
20
20
  if (v === true) {
21
- v = c;
21
+ v = MEDIA_TYPES.has(c) ? c : `(${c})`;
22
22
  } else if (v === false) {
23
- v = "not " + c;
23
+ v = "not " + (MEDIA_TYPES.has(c) ? c : `(${c})`);
24
24
  } else if (v === "only") {
25
25
  v += " " + c;
26
26
  } else {
@@ -31,6 +31,7 @@ const formatCond = (cond) => {
31
31
  }
32
32
  return acc.join(" and ");
33
33
  };
34
+ const MEDIA_TYPES = /* @__PURE__ */ new Set(["all", "print", "screen"]);
34
35
  export {
35
36
  conditional
36
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/hiccup-css",
3
- "version": "2.2.20",
3
+ "version": "2.3.1",
4
4
  "description": "CSS from nested JS data structures",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -35,16 +35,15 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@thi.ng/api": "^8.9.12",
39
- "@thi.ng/checks": "^3.4.12",
40
- "@thi.ng/errors": "^2.4.6",
41
- "@thi.ng/transducers": "^8.8.15"
38
+ "@thi.ng/api": "^8.9.14",
39
+ "@thi.ng/checks": "^3.4.14",
40
+ "@thi.ng/errors": "^2.4.8",
41
+ "@thi.ng/transducers": "^8.8.17"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@microsoft/api-extractor": "^7.38.3",
45
45
  "esbuild": "^0.19.8",
46
46
  "rimraf": "^5.0.5",
47
- "tools": "^0.0.1",
48
47
  "typedoc": "^0.25.4",
49
48
  "typescript": "^5.3.2"
50
49
  },
@@ -58,7 +57,6 @@
58
57
  "export",
59
58
  "fileformat",
60
59
  "hiccup",
61
- "iterator",
62
60
  "json",
63
61
  "typescript",
64
62
  "ui"
@@ -67,7 +65,7 @@
67
65
  "access": "public"
68
66
  },
69
67
  "engines": {
70
- "node": ">=12.7"
68
+ "node": ">=18"
71
69
  },
72
70
  "files": [
73
71
  "./*.js",
@@ -128,5 +126,5 @@
128
126
  ],
129
127
  "year": 2016
130
128
  },
131
- "gitHead": "5e7bafedfc3d53bc131469a28de31dd8e5b4a3ff\n"
129
+ "gitHead": "0d9265be7be13eccf0ef75eaedbfd42626339279\n"
132
130
  }
package/units.js CHANGED
@@ -1,6 +1,6 @@
1
1
  let PRECISION = 4;
2
2
  const setPrecision = (n) => PRECISION = n;
3
- const ff = (x) => x === (x | 0) ? String(x) : x.toFixed(PRECISION);
3
+ const ff = (x) => x === (x | 0) ? String(x) : x.toFixed(PRECISION).replace(/^0./, ".").replace(/0+$/, "");
4
4
  const em = (x) => `${ff(x)}em`;
5
5
  const ex = (x) => `${ff(x)}ex`;
6
6
  const rem = (x) => `${ff(x)}rem`;