@thi.ng/hiccup-css 2.7.9 → 2.7.11

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**: 2024-05-08T18:24:32Z
3
+ - **Last updated**: 2024-06-29T09:28:36Z
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
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
10
+ > This is one of 189 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.23 KB
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
- * css(
21
- * animation(
22
- * "fadein",
23
- * { delay: "0.5s" },
24
- * { opacity: 0 },
25
- * { opacity: 1 }
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(`${space}${type} ${formatCond(cond)}${opts.format.declStart}`);
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 formatCond = (cond) => {
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 xfSel = comp(
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 withScope = (xf, scope) => comp(
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, makeSelector(parent, sel), r, opts);
33
+ expand(acc, __makeSelector(parent, sel), r, opts);
34
34
  } else if (isIterable(r) && !isString(r)) {
35
- expand(acc, makeSelector(parent, sel), [...r], opts);
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(formatRule(parent, sel, curr, opts));
59
+ curr && acc.push(__formatRule(parent, sel, curr, opts));
60
60
  return acc;
61
61
  };
62
- const makeSelector = (parent, curr) => parent.length ? [...permutations(parent, curr)] : curr;
63
- const formatRule = (parent, sel, curr, opts) => {
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 ? withScope(xfSel, opts.scope) : xfSel;
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
- makeSelector(parent, sel)
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
- * css(at_keyframes("fadein", {0: {opacity: 0}, 100: {opacity: 1}}))
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
- * css(at_keyframes("fadein", {opacity: 0}, {opacity: 1}));
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.9",
3
+ "version": "2.7.11",
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://github.com/thi-ng/umbrella/tree/develop/packages/hiccup-css#readme",
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.2",
40
- "@thi.ng/checks": "^3.6.4",
41
- "@thi.ng/errors": "^2.5.7",
42
- "@thi.ng/transducers": "^9.0.5"
39
+ "@thi.ng/api": "^8.11.4",
40
+ "@thi.ng/checks": "^3.6.6",
41
+ "@thi.ng/errors": "^2.5.9",
42
+ "@thi.ng/transducers": "^9.0.7"
43
43
  },
44
44
  "devDependencies": {
45
- "@microsoft/api-extractor": "^7.43.2",
46
- "esbuild": "^0.21.1",
45
+ "@microsoft/api-extractor": "^7.47.0",
46
+ "esbuild": "^0.21.5",
47
47
  "typedoc": "^0.25.13",
48
- "typescript": "^5.4.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": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
130
+ "gitHead": "7b950c112fba0b2e7c450765b15624c3382f1354\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;
package/units.js CHANGED
@@ -31,6 +31,7 @@ export {
31
31
  deg,
32
32
  em,
33
33
  ex,
34
+ ff,
34
35
  inch,
35
36
  lh,
36
37
  mm,