@breadstone-infrastructure/style-dictionary 0.0.174 → 0.0.176

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 (143) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/formats/tailwind/DesignTokenType.d.ts +10 -0
  3. package/formats/tailwind/DesignTokenType.d.ts.map +1 -0
  4. package/formats/tailwind/DesignTokenType.js +3 -0
  5. package/formats/tailwind/DesignTokenType.js.map +1 -0
  6. package/formats/tailwind/TailwindPropertyMapping.d.ts +61 -0
  7. package/formats/tailwind/TailwindPropertyMapping.d.ts.map +1 -0
  8. package/formats/tailwind/TailwindPropertyMapping.js +326 -0
  9. package/formats/tailwind/TailwindPropertyMapping.js.map +1 -0
  10. package/formats/tailwind/buildTailwindConfig.d.ts +23 -0
  11. package/formats/tailwind/buildTailwindConfig.d.ts.map +1 -0
  12. package/formats/tailwind/buildTailwindConfig.js +258 -0
  13. package/formats/tailwind/buildTailwindConfig.js.map +1 -0
  14. package/formats/tailwind/index.d.ts +2 -0
  15. package/formats/tailwind/index.d.ts.map +1 -0
  16. package/formats/tailwind/index.js +18 -0
  17. package/formats/tailwind/index.js.map +1 -0
  18. package/formats/tailwind/tailwindFormat.d.ts +17 -0
  19. package/formats/tailwind/tailwindFormat.d.ts.map +1 -0
  20. package/formats/tailwind/tailwindFormat.js +77 -0
  21. package/formats/tailwind/tailwindFormat.js.map +1 -0
  22. package/index.d.ts +9 -9
  23. package/index.d.ts.map +1 -1
  24. package/index.js +31 -19
  25. package/index.js.map +1 -1
  26. package/package.json +4 -3
  27. package/preprocessors/{Shadow.d.ts → expandShadowPreprocessor.d.ts} +1 -1
  28. package/preprocessors/expandShadowPreprocessor.d.ts.map +1 -0
  29. package/preprocessors/{Shadow.js → expandShadowPreprocessor.js} +1 -12
  30. package/preprocessors/expandShadowPreprocessor.js.map +1 -0
  31. package/preprocessors/lint/engine/preprocessor.d.ts +12 -0
  32. package/preprocessors/lint/engine/preprocessor.d.ts.map +1 -0
  33. package/preprocessors/lint/engine/preprocessor.js +44 -0
  34. package/preprocessors/lint/engine/preprocessor.js.map +1 -0
  35. package/preprocessors/lint/engine/types.d.ts +21 -0
  36. package/preprocessors/lint/engine/types.d.ts.map +1 -0
  37. package/preprocessors/lint/engine/types.js +4 -0
  38. package/preprocessors/lint/engine/types.js.map +1 -0
  39. package/preprocessors/lint/engine/walker.d.ts +13 -0
  40. package/preprocessors/lint/engine/walker.d.ts.map +1 -0
  41. package/preprocessors/lint/engine/walker.js +30 -0
  42. package/preprocessors/lint/engine/walker.js.map +1 -0
  43. package/preprocessors/lint/index.d.ts +4 -0
  44. package/preprocessors/lint/index.d.ts.map +1 -0
  45. package/preprocessors/lint/index.js +19 -0
  46. package/preprocessors/lint/index.js.map +1 -0
  47. package/preprocessors/lint/rules/forbiddenTokenName.d.ts +25 -0
  48. package/preprocessors/lint/rules/forbiddenTokenName.d.ts.map +1 -0
  49. package/preprocessors/lint/rules/forbiddenTokenName.js +40 -0
  50. package/preprocessors/lint/rules/forbiddenTokenName.js.map +1 -0
  51. package/preprocessors/lint/rules/forbiddenValue.d.ts +31 -0
  52. package/preprocessors/lint/rules/forbiddenValue.d.ts.map +1 -0
  53. package/preprocessors/lint/rules/forbiddenValue.js +48 -0
  54. package/preprocessors/lint/rules/forbiddenValue.js.map +1 -0
  55. package/preprocessors/lint/rules/index.d.ts +9 -0
  56. package/preprocessors/lint/rules/index.d.ts.map +1 -0
  57. package/preprocessors/lint/rules/index.js +25 -0
  58. package/preprocessors/lint/rules/index.js.map +1 -0
  59. package/preprocessors/lint/rules/namingConvention.d.ts +26 -0
  60. package/preprocessors/lint/rules/namingConvention.d.ts.map +1 -0
  61. package/preprocessors/lint/rules/namingConvention.js +35 -0
  62. package/preprocessors/lint/rules/namingConvention.js.map +1 -0
  63. package/preprocessors/lint/rules/noDollarProps.d.ts +6 -0
  64. package/preprocessors/lint/rules/noDollarProps.d.ts.map +1 -0
  65. package/preprocessors/lint/rules/noDollarProps.js +27 -0
  66. package/preprocessors/lint/rules/noDollarProps.js.map +1 -0
  67. package/preprocessors/lint/rules/requireType.d.ts +6 -0
  68. package/preprocessors/lint/rules/requireType.d.ts.map +1 -0
  69. package/preprocessors/lint/rules/requireType.js +21 -0
  70. package/preprocessors/lint/rules/requireType.js.map +1 -0
  71. package/preprocessors/lint/rules/requireValue.d.ts +6 -0
  72. package/preprocessors/lint/rules/requireValue.d.ts.map +1 -0
  73. package/preprocessors/lint/rules/requireValue.js +21 -0
  74. package/preprocessors/lint/rules/requireValue.js.map +1 -0
  75. package/preprocessors/lint/rules/validType.d.ts +25 -0
  76. package/preprocessors/lint/rules/validType.d.ts.map +1 -0
  77. package/preprocessors/lint/rules/validType.js +41 -0
  78. package/preprocessors/lint/rules/validType.js.map +1 -0
  79. package/preprocessors/lint/rules/valueTypeByTokenType.d.ts +40 -0
  80. package/preprocessors/lint/rules/valueTypeByTokenType.d.ts.map +1 -0
  81. package/preprocessors/lint/rules/valueTypeByTokenType.js +80 -0
  82. package/preprocessors/lint/rules/valueTypeByTokenType.js.map +1 -0
  83. package/transforms/gradientCssTransform.d.ts +3 -0
  84. package/transforms/gradientCssTransform.d.ts.map +1 -0
  85. package/transforms/{Gradient.js → gradientCssTransform.js} +4 -4
  86. package/transforms/gradientCssTransform.js.map +1 -0
  87. package/transforms/letterSpacingCalcCssTransform.d.ts +3 -0
  88. package/transforms/letterSpacingCalcCssTransform.d.ts.map +1 -0
  89. package/transforms/{LetterSpacing.js → letterSpacingCalcCssTransform.js} +4 -4
  90. package/transforms/letterSpacingCalcCssTransform.js.map +1 -0
  91. package/transforms/listScssTransform.d.ts +3 -0
  92. package/transforms/listScssTransform.d.ts.map +1 -0
  93. package/transforms/{List.js → listScssTransform.js} +4 -4
  94. package/transforms/listScssTransform.js.map +1 -0
  95. package/transforms/oklchCssTransform.d.ts +7 -0
  96. package/transforms/oklchCssTransform.d.ts.map +1 -0
  97. package/transforms/oklchCssTransform.js +52 -0
  98. package/transforms/oklchCssTransform.js.map +1 -0
  99. package/transforms/{QuoteString.d.ts → quoteStringTransform.d.ts} +1 -1
  100. package/transforms/quoteStringTransform.d.ts.map +1 -0
  101. package/transforms/{QuoteString.js → quoteStringTransform.js} +2 -2
  102. package/transforms/quoteStringTransform.js.map +1 -0
  103. package/transforms/{Shadow.d.ts → shadowCssTransform.d.ts} +1 -1
  104. package/transforms/shadowCssTransform.d.ts.map +1 -0
  105. package/transforms/{Shadow.js → shadowCssTransform.js} +2 -2
  106. package/transforms/shadowCssTransform.js.map +1 -0
  107. package/utilities/{Extract.d.ts → extractTokensByType.d.ts} +1 -1
  108. package/utilities/extractTokensByType.d.ts.map +1 -0
  109. package/utilities/{Extract.js → extractTokensByType.js} +2 -2
  110. package/utilities/extractTokensByType.js.map +1 -0
  111. package/formats/tailwind.d.ts +0 -3
  112. package/formats/tailwind.d.ts.map +0 -1
  113. package/formats/tailwind.js +0 -209
  114. package/formats/tailwind.js.map +0 -1
  115. package/preprocessors/Lint.d.ts +0 -3
  116. package/preprocessors/Lint.d.ts.map +0 -1
  117. package/preprocessors/Lint.js +0 -65
  118. package/preprocessors/Lint.js.map +0 -1
  119. package/preprocessors/Shadow.d.ts.map +0 -1
  120. package/preprocessors/Shadow.js.map +0 -1
  121. package/transforms/Gradient.d.ts +0 -3
  122. package/transforms/Gradient.d.ts.map +0 -1
  123. package/transforms/Gradient.js.map +0 -1
  124. package/transforms/LetterSpacing.d.ts +0 -3
  125. package/transforms/LetterSpacing.d.ts.map +0 -1
  126. package/transforms/LetterSpacing.js.map +0 -1
  127. package/transforms/List.d.ts +0 -3
  128. package/transforms/List.d.ts.map +0 -1
  129. package/transforms/List.js.map +0 -1
  130. package/transforms/NameSnakeUpperCase.d.ts +0 -6
  131. package/transforms/NameSnakeUpperCase.d.ts.map +0 -1
  132. package/transforms/NameSnakeUpperCase.js +0 -20
  133. package/transforms/NameSnakeUpperCase.js.map +0 -1
  134. package/transforms/QuoteString.d.ts.map +0 -1
  135. package/transforms/QuoteString.js.map +0 -1
  136. package/transforms/Shadow.d.ts.map +0 -1
  137. package/transforms/Shadow.js.map +0 -1
  138. package/utilities/Extract.d.ts.map +0 -1
  139. package/utilities/Extract.js.map +0 -1
  140. /package/utilities/{GetValue.d.ts → getValue.d.ts} +0 -0
  141. /package/utilities/{GetValue.d.ts.map → getValue.d.ts.map} +0 -0
  142. /package/utilities/{GetValue.js → getValue.js} +0 -0
  143. /package/utilities/{GetValue.js.map → getValue.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 0.0.175 (2025-11-28)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - add missing newline at end of package.json ([b00046e27b](https://github.com/RueDeRennes/mosaik/commit/b00046e27b))
6
+
7
+ ## 0.0.174 (2025-11-28)
8
+
9
+ ### 🚀 Features
10
+
11
+ - Add utility classes and methods for number, string, time, version, and process handling ([941d93259a](https://github.com/RueDeRennes/mosaik/commit/941d93259a))
12
+ - **tailwind:** add Joy Tailwind plugin with configuration options and token exposure ([72bbf954a8](https://github.com/RueDeRennes/mosaik/commit/72bbf954a8))
13
+ - **svg:** add SVG to path conversion utility ([f2f74da782](https://github.com/RueDeRennes/mosaik/commit/f2f74da782))
14
+
15
+ ### 🩹 Fixes
16
+
17
+ - remove unused elevation2 light token and update release version in package.json ([9a63ade438](https://github.com/RueDeRennes/mosaik/commit/9a63ade438))
18
+ - remove unused dependency 'element-to-path' from yarn.lock ([df86dc94de](https://github.com/RueDeRennes/mosaik/commit/df86dc94de))
19
+ - add newline at end of package.json ([73db364d3c](https://github.com/RueDeRennes/mosaik/commit/73db364d3c))
20
+
1
21
  ## 0.0.173 (2025-11-26)
2
22
 
3
23
  ### 🚀 Features
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Supported logical token types as returned by `getType`.
3
+ *
4
+ * This mirrors your original formatter’s behavior and is used for
5
+ * type-based fallback mapping if no valid category is present.
6
+ *
7
+ * @public
8
+ */
9
+ export type DesignTokenType = 'borderRadius' | 'borderWidth' | 'color' | 'duration' | 'font' | 'fontFamily' | 'fontSize' | 'fontWeight' | 'height' | 'letterSpacing' | 'lineHeight' | 'maxHeight' | 'maxWidth' | 'minHeight' | 'minWidth' | 'opacity' | 'shadow' | 'size' | 'spacing' | 'width' | 'zIndex';
10
+ //# sourceMappingURL=DesignTokenType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTokenType.d.ts","sourceRoot":"","sources":["../../../src/formats/tailwind/DesignTokenType.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAK,cAAc,GAAG,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,eAAe,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=DesignTokenType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTokenType.js","sourceRoot":"","sources":["../../../src/formats/tailwind/DesignTokenType.ts"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
1
+ import type { Config as TailwindConfig } from 'tailwindcss';
2
+ import type { DesignTokenType } from './DesignTokenType';
3
+ /**
4
+ * A valid key for the `theme` section of Tailwind config.
5
+ *
6
+ * @public
7
+ */
8
+ export type TailwindThemeKey = keyof NonNullable<TailwindConfig['theme']>;
9
+ /**
10
+ * Strategy describing how to map a token value under a given theme key.
11
+ *
12
+ * @private
13
+ */
14
+ type MappingStrategy = 'flat' | 'nested' | 'shadeMap' | 'shadow';
15
+ /**
16
+ * Function type for transforming token paths into Tailwind-compatible keys.
17
+ * Can return either a string (for flat/shadow strategies) or an array (for nested/shadeMap strategies).
18
+ *
19
+ * @public
20
+ */
21
+ export type PathTransformFn = (path: ReadonlyArray<string>) => string | ReadonlyArray<string>;
22
+ /**
23
+ * Internal mapping definition: for a given Tailwind theme key,
24
+ * which mapping strategy to apply when inserting tokens.
25
+ *
26
+ * @public
27
+ */
28
+ export interface IKeyMapping {
29
+ readonly themeKey: TailwindThemeKey;
30
+ readonly strategy: MappingStrategy;
31
+ readonly pathTransform?: PathTransformFn;
32
+ }
33
+ /**
34
+ * Set of supported design token types for validation.
35
+ * Used only for logging; unsupported types are skipped.
36
+ *
37
+ * @public
38
+ */
39
+ export declare const SUPPORTED_TOKEN_TYPES: ReadonlyArray<DesignTokenType>;
40
+ /**
41
+ * Maps token-level `category` values (which MUST match Tailwind theme keys)
42
+ * to Tailwind theme keys and the corresponding mapping strategy.
43
+ *
44
+ * This is the primary mapping: if a token specifies a `category` and it is
45
+ * found here, it is used directly.
46
+ *
47
+ * @public
48
+ */
49
+ export declare const CATEGORY_TO_KEY_MAPPING: Partial<Record<TailwindThemeKey, IKeyMapping>>;
50
+ /**
51
+ * Fallback mapping from logical token type → Tailwind theme key + strategy.
52
+ *
53
+ * This is used when there is no valid `category` on the token.
54
+ * It keeps the behavior close to the original formatter where routing
55
+ * was based on `type`.
56
+ *
57
+ * @public
58
+ */
59
+ export declare const TOKEN_TYPE_TO_KEY_MAPPING: Partial<Record<DesignTokenType, IKeyMapping>>;
60
+ export {};
61
+ //# sourceMappingURL=TailwindPropertyMapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TailwindPropertyMapping.d.ts","sourceRoot":"","sources":["../../../src/formats/tailwind/TailwindPropertyMapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMzD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAE1E;;;;GAIG;AACH,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC;CAC5C;AAMD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,eAAe,CAsBhE,CAAC;AAMF;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,WAAW,CAAC,CA8IlF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,CA6HnF,CAAC"}
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TOKEN_TYPE_TO_KEY_MAPPING = exports.CATEGORY_TO_KEY_MAPPING = exports.SUPPORTED_TOKEN_TYPES = void 0;
5
+ // #endregion
6
+ // #region Constants
7
+ /**
8
+ * Set of supported design token types for validation.
9
+ * Used only for logging; unsupported types are skipped.
10
+ *
11
+ * @public
12
+ */
13
+ exports.SUPPORTED_TOKEN_TYPES = [
14
+ 'borderRadius',
15
+ 'borderWidth',
16
+ 'color',
17
+ 'duration',
18
+ 'font',
19
+ 'fontFamily',
20
+ 'fontSize',
21
+ 'fontWeight',
22
+ 'height',
23
+ 'letterSpacing',
24
+ 'lineHeight',
25
+ 'maxHeight',
26
+ 'maxWidth',
27
+ 'minHeight',
28
+ 'minWidth',
29
+ 'opacity',
30
+ 'shadow',
31
+ 'size',
32
+ 'spacing',
33
+ 'width',
34
+ 'zIndex'
35
+ ];
36
+ // #endregion
37
+ // #region Mappings
38
+ /**
39
+ * Maps token-level `category` values (which MUST match Tailwind theme keys)
40
+ * to Tailwind theme keys and the corresponding mapping strategy.
41
+ *
42
+ * This is the primary mapping: if a token specifies a `category` and it is
43
+ * found here, it is used directly.
44
+ *
45
+ * @public
46
+ */
47
+ exports.CATEGORY_TO_KEY_MAPPING = {
48
+ colors: {
49
+ themeKey: 'colors',
50
+ strategy: 'shadeMap',
51
+ pathTransform: (path) => {
52
+ // color.light.primary.500 -> ['primary', '500'] (for light variant)
53
+ // color.dark.primary.500 -> ['primary-dark', '500'] (for dark variant)
54
+ if (path.length >= 4 && path[0] === 'color') {
55
+ const variant = path[1]; // 'light' or 'dark'
56
+ const colorName = path[2]; // 'primary', 'secondary', etc.
57
+ const shade = path[3]; // '500', '100', etc.
58
+ if (variant === 'light') {
59
+ return [colorName, shade];
60
+ }
61
+ else if (variant === 'dark') {
62
+ return [`${colorName}-dark`, shade];
63
+ }
64
+ }
65
+ return path;
66
+ }
67
+ },
68
+ spacing: {
69
+ themeKey: 'spacing',
70
+ strategy: 'flat',
71
+ pathTransform: (path) => {
72
+ // layout.radius -> 'radius'
73
+ // layout.space -> 'space'
74
+ if (path[0] === 'layout') {
75
+ return path[path.length - 1];
76
+ }
77
+ return path.join('-');
78
+ }
79
+ },
80
+ width: {
81
+ themeKey: 'width',
82
+ strategy: 'flat'
83
+ },
84
+ height: {
85
+ themeKey: 'height',
86
+ strategy: 'flat'
87
+ },
88
+ fontFamily: {
89
+ themeKey: 'fontFamily',
90
+ strategy: 'flat',
91
+ pathTransform: (path) => {
92
+ // typography.headline1.fontFamily -> 'headline1'
93
+ // font.family -> 'sans' (or custom name)
94
+ if (path[0] === 'typography' && path.length >= 2) {
95
+ return path[1];
96
+ }
97
+ if (path[0] === 'font' && path[1] === 'family') {
98
+ return 'sans';
99
+ }
100
+ return path[path.length - 1];
101
+ }
102
+ },
103
+ fontSize: {
104
+ themeKey: 'fontSize',
105
+ strategy: 'flat',
106
+ pathTransform: (path) => {
107
+ // typography.headline1.fontSize -> 'headline1'
108
+ if (path[0] === 'typography' && path.length >= 2) {
109
+ return path[1];
110
+ }
111
+ return path[path.length - 1];
112
+ }
113
+ },
114
+ boxShadow: {
115
+ themeKey: 'boxShadow',
116
+ strategy: 'shadow',
117
+ pathTransform: (path) => {
118
+ // elevation.light.regular -> 'regular'
119
+ // elevation.dark.* wird ignoriert oder separat behandelt
120
+ if (path[0] === 'elevation' && path.length >= 3) {
121
+ return path[2];
122
+ }
123
+ return path.join('-');
124
+ }
125
+ },
126
+ opacity: {
127
+ themeKey: 'opacity',
128
+ strategy: 'flat'
129
+ },
130
+ borderRadius: {
131
+ themeKey: 'borderRadius',
132
+ strategy: 'flat'
133
+ },
134
+ borderWidth: {
135
+ themeKey: 'borderWidth',
136
+ strategy: 'flat'
137
+ },
138
+ zIndex: {
139
+ themeKey: 'zIndex',
140
+ strategy: 'flat'
141
+ },
142
+ transitionDuration: {
143
+ themeKey: 'transitionDuration',
144
+ strategy: 'flat',
145
+ pathTransform: (path) => {
146
+ // duration.short -> 'short'
147
+ // duration._ -> 'DEFAULT'
148
+ if (path[0] === 'duration') {
149
+ return path[1] === '_' ? 'DEFAULT' : path[1];
150
+ }
151
+ return path[path.length - 1];
152
+ }
153
+ },
154
+ // Typography-related categories that didn't get their own top-level entry
155
+ // These are used by sub-properties of typography tokens
156
+ lineHeight: {
157
+ themeKey: 'lineHeight',
158
+ strategy: 'flat',
159
+ pathTransform: (path) => {
160
+ // typography.headline1.lineHeight -> 'headline1'
161
+ if (path[0] === 'typography' && path.length >= 2) {
162
+ return path[1];
163
+ }
164
+ return path[path.length - 1];
165
+ }
166
+ },
167
+ fontWeight: {
168
+ themeKey: 'fontWeight',
169
+ strategy: 'flat',
170
+ pathTransform: (path) => {
171
+ // typography.headline1.fontWeight -> 'headline1'
172
+ if (path[0] === 'typography' && path.length >= 2) {
173
+ return path[1];
174
+ }
175
+ return path[path.length - 1];
176
+ }
177
+ },
178
+ letterSpacing: {
179
+ themeKey: 'letterSpacing',
180
+ strategy: 'flat',
181
+ pathTransform: (path) => {
182
+ // typography.headline1.letterSpacing -> 'headline1'
183
+ if (path[0] === 'typography' && path.length >= 2) {
184
+ return path[1];
185
+ }
186
+ return path[path.length - 1];
187
+ }
188
+ }
189
+ };
190
+ /**
191
+ * Fallback mapping from logical token type → Tailwind theme key + strategy.
192
+ *
193
+ * This is used when there is no valid `category` on the token.
194
+ * It keeps the behavior close to the original formatter where routing
195
+ * was based on `type`.
196
+ *
197
+ * @public
198
+ */
199
+ exports.TOKEN_TYPE_TO_KEY_MAPPING = {
200
+ color: {
201
+ themeKey: 'colors',
202
+ strategy: 'shadeMap',
203
+ pathTransform: (path) => {
204
+ // color.light.primary.500 -> ['primary', '500'] (for light variant)
205
+ // color.dark.primary.500 -> ['primary-dark', '500'] (for dark variant)
206
+ // scheme.light.background -> ['background', 'DEFAULT'] (for light variant)
207
+ // scheme.dark.background -> ['background-dark', 'DEFAULT'] (for dark variant)
208
+ if (path[0] === 'color' && path.length >= 4) {
209
+ const variant = path[1]; // 'light' or 'dark'
210
+ const colorName = path[2]; // 'primary', 'secondary', etc.
211
+ const shade = path[3]; // '500', '100', etc.
212
+ if (variant === 'light') {
213
+ return [colorName, shade];
214
+ }
215
+ else if (variant === 'dark') {
216
+ return [`${colorName}-dark`, shade];
217
+ }
218
+ }
219
+ if (path[0] === 'scheme' && path.length >= 3) {
220
+ const variant = path[1]; // 'light' or 'dark'
221
+ const schemeName = path[2]; // 'background', 'foreground', etc.
222
+ if (variant === 'light') {
223
+ return [schemeName, 'DEFAULT'];
224
+ }
225
+ else if (variant === 'dark') {
226
+ return [`${schemeName}-dark`, 'DEFAULT'];
227
+ }
228
+ }
229
+ return path;
230
+ }
231
+ },
232
+ spacing: {
233
+ themeKey: 'spacing',
234
+ strategy: 'flat'
235
+ },
236
+ size: {
237
+ themeKey: 'spacing',
238
+ strategy: 'flat'
239
+ },
240
+ width: {
241
+ themeKey: 'width',
242
+ strategy: 'flat'
243
+ },
244
+ height: {
245
+ themeKey: 'height',
246
+ strategy: 'flat'
247
+ },
248
+ maxWidth: {
249
+ themeKey: 'maxWidth',
250
+ strategy: 'flat'
251
+ },
252
+ maxHeight: {
253
+ themeKey: 'maxHeight',
254
+ strategy: 'flat'
255
+ },
256
+ minWidth: {
257
+ themeKey: 'minWidth',
258
+ strategy: 'flat'
259
+ },
260
+ minHeight: {
261
+ themeKey: 'minHeight',
262
+ strategy: 'flat'
263
+ },
264
+ borderRadius: {
265
+ themeKey: 'borderRadius',
266
+ strategy: 'flat'
267
+ },
268
+ borderWidth: {
269
+ themeKey: 'borderWidth',
270
+ strategy: 'flat'
271
+ },
272
+ font: {
273
+ themeKey: 'fontFamily',
274
+ strategy: 'flat',
275
+ pathTransform: (path) => {
276
+ // typography.headline1.fontFamily -> 'headline1'
277
+ if (path[0] === 'typography' && path.length >= 2) {
278
+ return path[1];
279
+ }
280
+ if (path[0] === 'font' && path[1] === 'family') {
281
+ return 'DEFAULT';
282
+ }
283
+ return path[path.length - 1];
284
+ }
285
+ },
286
+ fontFamily: {
287
+ themeKey: 'fontFamily',
288
+ strategy: 'flat',
289
+ pathTransform: (path) => {
290
+ // typography.headline1.fontFamily -> 'headline1'
291
+ if (path[0] === 'typography' && path.length >= 2) {
292
+ return path[1];
293
+ }
294
+ return path[path.length - 1];
295
+ }
296
+ },
297
+ fontSize: {
298
+ themeKey: 'fontSize',
299
+ strategy: 'flat',
300
+ pathTransform: (path) => {
301
+ // typography.headline1.fontSize -> 'headline1'
302
+ if (path[0] === 'typography' && path.length >= 2) {
303
+ return path[1];
304
+ }
305
+ return path[path.length - 1];
306
+ }
307
+ },
308
+ shadow: {
309
+ themeKey: 'boxShadow',
310
+ strategy: 'shadow'
311
+ },
312
+ opacity: {
313
+ themeKey: 'opacity',
314
+ strategy: 'flat'
315
+ },
316
+ zIndex: {
317
+ themeKey: 'zIndex',
318
+ strategy: 'flat'
319
+ },
320
+ duration: {
321
+ themeKey: 'transitionDuration',
322
+ strategy: 'flat'
323
+ }
324
+ };
325
+ // #endregion
326
+ //# sourceMappingURL=TailwindPropertyMapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TailwindPropertyMapping.js","sourceRoot":"","sources":["../../../src/formats/tailwind/TailwindPropertyMapping.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AA2ClB,aAAa;AAEb,oBAAoB;AAEpB;;;;;GAKG;AACU,QAAA,qBAAqB,GAAmC;IACjE,cAAc;IACd,aAAa;IACb,OAAO;IACP,UAAU;IACV,MAAM;IACN,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,WAAW;IACX,UAAU;IACV,WAAW;IACX,UAAU;IACV,SAAS;IACT,QAAQ;IACR,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ;CACX,CAAC;AAEF,aAAa;AAEb,mBAAmB;AAEnB;;;;;;;;GAQG;AACU,QAAA,uBAAuB,GAAmD;IACnF,MAAM,EAAE;QACJ,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,UAAU;QACpB,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACpB,oEAAoE;YACpE,uEAAuE;YACvE,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;gBAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB;gBAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,+BAA+B;gBAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,qBA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AAEF,aAAa"}
@@ -0,0 +1,23 @@
1
+ import type { Config as TailwindConfig } from 'tailwindcss';
2
+ import type { TransformedToken } from 'style-dictionary/types';
3
+ /**
4
+ * Builds a TailwindConfig object (with `theme.extend`) from a list of Style-Dictionary tokens.
5
+ *
6
+ * Resolution priority per token:
7
+ *
8
+ * 1. If `token.category` is present and matches a known Tailwind theme key
9
+ * (configured in CATEGORY_TO_KEY_MAPPING), that mapping is used.
10
+ * 2. Otherwise, the token's logical type (`getType(token)`) is used with
11
+ * TOKEN_TYPE_TO_KEY_MAPPING as a fallback routing.
12
+ * 3. If neither category nor type yields a mapping, the token is skipped
13
+ * and a warning is logged.
14
+ *
15
+ * Additionally, this function validates token types up-front and logs warnings
16
+ * for unsupported types (non-blocking).
17
+ *
18
+ * @param allTokens All transformed tokens from Style-Dictionary.
19
+ * @param ignoredTokenNameSubstrings Optional substrings; tokens whose name contains any of them are ignored entirely.
20
+ * @returns A TailwindConfig where `theme.extend` contains the mapped tokens.
21
+ */
22
+ export declare function buildTailwindConfig(allTokens: ReadonlyArray<TransformedToken>, ignoredTokenNameSubstrings?: Array<string>): TailwindConfig;
23
+ //# sourceMappingURL=buildTailwindConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildTailwindConfig.d.ts","sourceRoot":"","sources":["../../../src/formats/tailwind/buildTailwindConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AA2H/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC1C,0BAA0B,GAAE,KAAK,CAAC,MAAM,CAAM,GAC/C,cAAc,CAiJhB"}