@thi.ng/hiccup-css 2.2.18 → 2.2.20

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-03T12:13:31Z
3
+ - **Last updated**: 2023-12-11T10:07:09Z
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.
package/animation.js CHANGED
@@ -1,53 +1,21 @@
1
1
  import { at_keyframes } from "./keyframes.js";
2
- /**
3
- * Defines new `@keyframes` with given `id` and creates related class of
4
- * same name to configure given animation `opts`. Only the `duration`
5
- * option is given a default value (250ms), all others are optional.
6
- *
7
- * @example
8
- * ```ts
9
- * css(
10
- * animation(
11
- * "fadein",
12
- * { delay: "0.5s" },
13
- * { opacity: 0 },
14
- * { opacity: 1 }
15
- * )
16
- * );
17
- * ```
18
- *
19
- * ```css
20
- * @keyframes fadein {
21
- * 0% {
22
- * opacity: 0;
23
- * }
24
- * 100% {
25
- * opacity: 1;
26
- * }
27
- * }
28
- *
29
- * .fadein {
30
- * animation-duration: 250ms;
31
- * animation-name: fadein;
32
- * animation-delay: 0.5s;
33
- * }
34
- * ```
35
- *
36
- * @param id - animation name
37
- * @param opts - animation config options
38
- * @param keyframes - keyframes
39
- */
40
- export const animation = (id, opts, ...keyframes) => {
41
- opts = {
42
- duration: "250ms",
43
- name: id,
44
- ...opts,
45
- };
46
- return [
47
- at_keyframes.apply(null, [id, ...keyframes]),
48
- [
49
- `.${id}`,
50
- Object.keys(opts).reduce((acc, k) => ((acc[`animation-${k}`] = opts[k]), acc), {}),
51
- ],
52
- ];
2
+ const animation = (id, opts, ...keyframes) => {
3
+ opts = {
4
+ duration: "250ms",
5
+ name: id,
6
+ ...opts
7
+ };
8
+ return [
9
+ at_keyframes.apply(null, [id, ...keyframes]),
10
+ [
11
+ `.${id}`,
12
+ Object.keys(opts).reduce(
13
+ (acc, k) => (acc[`animation-${k}`] = opts[k], acc),
14
+ {}
15
+ )
16
+ ]
17
+ ];
18
+ };
19
+ export {
20
+ animation
53
21
  };
package/api.js CHANGED
@@ -1,30 +1,26 @@
1
- export const DEFAULT_VENDORS = ["-moz-", "-ms-", "-o-", "-webkit-"];
2
- /**
3
- * Default format config used by {@link css} function.
4
- * Forms "minimized" CSS without obsolete white space
5
- * and omits comments unless they were forced.
6
- */
7
- export const COMPACT = {
8
- rules: "",
9
- ruleSep: ",",
10
- valSep: "",
11
- decls: "",
12
- declStart: "{",
13
- declEnd: "}",
14
- indent: "",
15
- comments: false,
1
+ const DEFAULT_VENDORS = ["-moz-", "-ms-", "-o-", "-webkit-"];
2
+ const COMPACT = {
3
+ rules: "",
4
+ ruleSep: ",",
5
+ valSep: "",
6
+ decls: "",
7
+ declStart: "{",
8
+ declEnd: "}",
9
+ indent: "",
10
+ comments: false
16
11
  };
17
- /**
18
- * Pretty printing format config with line breaks
19
- * and indentation.
20
- */
21
- export const PRETTY = {
22
- rules: "\n",
23
- ruleSep: ", ",
24
- valSep: " ",
25
- decls: "\n",
26
- declStart: " {\n",
27
- declEnd: "}\n",
28
- indent: " ",
29
- comments: true,
12
+ const PRETTY = {
13
+ rules: "\n",
14
+ ruleSep: ", ",
15
+ valSep: " ",
16
+ decls: "\n",
17
+ declStart: " {\n",
18
+ declEnd: "}\n",
19
+ indent: " ",
20
+ comments: true
21
+ };
22
+ export {
23
+ COMPACT,
24
+ DEFAULT_VENDORS,
25
+ PRETTY
30
26
  };
package/attribs.js CHANGED
@@ -1,46 +1,15 @@
1
1
  const $ = (op) => (id, x, caseSensitve = false) => `[${id}${op}="${x}"${caseSensitve ? " i" : ""}]`;
2
- /**
3
- * Returns attrib selector: `[id]`
4
- *
5
- * @param id -
6
- */
7
- export const withAttrib = (id) => `[${id}]`;
8
- /**
9
- * Returns attrib selector `[id=x]`
10
- *
11
- * @param id -
12
- * @param x -
13
- * @param caseSensitive -
14
- */
15
- export const attribEq = $("");
16
- /**
17
- * Returns attrib selector `[id~=x]`
18
- *
19
- * @param id -
20
- * @param x -
21
- * @param caseSensitive -
22
- */
23
- export const attribContains = $("~");
24
- /**
25
- * Returns attrib selector `[id^=x]`
26
- *
27
- * @param id -
28
- * @param x -
29
- * @param caseSensitive -
30
- */
31
- export const attribPrefix = $("^");
32
- /**
33
- * Returns attrib selector `[id$=x]`
34
- *
35
- * @param id -
36
- * @param x -
37
- * @param caseSensitive -
38
- */
39
- export const attribSuffix = $("$");
40
- /**
41
- * Returns attrib selector `[id*=x]`
42
- * @param id -
43
- * @param x -
44
- * @param caseSensitive -
45
- */
46
- export const attribMatches = $("*");
2
+ const withAttrib = (id) => `[${id}]`;
3
+ const attribEq = $("");
4
+ const attribContains = $("~");
5
+ const attribPrefix = $("^");
6
+ const attribSuffix = $("$");
7
+ const attribMatches = $("*");
8
+ export {
9
+ attribContains,
10
+ attribEq,
11
+ attribMatches,
12
+ attribPrefix,
13
+ attribSuffix,
14
+ withAttrib
15
+ };
package/comment.js CHANGED
@@ -1,12 +1,16 @@
1
1
  import { indent } from "./impl.js";
2
- export const comment = (body, force = false) => (acc, opts) => {
3
- const space = indent(opts);
4
- const inner = indent(opts, opts.depth + 1);
5
- if (opts.format.comments || force) {
6
- acc.push(space + "/*", body
7
- .split("\n")
8
- .map((l) => inner + l)
9
- .join("\n"), space + "*/");
10
- }
11
- return acc;
2
+ const comment = (body, force = false) => (acc, opts) => {
3
+ const space = indent(opts);
4
+ const inner = indent(opts, opts.depth + 1);
5
+ if (opts.format.comments || force) {
6
+ acc.push(
7
+ space + "/*",
8
+ body.split("\n").map((l) => inner + l).join("\n"),
9
+ space + "*/"
10
+ );
11
+ }
12
+ return acc;
13
+ };
14
+ export {
15
+ comment
12
16
  };
package/conditional.js CHANGED
@@ -1,36 +1,36 @@
1
1
  import { isString } from "@thi.ng/checks/is-string";
2
2
  import { expand, indent } from "./impl.js";
3
- export const conditional = (type, cond, rules) => (acc, opts) => {
4
- const space = indent(opts);
5
- acc.push(`${space}${type} ${formatCond(cond)}${opts.format.declStart}`);
6
- opts.depth++;
7
- expand(acc, [], rules, opts);
8
- opts.depth--;
9
- acc.push(space + opts.format.declEnd);
10
- return acc;
3
+ const conditional = (type, cond, rules) => (acc, opts) => {
4
+ const space = indent(opts);
5
+ acc.push(`${space}${type} ${formatCond(cond)}${opts.format.declStart}`);
6
+ opts.depth++;
7
+ expand(acc, [], rules, opts);
8
+ opts.depth--;
9
+ acc.push(space + opts.format.declEnd);
10
+ return acc;
11
11
  };
12
12
  const formatCond = (cond) => {
13
- if (isString(cond)) {
14
- return cond;
13
+ if (isString(cond)) {
14
+ return cond;
15
+ }
16
+ const acc = [];
17
+ for (let c in cond) {
18
+ if (cond.hasOwnProperty(c)) {
19
+ let v = cond[c];
20
+ if (v === true) {
21
+ v = c;
22
+ } else if (v === false) {
23
+ v = "not " + c;
24
+ } else if (v === "only") {
25
+ v += " " + c;
26
+ } else {
27
+ v = `(${c}:${v})`;
28
+ }
29
+ acc.push(v);
15
30
  }
16
- const acc = [];
17
- for (let c in cond) {
18
- if (cond.hasOwnProperty(c)) {
19
- let v = cond[c];
20
- if (v === true) {
21
- v = c;
22
- }
23
- else if (v === false) {
24
- v = "not " + c;
25
- }
26
- else if (v === "only") {
27
- v += " " + c;
28
- }
29
- else {
30
- v = `(${c}:${v})`;
31
- }
32
- acc.push(v);
33
- }
34
- }
35
- return acc.join(" and ");
31
+ }
32
+ return acc.join(" and ");
33
+ };
34
+ export {
35
+ conditional
36
36
  };
package/css.js CHANGED
@@ -5,22 +5,22 @@ import { isPlainObject } from "@thi.ng/checks/is-plain-object";
5
5
  import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
6
6
  import { COMPACT, DEFAULT_VENDORS } from "./api.js";
7
7
  import { expand, formatDecls } from "./impl.js";
8
- export const css = (rules, opts) => {
9
- opts = {
10
- format: COMPACT,
11
- vendors: DEFAULT_VENDORS,
12
- fns: {},
13
- depth: 0,
14
- ...opts,
15
- };
16
- isArray(opts.autoprefix) && (opts.autoprefix = new Set(opts.autoprefix));
17
- return isPlainObject(rules)
18
- ? formatDecls(rules, opts)
19
- : isFunction(rules)
20
- ? rules([], opts).join(opts.format.rules)
21
- : expand([], [], isArray(rules)
22
- ? rules
23
- : isNotStringAndIterable(rules)
24
- ? [...rules]
25
- : illegalArgs(`invalid rules`), opts).join(opts.format.rules);
8
+ const css = (rules, opts) => {
9
+ opts = {
10
+ format: COMPACT,
11
+ vendors: DEFAULT_VENDORS,
12
+ fns: {},
13
+ depth: 0,
14
+ ...opts
15
+ };
16
+ isArray(opts.autoprefix) && (opts.autoprefix = new Set(opts.autoprefix));
17
+ return isPlainObject(rules) ? formatDecls(rules, opts) : isFunction(rules) ? rules([], opts).join(opts.format.rules) : expand(
18
+ [],
19
+ [],
20
+ isArray(rules) ? rules : isNotStringAndIterable(rules) ? [...rules] : illegalArgs(`invalid rules`),
21
+ opts
22
+ ).join(opts.format.rules);
23
+ };
24
+ export {
25
+ css
26
26
  };
package/impl.js CHANGED
@@ -11,97 +11,99 @@ import { permutations } from "@thi.ng/transducers/permutations";
11
11
  import { repeat } from "@thi.ng/transducers/repeat";
12
12
  import { str } from "@thi.ng/transducers/str";
13
13
  import { transduce } from "@thi.ng/transducers/transduce";
14
- const EMPTY = new Set();
14
+ const EMPTY = /* @__PURE__ */ new Set();
15
15
  const NO_SPACES = ":[";
16
- const xfSel = comp(flatten(), map((x) => (NO_SPACES.indexOf(x.charAt(0)) >= 0 ? x : " " + x)));
17
- const withScope = (xf, scope) => comp(xf, map((x) => (isString(x) && x.indexOf(" .") == 0 ? x + scope : x)));
18
- /** @internal */
19
- export const expand = (acc, parent, rules, opts) => {
20
- const n = rules.length;
21
- const sel = [];
22
- let curr, isFn;
23
- const process = (i, r) => {
24
- let rfn = null;
25
- if (isArray(r)) {
26
- expand(acc, makeSelector(parent, sel), r, opts);
27
- }
28
- else if (isIterable(r) && !isString(r)) {
29
- expand(acc, makeSelector(parent, sel), [...r], opts);
30
- }
31
- else if ((isFn = isFunction(r)) || (rfn = opts.fns[r])) {
32
- if (!parent.length) {
33
- if (rfn) {
34
- rfn.apply(null, rules.slice(i + 1))(acc, opts);
35
- return true;
36
- }
37
- r(acc, opts);
38
- }
39
- else if (isFn) {
40
- process(i, r());
41
- }
42
- else {
43
- illegalArgs(`quoted fn ('${r}') only allowed at head position`);
44
- }
45
- }
46
- else if (isPlainObject(r)) {
47
- curr = Object.assign(curr || {}, r);
48
- }
49
- else if (r != null) {
50
- sel.push(r);
51
- }
52
- };
53
- for (let i = 0; i < n; i++) {
54
- if (process(i, rules[i])) {
55
- return acc;
16
+ const xfSel = comp(
17
+ flatten(),
18
+ map((x) => NO_SPACES.indexOf(x.charAt(0)) >= 0 ? x : " " + x)
19
+ );
20
+ const withScope = (xf, scope) => comp(
21
+ xf,
22
+ map((x) => isString(x) && x.indexOf(" .") == 0 ? x + scope : x)
23
+ );
24
+ const expand = (acc, parent, rules, opts) => {
25
+ const n = rules.length;
26
+ const sel = [];
27
+ let curr, isFn;
28
+ const process = (i, r) => {
29
+ let rfn = null;
30
+ if (isArray(r)) {
31
+ expand(acc, makeSelector(parent, sel), r, opts);
32
+ } else if (isIterable(r) && !isString(r)) {
33
+ expand(acc, makeSelector(parent, sel), [...r], opts);
34
+ } else if ((isFn = isFunction(r)) || (rfn = opts.fns[r])) {
35
+ if (!parent.length) {
36
+ if (rfn) {
37
+ rfn.apply(null, rules.slice(i + 1))(acc, opts);
38
+ return true;
56
39
  }
40
+ r(acc, opts);
41
+ } else if (isFn) {
42
+ process(i, r());
43
+ } else {
44
+ illegalArgs(`quoted fn ('${r}') only allowed at head position`);
45
+ }
46
+ } else if (isPlainObject(r)) {
47
+ curr = Object.assign(curr || {}, r);
48
+ } else if (r != null) {
49
+ sel.push(r);
50
+ }
51
+ };
52
+ for (let i = 0; i < n; i++) {
53
+ if (process(i, rules[i])) {
54
+ return acc;
57
55
  }
58
- curr && acc.push(formatRule(parent, sel, curr, opts));
59
- return acc;
56
+ }
57
+ curr && acc.push(formatRule(parent, sel, curr, opts));
58
+ return acc;
60
59
  };
61
60
  const makeSelector = (parent, curr) => parent.length ? [...permutations(parent, curr)] : curr;
62
61
  const formatRule = (parent, sel, curr, opts) => {
63
- const f = opts.format;
64
- const space = indent(opts);
65
- const xf = opts.scope ? withScope(xfSel, opts.scope) : xfSel;
66
- return [
67
- space,
68
- transduce(map((sel) => transduce(xf, str(), isArray(sel) ? sel : [sel]).trim()), str(f.ruleSep), makeSelector(parent, sel)),
69
- f.declStart,
70
- formatDecls(curr, opts),
71
- space,
72
- f.declEnd,
73
- ].join("");
62
+ const f = opts.format;
63
+ const space = indent(opts);
64
+ const xf = opts.scope ? withScope(xfSel, opts.scope) : xfSel;
65
+ return [
66
+ space,
67
+ transduce(
68
+ map(
69
+ (sel2) => transduce(xf, str(), isArray(sel2) ? sel2 : [sel2]).trim()
70
+ ),
71
+ str(f.ruleSep),
72
+ makeSelector(parent, sel)
73
+ ),
74
+ f.declStart,
75
+ formatDecls(curr, opts),
76
+ space,
77
+ f.declEnd
78
+ ].join("");
74
79
  };
75
- /** @internal */
76
- export const formatDecls = (rules, opts) => {
77
- const f = opts.format;
78
- const prefixes = (opts.autoprefix || EMPTY);
79
- const space = indent(opts, opts.depth + 1);
80
- const acc = [];
81
- for (let r in rules) {
82
- if (rules.hasOwnProperty(r)) {
83
- let val = rules[r];
84
- if (isFunction(val)) {
85
- val = val(rules);
86
- }
87
- if (isArray(val)) {
88
- val = val
89
- .map((v) => (isArray(v) ? v.join(" ") : v))
90
- .join(f.ruleSep);
91
- }
92
- if (prefixes.has(r)) {
93
- for (let v of opts.vendors) {
94
- acc.push(`${space}${v}${r}:${f.valSep}${val};`);
95
- }
96
- }
97
- acc.push(`${space}${r}:${f.valSep}${val};`);
80
+ const formatDecls = (rules, opts) => {
81
+ const f = opts.format;
82
+ const prefixes = opts.autoprefix || EMPTY;
83
+ const space = indent(opts, opts.depth + 1);
84
+ const acc = [];
85
+ for (let r in rules) {
86
+ if (rules.hasOwnProperty(r)) {
87
+ let val = rules[r];
88
+ if (isFunction(val)) {
89
+ val = val(rules);
90
+ }
91
+ if (isArray(val)) {
92
+ val = val.map((v) => isArray(v) ? v.join(" ") : v).join(f.ruleSep);
93
+ }
94
+ if (prefixes.has(r)) {
95
+ for (let v of opts.vendors) {
96
+ acc.push(`${space}${v}${r}:${f.valSep}${val};`);
98
97
  }
98
+ }
99
+ acc.push(`${space}${r}:${f.valSep}${val};`);
99
100
  }
100
- return acc.join(f.decls) + f.decls;
101
+ }
102
+ return acc.join(f.decls) + f.decls;
103
+ };
104
+ const indent = (opts, d = opts.depth) => d > 1 ? [...repeat(opts.format.indent, d)].join("") : d > 0 ? opts.format.indent : "";
105
+ export {
106
+ expand,
107
+ formatDecls,
108
+ indent
101
109
  };
102
- /** @internal */
103
- export const indent = (opts, d = opts.depth) => d > 1
104
- ? [...repeat(opts.format.indent, d)].join("")
105
- : d > 0
106
- ? opts.format.indent
107
- : "";
package/import.js CHANGED
@@ -1,4 +1,6 @@
1
- export const at_import = (url, ...queries) => (acc, opts) => (acc.push(queries.length
2
- ? `@import url(${url}) ${queries.join(opts.format.ruleSep)};`
3
- : `@import url(${url});`),
4
- acc);
1
+ const at_import = (url, ...queries) => (acc, opts) => (acc.push(
2
+ queries.length ? `@import url(${url}) ${queries.join(opts.format.ruleSep)};` : `@import url(${url});`
3
+ ), acc);
4
+ export {
5
+ at_import
6
+ };
package/inject.js CHANGED
@@ -1,28 +1,19 @@
1
- // https://davidwalsh.name/add-rules-stylesheets
2
- /**
3
- * Injects given CSS string as global stylesheet in DOM head. If `first`
4
- * is true, inserts it as first stylesheet, else (default) appends it.
5
- *
6
- * Returns created style DOM element.
7
- *
8
- * @param css - CSS string
9
- * @param first - true, if prepend to stylesheet list (else append)
10
- */
11
- export const injectStyleSheet = (css, first = false) => {
12
- const head = document.getElementsByTagName("head")[0];
13
- const sheet = document.createElement("style");
14
- sheet.setAttribute("type", "text/css");
15
- if (sheet.styleSheet !== undefined) {
16
- sheet.styleSheet.cssText = css;
17
- }
18
- else {
19
- sheet.textContent = css;
20
- }
21
- if (first) {
22
- head.insertBefore(sheet, head.firstChild);
23
- }
24
- else {
25
- head.appendChild(sheet);
26
- }
27
- return sheet;
1
+ const injectStyleSheet = (css, first = false) => {
2
+ const head = document.getElementsByTagName("head")[0];
3
+ const sheet = document.createElement("style");
4
+ sheet.setAttribute("type", "text/css");
5
+ if (sheet.styleSheet !== void 0) {
6
+ sheet.styleSheet.cssText = css;
7
+ } else {
8
+ sheet.textContent = css;
9
+ }
10
+ if (first) {
11
+ head.insertBefore(sheet, head.firstChild);
12
+ } else {
13
+ head.appendChild(sheet);
14
+ }
15
+ return sheet;
16
+ };
17
+ export {
18
+ injectStyleSheet
28
19
  };
package/keyframes.js CHANGED
@@ -1,25 +1,30 @@
1
1
  import { formatDecls, indent } from "./impl.js";
2
- export function at_keyframes(id, ...args) {
3
- const stops = args.length === 1 ? args[0] : { 0: args[0], 100: args[1] };
4
- return (acc, opts) => {
5
- const outer = indent(opts);
6
- opts.depth++;
7
- const inner = indent(opts);
8
- acc.push(`${outer}@keyframes ${id}${opts.format.declStart}`);
9
- for (let s in stops) {
10
- if (stops.hasOwnProperty(s)) {
11
- acc.push([
12
- inner,
13
- s + "%",
14
- opts.format.declStart,
15
- formatDecls(stops[s], opts),
16
- inner,
17
- opts.format.declEnd,
18
- ].join(""));
19
- }
20
- }
21
- opts.depth--;
22
- acc.push(outer + opts.format.declEnd);
23
- return acc;
24
- };
2
+ function at_keyframes(id, ...args) {
3
+ const stops = args.length === 1 ? args[0] : { 0: args[0], 100: args[1] };
4
+ return (acc, opts) => {
5
+ const outer = indent(opts);
6
+ opts.depth++;
7
+ const inner = indent(opts);
8
+ acc.push(`${outer}@keyframes ${id}${opts.format.declStart}`);
9
+ for (let s in stops) {
10
+ if (stops.hasOwnProperty(s)) {
11
+ acc.push(
12
+ [
13
+ inner,
14
+ s + "%",
15
+ opts.format.declStart,
16
+ formatDecls(stops[s], opts),
17
+ inner,
18
+ opts.format.declEnd
19
+ ].join("")
20
+ );
21
+ }
22
+ }
23
+ opts.depth--;
24
+ acc.push(outer + opts.format.declEnd);
25
+ return acc;
26
+ };
25
27
  }
28
+ export {
29
+ at_keyframes
30
+ };
package/media.js CHANGED
@@ -1,2 +1,5 @@
1
1
  import { conditional } from "./conditional.js";
2
- export const at_media = (cond, rules) => conditional("@media", cond, rules);
2
+ const at_media = (cond, rules) => conditional("@media", cond, rules);
3
+ export {
4
+ at_media
5
+ };
package/namespace.js CHANGED
@@ -1,6 +1,8 @@
1
- export function at_namespace(...args) {
2
- return (acc, _) => (acc.push(args.length > 1
3
- ? `@namespace ${args[0]} url(${args[1]});`
4
- : `@namespace url(${args[0]});`),
5
- acc);
1
+ function at_namespace(...args) {
2
+ return (acc, _) => (acc.push(
3
+ args.length > 1 ? `@namespace ${args[0]} url(${args[1]});` : `@namespace url(${args[0]});`
4
+ ), acc);
6
5
  }
6
+ export {
7
+ at_namespace
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/hiccup-css",
3
- "version": "2.2.18",
3
+ "version": "2.2.20",
4
4
  "description": "CSS from nested JS data structures",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -24,7 +24,9 @@
24
24
  "author": "Karsten Schmidt (https://thi.ng)",
25
25
  "license": "Apache-2.0",
26
26
  "scripts": {
27
- "build": "yarn clean && tsc --declaration",
27
+ "build": "yarn build:esbuild && yarn build:decl",
28
+ "build:decl": "tsc --declaration --emitDeclarationOnly",
29
+ "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
28
30
  "clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
29
31
  "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
32
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
@@ -33,14 +35,14 @@
33
35
  "test": "bun test"
34
36
  },
35
37
  "dependencies": {
36
- "@thi.ng/api": "^8.9.10",
37
- "@thi.ng/checks": "^3.4.10",
38
- "@thi.ng/errors": "^2.4.4",
39
- "@thi.ng/transducers": "^8.8.13"
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"
40
42
  },
41
43
  "devDependencies": {
42
44
  "@microsoft/api-extractor": "^7.38.3",
43
- "@thi.ng/testament": "^0.4.3",
45
+ "esbuild": "^0.19.8",
44
46
  "rimraf": "^5.0.5",
45
47
  "tools": "^0.0.1",
46
48
  "typedoc": "^0.25.4",
@@ -126,5 +128,5 @@
126
128
  ],
127
129
  "year": 2016
128
130
  },
129
- "gitHead": "04d1de79f256d7a53c6b5fd157b37f49bc88e11d\n"
131
+ "gitHead": "5e7bafedfc3d53bc131469a28de31dd8e5b4a3ff\n"
130
132
  }
@@ -4,12 +4,14 @@ import { at_keyframes } from "./keyframes.js";
4
4
  import { at_media } from "./media.js";
5
5
  import { at_namespace } from "./namespace.js";
6
6
  import { at_supports } from "./supports.js";
7
- /** @internal */
8
- export const QUOTED_FNS = {
9
- "@comment": comment,
10
- "@import": at_import,
11
- "@keyframes": at_keyframes,
12
- "@media": at_media,
13
- "@namespace": at_namespace,
14
- "@supports": at_supports,
7
+ const QUOTED_FNS = {
8
+ "@comment": comment,
9
+ "@import": at_import,
10
+ "@keyframes": at_keyframes,
11
+ "@media": at_media,
12
+ "@namespace": at_namespace,
13
+ "@supports": at_supports
14
+ };
15
+ export {
16
+ QUOTED_FNS
15
17
  };
package/supports.js CHANGED
@@ -1,2 +1,5 @@
1
1
  import { conditional } from "./conditional.js";
2
- export const at_supports = (cond, rules) => conditional("@supports", cond, rules);
2
+ const at_supports = (cond, rules) => conditional("@supports", cond, rules);
3
+ export {
4
+ at_supports
5
+ };
package/units.js CHANGED
@@ -1,28 +1,39 @@
1
- export let PRECISION = 4;
2
- /**
3
- * Sets the number of fractional digits used for formatting various floating
4
- * point values in the serialized SVG. The current value can be read via
5
- * {@link PRECISION}.
6
- *
7
- * @param n
8
- */
9
- export const setPrecision = (n) => (PRECISION = n);
10
- /** @internal */
11
- const ff = (x) => (x === (x | 0) ? String(x) : x.toFixed(PRECISION));
12
- export const em = (x) => `${ff(x)}em`;
13
- export const ex = (x) => `${ff(x)}ex`;
14
- export const rem = (x) => `${ff(x)}rem`;
15
- export const percent = (x) => `${ff(x)}%`;
16
- export const px = (x) => `${ff(x)}px`;
17
- export const vh = (x) => `${ff(x)}vh`;
18
- export const vw = (x) => `${ff(x)}vw`;
19
- export const vmin = (x) => `${ff(x)}vmin`;
20
- export const vmax = (x) => `${ff(x)}vmax`;
21
- export const ms = (x) => `${x | 0}ms`;
22
- export const second = (x) => `${ff(x)}s`;
23
- /** @deprecated use {@link second} */
24
- export const sec = second;
25
- export const deg = (x) => `${ff(x)}deg`;
26
- export const rad = (x) => `${ff(x)}rad`;
27
- export const turn = (x) => `${ff(x)}turn`;
28
- export const url = (x) => `url(${x})`;
1
+ let PRECISION = 4;
2
+ const setPrecision = (n) => PRECISION = n;
3
+ const ff = (x) => x === (x | 0) ? String(x) : x.toFixed(PRECISION);
4
+ const em = (x) => `${ff(x)}em`;
5
+ const ex = (x) => `${ff(x)}ex`;
6
+ const rem = (x) => `${ff(x)}rem`;
7
+ const percent = (x) => `${ff(x)}%`;
8
+ const px = (x) => `${ff(x)}px`;
9
+ const vh = (x) => `${ff(x)}vh`;
10
+ const vw = (x) => `${ff(x)}vw`;
11
+ const vmin = (x) => `${ff(x)}vmin`;
12
+ const vmax = (x) => `${ff(x)}vmax`;
13
+ const ms = (x) => `${x | 0}ms`;
14
+ const second = (x) => `${ff(x)}s`;
15
+ const sec = second;
16
+ const deg = (x) => `${ff(x)}deg`;
17
+ const rad = (x) => `${ff(x)}rad`;
18
+ const turn = (x) => `${ff(x)}turn`;
19
+ const url = (x) => `url(${x})`;
20
+ export {
21
+ PRECISION,
22
+ deg,
23
+ em,
24
+ ex,
25
+ ms,
26
+ percent,
27
+ px,
28
+ rad,
29
+ rem,
30
+ sec,
31
+ second,
32
+ setPrecision,
33
+ turn,
34
+ url,
35
+ vh,
36
+ vmax,
37
+ vmin,
38
+ vw
39
+ };