@thi.ng/hiccup-css 2.7.95 → 2.8.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/README.md CHANGED
@@ -125,7 +125,7 @@ Browser ESM import:
125
125
 
126
126
  [JSDelivr documentation](https://www.jsdelivr.com/)
127
127
 
128
- Package sizes (brotli'd, pre-treeshake): ESM: 2.24 KB
128
+ Package sizes (brotli'd, pre-treeshake): ESM: 2.42 KB
129
129
 
130
130
  ## Dependencies
131
131
 
package/font-face.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import type { CSSOpts } from "./api.js";
2
+ export interface FontFaceSpec {
3
+ family: string;
4
+ src: {
5
+ format: string;
6
+ url: string;
7
+ }[];
8
+ style: string;
9
+ weight: string;
10
+ stretch?: string;
11
+ display?: string;
12
+ unicode?: string[];
13
+ ascent?: string;
14
+ descent?: string;
15
+ feature?: string;
16
+ variation?: string;
17
+ lineGap?: string;
18
+ size?: string;
19
+ }
20
+ export declare const at_fontface: (spec: FontFaceSpec) => (acc: string[], opts: CSSOpts) => string[];
21
+ //# sourceMappingURL=font-face.d.ts.map
package/font-face.js ADDED
@@ -0,0 +1,32 @@
1
+ import { formatDecls, indent } from "./impl.js";
2
+ const at_fontface = (spec) => {
3
+ return (acc, opts) => {
4
+ const outer = indent(opts);
5
+ acc.push(
6
+ `${outer}@font-face${opts.format.declStart}${formatDecls(
7
+ {
8
+ "font-family": spec.family,
9
+ "font-style": spec.style,
10
+ "font-weight": spec.weight,
11
+ "font-stretch": spec.stretch,
12
+ "font-display": spec.display,
13
+ src: spec.src.map(
14
+ ({ format, url }) => `url(${url}) format(${format})`
15
+ ),
16
+ "unicode-range": spec.unicode,
17
+ "ascent-override": spec.ascent,
18
+ "descent-override": spec.ascent,
19
+ "font-feature-settings": spec.feature,
20
+ "font-variation-settings": spec.variation,
21
+ "line-gap-override": spec.lineGap,
22
+ "size-adjust": spec.size
23
+ },
24
+ opts
25
+ )}${outer}${opts.format.declEnd}`
26
+ );
27
+ return acc;
28
+ };
29
+ };
30
+ export {
31
+ at_fontface
32
+ };
package/impl.js CHANGED
@@ -87,6 +87,7 @@ const formatDecls = (rules, opts) => {
87
87
  for (const r in rules) {
88
88
  if (rules.hasOwnProperty(r)) {
89
89
  let val = rules[r];
90
+ if (val == null) continue;
90
91
  if (isFunction(val)) {
91
92
  val = val(rules);
92
93
  }
package/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from "./attribs.js";
4
4
  export * from "./comment.js";
5
5
  export * from "./conditional.js";
6
6
  export * from "./css.js";
7
+ export * from "./font-face.js";
7
8
  export * from "./import.js";
8
9
  export * from "./inject.js";
9
10
  export * from "./keyframes.js";
package/index.js CHANGED
@@ -4,6 +4,7 @@ export * from "./attribs.js";
4
4
  export * from "./comment.js";
5
5
  export * from "./conditional.js";
6
6
  export * from "./css.js";
7
+ export * from "./font-face.js";
7
8
  export * from "./import.js";
8
9
  export * from "./inject.js";
9
10
  export * from "./keyframes.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/hiccup-css",
3
- "version": "2.7.95",
3
+ "version": "2.8.1",
4
4
  "description": "CSS from nested JS data structures",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -40,13 +40,13 @@
40
40
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@thi.ng/api": "^8.12.26",
44
- "@thi.ng/checks": "^3.10.0",
45
- "@thi.ng/errors": "^2.6.15",
46
- "@thi.ng/transducers": "^9.6.40"
43
+ "@thi.ng/api": "^8.12.27",
44
+ "@thi.ng/checks": "^3.10.1",
45
+ "@thi.ng/errors": "^2.6.16",
46
+ "@thi.ng/transducers": "^9.6.41"
47
47
  },
48
48
  "devDependencies": {
49
- "esbuild": "^0.28.0",
49
+ "esbuild": "^0.28.1",
50
50
  "typedoc": "^0.28.19",
51
51
  "typescript": "^6.0.3"
52
52
  },
@@ -96,6 +96,9 @@
96
96
  "./css": {
97
97
  "default": "./css.js"
98
98
  },
99
+ "./font-face": {
100
+ "default": "./font-face.js"
101
+ },
99
102
  "./import": {
100
103
  "default": "./import.js"
101
104
  },
@@ -130,5 +133,5 @@
130
133
  ],
131
134
  "year": 2016
132
135
  },
133
- "gitHead": "c47c56420bcae2e0477d252a497be44f08ca185a"
136
+ "gitHead": "febee81fd8b59e5e330a6e6521a2667ed5401a3d"
134
137
  }
@@ -3,6 +3,7 @@ import { at_namespace } from "./namespace.js";
3
3
  /** @internal */
4
4
  export declare const QUOTED_FNS: {
5
5
  "@comment": (body: string, force?: boolean) => import("./api.js").RuleFn;
6
+ "@font-face": (spec: import("./font-face.js").FontFaceSpec) => (acc: string[], opts: import("./api.js").CSSOpts) => string[];
6
7
  "@import": (url: string, ...queries: string[]) => import("./api.js").RuleFn;
7
8
  "@keyframes": typeof at_keyframes;
8
9
  "@media": (cond: import("./api.js").Conditional, rules: any[]) => import("./api.js").RuleFn;
@@ -1,4 +1,5 @@
1
1
  import { comment } from "./comment.js";
2
+ import { at_fontface } from "./font-face.js";
2
3
  import { at_import } from "./import.js";
3
4
  import { at_keyframes } from "./keyframes.js";
4
5
  import { at_media } from "./media.js";
@@ -6,6 +7,7 @@ import { at_namespace } from "./namespace.js";
6
7
  import { at_supports } from "./supports.js";
7
8
  const QUOTED_FNS = {
8
9
  "@comment": comment,
10
+ "@font-face": at_fontface,
9
11
  "@import": at_import,
10
12
  "@keyframes": at_keyframes,
11
13
  "@media": at_media,