import StyleDictionary from 'style-dictionary'; import { pandaCssConfigThemeFormat } from './formats/pandaCssConfigThemeFormat.js'; import { tailwindV3PresetFormat } from './formats/tailwindV3PresetFormat.js'; import { tailwindV4ThemeFormat } from './formats/tailwindV4ThemeFormat.js'; import { cssThemeWithOverridesFormat } from './formats/cssThemeWithOverridesFormat.js'; import { crossBrandParser } from './parsers/crossBrandParser.js'; import { buildCliWrapper } from './build/buildCliWrapper.js'; import { removeBaseVariantTransform } from './transforms/removeBaseVariant.js'; const prefix = 'mfui'; // Register custom parser StyleDictionary.registerParser(crossBrandParser); // Register custom transform StyleDictionary.registerTransform(removeBaseVariantTransform); const myStyleDictionary = new StyleDictionary({ source: ['tokens/**/*.json'], hooks: { formats: { pandaCssConfigThemeFormat, tailwindV3PresetFormat, tailwindV4ThemeFormat, cssThemeWithOverridesFormat, }, }, parsers: ['w3cTokenJsonParser', 'crossBrandParser'], platforms: { css: { transformGroup: 'css', transforms: ['color/hex8', 'name/remove-base-variant'], buildPath: 'dist/css/', prefix, files: [ { destination: 'variables.css', format: 'css/variables', options: { outputReferences: true, selector: ':root, :host', }, }, ], }, 'css-theme-orange': { transformGroup: 'css', transforms: ['color/hex8', 'name/remove-base-variant'], buildPath: 'dist/css/', prefix, files: [ { destination: 'theme-orange.css', format: 'cssThemeWithOverridesFormat', options: { version: 'latest', }, }, ], }, scss: { transformGroup: 'scss', transforms: ['color/hex8', 'name/remove-base-variant'], buildPath: 'dist/scss/', prefix, files: [ { destination: '_variables.scss', format: 'scss/variables', options: { outputReferences: true, }, }, ], }, ts: { transformGroup: 'js', transforms: ['color/hex8', 'name/remove-base-variant', 'name/pascal'], buildPath: 'dist/', prefix, files: [ { destination: 'index.js', format: 'javascript/es6', }, { destination: 'index.d.ts', format: 'typescript/es6-declarations', }, ], options: { outputStringLiterals: true, }, }, panda: { transformGroup: 'web', transforms: ['color/hex8', 'name/remove-base-variant'], buildPath: 'dist/presets/', files: [ { destination: 'pandacss.ts', format: 'pandaCssConfigThemeFormat', }, ], }, 'tailwind-v3': { transformGroup: 'web', transforms: ['color/hex8', 'name/remove-base-variant'], buildPath: 'dist/presets/', files: [ { destination: 'tailwind.ts', format: 'tailwindV3PresetFormat', }, ], }, 'tailwind-v4': { transformGroup: 'css', transforms: ['color/hex8', 'name/remove-base-variant'], buildPath: 'dist/css/', files: [ { destination: 'tailwind-v4.css', format: 'tailwindV4ThemeFormat', }, ], }, }, }); await myStyleDictionary.hasInitialized; await myStyleDictionary.buildAllPlatforms(); await buildCliWrapper();