@koobiq/tokens-builder 3.17.1 → 3.17.2

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.
@@ -99,7 +99,7 @@ const newSemanticPaletteConfig = newSemanticPaletteColors.map((color) => ({
99
99
 
100
100
  module.exports = {
101
101
  css: {
102
- transformGroup: 'kbq/css',
102
+ transformGroup: 'kbq/css-new',
103
103
  files: [
104
104
  ...newSemanticPaletteConfig,
105
105
  ...newPaletteByColorsConfig,
package/package.json CHANGED
@@ -19,5 +19,5 @@
19
19
  "default": "./*"
20
20
  }
21
21
  },
22
- "version": "3.17.1"
22
+ "version": "3.17.2"
23
23
  }
@@ -13,4 +13,19 @@ module.exports = (StyleDictionary) => {
13
13
  'kbq-attribute/comment'
14
14
  ]
15
15
  });
16
+
17
+ StyleDictionary.registerTransformGroup({
18
+ name: 'kbq/css-new',
19
+ transforms: [
20
+ 'attribute/cti',
21
+ 'kbq-attribute/palette',
22
+ 'kbq-attribute/font',
23
+ 'kbq-attribute/light',
24
+ 'kbq-attribute/dark',
25
+ 'name/custom-kebab-strip-theme',
26
+ 'color/css',
27
+ 'kbq/prefix',
28
+ 'kbq-attribute/comment'
29
+ ]
30
+ });
16
31
  };
@@ -1,20 +1,39 @@
1
+ const toKebab = (path) => {
2
+ const standardKebab = path
3
+ .map((part) =>
4
+ part
5
+ .replace(/([a-z])([A-Z])/g, '$1-$2')
6
+ .replace(/"/g, '')
7
+ .replace(/[\s.]+/g, '-')
8
+ .toLowerCase()
9
+ )
10
+ .join('-');
11
+
12
+ // for alpha colors, remove the dash between 'a' and the index
13
+ return standardKebab.replace(/-a-(\d+)$/, '-a$1');
14
+ };
15
+
1
16
  module.exports = (StyleDictionary) => {
2
17
  StyleDictionary.registerTransform({
3
18
  name: 'name/custom-kebab',
4
19
  type: 'name',
20
+ transformer: (token) => toKebab(token.path)
21
+ });
22
+
23
+ // Same as custom-kebab but strips 'light'/'dark' when used as the type
24
+ // segment (e.g. shadow.light.card → shadow-card).
25
+ // Used for the new palette output so theme-scoped shadows don't carry
26
+ // the theme prefix in their variable name.
27
+ StyleDictionary.registerTransform({
28
+ name: 'name/custom-kebab-strip-theme',
29
+ type: 'name',
5
30
  transformer: (token) => {
6
- const standardKebab = token.path
7
- .map((part) =>
8
- part
9
- .replace(/([a-z])([A-Z])/g, '$1-$2')
10
- .replace(/"/g, '')
11
- .replace(/[\s.]+/g, '-')
12
- .toLowerCase()
13
- )
14
- .join('-');
31
+ const path =
32
+ token.attributes.category === 'light' || token.attributes.category === 'dark'
33
+ ? token.path.filter((part) => part !== 'light' && part !== 'dark')
34
+ : token.path;
15
35
 
16
- // for alpha colors, remove the dash between 'a' and the index
17
- return standardKebab.replace(/-a-(\d+)$/, '-a$1');
36
+ return toKebab(path);
18
37
  }
19
38
  });
20
39
  };