@thi.ng/hiccup-css 2.2.20 → 2.3.0
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 +12 -1
- package/README.md +1 -1
- package/conditional.js +3 -2
- package/package.json +7 -8
- package/units.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-12-
|
|
3
|
+
- **Last updated**: 2023-12-18T13:41:19Z
|
|
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
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.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "CSS from nested JS data structures",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"test": "bun test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.9.
|
|
39
|
-
"@thi.ng/checks": "^3.4.
|
|
40
|
-
"@thi.ng/errors": "^2.4.
|
|
41
|
-
"@thi.ng/transducers": "^8.8.
|
|
38
|
+
"@thi.ng/api": "^8.9.13",
|
|
39
|
+
"@thi.ng/checks": "^3.4.13",
|
|
40
|
+
"@thi.ng/errors": "^2.4.7",
|
|
41
|
+
"@thi.ng/transducers": "^8.8.16"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@microsoft/api-extractor": "^7.38.3",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"export",
|
|
59
59
|
"fileformat",
|
|
60
60
|
"hiccup",
|
|
61
|
-
"iterator",
|
|
62
61
|
"json",
|
|
63
62
|
"typescript",
|
|
64
63
|
"ui"
|
|
@@ -67,7 +66,7 @@
|
|
|
67
66
|
"access": "public"
|
|
68
67
|
},
|
|
69
68
|
"engines": {
|
|
70
|
-
"node": ">=
|
|
69
|
+
"node": ">=18"
|
|
71
70
|
},
|
|
72
71
|
"files": [
|
|
73
72
|
"./*.js",
|
|
@@ -128,5 +127,5 @@
|
|
|
128
127
|
],
|
|
129
128
|
"year": 2016
|
|
130
129
|
},
|
|
131
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "25a42a81fac8603a1e440a7aa8bc343276211ff4\n"
|
|
132
131
|
}
|
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`;
|