@projectwallace/css-design-tokens 0.11.3 → 0.11.5

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -6
  2. package/package.json +61 -56
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { analyze, colorFunctions, colorKeywords, cssKeywords, namedColors, systemColors } from "@projectwallace/css-analyzer";
2
- import { convert } from "css-time-sort";
2
+ import { convert } from "@projectwallace/css-time-sort";
3
3
  import { convert as convert$1 } from "color-sorter";
4
4
  import { parse_value } from "@projectwallace/css-parser/parse-value";
5
5
  import { DIMENSION, FUNCTION, HASH, IDENTIFIER, NUMBER, OPERATOR } from "@projectwallace/css-parser/nodes";
@@ -452,15 +452,14 @@ function analysis_to_tokens(analysis) {
452
452
  let unique = get_unique(analysis.values.fontFamilies);
453
453
  for (let font_family in unique) {
454
454
  let parsed = destructure_font_family(font_family);
455
- let name = `fontFamily-${hash(font_family)}`;
455
+ if (!parsed) continue;
456
+ let [main] = parsed;
457
+ let name = `fontFamily-${hash(main)}`;
456
458
  let extensions = {
457
459
  [EXTENSION_AUTHORED_AS]: font_family,
458
460
  [EXTENSION_USAGE_COUNT]: get_count(unique[font_family])
459
461
  };
460
- if (parsed === void 0) families[name] = {
461
- $value: font_family,
462
- $extensions: extensions
463
- };
462
+ if (families[name]) families[name].$extensions[EXTENSION_USAGE_COUNT] += extensions[EXTENSION_USAGE_COUNT];
464
463
  else families[name] = {
465
464
  $type: "fontFamily",
466
465
  $value: parsed,
package/package.json CHANGED
@@ -1,57 +1,62 @@
1
1
  {
2
- "name": "@projectwallace/css-design-tokens",
3
- "version": "0.11.3",
4
- "description": "Generate spec-compliant Design Tokens from CSS.",
5
- "keywords": [
6
- "color",
7
- "css",
8
- "design-tokens",
9
- "font",
10
- "spec",
11
- "token"
12
- ],
13
- "homepage": "https://github.com/projectwallace/css-design-tokens",
14
- "license": "EUPL-1.2",
15
- "author": "Bart Veneman <bart@projectwallace.com>",
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/projectwallace/css-design-tokens.git"
19
- },
20
- "files": [
21
- "dist"
22
- ],
23
- "type": "module",
24
- "main": "dist/index.js",
25
- "types": "dist/index.d.ts",
26
- "exports": {
27
- "types": "./dist/index.d.ts",
28
- "default": "./dist/index.js"
29
- },
30
- "scripts": {
31
- "test": "vitest --coverage",
32
- "build": "tsdown",
33
- "check": "tsc --noEmit",
34
- "lint": "oxlint; oxfmt --check"
35
- },
36
- "dependencies": {
37
- "@projectwallace/css-analyzer": "^9.6.2",
38
- "@projectwallace/css-parser": "^0.14.8",
39
- "color-sorter": "^7.0.2",
40
- "colorjs.io": "^0.6.1",
41
- "css-time-sort": "^3.0.1"
42
- },
43
- "devDependencies": {
44
- "@codecov/rollup-plugin": "^1.9.1",
45
- "@vitest/coverage-v8": "^4.1.2",
46
- "oxfmt": "^0.43.0",
47
- "oxlint": "^1.58.0",
48
- "publint": "^0.3.18",
49
- "tsdown": "^0.21.7",
50
- "typescript": "^6.0.2",
51
- "vitest": "^4.1.2"
52
- },
53
- "engines": {
54
- "node": ">=22"
55
- },
56
- "issues": "https://github.com/projectwallace/css-design-tokens/issues"
57
- }
2
+ "name": "@projectwallace/css-design-tokens",
3
+ "version": "0.11.5",
4
+ "description": "Generate spec-compliant Design Tokens from CSS.",
5
+ "keywords": [
6
+ "color",
7
+ "css",
8
+ "design-tokens",
9
+ "font",
10
+ "spec",
11
+ "token"
12
+ ],
13
+ "homepage": "https://github.com/projectwallace/css-design-tokens",
14
+ "license": "EUPL-1.2",
15
+ "author": "Bart Veneman <bart@projectwallace.com>",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/projectwallace/css-design-tokens.git"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "type": "module",
24
+ "main": "dist/index.js",
25
+ "types": "dist/index.d.ts",
26
+ "exports": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "provenance": true
33
+ },
34
+ "dependencies": {
35
+ "@projectwallace/css-analyzer": "^9.6.3",
36
+ "@projectwallace/css-parser": "^0.15.0",
37
+ "@projectwallace/css-time-sort": "^3.1.0",
38
+ "color-sorter": "^8.0.0",
39
+ "colorjs.io": "^0.6.1"
40
+ },
41
+ "devDependencies": {
42
+ "@codecov/rollup-plugin": "^2.0.1",
43
+ "@vitest/coverage-v8": "^4.1.4",
44
+ "oxfmt": "^0.49.0",
45
+ "oxlint": "^1.61.0",
46
+ "publint": "^0.3.18",
47
+ "tsdown": "^0.22.0",
48
+ "typescript": "^6.0.3",
49
+ "vitest": "^4.1.4"
50
+ },
51
+ "engines": {
52
+ "node": ">=22",
53
+ "pnpm": ">=10.0.0"
54
+ },
55
+ "issues": "https://github.com/projectwallace/css-design-tokens/issues",
56
+ "scripts": {
57
+ "test": "vitest --coverage",
58
+ "build": "tsdown",
59
+ "check": "tsc --noEmit",
60
+ "lint": "oxlint; oxfmt --check"
61
+ }
62
+ }