@breadstone-infrastructure/style-dictionary 0.0.174 → 0.0.175
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 +14 -0
- package/formats/tailwind/DesignTokenType.d.ts +10 -0
- package/formats/tailwind/DesignTokenType.d.ts.map +1 -0
- package/formats/tailwind/DesignTokenType.js +3 -0
- package/formats/tailwind/DesignTokenType.js.map +1 -0
- package/formats/tailwind/TailwindPropertyMapping.d.ts +66 -0
- package/formats/tailwind/TailwindPropertyMapping.d.ts.map +1 -0
- package/formats/tailwind/TailwindPropertyMapping.js +188 -0
- package/formats/tailwind/TailwindPropertyMapping.js.map +1 -0
- package/formats/tailwind/buildTailwindConfig.d.ts +23 -0
- package/formats/tailwind/buildTailwindConfig.d.ts.map +1 -0
- package/formats/tailwind/buildTailwindConfig.js +191 -0
- package/formats/tailwind/buildTailwindConfig.js.map +1 -0
- package/formats/tailwind/index.d.ts +2 -0
- package/formats/tailwind/index.d.ts.map +1 -0
- package/formats/tailwind/index.js +18 -0
- package/formats/tailwind/index.js.map +1 -0
- package/formats/tailwind/tailwindFormat.d.ts +17 -0
- package/formats/tailwind/tailwindFormat.d.ts.map +1 -0
- package/formats/tailwind/tailwindFormat.js +58 -0
- package/formats/tailwind/tailwindFormat.js.map +1 -0
- package/index.d.ts +8 -9
- package/index.d.ts.map +1 -1
- package/index.js +29 -19
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/preprocessors/{Shadow.d.ts → expandShadowPreprocessor.d.ts} +1 -1
- package/preprocessors/expandShadowPreprocessor.d.ts.map +1 -0
- package/preprocessors/{Shadow.js → expandShadowPreprocessor.js} +1 -12
- package/preprocessors/expandShadowPreprocessor.js.map +1 -0
- package/preprocessors/lint/engine/preprocessor.d.ts +12 -0
- package/preprocessors/lint/engine/preprocessor.d.ts.map +1 -0
- package/preprocessors/lint/engine/preprocessor.js +44 -0
- package/preprocessors/lint/engine/preprocessor.js.map +1 -0
- package/preprocessors/lint/engine/types.d.ts +21 -0
- package/preprocessors/lint/engine/types.d.ts.map +1 -0
- package/preprocessors/lint/engine/types.js +4 -0
- package/preprocessors/lint/engine/types.js.map +1 -0
- package/preprocessors/lint/engine/walker.d.ts +13 -0
- package/preprocessors/lint/engine/walker.d.ts.map +1 -0
- package/preprocessors/lint/engine/walker.js +30 -0
- package/preprocessors/lint/engine/walker.js.map +1 -0
- package/preprocessors/lint/index.d.ts +4 -0
- package/preprocessors/lint/index.d.ts.map +1 -0
- package/preprocessors/lint/index.js +19 -0
- package/preprocessors/lint/index.js.map +1 -0
- package/preprocessors/lint/rules/forbiddenTokenName.d.ts +25 -0
- package/preprocessors/lint/rules/forbiddenTokenName.d.ts.map +1 -0
- package/preprocessors/lint/rules/forbiddenTokenName.js +40 -0
- package/preprocessors/lint/rules/forbiddenTokenName.js.map +1 -0
- package/preprocessors/lint/rules/forbiddenValue.d.ts +31 -0
- package/preprocessors/lint/rules/forbiddenValue.d.ts.map +1 -0
- package/preprocessors/lint/rules/forbiddenValue.js +48 -0
- package/preprocessors/lint/rules/forbiddenValue.js.map +1 -0
- package/preprocessors/lint/rules/index.d.ts +9 -0
- package/preprocessors/lint/rules/index.d.ts.map +1 -0
- package/preprocessors/lint/rules/index.js +25 -0
- package/preprocessors/lint/rules/index.js.map +1 -0
- package/preprocessors/lint/rules/namingConvention.d.ts +26 -0
- package/preprocessors/lint/rules/namingConvention.d.ts.map +1 -0
- package/preprocessors/lint/rules/namingConvention.js +35 -0
- package/preprocessors/lint/rules/namingConvention.js.map +1 -0
- package/preprocessors/lint/rules/noDollarProps.d.ts +6 -0
- package/preprocessors/lint/rules/noDollarProps.d.ts.map +1 -0
- package/preprocessors/lint/rules/noDollarProps.js +27 -0
- package/preprocessors/lint/rules/noDollarProps.js.map +1 -0
- package/preprocessors/lint/rules/requireType.d.ts +6 -0
- package/preprocessors/lint/rules/requireType.d.ts.map +1 -0
- package/preprocessors/lint/rules/requireType.js +21 -0
- package/preprocessors/lint/rules/requireType.js.map +1 -0
- package/preprocessors/lint/rules/requireValue.d.ts +6 -0
- package/preprocessors/lint/rules/requireValue.d.ts.map +1 -0
- package/preprocessors/lint/rules/requireValue.js +21 -0
- package/preprocessors/lint/rules/requireValue.js.map +1 -0
- package/preprocessors/lint/rules/validType.d.ts +25 -0
- package/preprocessors/lint/rules/validType.d.ts.map +1 -0
- package/preprocessors/lint/rules/validType.js +41 -0
- package/preprocessors/lint/rules/validType.js.map +1 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.d.ts +40 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.d.ts.map +1 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.js +80 -0
- package/preprocessors/lint/rules/valueTypeByTokenType.js.map +1 -0
- package/transforms/gradientCssTransform.d.ts +3 -0
- package/transforms/gradientCssTransform.d.ts.map +1 -0
- package/transforms/{Gradient.js → gradientCssTransform.js} +4 -4
- package/transforms/gradientCssTransform.js.map +1 -0
- package/transforms/letterSpacingCalcCssTransform.d.ts +3 -0
- package/transforms/letterSpacingCalcCssTransform.d.ts.map +1 -0
- package/transforms/{LetterSpacing.js → letterSpacingCalcCssTransform.js} +4 -4
- package/transforms/letterSpacingCalcCssTransform.js.map +1 -0
- package/transforms/listScssTransform.d.ts +3 -0
- package/transforms/listScssTransform.d.ts.map +1 -0
- package/transforms/{List.js → listScssTransform.js} +4 -4
- package/transforms/listScssTransform.js.map +1 -0
- package/transforms/{QuoteString.d.ts → quoteStringTransform.d.ts} +1 -1
- package/transforms/quoteStringTransform.d.ts.map +1 -0
- package/transforms/{QuoteString.js → quoteStringTransform.js} +2 -2
- package/transforms/quoteStringTransform.js.map +1 -0
- package/transforms/{Shadow.d.ts → shadowCssTransform.d.ts} +1 -1
- package/transforms/shadowCssTransform.d.ts.map +1 -0
- package/transforms/{Shadow.js → shadowCssTransform.js} +2 -2
- package/transforms/shadowCssTransform.js.map +1 -0
- package/utilities/{Extract.d.ts → extractTokensByType.d.ts} +1 -1
- package/utilities/extractTokensByType.d.ts.map +1 -0
- package/utilities/{Extract.js → extractTokensByType.js} +2 -2
- package/utilities/extractTokensByType.js.map +1 -0
- package/formats/tailwind.d.ts +0 -3
- package/formats/tailwind.d.ts.map +0 -1
- package/formats/tailwind.js +0 -209
- package/formats/tailwind.js.map +0 -1
- package/preprocessors/Lint.d.ts +0 -3
- package/preprocessors/Lint.d.ts.map +0 -1
- package/preprocessors/Lint.js +0 -65
- package/preprocessors/Lint.js.map +0 -1
- package/preprocessors/Shadow.d.ts.map +0 -1
- package/preprocessors/Shadow.js.map +0 -1
- package/transforms/Gradient.d.ts +0 -3
- package/transforms/Gradient.d.ts.map +0 -1
- package/transforms/Gradient.js.map +0 -1
- package/transforms/LetterSpacing.d.ts +0 -3
- package/transforms/LetterSpacing.d.ts.map +0 -1
- package/transforms/LetterSpacing.js.map +0 -1
- package/transforms/List.d.ts +0 -3
- package/transforms/List.d.ts.map +0 -1
- package/transforms/List.js.map +0 -1
- package/transforms/NameSnakeUpperCase.d.ts +0 -6
- package/transforms/NameSnakeUpperCase.d.ts.map +0 -1
- package/transforms/NameSnakeUpperCase.js +0 -20
- package/transforms/NameSnakeUpperCase.js.map +0 -1
- package/transforms/QuoteString.d.ts.map +0 -1
- package/transforms/QuoteString.js.map +0 -1
- package/transforms/Shadow.d.ts.map +0 -1
- package/transforms/Shadow.js.map +0 -1
- package/utilities/Extract.d.ts.map +0 -1
- package/utilities/Extract.js.map +0 -1
- /package/utilities/{GetValue.d.ts → getValue.d.ts} +0 -0
- /package/utilities/{GetValue.d.ts.map → getValue.d.ts.map} +0 -0
- /package/utilities/{GetValue.js → getValue.js} +0 -0
- /package/utilities/{GetValue.js.map → getValue.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 0.0.174 (2025-11-28)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Add utility classes and methods for number, string, time, version, and process handling ([941d93259a](https://github.com/RueDeRennes/mosaik/commit/941d93259a))
|
|
6
|
+
- **tailwind:** add Joy Tailwind plugin with configuration options and token exposure ([72bbf954a8](https://github.com/RueDeRennes/mosaik/commit/72bbf954a8))
|
|
7
|
+
- **svg:** add SVG to path conversion utility ([f2f74da782](https://github.com/RueDeRennes/mosaik/commit/f2f74da782))
|
|
8
|
+
|
|
9
|
+
### 🩹 Fixes
|
|
10
|
+
|
|
11
|
+
- remove unused elevation2 light token and update release version in package.json ([9a63ade438](https://github.com/RueDeRennes/mosaik/commit/9a63ade438))
|
|
12
|
+
- remove unused dependency 'element-to-path' from yarn.lock ([df86dc94de](https://github.com/RueDeRennes/mosaik/commit/df86dc94de))
|
|
13
|
+
- add newline at end of package.json ([73db364d3c](https://github.com/RueDeRennes/mosaik/commit/73db364d3c))
|
|
14
|
+
|
|
1
15
|
## 0.0.173 (2025-11-26)
|
|
2
16
|
|
|
3
17
|
### 🚀 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 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTokenType.js","sourceRoot":"","sources":["../../../src/formats/tailwind/DesignTokenType.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
* - "flat": Direct mapping, e.g. spacing, fontSize.
|
|
13
|
+
* Example:
|
|
14
|
+
* path: ['layout-header-height'] -> spacing['layout-header-height']
|
|
15
|
+
* - "nested": Nested mapping based on token path segments.
|
|
16
|
+
* Example:
|
|
17
|
+
* path: ['layout', 'header', 'height'] -> spacing.layout.header.height
|
|
18
|
+
* - "shadeMap": Mapping for color shades.
|
|
19
|
+
* Example:
|
|
20
|
+
* path: ['brand', '500'] -> colors.brand['500']
|
|
21
|
+
* - "shadow": Mapping for shadow tokens.
|
|
22
|
+
* Example:
|
|
23
|
+
* path: ['card-shadow'] -> boxShadow['card-shadow']
|
|
24
|
+
*
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
type MappingStrategy = 'flat' | 'nested' | 'shadeMap' | 'shadow';
|
|
28
|
+
/**
|
|
29
|
+
* Internal mapping definition: for a given Tailwind theme key,
|
|
30
|
+
* which mapping strategy to apply when inserting tokens.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export interface IKeyMapping {
|
|
35
|
+
readonly themeKey: TailwindThemeKey;
|
|
36
|
+
readonly strategy: MappingStrategy;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Set of supported design token types for validation.
|
|
40
|
+
* Used only for logging; unsupported types are skipped.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare const SUPPORTED_TOKEN_TYPES: ReadonlyArray<DesignTokenType>;
|
|
45
|
+
/**
|
|
46
|
+
* Maps token-level `category` values (which MUST match Tailwind theme keys)
|
|
47
|
+
* to Tailwind theme keys and the corresponding mapping strategy.
|
|
48
|
+
*
|
|
49
|
+
* This is the primary mapping: if a token specifies a `category` and it is
|
|
50
|
+
* found here, it is used directly.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export declare const CATEGORY_TO_KEY_MAPPING: Partial<Record<TailwindThemeKey, IKeyMapping>>;
|
|
55
|
+
/**
|
|
56
|
+
* Fallback mapping from logical token type → Tailwind theme key + strategy.
|
|
57
|
+
*
|
|
58
|
+
* This is used when there is no valid `category` on the token.
|
|
59
|
+
* It keeps the behavior close to the original formatter where routing
|
|
60
|
+
* was based on `type`.
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
export declare const TOKEN_TYPE_TO_KEY_MAPPING: Partial<Record<DesignTokenType, IKeyMapping>>;
|
|
65
|
+
export {};
|
|
66
|
+
//# 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;AAIzD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;;;GAiBG;AACH,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACtC;AA+BD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,eAAe,CAsBhE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAiDlF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,CAqFnF,CAAC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Set of supported design token types for validation.
|
|
7
|
+
* Used only for logging; unsupported types are skipped.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
exports.SUPPORTED_TOKEN_TYPES = [
|
|
12
|
+
'borderRadius',
|
|
13
|
+
'borderWidth',
|
|
14
|
+
'color',
|
|
15
|
+
'duration',
|
|
16
|
+
'font',
|
|
17
|
+
'fontFamily',
|
|
18
|
+
'fontSize',
|
|
19
|
+
'fontWeight',
|
|
20
|
+
'height',
|
|
21
|
+
'letterSpacing',
|
|
22
|
+
'lineHeight',
|
|
23
|
+
'maxHeight',
|
|
24
|
+
'maxWidth',
|
|
25
|
+
'minHeight',
|
|
26
|
+
'minWidth',
|
|
27
|
+
'opacity',
|
|
28
|
+
'shadow',
|
|
29
|
+
'size',
|
|
30
|
+
'spacing',
|
|
31
|
+
'width',
|
|
32
|
+
'zIndex'
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Maps token-level `category` values (which MUST match Tailwind theme keys)
|
|
36
|
+
* to Tailwind theme keys and the corresponding mapping strategy.
|
|
37
|
+
*
|
|
38
|
+
* This is the primary mapping: if a token specifies a `category` and it is
|
|
39
|
+
* found here, it is used directly.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
exports.CATEGORY_TO_KEY_MAPPING = {
|
|
44
|
+
colors: {
|
|
45
|
+
themeKey: 'colors',
|
|
46
|
+
strategy: 'nested'
|
|
47
|
+
},
|
|
48
|
+
spacing: {
|
|
49
|
+
themeKey: 'spacing',
|
|
50
|
+
strategy: 'flat'
|
|
51
|
+
},
|
|
52
|
+
width: {
|
|
53
|
+
themeKey: 'width',
|
|
54
|
+
strategy: 'flat'
|
|
55
|
+
},
|
|
56
|
+
height: {
|
|
57
|
+
themeKey: 'height',
|
|
58
|
+
strategy: 'flat'
|
|
59
|
+
},
|
|
60
|
+
fontFamily: {
|
|
61
|
+
themeKey: 'fontFamily',
|
|
62
|
+
strategy: 'flat'
|
|
63
|
+
},
|
|
64
|
+
fontSize: {
|
|
65
|
+
themeKey: 'fontSize',
|
|
66
|
+
strategy: 'flat'
|
|
67
|
+
},
|
|
68
|
+
boxShadow: {
|
|
69
|
+
themeKey: 'boxShadow',
|
|
70
|
+
strategy: 'shadow'
|
|
71
|
+
},
|
|
72
|
+
opacity: {
|
|
73
|
+
themeKey: 'opacity',
|
|
74
|
+
strategy: 'flat'
|
|
75
|
+
},
|
|
76
|
+
borderRadius: {
|
|
77
|
+
themeKey: 'borderRadius',
|
|
78
|
+
strategy: 'flat'
|
|
79
|
+
},
|
|
80
|
+
borderWidth: {
|
|
81
|
+
themeKey: 'borderWidth',
|
|
82
|
+
strategy: 'flat'
|
|
83
|
+
},
|
|
84
|
+
zIndex: {
|
|
85
|
+
themeKey: 'zIndex',
|
|
86
|
+
strategy: 'flat'
|
|
87
|
+
},
|
|
88
|
+
transitionDuration: {
|
|
89
|
+
themeKey: 'transitionDuration',
|
|
90
|
+
strategy: 'flat'
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Fallback mapping from logical token type → Tailwind theme key + strategy.
|
|
95
|
+
*
|
|
96
|
+
* This is used when there is no valid `category` on the token.
|
|
97
|
+
* It keeps the behavior close to the original formatter where routing
|
|
98
|
+
* was based on `type`.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
exports.TOKEN_TYPE_TO_KEY_MAPPING = {
|
|
103
|
+
color: {
|
|
104
|
+
themeKey: 'colors',
|
|
105
|
+
strategy: 'nested'
|
|
106
|
+
},
|
|
107
|
+
spacing: {
|
|
108
|
+
themeKey: 'spacing',
|
|
109
|
+
strategy: 'flat'
|
|
110
|
+
},
|
|
111
|
+
size: {
|
|
112
|
+
themeKey: 'spacing',
|
|
113
|
+
strategy: 'flat'
|
|
114
|
+
},
|
|
115
|
+
width: {
|
|
116
|
+
themeKey: 'width',
|
|
117
|
+
strategy: 'flat'
|
|
118
|
+
},
|
|
119
|
+
height: {
|
|
120
|
+
themeKey: 'height',
|
|
121
|
+
strategy: 'flat'
|
|
122
|
+
},
|
|
123
|
+
maxWidth: {
|
|
124
|
+
themeKey: 'maxWidth',
|
|
125
|
+
strategy: 'flat'
|
|
126
|
+
},
|
|
127
|
+
maxHeight: {
|
|
128
|
+
themeKey: 'maxHeight',
|
|
129
|
+
strategy: 'flat'
|
|
130
|
+
},
|
|
131
|
+
minWidth: {
|
|
132
|
+
themeKey: 'minWidth',
|
|
133
|
+
strategy: 'flat'
|
|
134
|
+
},
|
|
135
|
+
minHeight: {
|
|
136
|
+
themeKey: 'minHeight',
|
|
137
|
+
strategy: 'flat'
|
|
138
|
+
},
|
|
139
|
+
borderRadius: {
|
|
140
|
+
themeKey: 'borderRadius',
|
|
141
|
+
strategy: 'flat'
|
|
142
|
+
},
|
|
143
|
+
borderWidth: {
|
|
144
|
+
themeKey: 'borderWidth',
|
|
145
|
+
strategy: 'flat'
|
|
146
|
+
},
|
|
147
|
+
font: {
|
|
148
|
+
themeKey: 'fontFamily',
|
|
149
|
+
strategy: 'flat'
|
|
150
|
+
},
|
|
151
|
+
fontFamily: {
|
|
152
|
+
themeKey: 'fontFamily',
|
|
153
|
+
strategy: 'flat'
|
|
154
|
+
},
|
|
155
|
+
fontSize: {
|
|
156
|
+
themeKey: 'fontSize',
|
|
157
|
+
strategy: 'flat'
|
|
158
|
+
},
|
|
159
|
+
fontWeight: {
|
|
160
|
+
themeKey: 'fontWeight',
|
|
161
|
+
strategy: 'flat'
|
|
162
|
+
},
|
|
163
|
+
lineHeight: {
|
|
164
|
+
themeKey: 'lineHeight',
|
|
165
|
+
strategy: 'flat'
|
|
166
|
+
},
|
|
167
|
+
letterSpacing: {
|
|
168
|
+
themeKey: 'letterSpacing',
|
|
169
|
+
strategy: 'flat'
|
|
170
|
+
},
|
|
171
|
+
shadow: {
|
|
172
|
+
themeKey: 'boxShadow',
|
|
173
|
+
strategy: 'shadow'
|
|
174
|
+
},
|
|
175
|
+
opacity: {
|
|
176
|
+
themeKey: 'opacity',
|
|
177
|
+
strategy: 'flat'
|
|
178
|
+
},
|
|
179
|
+
zIndex: {
|
|
180
|
+
themeKey: 'zIndex',
|
|
181
|
+
strategy: 'flat'
|
|
182
|
+
},
|
|
183
|
+
duration: {
|
|
184
|
+
themeKey: 'transitionDuration',
|
|
185
|
+
strategy: 'flat'
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=TailwindPropertyMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TailwindPropertyMapping.js","sourceRoot":"","sources":["../../../src/formats/tailwind/TailwindPropertyMapping.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AA0ElB;;;;;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;;;;;;;;GAQG;AACU,QAAA,uBAAuB,GAAmD;IACnF,MAAM,EAAE;QACJ,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,QAAQ;KACrB;IACD,OAAO,EAAE;QACL,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,MAAM;KACnB;IACD,KAAK,EAAE;QACH,QAAQ,EAAE,OAAO;QACjB,QAAQ,EAAE,MAAM;KACnB;IACD,MAAM,EAAE;QACJ,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,MAAM;KACnB;IACD,UAAU,EAAE;QACR,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACN,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,MAAM;KACnB;IACD,SAAS,EAAE;QACP,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,QAAQ;KACrB;IACD,OAAO,EAAE;QACL,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,MAAM;KACnB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,cAAc;QACxB,QAAQ,EAAE,MAAM;KACn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B;IACD,QAAQ,EAAE;QACN,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,MAAM;KACnB;IACD,UAAU,EAAE;QACR,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,MAAM;KACnB;IACD,UAAU,EAAE;QACR,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,MAAM;KACnB;IACD,aAAa,EAAE;QACX,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,MAAM;KACnB;IACD,MAAM,EAAE;QACJ,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,QAAQ;KACrB;IACD,OAAO,EAAE;QACL,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,MAAM;KACnB;IACD,MAAM,EAAE;QACJ,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACN,QAAQ,EAAE,oBAAoB;QAC9B,QAAQ,EAAE,MAAM;KACnB;CACJ,CAAC"}
|
|
@@ -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;AAyH/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC1C,0BAA0B,GAAE,KAAK,CAAC,MAAM,CAAM,GAC/C,cAAc,CAqEhB"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.buildTailwindConfig = buildTailwindConfig;
|
|
5
|
+
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
6
|
+
const getType_js_1 = require("../../utilities/getType.js");
|
|
7
|
+
const getValue_js_1 = require("../../utilities/getValue.js");
|
|
8
|
+
const TailwindPropertyMapping_js_1 = require("./TailwindPropertyMapping.js");
|
|
9
|
+
// #endregion
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes a raw token value into a JS value suitable for a Tailwind config.
|
|
12
|
+
*
|
|
13
|
+
* @param value Raw token value.
|
|
14
|
+
* @returns Normalized value (string, number, or array) that can be used in Tailwind config.
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
function normalizeValue(value) {
|
|
18
|
+
if (Array.isArray(value)) {
|
|
19
|
+
return value.map((v) => String(v));
|
|
20
|
+
}
|
|
21
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
return String(value);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Deeply sets a value on an object via a path array. Similar to lodash.set.
|
|
28
|
+
*
|
|
29
|
+
* @param obj Target object.
|
|
30
|
+
* @param path Array of keys.
|
|
31
|
+
* @param value Value to set.
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
function deepSet(obj, path, value) {
|
|
35
|
+
let current = obj;
|
|
36
|
+
for (let i = 0; i < path.length; i++) {
|
|
37
|
+
const key = path[i];
|
|
38
|
+
if (i === path.length - 1) {
|
|
39
|
+
current[key] = value;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
if (!current[key] || typeof current[key] !== 'object') {
|
|
43
|
+
current[key] = {};
|
|
44
|
+
}
|
|
45
|
+
current = current[key];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validates that tokens use supported logical types and logs warnings
|
|
51
|
+
* for those that cannot be mapped to Tailwind.
|
|
52
|
+
*
|
|
53
|
+
* This does not throw, it only logs — matching the original behavior.
|
|
54
|
+
*
|
|
55
|
+
* @param tokens All transformed tokens.
|
|
56
|
+
* @param ignoredNames Optional substrings; tokens whose name contains any of them are ignored.
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
function validateTokenTypes(tokens, ignoredNames = []) {
|
|
60
|
+
const supported = new Set(TailwindPropertyMapping_js_1.SUPPORTED_TOKEN_TYPES);
|
|
61
|
+
tokens
|
|
62
|
+
.filter((token) => {
|
|
63
|
+
const lower = token.name.toLowerCase();
|
|
64
|
+
return !ignoredNames.some((substr) => lower.includes(substr.toLowerCase()));
|
|
65
|
+
})
|
|
66
|
+
.forEach((token) => {
|
|
67
|
+
const type = (0, getType_js_1.getType)(token);
|
|
68
|
+
if (!type) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!supported.has(type)) {
|
|
72
|
+
console.warn(`${(0, utilities_1.symbol)('warning')} ${(0, utilities_1.yellow)(`Type "${type}" is not supported in Tailwind builder for token "${token.path.join('.')}:${token.name}".`)}`);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolves the mapping for a token in three steps:
|
|
78
|
+
*
|
|
79
|
+
* 1. If a `category` is present and mapped, use that mapping.
|
|
80
|
+
* 2. Otherwise, fall back to token type via `getType` and `TOKEN_TYPE_TO_KEY_MAPPING`.
|
|
81
|
+
* 3. If neither yields a mapping, return undefined (caller will log and skip).
|
|
82
|
+
*
|
|
83
|
+
* @param token The token to resolve mapping for.
|
|
84
|
+
* @returns An IKeyMapping when resolvable, otherwise undefined.
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
function resolveMappingForToken(token) {
|
|
88
|
+
const rawCategory = token.category;
|
|
89
|
+
// 1. Category-based mapping (if present)
|
|
90
|
+
if (rawCategory) {
|
|
91
|
+
const categoryKey = rawCategory;
|
|
92
|
+
const byCategory = TailwindPropertyMapping_js_1.CATEGORY_TO_KEY_MAPPING[categoryKey];
|
|
93
|
+
if (byCategory) {
|
|
94
|
+
return byCategory;
|
|
95
|
+
}
|
|
96
|
+
// Category was provided but not recognized; we fall back to type-based logic.
|
|
97
|
+
console.warn(`${(0, utilities_1.symbol)('warning')} ${(0, utilities_1.yellow)(`Token "${token.name}" specifies category "${rawCategory}", which is not mapped. Falling back to token type.`)}`);
|
|
98
|
+
}
|
|
99
|
+
// 2. Type-based mapping
|
|
100
|
+
const type = (0, getType_js_1.getType)(token);
|
|
101
|
+
if (type) {
|
|
102
|
+
const byType = TailwindPropertyMapping_js_1.TOKEN_TYPE_TO_KEY_MAPPING[type];
|
|
103
|
+
if (byType) {
|
|
104
|
+
return byType;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// 3. Nothing found: no mapping available
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Builds a TailwindConfig object (with `theme.extend`) from a list of Style-Dictionary tokens.
|
|
112
|
+
*
|
|
113
|
+
* Resolution priority per token:
|
|
114
|
+
*
|
|
115
|
+
* 1. If `token.category` is present and matches a known Tailwind theme key
|
|
116
|
+
* (configured in CATEGORY_TO_KEY_MAPPING), that mapping is used.
|
|
117
|
+
* 2. Otherwise, the token's logical type (`getType(token)`) is used with
|
|
118
|
+
* TOKEN_TYPE_TO_KEY_MAPPING as a fallback routing.
|
|
119
|
+
* 3. If neither category nor type yields a mapping, the token is skipped
|
|
120
|
+
* and a warning is logged.
|
|
121
|
+
*
|
|
122
|
+
* Additionally, this function validates token types up-front and logs warnings
|
|
123
|
+
* for unsupported types (non-blocking).
|
|
124
|
+
*
|
|
125
|
+
* @param allTokens All transformed tokens from Style-Dictionary.
|
|
126
|
+
* @param ignoredTokenNameSubstrings Optional substrings; tokens whose name contains any of them are ignored entirely.
|
|
127
|
+
* @returns A TailwindConfig where `theme.extend` contains the mapped tokens.
|
|
128
|
+
*/
|
|
129
|
+
function buildTailwindConfig(allTokens, ignoredTokenNameSubstrings = []) {
|
|
130
|
+
// Pre-validation of token types (non-blocking, only logs)
|
|
131
|
+
validateTokenTypes(allTokens, ignoredTokenNameSubstrings);
|
|
132
|
+
const config = { theme: { extend: {} } };
|
|
133
|
+
for (const token of allTokens) {
|
|
134
|
+
const lowerName = token.name.toLowerCase();
|
|
135
|
+
if (ignoredTokenNameSubstrings.some((substr) => lowerName.includes(substr.toLowerCase()))) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const mapping = resolveMappingForToken(token);
|
|
139
|
+
if (!mapping) {
|
|
140
|
+
console.warn(`${(0, utilities_1.symbol)('warning')} ${(0, utilities_1.yellow)(`Token "${token.path.join('.')}:${token.name}" cannot be mapped to Tailwind (no valid category or type mapping). Skipping.`)}`);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const { themeKey, strategy } = mapping;
|
|
144
|
+
if (!config.theme?.extend) {
|
|
145
|
+
if (!config.theme) {
|
|
146
|
+
config.theme = {};
|
|
147
|
+
config.theme.extend = {};
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
config.theme.extend = {};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const extend = config.theme.extend;
|
|
154
|
+
// eslint-disable-next-line no-multi-assign
|
|
155
|
+
const section = extend[themeKey] ??= {};
|
|
156
|
+
const rawValue = (0, getValue_js_1.getValue)(token);
|
|
157
|
+
const normalized = normalizeValue(rawValue);
|
|
158
|
+
const path = token.path.length > 0 ? token.path : [token.name];
|
|
159
|
+
switch (strategy) {
|
|
160
|
+
case 'flat': {
|
|
161
|
+
const key = path.join('.');
|
|
162
|
+
section[key] = normalized;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
case 'nested': {
|
|
166
|
+
deepSet(section, path, normalized);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case 'shadeMap': {
|
|
170
|
+
// Example:
|
|
171
|
+
// path: ['brand', '500'] -> colors.brand['500']
|
|
172
|
+
const [group, ...rest] = path;
|
|
173
|
+
const shadeKey = rest.join('.') || 'DEFAULT';
|
|
174
|
+
section[group] ??= {};
|
|
175
|
+
section[group][shadeKey] = normalized;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case 'shadow': {
|
|
179
|
+
const key = path.join('-');
|
|
180
|
+
section[key] = Array.isArray(normalized) ? normalized.map((v) => String(v)).join(', ') : String(normalized);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
default: {
|
|
184
|
+
console.warn(`${(0, utilities_1.symbol)('warning')} ${(0, utilities_1.yellow)(`Unsupported mapping strategy "${String(strategy)}" for token "${token.name}".`)}`);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return config;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=buildTailwindConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTailwindConfig.js","sourceRoot":"","sources":["../../../src/formats/tailwind/buildTailwindConfig.ts"],"names":[],"mappings":";AAAA,kBAAkB;;AA+IlB,kDAwEC;AAnND,oEAAsE;AACtE,2DAAqD;AACrD,6DAAuD;AAEvD,6EAAkK;AAElK,aAAa;AAEb;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,KAAc;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,OAAO,CAAC,GAAwB,EAAE,IAAmB,EAAE,KAAc;IAC1E,IAAI,OAAO,GAAG,GAAG,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,OAAO,CAAC,GAAG,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ot":"","sources":["../../../src/formats/tailwind/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./tailwindFormat"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formats/tailwind/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Format } from 'style-dictionary/types';
|
|
2
|
+
/**
|
|
3
|
+
* Style-Dictionary format that outputs a CommonJS `tailwind.config.js`,
|
|
4
|
+
* exporting the theme configuration as `module.exports = …`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const tailwindConfigCjsFormat: Format;
|
|
7
|
+
/**
|
|
8
|
+
* Style-Dictionary format that outputs an ESM `tailwind.config.mjs`,
|
|
9
|
+
* exporting the theme configuration as `export default { … }`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const tailwindConfigEsmFormat: Format;
|
|
12
|
+
/**
|
|
13
|
+
* Style-Dictionary format that generates a full Tailwind plugin JS module.
|
|
14
|
+
* The output exports a config + plugin registration — no manual imports needed.
|
|
15
|
+
*/
|
|
16
|
+
export declare const tailwindPluginJsFormat: Format;
|
|
17
|
+
//# sourceMappingURL=tailwindFormat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwindFormat.d.ts","sourceRoot":"","sources":["../../../src/formats/tailwind/tailwindFormat.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,MAAM,EAAgB,MAAM,wBAAwB,CAAC;AAKvF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,MASrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,MASrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,MA4BpC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.tailwindPluginJsFormat = exports.tailwindConfigEsmFormat = exports.tailwindConfigCjsFormat = void 0;
|
|
5
|
+
const buildTailwindConfig_js_1 = require("./buildTailwindConfig.js");
|
|
6
|
+
// #endregion
|
|
7
|
+
/**
|
|
8
|
+
* Style-Dictionary format that outputs a CommonJS `tailwind.config.js`,
|
|
9
|
+
* exporting the theme configuration as `module.exports = …`.
|
|
10
|
+
*/
|
|
11
|
+
exports.tailwindConfigCjsFormat = {
|
|
12
|
+
name: 'tailwind/config/cjs',
|
|
13
|
+
format({ dictionary, options }) {
|
|
14
|
+
const config = (0, buildTailwindConfig_js_1.buildTailwindConfig)(dictionary.allTokens, options.ignoredTokenNames ?? []);
|
|
15
|
+
return `module.exports = ${JSON.stringify(config, null, 2)};\n`;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Style-Dictionary format that outputs an ESM `tailwind.config.mjs`,
|
|
20
|
+
* exporting the theme configuration as `export default { … }`.
|
|
21
|
+
*/
|
|
22
|
+
exports.tailwindConfigEsmFormat = {
|
|
23
|
+
name: 'tailwind/config/esm',
|
|
24
|
+
format({ dictionary, options }) {
|
|
25
|
+
const config = (0, buildTailwindConfig_js_1.buildTailwindConfig)(dictionary.allTokens, options.ignoredTokenNames ?? []);
|
|
26
|
+
return `export default ${JSON.stringify(config, null, 2)};\n`;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Style-Dictionary format that generates a full Tailwind plugin JS module.
|
|
31
|
+
* The output exports a config + plugin registration — no manual imports needed.
|
|
32
|
+
*/
|
|
33
|
+
exports.tailwindPluginJsFormat = {
|
|
34
|
+
name: 'tailwind/plugin',
|
|
35
|
+
format({ dictionary, options }) {
|
|
36
|
+
const config = (0, buildTailwindConfig_js_1.buildTailwindConfig)(dictionary.allTokens, options.ignoredTokenNames ?? []);
|
|
37
|
+
const themeSection = JSON.stringify(config.theme, null, 2);
|
|
38
|
+
return `${`
|
|
39
|
+
const plugin = require('tailwindcss/plugin');
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
theme: ${themeSection},
|
|
43
|
+
plugins: [
|
|
44
|
+
plugin(function({ addUtilities, theme, e }) {
|
|
45
|
+
const shadows = theme('boxShadow') || {};
|
|
46
|
+
const utils = Object.entries(shadows).reduce((acc, [key, value]) => {
|
|
47
|
+
acc['.' + e('shadow-' + key)] = { boxShadow: value };
|
|
48
|
+
return acc;
|
|
49
|
+
}, {});
|
|
50
|
+
addUtilities(utils, ['responsive', 'hover', 'focus']);
|
|
51
|
+
// You can extend with more utilities here (spacing, radii, etc.)
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
`.trim()}\n`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL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