@kiva/kv-tokens 2.15.0 → 2.16.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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.16.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-tokens@2.16.0...@kiva/kv-tokens@2.16.1) (2025-01-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update font cdn url ([b0e3d37](https://github.com/kiva/kv-ui-elements/commit/b0e3d37694064aa372b5776e311d1109f552ff5a))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.16.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-tokens@2.15.0...@kiva/kv-tokens@2.16.0) (2024-11-20)
18
+
19
+
20
+ ### Features
21
+
22
+ * **kv-tokens:** generate scss variables from primitives.json during build ([1567bbf](https://github.com/kiva/kv-ui-elements/commit/1567bbfe3411f003963b439e63628326822e57ac))
23
+
24
+
25
+
26
+
27
+
6
28
  # [2.15.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-tokens@2.14.0...@kiva/kv-tokens@2.15.0) (2024-11-18)
7
29
 
8
30
 
package/build/build.cjs CHANGED
@@ -1,5 +1,7 @@
1
1
  const fs = require('node:fs');
2
+ const primitives = require('../primitives.json');
2
3
  const { generateExternalSVG } = require('../configs/kivaHeadingUnderline.cjs');
4
+ const { flattenJSON } = require('../configs/util.cjs');
3
5
 
4
6
  // Note: dir is relative to the root of the kv-tokens package
5
7
  const dir = '../../dist/kvui';
@@ -12,3 +14,12 @@ if (!fs.existsSync(dir)) {
12
14
  // Generate Heading Underline SVG
13
15
  const svg = generateExternalSVG();
14
16
  fs.writeFileSync(`${dir}/heading-underline.svg`, svg);
17
+
18
+ // Generate SCSS variables
19
+ const today = new Date().toUTCString();
20
+ const variables = flattenJSON(primitives);
21
+ const scss = Object.keys(variables)
22
+ .map((key) => `$${key.toLowerCase().replace('.', '-')}: ${variables[key]};`)
23
+ .join('\n');
24
+ const withComment = `// Do not edit directly.\n// Generated on ${today}. \n\n${scss}\n`;
25
+ fs.writeFileSync(`${dir}/tw-exported-vars.scss`, withComment);
@@ -23,7 +23,7 @@ const webFonts = [
23
23
  fontStyle: 'normal',
24
24
  fontDisplay: 'swap',
25
25
  // eslint-disable-next-line max-len
26
- src: 'url(//www-kiva-org.freetls.fastly.net/static/fonts/PostGrotesk-Medium.8c8a585.woff2) format(\'woff2\')',
26
+ src: 'url(//www.kiva.org/static/fonts/PostGrotesk-Medium.8c8a585.woff2) format(\'woff2\')',
27
27
  },
28
28
  },
29
29
  // Note corresponding font weight in Tailwind is "normal"
@@ -34,7 +34,7 @@ const webFonts = [
34
34
  fontStyle: 'italic',
35
35
  fontDisplay: 'swap',
36
36
  // eslint-disable-next-line max-len
37
- src: 'url(//www-kiva-org.freetls.fastly.net/static/fonts/PostGrotesk-MediumItalic.133f41d.woff2) format(\'woff2\')',
37
+ src: 'url(//www.kiva.org/static/fonts/PostGrotesk-MediumItalic.133f41d.woff2) format(\'woff2\')',
38
38
  },
39
39
  },
40
40
  // Note corresponding font weight in Tailwind is "light"
@@ -44,7 +44,7 @@ const webFonts = [
44
44
  fontWeight: '300',
45
45
  fontStyle: 'normal',
46
46
  fontDisplay: 'swap',
47
- src: 'url(//www-kiva-org.freetls.fastly.net/static/fonts/PostGrotesk-Book.246fc8e.woff2) format(\'woff2\')',
47
+ src: 'url(//www.kiva.org/static/fonts/PostGrotesk-Book.246fc8e.woff2) format(\'woff2\')',
48
48
  },
49
49
  },
50
50
  // Note corresponding font weight in Tailwind is "light"
@@ -55,7 +55,7 @@ const webFonts = [
55
55
  fontStyle: 'italic',
56
56
  fontDisplay: 'swap',
57
57
  // eslint-disable-next-line max-len
58
- src: 'url(//www-kiva-org.freetls.fastly.net/static/fonts/PostGrotesk-BookItalic.4d06d39.woff2) format(\'woff2\')',
58
+ src: 'url(//www.kiva.org/static/fonts/PostGrotesk-BookItalic.4d06d39.woff2) format(\'woff2\')',
59
59
  },
60
60
  },
61
61
  ];
package/configs/util.cjs CHANGED
@@ -20,9 +20,25 @@ const base64 = (str) => {
20
20
  return window.btoa(str);
21
21
  };
22
22
 
23
+ const flattenJSON = (obj, parentKey = '') => {
24
+ const flattened = {};
25
+
26
+ Object.keys(obj).forEach((key) => {
27
+ const newKey = parentKey ? `${parentKey}-${key}` : key;
28
+ if (typeof obj[key] === 'object') {
29
+ Object.assign(flattened, flattenJSON(obj[key], newKey));
30
+ } else {
31
+ flattened[newKey] = obj[key];
32
+ }
33
+ });
34
+
35
+ return flattened;
36
+ };
37
+
23
38
  module.exports = {
24
39
  rem,
25
40
  em,
26
41
  hexToRGB,
27
42
  base64,
43
+ flattenJSON,
28
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-tokens",
3
- "version": "2.15.0",
3
+ "version": "2.16.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -15,5 +15,5 @@
15
15
  "@tailwindcss/typography": "^0.5.1",
16
16
  "tailwindcss": "^3.4.3"
17
17
  },
18
- "gitHead": "fab4917b631c7c5491a23d7cd88ec2f65a5fa928"
18
+ "gitHead": "bcfe3bd0b8f202f7bdd27e47ce013f9c51d69469"
19
19
  }