@breadstone-infrastructure/style-dictionary 0.0.205 → 0.0.209
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 +182 -0
- package/formats/index.d.ts +3 -0
- package/formats/index.d.ts.map +1 -0
- package/formats/{tailwind/index.js → index.js} +2 -2
- package/formats/index.js.map +1 -0
- package/formats/tailwind/v3/DesignTokenType.d.ts.map +1 -0
- package/formats/tailwind/v3/DesignTokenType.js.map +1 -0
- package/formats/tailwind/{TailwindPropertyMapping.d.ts → v3/TailwindV3PropertyMapping.d.ts} +15 -15
- package/formats/tailwind/v3/TailwindV3PropertyMapping.d.ts.map +1 -0
- package/formats/tailwind/{TailwindPropertyMapping.js → v3/TailwindV3PropertyMapping.js} +6 -6
- package/formats/tailwind/v3/TailwindV3PropertyMapping.js.map +1 -0
- package/formats/tailwind/{buildTailwindConfig.d.ts → v3/buildTailwindV3Config.d.ts} +5 -4
- package/formats/tailwind/v3/buildTailwindV3Config.d.ts.map +1 -0
- package/formats/tailwind/{buildTailwindConfig.js → v3/buildTailwindV3Config.js} +19 -17
- package/formats/tailwind/v3/buildTailwindV3Config.js.map +1 -0
- package/formats/tailwind/v3/index.d.ts +5 -0
- package/formats/tailwind/v3/index.d.ts.map +1 -0
- package/formats/tailwind/v3/index.js +21 -0
- package/formats/tailwind/v3/index.js.map +1 -0
- package/formats/tailwind/v3/tailwindV3Format.d.ts +32 -0
- package/formats/tailwind/v3/tailwindV3Format.d.ts.map +1 -0
- package/formats/tailwind/v3/tailwindV3Format.js +123 -0
- package/formats/tailwind/v3/tailwindV3Format.js.map +1 -0
- package/formats/tailwind/v4/DesignTokenType.d.ts +10 -0
- package/formats/tailwind/v4/DesignTokenType.d.ts.map +1 -0
- package/formats/tailwind/v4/DesignTokenType.js +3 -0
- package/formats/tailwind/v4/DesignTokenType.js.map +1 -0
- package/formats/tailwind/v4/TailwindV4PropertyMapping.d.ts +45 -0
- package/formats/tailwind/v4/TailwindV4PropertyMapping.d.ts.map +1 -0
- package/formats/tailwind/v4/TailwindV4PropertyMapping.js +322 -0
- package/formats/tailwind/v4/TailwindV4PropertyMapping.js.map +1 -0
- package/formats/tailwind/v4/buildTailwindV4Config.d.ts +83 -0
- package/formats/tailwind/v4/buildTailwindV4Config.d.ts.map +1 -0
- package/formats/tailwind/v4/buildTailwindV4Config.js +338 -0
- package/formats/tailwind/v4/buildTailwindV4Config.js.map +1 -0
- package/formats/tailwind/v4/buildTailwindV4Theme.d.ts +71 -0
- package/formats/tailwind/v4/buildTailwindV4Theme.d.ts.map +1 -0
- package/formats/tailwind/v4/buildTailwindV4Theme.js +247 -0
- package/formats/tailwind/v4/buildTailwindV4Theme.js.map +1 -0
- package/formats/tailwind/v4/index.d.ts +4 -0
- package/formats/tailwind/v4/index.d.ts.map +1 -0
- package/formats/tailwind/v4/index.js +20 -0
- package/formats/tailwind/v4/index.js.map +1 -0
- package/formats/tailwind/v4/tailwindV4Format.d.ts +119 -0
- package/formats/tailwind/v4/tailwindV4Format.d.ts.map +1 -0
- package/formats/tailwind/v4/tailwindV4Format.js +169 -0
- package/formats/tailwind/v4/tailwindV4Format.js.map +1 -0
- package/index.d.ts +3 -9
- package/index.d.ts.map +1 -1
- package/index.js +3 -17
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/preprocessors/index.d.ts +3 -0
- package/preprocessors/index.d.ts.map +1 -0
- package/preprocessors/index.js +19 -0
- package/preprocessors/index.js.map +1 -0
- package/transforms/index.d.ts +7 -0
- package/transforms/index.d.ts.map +1 -0
- package/transforms/index.js +23 -0
- package/transforms/index.js.map +1 -0
- package/formats/tailwind/DesignTokenType.d.ts.map +0 -1
- package/formats/tailwind/DesignTokenType.js.map +0 -1
- package/formats/tailwind/TailwindPropertyMapping.d.ts.map +0 -1
- package/formats/tailwind/TailwindPropertyMapping.js.map +0 -1
- package/formats/tailwind/buildTailwindConfig.d.ts.map +0 -1
- package/formats/tailwind/buildTailwindConfig.js.map +0 -1
- package/formats/tailwind/index.d.ts +0 -3
- package/formats/tailwind/index.d.ts.map +0 -1
- package/formats/tailwind/index.js.map +0 -1
- package/formats/tailwind/tailwindFormat.d.ts +0 -13
- package/formats/tailwind/tailwindFormat.d.ts.map +0 -1
- package/formats/tailwind/tailwindFormat.js +0 -57
- package/formats/tailwind/tailwindFormat.js.map +0 -1
- package/formats/tailwind/tailwindFormat2.d.ts +0 -13
- package/formats/tailwind/tailwindFormat2.d.ts.map +0 -1
- package/formats/tailwind/tailwindFormat2.js +0 -65
- package/formats/tailwind/tailwindFormat2.js.map +0 -1
- /package/formats/tailwind/{DesignTokenType.d.ts → v3/DesignTokenType.d.ts} +0 -0
- /package/formats/tailwind/{DesignTokenType.js → v3/DesignTokenType.js} +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.tailwindV3PluginTsFormat = exports.tailwindV3PresetTsFormat = exports.tailwindV3PluginFormat = exports.tailwindV3PresetFormat = void 0;
|
|
5
|
+
const buildTailwindV3Config_js_1 = require("./buildTailwindV3Config.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
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
exports.tailwindV3PresetFormat = {
|
|
14
|
+
name: 'tailwind/v3/preset/js',
|
|
15
|
+
format({ dictionary, options }) {
|
|
16
|
+
const config = (0, buildTailwindV3Config_js_1.buildTailwindV3Config)(dictionary.allTokens, options.ignoredTokenNames ?? []);
|
|
17
|
+
const header = `// ------------------------------------------------------------------------------
|
|
18
|
+
// <auto-generated>
|
|
19
|
+
// This code was generated by a tool.
|
|
20
|
+
// Changes to this file may cause incorrect behavior and will be lost if
|
|
21
|
+
// the code is regenerated.
|
|
22
|
+
// </auto-generated>
|
|
23
|
+
// ------------------------------------------------------------------------------`;
|
|
24
|
+
return `${header}\n\nmodule.exports = ${JSON.stringify(config, null, 2)};\n`;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Style-Dictionary format that generates a Tailwind v3 plugin module.
|
|
29
|
+
* Exports a proper Tailwind CSS plugin that can be added to the plugins array
|
|
30
|
+
* in tailwind.config.js.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
exports.tailwindV3PluginFormat = {
|
|
35
|
+
name: 'tailwind/v3/plugin/js',
|
|
36
|
+
format({ dictionary, options }) {
|
|
37
|
+
const config = (0, buildTailwindV3Config_js_1.buildTailwindV3Config)(dictionary.allTokens, options.ignoredTokenNames ?? []);
|
|
38
|
+
const themeSection = JSON.stringify(config.theme, null, 2);
|
|
39
|
+
const header = `// ------------------------------------------------------------------------------
|
|
40
|
+
// <auto-generated>
|
|
41
|
+
// This code was generated by a tool.
|
|
42
|
+
// Changes to this file may cause incorrect behavior and will be lost if
|
|
43
|
+
// the code is regenerated.
|
|
44
|
+
// </auto-generated>
|
|
45
|
+
// ------------------------------------------------------------------------------`;
|
|
46
|
+
return `${header}\n\nconst plugin = require('tailwindcss/plugin');
|
|
47
|
+
|
|
48
|
+
module.exports = plugin(function({ addUtilities, theme, e }) {
|
|
49
|
+
// Optional: Add custom utilities here
|
|
50
|
+
// Example: Custom shadow utilities
|
|
51
|
+
// const shadows = theme('boxShadow') || {};
|
|
52
|
+
// const shadowUtils = Object.entries(shadows).reduce((acc, [key, value]) => {
|
|
53
|
+
// acc['.' + e('shadow-' + key)] = { boxShadow: value };
|
|
54
|
+
// return acc;
|
|
55
|
+
// }, {});
|
|
56
|
+
// addUtilities(shadowUtils);
|
|
57
|
+
}, ${themeSection});
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Style-Dictionary format that outputs a TypeScript Tailwind v3 preset,
|
|
63
|
+
* exporting the theme configuration with type annotations.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
exports.tailwindV3PresetTsFormat = {
|
|
68
|
+
name: 'tailwind/v3/preset/ts',
|
|
69
|
+
format({ dictionary, options }) {
|
|
70
|
+
const config = (0, buildTailwindV3Config_js_1.buildTailwindV3Config)(dictionary.allTokens, options.ignoredTokenNames ?? []);
|
|
71
|
+
const header = `// ------------------------------------------------------------------------------
|
|
72
|
+
// <auto-generated>
|
|
73
|
+
// This code was generated by a tool.
|
|
74
|
+
// Changes to this file may cause incorrect behavior and will be lost if
|
|
75
|
+
// the code is regenerated.
|
|
76
|
+
// </auto-generated>
|
|
77
|
+
// ------------------------------------------------------------------------------`;
|
|
78
|
+
return `
|
|
79
|
+
${header}
|
|
80
|
+
|
|
81
|
+
import { Config } from 'tailwindcss';
|
|
82
|
+
|
|
83
|
+
module.exports = ${JSON.stringify(config, null, 2)} satisfies Partial<Config>;
|
|
84
|
+
`.trim();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Style-Dictionary format that generates a TypeScript Tailwind v3 plugin module.
|
|
89
|
+
* Exports a proper Tailwind CSS plugin that can be added to the plugins array
|
|
90
|
+
* in tailwind.config.ts.
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
exports.tailwindV3PluginTsFormat = {
|
|
95
|
+
name: 'tailwind/v3/plugin/ts',
|
|
96
|
+
format({ dictionary, options }) {
|
|
97
|
+
const config = (0, buildTailwindV3Config_js_1.buildTailwindV3Config)(dictionary.allTokens, options.ignoredTokenNames ?? []);
|
|
98
|
+
const themeSection = JSON.stringify(config.theme, null, 2);
|
|
99
|
+
const header = `// ------------------------------------------------------------------------------
|
|
100
|
+
// <auto-generated>
|
|
101
|
+
// This code was generated by a tool.
|
|
102
|
+
// Changes to this file may cause incorrect behavior and will be lost if
|
|
103
|
+
// the code is regenerated.
|
|
104
|
+
// </auto-generated>
|
|
105
|
+
// ------------------------------------------------------------------------------`;
|
|
106
|
+
return `${header}
|
|
107
|
+
|
|
108
|
+
import createPlugin from 'tailwindcss/plugin';
|
|
109
|
+
|
|
110
|
+
module.exports = createPlugin(function({ addUtilities, theme, e }) {
|
|
111
|
+
// Optional: Add custom utilities here
|
|
112
|
+
// Example: Custom shadow utilities
|
|
113
|
+
// const shadows = theme('boxShadow') || {};
|
|
114
|
+
// const shadowUtils = Object.entries(shadows).reduce((acc, [key, value]) => {
|
|
115
|
+
// acc['.' + e('shadow-' + key)] = { boxShadow: value };
|
|
116
|
+
// return acc;
|
|
117
|
+
// }, {});
|
|
118
|
+
// addUtilities(shadowUtils);
|
|
119
|
+
}, ${themeSection});
|
|
120
|
+
`.trim();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=tailwindV3Format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwindV3Format.js","sourceRoot":"","sources":["../../../../src/formats/tailwind/v3/tailwindV3Format.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAGlB,yEAAmE;AAEnE,aAAa;AAEb;;;;;GAKG;AACU,QAAA,sBAAsB,GAAW;IAC1C,IAAI,EAAE,uBAAuB;IAC7B,MAAM,CAAC,EAAE,UAAU,EAAE,OAAO,EAG3B;QACG,MAAM,MAAM,GAAG,IAAA,gDAAqB,EAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;QAC5F,MAAM,MAAM,GAAG;;;;;;kFAM2D,CAAC;QAC3E,OAAO,GAAG,MAAM,wBAAwB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;IACjF,CAAC;CACJ,CAAC;AAEF;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAW;IAC1C,IAAI,EAAE,uBAAuB;I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;;;;;;;;;;KAanB,YAAY;CAChB,CAAC,IAAI,EAAE,CAAC;IACL,CAAC;CACJ,CAAC"}
|
|
@@ -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' | 'textDecorationLine' | 'textTransform' | 'width' | 'zIndex';
|
|
10
|
+
//# sourceMappingURL=DesignTokenType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTokenType.d.ts","sourceRoot":"","sources":["../../../../src/formats/tailwind/v4/DesignTokenType.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,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,oBAAoB,GAAG,eAAe,GAAG,OAAO,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTokenType.js","sourceRoot":"","sources":["../../../../src/formats/tailwind/v4/DesignTokenType.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { DesignTokenType } from './DesignTokenType.js';
|
|
2
|
+
/**
|
|
3
|
+
* Tailwind v4 CSS variable namespace prefixes.
|
|
4
|
+
* In Tailwind v4, theme values are exposed as CSS custom properties
|
|
5
|
+
* with specific namespace prefixes.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type TailwindV4Namespace = '--color' | '--font-family' | '--font-size' | '--font-weight' | '--letter-spacing' | '--line-height' | '--radius' | '--shadow' | '--spacing' | '--width' | '--height' | '--z' | '--opacity' | '--transition-duration' | '--border-width';
|
|
10
|
+
/**
|
|
11
|
+
* Function type for transforming token paths into Tailwind v4 compatible variable names.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export type PathTransformFn = (path: ReadonlyArray<string>) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Internal mapping definition for Tailwind v4.
|
|
18
|
+
* Maps tokens to CSS custom property namespaces.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export interface IV4KeyMapping {
|
|
23
|
+
readonly namespace: TailwindV4Namespace;
|
|
24
|
+
readonly pathTransform?: PathTransformFn;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Set of supported design token types for validation.
|
|
28
|
+
* Used only for logging; unsupported types are skipped.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export declare const SUPPORTED_TOKEN_TYPES: ReadonlyArray<DesignTokenType>;
|
|
33
|
+
/**
|
|
34
|
+
* Maps category values to Tailwind v4 CSS variable namespaces.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export declare const CATEGORY_TO_V4_MAPPING: Record<string, IV4KeyMapping>;
|
|
39
|
+
/**
|
|
40
|
+
* Fallback mapping from logical token type → Tailwind v4 namespace.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare const TOKEN_TYPE_TO_V4_MAPPING: Partial<Record<DesignTokenType, IV4KeyMapping>>;
|
|
45
|
+
//# sourceMappingURL=TailwindV4PropertyMapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TailwindV4PropertyMapping.d.ts","sourceRoot":"","sources":["../../../../src/formats/tailwind/v4/TailwindV4PropertyMapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,eAAe,GAAG,aAAa,GAAG,eAAe,GAAG,kBAAkB,GAAG,eAAe,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,WAAW,GAAG,uBAAuB,GAAG,gBAAgB,CAAC;AAE3Q;;;;GAIG;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC;CAC5C;AAMD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,eAAe,CAwBhE,CAAC;AAkIF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAiEhE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,CAqFpF,CAAC"}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TOKEN_TYPE_TO_V4_MAPPING = exports.CATEGORY_TO_V4_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
|
+
'textDecorationLine',
|
|
34
|
+
'textTransform',
|
|
35
|
+
'width',
|
|
36
|
+
'zIndex'
|
|
37
|
+
];
|
|
38
|
+
// #endregion
|
|
39
|
+
// #region Mappings
|
|
40
|
+
/**
|
|
41
|
+
* Default path transform that converts token path to kebab-case variable name.
|
|
42
|
+
*
|
|
43
|
+
* @param path Token path array.
|
|
44
|
+
* @returns Kebab-case variable name suffix.
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
function defaultPathTransform(path) {
|
|
48
|
+
return path.join('-').toLowerCase();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Transform for color tokens that handles light/dark variants.
|
|
52
|
+
*
|
|
53
|
+
* @param path Token path array.
|
|
54
|
+
* @returns Formatted color variable name.
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
function colorPathTransform(path) {
|
|
58
|
+
// color.light.primary.500 -> 'primary-500'
|
|
59
|
+
// color.dark.primary.500 -> 'primary-500-dark'
|
|
60
|
+
// scheme.light.background -> 'scheme-background'
|
|
61
|
+
// scheme.dark.background -> 'scheme-background-dark'
|
|
62
|
+
if (path[0] === 'color') {
|
|
63
|
+
if (path.length >= 4) {
|
|
64
|
+
const variant = path[1]; // 'light' or 'dark'
|
|
65
|
+
const colorName = path[2]; // 'primary', 'secondary', etc.
|
|
66
|
+
const shade = path[3]; // '500', '100', etc.
|
|
67
|
+
if (variant === 'dark') {
|
|
68
|
+
return `${colorName}-${shade}-dark`;
|
|
69
|
+
}
|
|
70
|
+
return `${colorName}-${shade}`;
|
|
71
|
+
}
|
|
72
|
+
else if (path.length === 3) {
|
|
73
|
+
const variant = path[1];
|
|
74
|
+
const colorName = path[2];
|
|
75
|
+
if (variant === 'dark') {
|
|
76
|
+
return `${colorName}-dark`;
|
|
77
|
+
}
|
|
78
|
+
return colorName;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else if (path[0] === 'scheme' && path.length >= 3) {
|
|
82
|
+
const variant = path[1];
|
|
83
|
+
const schemeName = path[2];
|
|
84
|
+
if (variant === 'dark') {
|
|
85
|
+
return `scheme-${schemeName}-dark`;
|
|
86
|
+
}
|
|
87
|
+
return `scheme-${schemeName}`;
|
|
88
|
+
}
|
|
89
|
+
return path.join('-').toLowerCase();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Transform for elevation/shadow tokens.
|
|
93
|
+
*
|
|
94
|
+
* @param path Token path array.
|
|
95
|
+
* @returns Formatted shadow variable name.
|
|
96
|
+
* @private
|
|
97
|
+
*/
|
|
98
|
+
function shadowPathTransform(path) {
|
|
99
|
+
// elevation.light.regular -> 'regular'
|
|
100
|
+
// elevation.dark.regular -> 'regular-dark'
|
|
101
|
+
if (path[0] === 'elevation') {
|
|
102
|
+
if (path.length >= 3) {
|
|
103
|
+
const variant = path[1];
|
|
104
|
+
const name = path[2];
|
|
105
|
+
if (variant === 'dark') {
|
|
106
|
+
return `${name}-dark`;
|
|
107
|
+
}
|
|
108
|
+
return name;
|
|
109
|
+
}
|
|
110
|
+
return path.slice(1).join('-');
|
|
111
|
+
}
|
|
112
|
+
return path.join('-').toLowerCase();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Transform for spacing tokens.
|
|
116
|
+
*
|
|
117
|
+
* @param path Token path array.
|
|
118
|
+
* @returns Formatted spacing variable name.
|
|
119
|
+
* @private
|
|
120
|
+
*/
|
|
121
|
+
function spacingPathTransform(path) {
|
|
122
|
+
// layout.radius -> 'radius'
|
|
123
|
+
// layout.space -> 'space'
|
|
124
|
+
if (path[0] === 'layout') {
|
|
125
|
+
return path[path.length - 1];
|
|
126
|
+
}
|
|
127
|
+
return path.join('-').toLowerCase();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Transform for typography-related tokens.
|
|
131
|
+
*
|
|
132
|
+
* @param path Token path array.
|
|
133
|
+
* @returns Formatted typography variable name.
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
function typographyPathTransform(path) {
|
|
137
|
+
// typography.headline1.fontSize -> 'headline1'
|
|
138
|
+
if (path[0] === 'typography' && path.length >= 2) {
|
|
139
|
+
return path[1];
|
|
140
|
+
}
|
|
141
|
+
return path[path.length - 1];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Transform for duration tokens.
|
|
145
|
+
*
|
|
146
|
+
* @param path Token path array.
|
|
147
|
+
* @returns Formatted duration variable name.
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
function durationPathTransform(path) {
|
|
151
|
+
// duration.short -> 'short'
|
|
152
|
+
// duration._ -> 'DEFAULT'
|
|
153
|
+
if (path[0] === 'duration') {
|
|
154
|
+
const value = path[1];
|
|
155
|
+
return value === '_' ? 'default' : value;
|
|
156
|
+
}
|
|
157
|
+
return path[path.length - 1];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Maps category values to Tailwind v4 CSS variable namespaces.
|
|
161
|
+
*
|
|
162
|
+
* @public
|
|
163
|
+
*/
|
|
164
|
+
exports.CATEGORY_TO_V4_MAPPING = {
|
|
165
|
+
colors: {
|
|
166
|
+
namespace: '--color',
|
|
167
|
+
pathTransform: colorPathTransform
|
|
168
|
+
},
|
|
169
|
+
scheme: {
|
|
170
|
+
namespace: '--color',
|
|
171
|
+
pathTransform: colorPathTransform
|
|
172
|
+
},
|
|
173
|
+
spacing: {
|
|
174
|
+
namespace: '--spacing',
|
|
175
|
+
pathTransform: spacingPathTransform
|
|
176
|
+
},
|
|
177
|
+
width: {
|
|
178
|
+
namespace: '--width',
|
|
179
|
+
pathTransform: defaultPathTransform
|
|
180
|
+
},
|
|
181
|
+
height: {
|
|
182
|
+
namespace: '--height',
|
|
183
|
+
pathTransform: defaultPathTransform
|
|
184
|
+
},
|
|
185
|
+
fontFamily: {
|
|
186
|
+
namespace: '--font-family',
|
|
187
|
+
pathTransform: typographyPathTransform
|
|
188
|
+
},
|
|
189
|
+
fontSize: {
|
|
190
|
+
namespace: '--font-size',
|
|
191
|
+
pathTransform: typographyPathTransform
|
|
192
|
+
},
|
|
193
|
+
boxShadow: {
|
|
194
|
+
namespace: '--shadow',
|
|
195
|
+
pathTransform: shadowPathTransform
|
|
196
|
+
},
|
|
197
|
+
opacity: {
|
|
198
|
+
namespace: '--opacity',
|
|
199
|
+
pathTransform: defaultPathTransform
|
|
200
|
+
},
|
|
201
|
+
borderRadius: {
|
|
202
|
+
namespace: '--radius',
|
|
203
|
+
pathTransform: defaultPathTransform
|
|
204
|
+
},
|
|
205
|
+
borderWidth: {
|
|
206
|
+
namespace: '--border-width',
|
|
207
|
+
pathTransform: defaultPathTransform
|
|
208
|
+
},
|
|
209
|
+
zIndex: {
|
|
210
|
+
namespace: '--z',
|
|
211
|
+
pathTransform: defaultPathTransform
|
|
212
|
+
},
|
|
213
|
+
transitionDuration: {
|
|
214
|
+
namespace: '--transition-duration',
|
|
215
|
+
pathTransform: durationPathTransform
|
|
216
|
+
},
|
|
217
|
+
lineHeight: {
|
|
218
|
+
namespace: '--line-height',
|
|
219
|
+
pathTransform: typographyPathTransform
|
|
220
|
+
},
|
|
221
|
+
fontWeight: {
|
|
222
|
+
namespace: '--font-weight',
|
|
223
|
+
pathTransform: typographyPathTransform
|
|
224
|
+
},
|
|
225
|
+
letterSpacing: {
|
|
226
|
+
namespace: '--letter-spacing',
|
|
227
|
+
pathTransform: typographyPathTransform
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Fallback mapping from logical token type → Tailwind v4 namespace.
|
|
232
|
+
*
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
exports.TOKEN_TYPE_TO_V4_MAPPING = {
|
|
236
|
+
color: {
|
|
237
|
+
namespace: '--color',
|
|
238
|
+
pathTransform: colorPathTransform
|
|
239
|
+
},
|
|
240
|
+
spacing: {
|
|
241
|
+
namespace: '--spacing',
|
|
242
|
+
pathTransform: spacingPathTransform
|
|
243
|
+
},
|
|
244
|
+
size: {
|
|
245
|
+
namespace: '--spacing',
|
|
246
|
+
pathTransform: defaultPathTransform
|
|
247
|
+
},
|
|
248
|
+
width: {
|
|
249
|
+
namespace: '--width',
|
|
250
|
+
pathTransform: defaultPathTransform
|
|
251
|
+
},
|
|
252
|
+
height: {
|
|
253
|
+
namespace: '--height',
|
|
254
|
+
pathTransform: defaultPathTransform
|
|
255
|
+
},
|
|
256
|
+
maxWidth: {
|
|
257
|
+
namespace: '--width',
|
|
258
|
+
pathTransform: (path) => `max-${defaultPathTransform(path)}`
|
|
259
|
+
},
|
|
260
|
+
maxHeight: {
|
|
261
|
+
namespace: '--height',
|
|
262
|
+
pathTransform: (path) => `max-${defaultPathTransform(path)}`
|
|
263
|
+
},
|
|
264
|
+
minWidth: {
|
|
265
|
+
namespace: '--width',
|
|
266
|
+
pathTransform: (path) => `min-${defaultPathTransform(path)}`
|
|
267
|
+
},
|
|
268
|
+
minHeight: {
|
|
269
|
+
namespace: '--height',
|
|
270
|
+
pathTransform: (path) => `min-${defaultPathTransform(path)}`
|
|
271
|
+
},
|
|
272
|
+
borderRadius: {
|
|
273
|
+
namespace: '--radius',
|
|
274
|
+
pathTransform: defaultPathTransform
|
|
275
|
+
},
|
|
276
|
+
borderWidth: {
|
|
277
|
+
namespace: '--border-width',
|
|
278
|
+
pathTransform: defaultPathTransform
|
|
279
|
+
},
|
|
280
|
+
font: {
|
|
281
|
+
namespace: '--font-family',
|
|
282
|
+
pathTransform: typographyPathTransform
|
|
283
|
+
},
|
|
284
|
+
fontFamily: {
|
|
285
|
+
namespace: '--font-family',
|
|
286
|
+
pathTransform: typographyPathTransform
|
|
287
|
+
},
|
|
288
|
+
fontSize: {
|
|
289
|
+
namespace: '--font-size',
|
|
290
|
+
pathTransform: typographyPathTransform
|
|
291
|
+
},
|
|
292
|
+
fontWeight: {
|
|
293
|
+
namespace: '--font-weight',
|
|
294
|
+
pathTransform: typographyPathTransform
|
|
295
|
+
},
|
|
296
|
+
lineHeight: {
|
|
297
|
+
namespace: '--line-height',
|
|
298
|
+
pathTransform: typographyPathTransform
|
|
299
|
+
},
|
|
300
|
+
letterSpacing: {
|
|
301
|
+
namespace: '--letter-spacing',
|
|
302
|
+
pathTransform: typographyPathTransform
|
|
303
|
+
},
|
|
304
|
+
shadow: {
|
|
305
|
+
namespace: '--shadow',
|
|
306
|
+
pathTransform: shadowPathTransform
|
|
307
|
+
},
|
|
308
|
+
opacity: {
|
|
309
|
+
namespace: '--opacity',
|
|
310
|
+
pathTransform: defaultPathTransform
|
|
311
|
+
},
|
|
312
|
+
zIndex: {
|
|
313
|
+
namespace: '--z',
|
|
314
|
+
pathTransform: defaultPathTransform
|
|
315
|
+
},
|
|
316
|
+
duration: {
|
|
317
|
+
namespace: '--transition-duration',
|
|
318
|
+
pathTransform: durationPathTransform
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
// #endregion
|
|
322
|
+
//# sourceMappingURL=TailwindV4PropertyMapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TailwindV4PropertyMapping.js","sourceRoot":"","sources":["../../../../src/formats/tailwind/v4/TailwindV4PropertyMapping.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAoClB,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,oBAAoB;IACpB,eAAe;IACf,OAAO;IACP,QAAQ;CACX,CAAC;AAEF,aAAa;AAEb,mBAAmB;AAEnB;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,IAA2B;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AACxC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,IAA2B;IACnD,2CAA2C;IAC3C,+CAA+C;IAC/C,iDAAiD;IACjD,qDAAqD;IACrD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;QACtB,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACnB,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB;YAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,+BAA+B;YAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB;YAE5C,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;gBACrB,OAAO,GAAG,SAAS,IAAI,KAAK,OAAO,CAAC;YACxC,CAAC;YACD,OAAO,GAAG,SAAS,IAAI,KAAK,EAAE,CAAC;QACnC,CAA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UAAU,EAAE;QACR,SAAS,EAAE,eAAe;QAC1B,aAAa,EAAE,uBAAuB;KACzC;IACD,aAAa,EAAE;QACX,SAAS,EAAE,kBAAkB;QAC7B,aAAa,EAAE,uBAAuB;KACzC;IACD,MAAM,EAAE;QACJ,SAAS,EAAE,UAAU;QACrB,aAAa,EAAE,mBAAmB;KACrC;IACD,OAAO,EAAE;QACL,SAAS,EAAE,WAAW;QACtB,aAAa,EAAE,oBAAoB;KACtC;IACD,MAAM,EAAE;QACJ,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,oBAAoB;KACtC;IACD,QAAQ,EAAE;QACN,SAAS,EAAE,uBAAuB;QAClC,aAAa,EAAE,qBAAqB;KACvC;CACJ,CAAC;AAEF,aAAa"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { TransformedToken } from 'style-dictionary/types';
|
|
2
|
+
/**
|
|
3
|
+
* Tailwind v4 theme configuration structure.
|
|
4
|
+
* In v4, the theme is much flatter and uses direct CSS variable references.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type ITailwindV4Theme = Readonly<Record<string, string | Record<string, string | Record<string, string>>>>;
|
|
9
|
+
/**
|
|
10
|
+
* Tailwind v4 configuration structure.
|
|
11
|
+
* Note: v4 uses a flatter structure compared to v3.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export interface ITailwindV4Config {
|
|
16
|
+
readonly theme?: ITailwindV4Theme;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for building the Tailwind v4 JavaScript config.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface IBuildTailwindV4ConfigOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Token name substrings to ignore.
|
|
26
|
+
*/
|
|
27
|
+
readonly ignoredTokenNameSubstrings?: ReadonlyArray<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to wrap theme values in extend.
|
|
30
|
+
* In v4, you can still use extend to add to defaults rather than replace.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
readonly useExtend?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Builds a Tailwind v4 config object from Style-Dictionary tokens.
|
|
38
|
+
*
|
|
39
|
+
* In Tailwind v4, the configuration structure is flatter and works
|
|
40
|
+
* in conjunction with the CSS-first approach. This generates a config
|
|
41
|
+
* that can be used with the @config directive.
|
|
42
|
+
*
|
|
43
|
+
* @param allTokens All transformed tokens from Style-Dictionary.
|
|
44
|
+
* @param options Build options.
|
|
45
|
+
* @returns A Tailwind v4 config object.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildTailwindV4Config(allTokens: ReadonlyArray<TransformedToken>, options?: IBuildTailwindV4ConfigOptions): ITailwindV4Config;
|
|
49
|
+
/**
|
|
50
|
+
* Formats a Tailwind v4 config object as a JavaScript module string.
|
|
51
|
+
*
|
|
52
|
+
* @param config The config object.
|
|
53
|
+
* @returns Formatted JavaScript string.
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export declare function formatTailwindV4ConfigAsJs(config: ITailwindV4Config): string;
|
|
57
|
+
/**
|
|
58
|
+
* Formats a Tailwind v4 config object as a TypeScript module string.
|
|
59
|
+
*
|
|
60
|
+
* @param config The config object.
|
|
61
|
+
* @returns Formatted TypeScript string.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
export declare function formatTailwindV4ConfigAsTs(config: ITailwindV4Config): string;
|
|
65
|
+
/**
|
|
66
|
+
* Builds and formats a Tailwind v4 JavaScript config file from tokens.
|
|
67
|
+
*
|
|
68
|
+
* @param allTokens All transformed tokens from Style-Dictionary.
|
|
69
|
+
* @param options Build options.
|
|
70
|
+
* @returns Formatted JavaScript config file content.
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildTailwindV4ConfigJs(allTokens: ReadonlyArray<TransformedToken>, options?: IBuildTailwindV4ConfigOptions): string;
|
|
74
|
+
/**
|
|
75
|
+
* Builds and formats a Tailwind v4 TypeScript config file from tokens.
|
|
76
|
+
*
|
|
77
|
+
* @param allTokens All transformed tokens from Style-Dictionary.
|
|
78
|
+
* @param options Build options.
|
|
79
|
+
* @returns Formatted TypeScript config file content.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildTailwindV4ConfigTs(allTokens: ReadonlyArray<TransformedToken>, options?: IBuildTailwindV4ConfigOptions): string;
|
|
83
|
+
//# sourceMappingURL=buildTailwindV4Config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTailwindV4Config.d.ts","sourceRoot":"","sources":["../../../../src/formats/tailwind/v4/buildTailwindV4Config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAgB/D;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAElH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAE1C;;OAEG;IACH,QAAQ,CAAC,0BAA0B,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAChC;AAoLD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC1C,OAAO,GAAE,6BAAkC,GAC5C,iBAAiB,CAo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