@dsai-io/tools 0.0.1 → 1.0.7
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/README.md +282 -30
- package/dist/cli/index.cjs +6271 -2233
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +4 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +6232 -2195
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.cjs +198 -61
- package/dist/config/index.cjs.map +1 -1
- package/dist/config/index.d.cts +490 -1759
- package/dist/config/index.d.ts +490 -1759
- package/dist/config/index.js +197 -61
- package/dist/config/index.js.map +1 -1
- package/dist/icons/index.cjs +1 -1
- package/dist/icons/index.cjs.map +1 -1
- package/dist/icons/index.d.cts +1 -1
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.cjs +6733 -2888
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6774 -2963
- package/dist/index.js.map +1 -1
- package/dist/tokens/index.cjs +4457 -737
- package/dist/tokens/index.cjs.map +1 -1
- package/dist/tokens/index.d.cts +1258 -17
- package/dist/tokens/index.d.ts +1258 -17
- package/dist/tokens/index.js +4368 -683
- package/dist/tokens/index.js.map +1 -1
- package/dist/{types-Idj08nad.d.cts → types-DabOzcsj.d.cts} +236 -3
- package/dist/{types-Idj08nad.d.ts → types-DabOzcsj.d.ts} +236 -3
- package/dist/utils/circuit-breaker.cjs +173 -0
- package/dist/utils/circuit-breaker.cjs.map +1 -0
- package/dist/utils/circuit-breaker.d.cts +123 -0
- package/dist/utils/circuit-breaker.d.ts +123 -0
- package/dist/utils/circuit-breaker.js +169 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/package.json +10 -5
|
@@ -130,6 +130,10 @@ interface TokensConfig {
|
|
|
130
130
|
* @example '_variables.scss' or 'path/to/custom-base.scss'
|
|
131
131
|
*/
|
|
132
132
|
scssImportHeader?: string;
|
|
133
|
+
/**
|
|
134
|
+
* SCSS/CSS output style options
|
|
135
|
+
*/
|
|
136
|
+
scss?: ScssOutputConfig;
|
|
133
137
|
/** Theme mode settings */
|
|
134
138
|
themes?: ThemesConfig;
|
|
135
139
|
/** Custom Style Dictionary transforms */
|
|
@@ -194,11 +198,33 @@ interface TokensConfig {
|
|
|
194
198
|
* Controls which steps run and their paths
|
|
195
199
|
*/
|
|
196
200
|
pipeline?: TokensBuildPipeline;
|
|
201
|
+
/**
|
|
202
|
+
* Postprocess configuration for CSS file transformations
|
|
203
|
+
* Applied after SASS compilation
|
|
204
|
+
*/
|
|
205
|
+
postprocess?: PostprocessConfig;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Postprocess configuration for CSS file transformations
|
|
209
|
+
*/
|
|
210
|
+
interface PostprocessConfig {
|
|
211
|
+
/** Whether postprocessing is enabled */
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
/** Directory containing CSS files to process */
|
|
214
|
+
cssDir?: string;
|
|
215
|
+
/** File names to process */
|
|
216
|
+
files?: string[];
|
|
217
|
+
/** Replacement rules to apply */
|
|
218
|
+
replacements?: Array<{
|
|
219
|
+
description?: string;
|
|
220
|
+
from: string | RegExp;
|
|
221
|
+
to: string;
|
|
222
|
+
}>;
|
|
197
223
|
}
|
|
198
224
|
/**
|
|
199
225
|
* Build pipeline step names
|
|
200
226
|
*/
|
|
201
|
-
type BuildPipelineStep = 'validate' | 'transform' | 'style-dictionary' | 'sync' | 'sass-theme' | 'sass-theme-minified' | 'postprocess' | 'sass-utilities' | 'sass-utilities-minified' | 'bundle';
|
|
227
|
+
type BuildPipelineStep = 'validate' | 'snapshot' | 'preprocess' | 'transform' | 'style-dictionary' | 'multi-theme' | 'sync' | 'sass-theme' | 'sass-theme-minified' | 'postprocess' | 'sass-utilities' | 'sass-utilities-minified' | 'bundle';
|
|
202
228
|
/**
|
|
203
229
|
* Build pipeline paths configuration
|
|
204
230
|
*/
|
|
@@ -263,18 +289,181 @@ interface BuildSummary {
|
|
|
263
289
|
themes: string[];
|
|
264
290
|
};
|
|
265
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* CSS/SCSS output style options
|
|
294
|
+
* Controls whether to generate expanded, compressed, or both formats
|
|
295
|
+
*/
|
|
296
|
+
interface ScssOutputConfig {
|
|
297
|
+
/**
|
|
298
|
+
* Output format styles to generate
|
|
299
|
+
* - 'expanded': Human-readable, formatted CSS
|
|
300
|
+
* - 'compressed': Minified CSS for production
|
|
301
|
+
* @default ['expanded']
|
|
302
|
+
*/
|
|
303
|
+
outputStyles?: ('expanded' | 'compressed')[];
|
|
304
|
+
/**
|
|
305
|
+
* Generate source maps for debugging
|
|
306
|
+
* @default false
|
|
307
|
+
*/
|
|
308
|
+
generateSourceMaps?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Suffix for minified/compressed output files
|
|
311
|
+
* @default '.min'
|
|
312
|
+
* @example '.min' produces 'theme.min.css' alongside 'theme.css'
|
|
313
|
+
*/
|
|
314
|
+
minifiedSuffix?: string;
|
|
315
|
+
/**
|
|
316
|
+
* Entry SCSS file for theme compilation
|
|
317
|
+
* Relative to config file location
|
|
318
|
+
* @example 'src/scss/dsai-theme-bs.scss'
|
|
319
|
+
*/
|
|
320
|
+
themeEntry?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Entry SCSS file for utilities compilation
|
|
323
|
+
* Relative to config file location
|
|
324
|
+
* @example 'src/scss/dsai-utilities.scss'
|
|
325
|
+
*/
|
|
326
|
+
utilitiesEntry?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Output directory for compiled CSS files
|
|
329
|
+
* Relative to config file location
|
|
330
|
+
* @default 'src/generated'
|
|
331
|
+
*/
|
|
332
|
+
cssOutputDir?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Additional Sass load paths for @use and @import resolution
|
|
335
|
+
* @default ['node_modules']
|
|
336
|
+
*/
|
|
337
|
+
loadPaths?: string[];
|
|
338
|
+
/**
|
|
339
|
+
* Target CSS framework for variable naming conventions
|
|
340
|
+
* Controls how token names are mapped to framework-specific names
|
|
341
|
+
* @default 'bootstrap'
|
|
342
|
+
*/
|
|
343
|
+
framework?: FrameworkTarget;
|
|
344
|
+
/**
|
|
345
|
+
* Custom name mappings for token → framework variable names
|
|
346
|
+
* Merged with framework defaults (custom mappings take precedence)
|
|
347
|
+
* @example { 'typography-text-base': 'font-size-base', 'typography-heading-h1': 'h1-font-size' }
|
|
348
|
+
*/
|
|
349
|
+
nameMapping?: Record<string, string>;
|
|
350
|
+
/**
|
|
351
|
+
* Output path for generated SCSS variables file
|
|
352
|
+
* Relative to config file location
|
|
353
|
+
* @default 'src/scss/_variables.scss'
|
|
354
|
+
*/
|
|
355
|
+
variablesOutput?: string;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Supported CSS framework targets
|
|
359
|
+
* Each framework has its own naming conventions for variables
|
|
360
|
+
*/
|
|
361
|
+
type FrameworkTarget = 'bootstrap' | 'shadcn' | 'tailwind' | 'mui' | 'custom';
|
|
362
|
+
/**
|
|
363
|
+
* Framework mapping configuration
|
|
364
|
+
* Defines how Figma token names map to framework-specific variable names
|
|
365
|
+
*/
|
|
366
|
+
interface FrameworkMappingConfig {
|
|
367
|
+
/**
|
|
368
|
+
* Framework identifier
|
|
369
|
+
*/
|
|
370
|
+
framework: FrameworkTarget;
|
|
371
|
+
/**
|
|
372
|
+
* Token name → framework variable name mappings
|
|
373
|
+
* Keys are Figma/DTCG token names, values are framework variable names
|
|
374
|
+
*/
|
|
375
|
+
mappings: Record<string, string>;
|
|
376
|
+
/**
|
|
377
|
+
* Pattern-based mappings using regex
|
|
378
|
+
* Applied after explicit mappings
|
|
379
|
+
* @example [{ pattern: /^typography-heading-(.+)$/, replacement: 'h$1-font-size' }]
|
|
380
|
+
*/
|
|
381
|
+
patterns?: FrameworkMappingPattern[];
|
|
382
|
+
/**
|
|
383
|
+
* Variable prefix for this framework
|
|
384
|
+
* @example '$' for SCSS, '--' for CSS custom properties
|
|
385
|
+
*/
|
|
386
|
+
variablePrefix?: string;
|
|
387
|
+
/**
|
|
388
|
+
* File header comment
|
|
389
|
+
*/
|
|
390
|
+
header?: string;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Pattern-based name mapping rule
|
|
394
|
+
*/
|
|
395
|
+
interface FrameworkMappingPattern {
|
|
396
|
+
/**
|
|
397
|
+
* Regex pattern to match token names
|
|
398
|
+
*/
|
|
399
|
+
pattern: RegExp | string;
|
|
400
|
+
/**
|
|
401
|
+
* Replacement string (supports $1, $2, etc. for capture groups)
|
|
402
|
+
*/
|
|
403
|
+
replacement: string;
|
|
404
|
+
/**
|
|
405
|
+
* Optional description for documentation
|
|
406
|
+
*/
|
|
407
|
+
description?: string;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Individual theme definition
|
|
411
|
+
* Specifies how a theme is discovered and built
|
|
412
|
+
*/
|
|
413
|
+
interface ThemeDefinition {
|
|
414
|
+
/**
|
|
415
|
+
* Whether this is the default theme (uses :root selector)
|
|
416
|
+
* Only one theme can be default
|
|
417
|
+
* @default false
|
|
418
|
+
*/
|
|
419
|
+
isDefault?: boolean;
|
|
420
|
+
/**
|
|
421
|
+
* File suffix pattern for this theme
|
|
422
|
+
* null means files without any theme suffix (default theme)
|
|
423
|
+
* e.g., '-dark' matches files like 'foundation-dark.json'
|
|
424
|
+
* @default null for default theme, '-{themeName}' for others
|
|
425
|
+
*/
|
|
426
|
+
suffix?: string | null;
|
|
427
|
+
/**
|
|
428
|
+
* CSS selector for this theme
|
|
429
|
+
* @example ':root' for default, '[data-dsai-theme="dark"]' for dark
|
|
430
|
+
*/
|
|
431
|
+
selector: string;
|
|
432
|
+
/**
|
|
433
|
+
* Optional media query for automatic switching
|
|
434
|
+
* @example '(prefers-color-scheme: dark)'
|
|
435
|
+
*/
|
|
436
|
+
mediaQuery?: string;
|
|
437
|
+
/**
|
|
438
|
+
* Optional data attribute (derived from selector if not specified)
|
|
439
|
+
*/
|
|
440
|
+
dataAttribute?: string;
|
|
441
|
+
/**
|
|
442
|
+
* Custom output file names per format
|
|
443
|
+
* If not specified, uses default naming pattern with theme suffix
|
|
444
|
+
*/
|
|
445
|
+
outputFiles?: Partial<Record<OutputFormat, string>>;
|
|
446
|
+
}
|
|
266
447
|
/**
|
|
267
448
|
* Theme configuration
|
|
268
449
|
*/
|
|
269
450
|
interface ThemesConfig {
|
|
451
|
+
/**
|
|
452
|
+
* Enable/disable theme processing
|
|
453
|
+
* @default true
|
|
454
|
+
*/
|
|
455
|
+
enabled?: boolean;
|
|
270
456
|
/**
|
|
271
457
|
* Auto-detect available modes from Figma export
|
|
458
|
+
* When true, scans for files with theme suffixes
|
|
459
|
+
* When false, only builds themes explicitly defined in definitions
|
|
272
460
|
* @default true
|
|
273
461
|
*/
|
|
274
462
|
autoDetect?: boolean;
|
|
275
463
|
/**
|
|
276
464
|
* Default theme mode (uses :root selector)
|
|
277
|
-
* @default '
|
|
465
|
+
* @default 'light'
|
|
466
|
+
* @deprecated Use definitions with isDefault: true instead
|
|
278
467
|
*/
|
|
279
468
|
default?: string;
|
|
280
469
|
/**
|
|
@@ -286,6 +475,12 @@ interface ThemesConfig {
|
|
|
286
475
|
* CSS selector patterns for themes
|
|
287
476
|
*/
|
|
288
477
|
selectorPattern?: ThemeSelectorPattern;
|
|
478
|
+
/**
|
|
479
|
+
* Explicit theme definitions
|
|
480
|
+
* Key is theme name, value is theme configuration
|
|
481
|
+
* When specified, provides explicit control over theme builds
|
|
482
|
+
*/
|
|
483
|
+
definitions?: Record<string, ThemeDefinition>;
|
|
289
484
|
}
|
|
290
485
|
/**
|
|
291
486
|
* Theme selector pattern configuration
|
|
@@ -443,14 +638,39 @@ interface IconsConfig {
|
|
|
443
638
|
*/
|
|
444
639
|
prefix?: string;
|
|
445
640
|
}
|
|
641
|
+
/**
|
|
642
|
+
* Resolved theme definition with all required fields
|
|
643
|
+
*/
|
|
644
|
+
interface ResolvedThemeDefinition {
|
|
645
|
+
/** Whether this is the default theme */
|
|
646
|
+
isDefault: boolean;
|
|
647
|
+
/** File suffix pattern (null for default theme) */
|
|
648
|
+
suffix: string | null;
|
|
649
|
+
/** CSS selector */
|
|
650
|
+
selector: string;
|
|
651
|
+
/** Optional media query */
|
|
652
|
+
mediaQuery?: string;
|
|
653
|
+
/** Optional data attribute */
|
|
654
|
+
dataAttribute?: string;
|
|
655
|
+
/** Output file names per format */
|
|
656
|
+
outputFiles: Record<OutputFormat, string>;
|
|
657
|
+
}
|
|
446
658
|
/**
|
|
447
659
|
* Resolved themes config with all defaults applied
|
|
448
660
|
*/
|
|
449
661
|
interface ResolvedThemesConfig {
|
|
662
|
+
/** Whether themes are enabled */
|
|
663
|
+
enabled: boolean;
|
|
664
|
+
/** Auto-detect themes from files */
|
|
450
665
|
autoDetect: boolean;
|
|
666
|
+
/** Default theme name (for backward compat) */
|
|
451
667
|
default: string;
|
|
668
|
+
/** Modes to ignore */
|
|
452
669
|
ignoreModes: string[];
|
|
670
|
+
/** Selector patterns */
|
|
453
671
|
selectorPattern: Required<ThemeSelectorPattern>;
|
|
672
|
+
/** Resolved theme definitions */
|
|
673
|
+
definitions: Record<string, ResolvedThemeDefinition>;
|
|
454
674
|
}
|
|
455
675
|
/**
|
|
456
676
|
* Resolved tokens config with all defaults applied
|
|
@@ -486,6 +706,19 @@ interface ResolvedTokensConfig {
|
|
|
486
706
|
watch: boolean;
|
|
487
707
|
watchDirectories: string[];
|
|
488
708
|
pipeline?: TokensBuildPipeline;
|
|
709
|
+
scss?: {
|
|
710
|
+
cssOutputDir?: string;
|
|
711
|
+
};
|
|
712
|
+
postprocess?: {
|
|
713
|
+
enabled?: boolean;
|
|
714
|
+
cssDir?: string;
|
|
715
|
+
files?: string[];
|
|
716
|
+
replacements?: Array<{
|
|
717
|
+
description?: string;
|
|
718
|
+
from: string | RegExp;
|
|
719
|
+
to: string;
|
|
720
|
+
}>;
|
|
721
|
+
};
|
|
489
722
|
}
|
|
490
723
|
/**
|
|
491
724
|
* Resolved icons config with all defaults applied
|
|
@@ -543,4 +776,4 @@ interface LoadConfigResult {
|
|
|
543
776
|
warnings: string[];
|
|
544
777
|
}
|
|
545
778
|
|
|
546
|
-
export type { BuildSummary as B, CustomTransform as C, DsaiConfig as D,
|
|
779
|
+
export type { BuildSummary as B, CustomTransform as C, DsaiConfig as D, FrameworkTarget as F, GlobalConfig as G, IconsConfig as I, LoadConfigOptions as L, OutputFormat as O, Platform as P, ResolvedConfig as R, ScssOutputConfig as S, TokensConfig as T, ThemesConfig as a, ThemeDefinition as b, ThemeSelectorPattern as c, FrameworkMappingConfig as d, FrameworkMappingPattern as e, ResolvedGlobalConfig as f, ResolvedTokensConfig as g, ResolvedIconsConfig as h, ResolvedThemesConfig as i, ResolvedThemeDefinition as j, CustomFormat as k, CustomPreprocessor as l, CustomFilter as m, TokenData as n, TransformOptions as o, FormatArgs as p, Dictionary as q, FileConfig as r, LoadConfigResult as s, LogLevel as t, IconFramework as u };
|
|
@@ -130,6 +130,10 @@ interface TokensConfig {
|
|
|
130
130
|
* @example '_variables.scss' or 'path/to/custom-base.scss'
|
|
131
131
|
*/
|
|
132
132
|
scssImportHeader?: string;
|
|
133
|
+
/**
|
|
134
|
+
* SCSS/CSS output style options
|
|
135
|
+
*/
|
|
136
|
+
scss?: ScssOutputConfig;
|
|
133
137
|
/** Theme mode settings */
|
|
134
138
|
themes?: ThemesConfig;
|
|
135
139
|
/** Custom Style Dictionary transforms */
|
|
@@ -194,11 +198,33 @@ interface TokensConfig {
|
|
|
194
198
|
* Controls which steps run and their paths
|
|
195
199
|
*/
|
|
196
200
|
pipeline?: TokensBuildPipeline;
|
|
201
|
+
/**
|
|
202
|
+
* Postprocess configuration for CSS file transformations
|
|
203
|
+
* Applied after SASS compilation
|
|
204
|
+
*/
|
|
205
|
+
postprocess?: PostprocessConfig;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Postprocess configuration for CSS file transformations
|
|
209
|
+
*/
|
|
210
|
+
interface PostprocessConfig {
|
|
211
|
+
/** Whether postprocessing is enabled */
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
/** Directory containing CSS files to process */
|
|
214
|
+
cssDir?: string;
|
|
215
|
+
/** File names to process */
|
|
216
|
+
files?: string[];
|
|
217
|
+
/** Replacement rules to apply */
|
|
218
|
+
replacements?: Array<{
|
|
219
|
+
description?: string;
|
|
220
|
+
from: string | RegExp;
|
|
221
|
+
to: string;
|
|
222
|
+
}>;
|
|
197
223
|
}
|
|
198
224
|
/**
|
|
199
225
|
* Build pipeline step names
|
|
200
226
|
*/
|
|
201
|
-
type BuildPipelineStep = 'validate' | 'transform' | 'style-dictionary' | 'sync' | 'sass-theme' | 'sass-theme-minified' | 'postprocess' | 'sass-utilities' | 'sass-utilities-minified' | 'bundle';
|
|
227
|
+
type BuildPipelineStep = 'validate' | 'snapshot' | 'preprocess' | 'transform' | 'style-dictionary' | 'multi-theme' | 'sync' | 'sass-theme' | 'sass-theme-minified' | 'postprocess' | 'sass-utilities' | 'sass-utilities-minified' | 'bundle';
|
|
202
228
|
/**
|
|
203
229
|
* Build pipeline paths configuration
|
|
204
230
|
*/
|
|
@@ -263,18 +289,181 @@ interface BuildSummary {
|
|
|
263
289
|
themes: string[];
|
|
264
290
|
};
|
|
265
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* CSS/SCSS output style options
|
|
294
|
+
* Controls whether to generate expanded, compressed, or both formats
|
|
295
|
+
*/
|
|
296
|
+
interface ScssOutputConfig {
|
|
297
|
+
/**
|
|
298
|
+
* Output format styles to generate
|
|
299
|
+
* - 'expanded': Human-readable, formatted CSS
|
|
300
|
+
* - 'compressed': Minified CSS for production
|
|
301
|
+
* @default ['expanded']
|
|
302
|
+
*/
|
|
303
|
+
outputStyles?: ('expanded' | 'compressed')[];
|
|
304
|
+
/**
|
|
305
|
+
* Generate source maps for debugging
|
|
306
|
+
* @default false
|
|
307
|
+
*/
|
|
308
|
+
generateSourceMaps?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Suffix for minified/compressed output files
|
|
311
|
+
* @default '.min'
|
|
312
|
+
* @example '.min' produces 'theme.min.css' alongside 'theme.css'
|
|
313
|
+
*/
|
|
314
|
+
minifiedSuffix?: string;
|
|
315
|
+
/**
|
|
316
|
+
* Entry SCSS file for theme compilation
|
|
317
|
+
* Relative to config file location
|
|
318
|
+
* @example 'src/scss/dsai-theme-bs.scss'
|
|
319
|
+
*/
|
|
320
|
+
themeEntry?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Entry SCSS file for utilities compilation
|
|
323
|
+
* Relative to config file location
|
|
324
|
+
* @example 'src/scss/dsai-utilities.scss'
|
|
325
|
+
*/
|
|
326
|
+
utilitiesEntry?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Output directory for compiled CSS files
|
|
329
|
+
* Relative to config file location
|
|
330
|
+
* @default 'src/generated'
|
|
331
|
+
*/
|
|
332
|
+
cssOutputDir?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Additional Sass load paths for @use and @import resolution
|
|
335
|
+
* @default ['node_modules']
|
|
336
|
+
*/
|
|
337
|
+
loadPaths?: string[];
|
|
338
|
+
/**
|
|
339
|
+
* Target CSS framework for variable naming conventions
|
|
340
|
+
* Controls how token names are mapped to framework-specific names
|
|
341
|
+
* @default 'bootstrap'
|
|
342
|
+
*/
|
|
343
|
+
framework?: FrameworkTarget;
|
|
344
|
+
/**
|
|
345
|
+
* Custom name mappings for token → framework variable names
|
|
346
|
+
* Merged with framework defaults (custom mappings take precedence)
|
|
347
|
+
* @example { 'typography-text-base': 'font-size-base', 'typography-heading-h1': 'h1-font-size' }
|
|
348
|
+
*/
|
|
349
|
+
nameMapping?: Record<string, string>;
|
|
350
|
+
/**
|
|
351
|
+
* Output path for generated SCSS variables file
|
|
352
|
+
* Relative to config file location
|
|
353
|
+
* @default 'src/scss/_variables.scss'
|
|
354
|
+
*/
|
|
355
|
+
variablesOutput?: string;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Supported CSS framework targets
|
|
359
|
+
* Each framework has its own naming conventions for variables
|
|
360
|
+
*/
|
|
361
|
+
type FrameworkTarget = 'bootstrap' | 'shadcn' | 'tailwind' | 'mui' | 'custom';
|
|
362
|
+
/**
|
|
363
|
+
* Framework mapping configuration
|
|
364
|
+
* Defines how Figma token names map to framework-specific variable names
|
|
365
|
+
*/
|
|
366
|
+
interface FrameworkMappingConfig {
|
|
367
|
+
/**
|
|
368
|
+
* Framework identifier
|
|
369
|
+
*/
|
|
370
|
+
framework: FrameworkTarget;
|
|
371
|
+
/**
|
|
372
|
+
* Token name → framework variable name mappings
|
|
373
|
+
* Keys are Figma/DTCG token names, values are framework variable names
|
|
374
|
+
*/
|
|
375
|
+
mappings: Record<string, string>;
|
|
376
|
+
/**
|
|
377
|
+
* Pattern-based mappings using regex
|
|
378
|
+
* Applied after explicit mappings
|
|
379
|
+
* @example [{ pattern: /^typography-heading-(.+)$/, replacement: 'h$1-font-size' }]
|
|
380
|
+
*/
|
|
381
|
+
patterns?: FrameworkMappingPattern[];
|
|
382
|
+
/**
|
|
383
|
+
* Variable prefix for this framework
|
|
384
|
+
* @example '$' for SCSS, '--' for CSS custom properties
|
|
385
|
+
*/
|
|
386
|
+
variablePrefix?: string;
|
|
387
|
+
/**
|
|
388
|
+
* File header comment
|
|
389
|
+
*/
|
|
390
|
+
header?: string;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Pattern-based name mapping rule
|
|
394
|
+
*/
|
|
395
|
+
interface FrameworkMappingPattern {
|
|
396
|
+
/**
|
|
397
|
+
* Regex pattern to match token names
|
|
398
|
+
*/
|
|
399
|
+
pattern: RegExp | string;
|
|
400
|
+
/**
|
|
401
|
+
* Replacement string (supports $1, $2, etc. for capture groups)
|
|
402
|
+
*/
|
|
403
|
+
replacement: string;
|
|
404
|
+
/**
|
|
405
|
+
* Optional description for documentation
|
|
406
|
+
*/
|
|
407
|
+
description?: string;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Individual theme definition
|
|
411
|
+
* Specifies how a theme is discovered and built
|
|
412
|
+
*/
|
|
413
|
+
interface ThemeDefinition {
|
|
414
|
+
/**
|
|
415
|
+
* Whether this is the default theme (uses :root selector)
|
|
416
|
+
* Only one theme can be default
|
|
417
|
+
* @default false
|
|
418
|
+
*/
|
|
419
|
+
isDefault?: boolean;
|
|
420
|
+
/**
|
|
421
|
+
* File suffix pattern for this theme
|
|
422
|
+
* null means files without any theme suffix (default theme)
|
|
423
|
+
* e.g., '-dark' matches files like 'foundation-dark.json'
|
|
424
|
+
* @default null for default theme, '-{themeName}' for others
|
|
425
|
+
*/
|
|
426
|
+
suffix?: string | null;
|
|
427
|
+
/**
|
|
428
|
+
* CSS selector for this theme
|
|
429
|
+
* @example ':root' for default, '[data-dsai-theme="dark"]' for dark
|
|
430
|
+
*/
|
|
431
|
+
selector: string;
|
|
432
|
+
/**
|
|
433
|
+
* Optional media query for automatic switching
|
|
434
|
+
* @example '(prefers-color-scheme: dark)'
|
|
435
|
+
*/
|
|
436
|
+
mediaQuery?: string;
|
|
437
|
+
/**
|
|
438
|
+
* Optional data attribute (derived from selector if not specified)
|
|
439
|
+
*/
|
|
440
|
+
dataAttribute?: string;
|
|
441
|
+
/**
|
|
442
|
+
* Custom output file names per format
|
|
443
|
+
* If not specified, uses default naming pattern with theme suffix
|
|
444
|
+
*/
|
|
445
|
+
outputFiles?: Partial<Record<OutputFormat, string>>;
|
|
446
|
+
}
|
|
266
447
|
/**
|
|
267
448
|
* Theme configuration
|
|
268
449
|
*/
|
|
269
450
|
interface ThemesConfig {
|
|
451
|
+
/**
|
|
452
|
+
* Enable/disable theme processing
|
|
453
|
+
* @default true
|
|
454
|
+
*/
|
|
455
|
+
enabled?: boolean;
|
|
270
456
|
/**
|
|
271
457
|
* Auto-detect available modes from Figma export
|
|
458
|
+
* When true, scans for files with theme suffixes
|
|
459
|
+
* When false, only builds themes explicitly defined in definitions
|
|
272
460
|
* @default true
|
|
273
461
|
*/
|
|
274
462
|
autoDetect?: boolean;
|
|
275
463
|
/**
|
|
276
464
|
* Default theme mode (uses :root selector)
|
|
277
|
-
* @default '
|
|
465
|
+
* @default 'light'
|
|
466
|
+
* @deprecated Use definitions with isDefault: true instead
|
|
278
467
|
*/
|
|
279
468
|
default?: string;
|
|
280
469
|
/**
|
|
@@ -286,6 +475,12 @@ interface ThemesConfig {
|
|
|
286
475
|
* CSS selector patterns for themes
|
|
287
476
|
*/
|
|
288
477
|
selectorPattern?: ThemeSelectorPattern;
|
|
478
|
+
/**
|
|
479
|
+
* Explicit theme definitions
|
|
480
|
+
* Key is theme name, value is theme configuration
|
|
481
|
+
* When specified, provides explicit control over theme builds
|
|
482
|
+
*/
|
|
483
|
+
definitions?: Record<string, ThemeDefinition>;
|
|
289
484
|
}
|
|
290
485
|
/**
|
|
291
486
|
* Theme selector pattern configuration
|
|
@@ -443,14 +638,39 @@ interface IconsConfig {
|
|
|
443
638
|
*/
|
|
444
639
|
prefix?: string;
|
|
445
640
|
}
|
|
641
|
+
/**
|
|
642
|
+
* Resolved theme definition with all required fields
|
|
643
|
+
*/
|
|
644
|
+
interface ResolvedThemeDefinition {
|
|
645
|
+
/** Whether this is the default theme */
|
|
646
|
+
isDefault: boolean;
|
|
647
|
+
/** File suffix pattern (null for default theme) */
|
|
648
|
+
suffix: string | null;
|
|
649
|
+
/** CSS selector */
|
|
650
|
+
selector: string;
|
|
651
|
+
/** Optional media query */
|
|
652
|
+
mediaQuery?: string;
|
|
653
|
+
/** Optional data attribute */
|
|
654
|
+
dataAttribute?: string;
|
|
655
|
+
/** Output file names per format */
|
|
656
|
+
outputFiles: Record<OutputFormat, string>;
|
|
657
|
+
}
|
|
446
658
|
/**
|
|
447
659
|
* Resolved themes config with all defaults applied
|
|
448
660
|
*/
|
|
449
661
|
interface ResolvedThemesConfig {
|
|
662
|
+
/** Whether themes are enabled */
|
|
663
|
+
enabled: boolean;
|
|
664
|
+
/** Auto-detect themes from files */
|
|
450
665
|
autoDetect: boolean;
|
|
666
|
+
/** Default theme name (for backward compat) */
|
|
451
667
|
default: string;
|
|
668
|
+
/** Modes to ignore */
|
|
452
669
|
ignoreModes: string[];
|
|
670
|
+
/** Selector patterns */
|
|
453
671
|
selectorPattern: Required<ThemeSelectorPattern>;
|
|
672
|
+
/** Resolved theme definitions */
|
|
673
|
+
definitions: Record<string, ResolvedThemeDefinition>;
|
|
454
674
|
}
|
|
455
675
|
/**
|
|
456
676
|
* Resolved tokens config with all defaults applied
|
|
@@ -486,6 +706,19 @@ interface ResolvedTokensConfig {
|
|
|
486
706
|
watch: boolean;
|
|
487
707
|
watchDirectories: string[];
|
|
488
708
|
pipeline?: TokensBuildPipeline;
|
|
709
|
+
scss?: {
|
|
710
|
+
cssOutputDir?: string;
|
|
711
|
+
};
|
|
712
|
+
postprocess?: {
|
|
713
|
+
enabled?: boolean;
|
|
714
|
+
cssDir?: string;
|
|
715
|
+
files?: string[];
|
|
716
|
+
replacements?: Array<{
|
|
717
|
+
description?: string;
|
|
718
|
+
from: string | RegExp;
|
|
719
|
+
to: string;
|
|
720
|
+
}>;
|
|
721
|
+
};
|
|
489
722
|
}
|
|
490
723
|
/**
|
|
491
724
|
* Resolved icons config with all defaults applied
|
|
@@ -543,4 +776,4 @@ interface LoadConfigResult {
|
|
|
543
776
|
warnings: string[];
|
|
544
777
|
}
|
|
545
778
|
|
|
546
|
-
export type { BuildSummary as B, CustomTransform as C, DsaiConfig as D,
|
|
779
|
+
export type { BuildSummary as B, CustomTransform as C, DsaiConfig as D, FrameworkTarget as F, GlobalConfig as G, IconsConfig as I, LoadConfigOptions as L, OutputFormat as O, Platform as P, ResolvedConfig as R, ScssOutputConfig as S, TokensConfig as T, ThemesConfig as a, ThemeDefinition as b, ThemeSelectorPattern as c, FrameworkMappingConfig as d, FrameworkMappingPattern as e, ResolvedGlobalConfig as f, ResolvedTokensConfig as g, ResolvedIconsConfig as h, ResolvedThemesConfig as i, ResolvedThemeDefinition as j, CustomFormat as k, CustomPreprocessor as l, CustomFilter as m, TokenData as n, TransformOptions as o, FormatArgs as p, Dictionary as q, FileConfig as r, LoadConfigResult as s, LogLevel as t, IconFramework as u };
|