@thi.ng/hiccup-css 2.7.9 → 2.7.10
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 +7 -1
- package/README.md +2 -2
- package/animation.d.ts +11 -7
- package/conditional.js +4 -2
- package/impl.js +9 -9
- package/keyframes.d.ts +11 -10
- package/package.json +10 -10
- package/units.d.ts +2 -0
- package/units.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
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,12 @@ 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.7.10](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-css@2.7.10) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
|
|
17
|
+
|
|
12
18
|
## [2.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/hiccup-css@2.7.0) (2024-03-21)
|
|
13
19
|
|
|
14
20
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -122,7 +122,7 @@ Browser ESM import:
|
|
|
122
122
|
|
|
123
123
|
[JSDelivr documentation](https://www.jsdelivr.com/)
|
|
124
124
|
|
|
125
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 2.
|
|
125
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 2.24 KB
|
|
126
126
|
|
|
127
127
|
## Dependencies
|
|
128
128
|
|
package/animation.d.ts
CHANGED
|
@@ -14,19 +14,23 @@ export interface AnimationOpts {
|
|
|
14
14
|
* option is given a default value (250ms), all others are optional.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
* ```ts
|
|
17
|
+
* ```ts tangle:../export/animation.ts
|
|
18
18
|
* import { animation, css } from "@thi.ng/hiccup-css";
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
20
|
+
* console.log(
|
|
21
|
+
* css(
|
|
22
|
+
* animation(
|
|
23
|
+
* "fadein",
|
|
24
|
+
* { delay: "0.5s" },
|
|
25
|
+
* { opacity: 0 },
|
|
26
|
+
* { opacity: 1 }
|
|
27
|
+
* )
|
|
26
28
|
* )
|
|
27
29
|
* );
|
|
28
30
|
* ```
|
|
29
31
|
*
|
|
32
|
+
* Result:
|
|
33
|
+
*
|
|
30
34
|
* ```css
|
|
31
35
|
* @keyframes fadein {
|
|
32
36
|
* 0% {
|
package/conditional.js
CHANGED
|
@@ -2,14 +2,16 @@ import { isString } from "@thi.ng/checks/is-string";
|
|
|
2
2
|
import { expand, indent } from "./impl.js";
|
|
3
3
|
const conditional = (type, cond, rules) => (acc, opts) => {
|
|
4
4
|
const space = indent(opts);
|
|
5
|
-
acc.push(
|
|
5
|
+
acc.push(
|
|
6
|
+
`${space}${type} ${__formatCond(cond)}${opts.format.declStart}`
|
|
7
|
+
);
|
|
6
8
|
opts.depth++;
|
|
7
9
|
expand(acc, [], rules, opts);
|
|
8
10
|
opts.depth--;
|
|
9
11
|
acc.push(space + opts.format.declEnd);
|
|
10
12
|
return acc;
|
|
11
13
|
};
|
|
12
|
-
const
|
|
14
|
+
const __formatCond = (cond) => {
|
|
13
15
|
if (isString(cond)) {
|
|
14
16
|
return cond;
|
|
15
17
|
}
|
package/impl.js
CHANGED
|
@@ -13,13 +13,13 @@ import { str } from "@thi.ng/transducers/str";
|
|
|
13
13
|
import { transduce } from "@thi.ng/transducers/transduce";
|
|
14
14
|
const EMPTY = /* @__PURE__ */ new Set();
|
|
15
15
|
const NO_SPACES = ":[";
|
|
16
|
-
const
|
|
16
|
+
const __xfSel = comp(
|
|
17
17
|
flatten(),
|
|
18
18
|
map(
|
|
19
19
|
(x) => x[0] === "&" ? x.substring(1) : NO_SPACES.includes(x[0]) ? x : " " + x
|
|
20
20
|
)
|
|
21
21
|
);
|
|
22
|
-
const
|
|
22
|
+
const __withScope = (xf, scope) => comp(
|
|
23
23
|
xf,
|
|
24
24
|
map((x) => isString(x) && x.startsWith(" .") ? x + scope : x)
|
|
25
25
|
);
|
|
@@ -30,9 +30,9 @@ const expand = (acc, parent, rules, opts) => {
|
|
|
30
30
|
const process = (i, r) => {
|
|
31
31
|
let rfn = null;
|
|
32
32
|
if (isArray(r)) {
|
|
33
|
-
expand(acc,
|
|
33
|
+
expand(acc, __makeSelector(parent, sel), r, opts);
|
|
34
34
|
} else if (isIterable(r) && !isString(r)) {
|
|
35
|
-
expand(acc,
|
|
35
|
+
expand(acc, __makeSelector(parent, sel), [...r], opts);
|
|
36
36
|
} else if ((isFn = isFunction(r)) || (rfn = opts.fns[r])) {
|
|
37
37
|
if (!parent.length) {
|
|
38
38
|
if (rfn) {
|
|
@@ -56,14 +56,14 @@ const expand = (acc, parent, rules, opts) => {
|
|
|
56
56
|
return acc;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
curr && acc.push(
|
|
59
|
+
curr && acc.push(__formatRule(parent, sel, curr, opts));
|
|
60
60
|
return acc;
|
|
61
61
|
};
|
|
62
|
-
const
|
|
63
|
-
const
|
|
62
|
+
const __makeSelector = (parent, curr) => parent.length ? [...permutations(parent, curr)] : curr;
|
|
63
|
+
const __formatRule = (parent, sel, curr, opts) => {
|
|
64
64
|
const f = opts.format;
|
|
65
65
|
const space = indent(opts);
|
|
66
|
-
const xf = opts.scope ?
|
|
66
|
+
const xf = opts.scope ? __withScope(__xfSel, opts.scope) : __xfSel;
|
|
67
67
|
return [
|
|
68
68
|
space,
|
|
69
69
|
transduce(
|
|
@@ -71,7 +71,7 @@ const formatRule = (parent, sel, curr, opts) => {
|
|
|
71
71
|
(sel2) => transduce(xf, str(), isArray(sel2) ? sel2 : [sel2]).trim()
|
|
72
72
|
),
|
|
73
73
|
str(f.ruleSep),
|
|
74
|
-
|
|
74
|
+
__makeSelector(parent, sel)
|
|
75
75
|
),
|
|
76
76
|
f.declStart,
|
|
77
77
|
formatDecls(curr, opts),
|
package/keyframes.d.ts
CHANGED
|
@@ -6,20 +6,19 @@ export type Keyframe = Record<string, any>;
|
|
|
6
6
|
* objects. This way any number of stops can be specified.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* ```ts
|
|
9
|
+
* ```ts tangle:../export/at-keyframes.ts
|
|
10
10
|
* import { at_keyframes, css } from "@thi.ng/hiccup-css";
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* console.log(
|
|
13
|
+
* css(at_keyframes("fadein", {0: {opacity: 0}, 100: {opacity: 1}}))
|
|
14
|
+
* );
|
|
13
15
|
* // @keyframes fadein {
|
|
14
|
-
* //
|
|
15
16
|
* // 0% {
|
|
16
17
|
* // opacity: 0;
|
|
17
18
|
* // }
|
|
18
|
-
* //
|
|
19
19
|
* // 100% {
|
|
20
20
|
* // opacity: 1;
|
|
21
21
|
* // }
|
|
22
|
-
* //
|
|
23
22
|
* // }
|
|
24
23
|
* ```
|
|
25
24
|
*
|
|
@@ -28,20 +27,22 @@ export type Keyframe = Record<string, any>;
|
|
|
28
27
|
* will be at 0%, 50%, 100%.
|
|
29
28
|
*
|
|
30
29
|
* @example
|
|
31
|
-
* ```ts
|
|
30
|
+
* ```ts tangle:../export/at-keyframes-2.ts
|
|
32
31
|
* import { at_keyframes, css } from "@thi.ng/hiccup-css";
|
|
33
32
|
*
|
|
34
|
-
*
|
|
33
|
+
* console.log(
|
|
34
|
+
* css(at_keyframes("fadein", { opacity: 0 }, { opacity: 0.33 }, { opacity: 1 }))
|
|
35
|
+
* );
|
|
35
36
|
* // @keyframes fadein {
|
|
36
|
-
* //
|
|
37
37
|
* // 0% {
|
|
38
38
|
* // opacity: 0;
|
|
39
39
|
* // }
|
|
40
|
-
* //
|
|
40
|
+
* // 50% {
|
|
41
|
+
* // opacity: 0.33;
|
|
42
|
+
* // }
|
|
41
43
|
* // 100% {
|
|
42
44
|
* // opacity: 1;
|
|
43
45
|
* // }
|
|
44
|
-
* //
|
|
45
46
|
* // }
|
|
46
47
|
* ```
|
|
47
48
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/hiccup-css",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.10",
|
|
4
4
|
"description": "CSS from nested JS data structures",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/hiccup-css",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/errors": "^2.5.
|
|
42
|
-
"@thi.ng/transducers": "^9.0.
|
|
39
|
+
"@thi.ng/api": "^8.11.3",
|
|
40
|
+
"@thi.ng/checks": "^3.6.5",
|
|
41
|
+
"@thi.ng/errors": "^2.5.8",
|
|
42
|
+
"@thi.ng/transducers": "^9.0.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "^7.
|
|
46
|
-
"esbuild": "^0.21.
|
|
45
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
46
|
+
"esbuild": "^0.21.5",
|
|
47
47
|
"typedoc": "^0.25.13",
|
|
48
|
-
"typescript": "^5.
|
|
48
|
+
"typescript": "^5.5.2"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"array",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
],
|
|
128
128
|
"year": 2016
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
131
131
|
}
|
package/units.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare let PRECISION: number;
|
|
|
7
7
|
* @param n
|
|
8
8
|
*/
|
|
9
9
|
export declare const setPrecision: (n: number) => number;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const ff: (x: number) => string;
|
|
10
12
|
export declare const cap: (x: number) => string;
|
|
11
13
|
export declare const ch: (x: number) => string;
|
|
12
14
|
export declare const cm: (x: number) => string;
|