@dsai-io/tools 0.0.1

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.
@@ -0,0 +1,2070 @@
1
+ import { R as ResolvedConfig, O as OutputFormat } from '../types-Idj08nad.cjs';
2
+
3
+ /**
4
+ * Token-specific type definitions
5
+ *
6
+ * Defines types for DTCG-compliant tokens, validation, transformation,
7
+ * and build processes.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ /**
12
+ * DTCG-compliant token value
13
+ * @see https://www.designtokens.org/
14
+ */
15
+ interface DTCGToken {
16
+ /** The resolved value of the token */
17
+ $value: unknown;
18
+ /** Token type (color, dimension, etc.) */
19
+ $type?: TokenType;
20
+ /** Human-readable description */
21
+ $description?: string;
22
+ /** Extension data */
23
+ $extensions?: Record<string, unknown>;
24
+ }
25
+ /**
26
+ * Legacy Style Dictionary token format
27
+ */
28
+ interface LegacyToken {
29
+ /** The resolved value of the token */
30
+ value: unknown;
31
+ /** Token type */
32
+ type?: string;
33
+ /** Human-readable description */
34
+ description?: string;
35
+ /** Comment (older format) */
36
+ comment?: string;
37
+ }
38
+ /**
39
+ * Combined token type supporting both DTCG and legacy formats
40
+ */
41
+ type Token = DTCGToken | LegacyToken;
42
+ /**
43
+ * Token collection (nested structure of tokens or groups)
44
+ */
45
+ interface TokenCollection {
46
+ [key: string]: Token | TokenCollection | unknown;
47
+ }
48
+ /**
49
+ * Figma export format (from Tokens Studio)
50
+ */
51
+ interface FigmaExport {
52
+ [collectionName: string]: FigmaCollection;
53
+ }
54
+ /**
55
+ * Single Figma collection with optional modes
56
+ */
57
+ interface FigmaCollection {
58
+ /** Mode-specific token values */
59
+ modes?: Record<string, TokenCollection>;
60
+ /** Direct tokens if no modes */
61
+ [key: string]: unknown;
62
+ }
63
+ /**
64
+ * Valid token types per DTCG specification
65
+ */
66
+ declare const VALID_TOKEN_TYPES: readonly ["color", "dimension", "fontFamily", "fontWeight", "fontStyle", "shadow", "number", "string", "duration", "cubicBezier", "strokeStyle", "border", "transition", "gradient", "typography", "letterSpacing", "lineHeight", "paragraphSpacing", "textDecoration", "textCase"];
67
+ /**
68
+ * Token type (DTCG specification)
69
+ */
70
+ type TokenType = (typeof VALID_TOKEN_TYPES)[number];
71
+ /**
72
+ * Severity level for validation issues
73
+ */
74
+ type ValidationSeverity = 'error' | 'warning' | 'info';
75
+ /**
76
+ * A single validation issue
77
+ */
78
+ interface ValidationIssue {
79
+ /** Token path (e.g., "color.brand.primary") */
80
+ path: string;
81
+ /** Human-readable message */
82
+ message: string;
83
+ /** Issue severity */
84
+ severity: ValidationSeverity;
85
+ /** The problematic value (if applicable) */
86
+ value?: unknown;
87
+ /** Suggested fix (if applicable) */
88
+ suggestion?: string;
89
+ }
90
+ /**
91
+ * Result of token validation
92
+ */
93
+ interface ValidationResult {
94
+ /** Whether validation passed (no errors) */
95
+ valid: boolean;
96
+ /** Validation errors (blocking issues) */
97
+ errors: ValidationIssue[];
98
+ /** Validation warnings (non-blocking) */
99
+ warnings: ValidationIssue[];
100
+ /** Total number of tokens validated */
101
+ tokenCount: number;
102
+ /** Number of files validated */
103
+ fileCount: number;
104
+ /** Validation duration in milliseconds */
105
+ duration?: number;
106
+ }
107
+ /**
108
+ * Options for validation
109
+ */
110
+ interface ValidateOptions {
111
+ /** Directory containing token files */
112
+ collectionsDir?: string;
113
+ /** File patterns to validate */
114
+ patterns?: string[];
115
+ /** Enable verbose output */
116
+ verbose?: boolean;
117
+ /** Suppress output */
118
+ quiet?: boolean;
119
+ /** Treat warnings as errors */
120
+ strict?: boolean;
121
+ }
122
+ /**
123
+ * Options for Figma token transformation
124
+ */
125
+ interface TransformOptions {
126
+ /** Source directory with Figma exports */
127
+ sourceDir: string;
128
+ /** Output directory for collections */
129
+ collectionsDir: string;
130
+ /**
131
+ * Glob patterns for finding source files
132
+ * @example ['theme.json', '*.tokens.json', 'figma-variables-*.json']
133
+ */
134
+ sourcePatterns?: string[];
135
+ /**
136
+ * Map of collection names to specific file paths
137
+ * @example { 'primitives': './colors.json', 'semantic': './semantic.json' }
138
+ */
139
+ collectionMapping?: Record<string, string>;
140
+ /** Preserve $codeSyntax references from Figma */
141
+ preserveCodeSyntax?: boolean;
142
+ /** Modes to ignore during transformation */
143
+ ignoreModes?: string[];
144
+ /** Default mode name */
145
+ defaultMode?: string;
146
+ /** Dry run (don't write files) */
147
+ dryRun?: boolean;
148
+ /** Enable verbose output */
149
+ verbose?: boolean;
150
+ }
151
+ /**
152
+ * Result of token transformation
153
+ */
154
+ interface TransformResult {
155
+ /** Whether transformation succeeded */
156
+ success: boolean;
157
+ /** Files written during transformation */
158
+ filesWritten: string[];
159
+ /** Number of tokens processed */
160
+ tokensProcessed: number;
161
+ /** Modes detected in Figma export */
162
+ modesDetected: string[];
163
+ /** Errors encountered */
164
+ errors: string[];
165
+ /** Warnings generated */
166
+ warnings: string[];
167
+ /** Duration in milliseconds */
168
+ duration?: number;
169
+ }
170
+ /**
171
+ * A single build step
172
+ */
173
+ interface BuildStep {
174
+ /** Step name for display */
175
+ name: string;
176
+ /** Shell command to run (if external) */
177
+ command?: string;
178
+ /** Function to execute (if internal). Returns boolean for success/failure, or undefined */
179
+ fn?: () => boolean | undefined | Promise<boolean | undefined>;
180
+ /** Whether to skip this step */
181
+ skip?: boolean;
182
+ /** Working directory for command */
183
+ cwd?: string;
184
+ }
185
+ /**
186
+ * Options for token build
187
+ */
188
+ interface BuildOptions {
189
+ /** Skip validation step */
190
+ skipValidate?: boolean;
191
+ /** Skip transformation step */
192
+ skipTransform?: boolean;
193
+ /** Only build theme CSS */
194
+ onlyTheme?: boolean;
195
+ /** Enable watch mode */
196
+ watch?: boolean;
197
+ /** Dry run (don't write files) */
198
+ dryRun?: boolean;
199
+ /** Enable verbose output */
200
+ verbose?: boolean;
201
+ /** Suppress output */
202
+ quiet?: boolean;
203
+ /** Output directory for all formats */
204
+ outputDir?: string;
205
+ /** Per-format output directories */
206
+ outputDirs?: Partial<Record<string, string>>;
207
+ /** Per-format output file names */
208
+ outputFileNames?: Partial<Record<string, string>>;
209
+ /** Additional SCSS directories to merge */
210
+ additionalScssDirectories?: string[];
211
+ /** Additional CSS directories to merge */
212
+ additionalCssDirectories?: string[];
213
+ /** Merge order for additional styles */
214
+ mergeOrder?: 'before' | 'after';
215
+ /** Create combined bundle files */
216
+ createBundle?: boolean;
217
+ /** Custom SCSS import header */
218
+ scssImportHeader?: string;
219
+ /** Additional directories to watch */
220
+ watchDirectories?: string[];
221
+ /** Build pipeline configuration */
222
+ pipeline?: {
223
+ /** Steps to include in the build */
224
+ steps?: Array<'validate' | 'transform' | 'style-dictionary' | 'sync' | 'sass-theme' | 'sass-theme-minified' | 'postprocess' | 'sass-utilities' | 'sass-utilities-minified' | 'bundle'>;
225
+ /** Paths configuration for build steps */
226
+ paths?: {
227
+ syncSource?: string;
228
+ syncTarget?: string;
229
+ sassThemeInput?: string;
230
+ sassThemeOutput?: string;
231
+ sassThemeMinifiedOutput?: string;
232
+ sassUtilitiesInput?: string;
233
+ sassUtilitiesOutput?: string;
234
+ sassUtilitiesMinifiedOutput?: string;
235
+ };
236
+ /** Style Dictionary config file name */
237
+ styleDictionaryConfig?: string;
238
+ };
239
+ }
240
+ /**
241
+ * Result of token build
242
+ */
243
+ interface BuildResult {
244
+ /** Whether build succeeded */
245
+ success: boolean;
246
+ /** Steps that completed successfully */
247
+ stepsCompleted: string[];
248
+ /** Steps that failed */
249
+ stepsFailed: string[];
250
+ /** Total duration in milliseconds */
251
+ duration: number;
252
+ /** Errors encountered */
253
+ errors: string[];
254
+ /** Warnings generated */
255
+ warnings: string[];
256
+ /** Generated output files */
257
+ outputFiles?: string[];
258
+ }
259
+ /**
260
+ * Options for token sync
261
+ */
262
+ interface SyncOptions {
263
+ /** Source file (Style Dictionary output) */
264
+ sourceFile: string;
265
+ /** Target file (TypeScript source) */
266
+ targetFile: string;
267
+ /** Dry run (don't write files) */
268
+ dryRun?: boolean;
269
+ /** Enable verbose output */
270
+ verbose?: boolean;
271
+ }
272
+ /**
273
+ * Result of token sync
274
+ */
275
+ interface SyncResult {
276
+ /** Whether sync succeeded */
277
+ success: boolean;
278
+ /** Number of tokens synced */
279
+ tokensCount: number;
280
+ /** Whether file was changed */
281
+ changed: boolean;
282
+ /** Errors encountered */
283
+ errors?: string[];
284
+ }
285
+ /**
286
+ * A text replacement rule
287
+ */
288
+ interface ReplacementRule {
289
+ /** Pattern to search for (string or regex) */
290
+ from: string | RegExp;
291
+ /** Replacement string */
292
+ to: string;
293
+ /** Optional description */
294
+ description?: string;
295
+ }
296
+ /**
297
+ * Options for CSS post-processing
298
+ */
299
+ interface PostprocessOptions {
300
+ /** Input CSS file */
301
+ inputFile: string;
302
+ /** Output CSS file (defaults to input) */
303
+ outputFile?: string;
304
+ /** Replacements to make */
305
+ replacements?: ReplacementRule[];
306
+ /** Dry run (don't write files) */
307
+ dryRun?: boolean;
308
+ /** Enable verbose output */
309
+ verbose?: boolean;
310
+ }
311
+ /**
312
+ * Result of post-processing
313
+ */
314
+ interface PostprocessResult {
315
+ /** Whether post-processing succeeded */
316
+ success: boolean;
317
+ /** Number of replacements made */
318
+ replacementsMade: number;
319
+ /** Output file path */
320
+ outputFile: string;
321
+ /** Errors encountered */
322
+ errors?: string[];
323
+ }
324
+ /**
325
+ * Options for merging collections
326
+ */
327
+ interface MergeOptions {
328
+ /** Source files to merge */
329
+ sourceFiles: string[];
330
+ /** Output file path */
331
+ outputFile: string;
332
+ /** Merge strategy for conflicts */
333
+ strategy?: 'first' | 'last' | 'error';
334
+ /** Dry run (don't write files) */
335
+ dryRun?: boolean;
336
+ /** Enable verbose output */
337
+ verbose?: boolean;
338
+ }
339
+ /**
340
+ * Result of collection merge
341
+ */
342
+ interface MergeResult {
343
+ /** Whether merge succeeded */
344
+ success: boolean;
345
+ /** Number of collections merged */
346
+ collectionsCount: number;
347
+ /** Number of tokens in result */
348
+ tokensCount: number;
349
+ /** Output file path */
350
+ outputFile: string;
351
+ /** Conflicts detected */
352
+ conflicts?: string[];
353
+ /** Errors encountered */
354
+ errors?: string[];
355
+ }
356
+ /**
357
+ * Check if an object is a DTCG token
358
+ */
359
+ declare function isDTCGToken(obj: unknown): obj is DTCGToken;
360
+ /**
361
+ * Check if an object is a legacy token
362
+ */
363
+ declare function isLegacyToken(obj: unknown): obj is LegacyToken;
364
+ /**
365
+ * Check if an object is any token type
366
+ */
367
+ declare function isToken(obj: unknown): obj is Token;
368
+ /**
369
+ * Check if a string is a valid token type
370
+ */
371
+ declare function isValidTokenType(type: string): type is TokenType;
372
+ /**
373
+ * Check if a value is a token reference
374
+ */
375
+ declare function isTokenReference(value: unknown): boolean;
376
+ /**
377
+ * Get the value from a token regardless of format
378
+ */
379
+ declare function getTokenValue(token: Token): unknown;
380
+ /**
381
+ * Get the type from a token regardless of format
382
+ */
383
+ declare function getTokenType(token: Token): string | undefined;
384
+ /**
385
+ * Get the description from a token regardless of format
386
+ */
387
+ declare function getTokenDescription(token: Token): string | undefined;
388
+ /**
389
+ * Convert a legacy token to DTCG format
390
+ */
391
+ declare function toDTCGToken(token: LegacyToken): DTCGToken;
392
+ /**
393
+ * Parse a token reference string
394
+ * @param ref - Reference string like "{color.brand.primary}"
395
+ * @returns Path segments like ["color", "brand", "primary"]
396
+ */
397
+ declare function parseTokenReference(ref: string): string[] | null;
398
+
399
+ /**
400
+ * Token validation module
401
+ *
402
+ * Validates design tokens for DTCG compliance and structural integrity.
403
+ *
404
+ * @packageDocumentation
405
+ */
406
+
407
+ /**
408
+ * Validate all tokens in a directory
409
+ *
410
+ * @param config - Resolved configuration
411
+ * @param options - Validation options
412
+ * @returns Validation result
413
+ *
414
+ * @example
415
+ * ```typescript
416
+ * import { validateTokens, loadConfig } from '@dsai-io/tools';
417
+ *
418
+ * const { config } = await loadConfig();
419
+ * const result = await validateTokens(config);
420
+ *
421
+ * if (!result.valid) {
422
+ * console.error('Validation failed:', result.errors);
423
+ * }
424
+ * ```
425
+ */
426
+ declare function validateTokens(config: ResolvedConfig, options?: ValidateOptions): Promise<ValidationResult>;
427
+ /**
428
+ * Validate tokens and exit with code (for CLI usage)
429
+ *
430
+ * @param config - Resolved configuration
431
+ * @param options - Validation options
432
+ */
433
+ declare function validateTokensCLI(config: ResolvedConfig, options?: ValidateOptions): Promise<void>;
434
+
435
+ /**
436
+ * Figma Export Validation module
437
+ *
438
+ * Validates Figma token exports before transformation to ensure
439
+ * they meet the expected structure and format requirements.
440
+ *
441
+ * @packageDocumentation
442
+ */
443
+
444
+ /**
445
+ * Expected structure for a Figma collection
446
+ */
447
+ interface ExpectedCollection {
448
+ /** File name for this collection */
449
+ input: string;
450
+ /** Whether the collection has mode variants (Light/Dark) */
451
+ modeAware: boolean;
452
+ /** Expected mode names */
453
+ modes?: string[];
454
+ }
455
+ /**
456
+ * Expected collections configuration
457
+ */
458
+ interface ExpectedCollections {
459
+ [key: string]: ExpectedCollection;
460
+ }
461
+ /**
462
+ * Figma validation options
463
+ */
464
+ interface ValidateFigmaOptions {
465
+ /** Path to the figma-exports directory */
466
+ exportsDir?: string;
467
+ /** Expected collection definitions */
468
+ collections?: ExpectedCollections;
469
+ /** Strict mode - treat warnings as errors */
470
+ strict?: boolean;
471
+ /** Skip missing files */
472
+ skipMissing?: boolean;
473
+ /** Configuration object */
474
+ config?: ResolvedConfig;
475
+ }
476
+ /**
477
+ * Figma validation result
478
+ */
479
+ interface ValidateFigmaResult extends ValidationResult {
480
+ /** Per-file validation results */
481
+ files: Map<string, ValidationResult>;
482
+ /** Detected modes across all files */
483
+ detectedModes: Set<string>;
484
+ /** Missing expected files */
485
+ missingFiles: string[];
486
+ }
487
+ /**
488
+ * Validate a single Figma export file
489
+ */
490
+ declare function validateFigmaFile(filePath: string, expectedCollection?: ExpectedCollection): ValidationResult & {
491
+ detectedModes: Set<string>;
492
+ };
493
+ /**
494
+ * Validate all Figma exports in a directory
495
+ */
496
+ declare function validateFigmaExports(options?: ValidateFigmaOptions): ValidateFigmaResult;
497
+ /**
498
+ * Detect modes from Figma export data
499
+ */
500
+ declare function detectModes$1(data: FigmaExport, collectionName?: string): string[];
501
+ /**
502
+ * CLI entry point for Figma validation
503
+ */
504
+ declare function validateFigmaCLI(exportsDir: string, options?: Omit<ValidateFigmaOptions, 'exportsDir'>): boolean;
505
+
506
+ /**
507
+ * Token Transformation module
508
+ *
509
+ * Transforms Figma token exports to Style Dictionary format with DTCG compliance.
510
+ *
511
+ * @packageDocumentation
512
+ */
513
+
514
+ /**
515
+ * Transform options specific to token values
516
+ */
517
+ interface TokenTransformOptions {
518
+ /** Font stack to prepend font name to */
519
+ fontStack?: string;
520
+ /** Token path for context-aware transformations */
521
+ tokenPath?: string;
522
+ /** Token scopes from Figma */
523
+ scopes?: string[];
524
+ /** Whether value represents a circle (50%) */
525
+ isCircle?: boolean;
526
+ /** Whether value represents a pill (9999px) */
527
+ isPill?: boolean;
528
+ }
529
+ /**
530
+ * Transform value based on type
531
+ */
532
+ declare function transformValue(value: unknown, type: string | undefined, options?: TokenTransformOptions): unknown;
533
+ /**
534
+ * Transform type from Figma to DTCG standard
535
+ */
536
+ declare function transformType(figmaType: string | undefined): TokenType | undefined;
537
+ /**
538
+ * Transform a single token from Figma format to DTCG-compliant format
539
+ */
540
+ declare function transformToken(figmaToken: unknown, options?: TokenTransformOptions): DTCGToken | null;
541
+ /**
542
+ * Recursively transform nested token objects
543
+ */
544
+ declare function transformTokenTree(obj: unknown, parentKey?: string, options?: Record<string, TokenTransformOptions>): Record<string, unknown>;
545
+ /**
546
+ * Detect modes from Figma export data
547
+ */
548
+ declare function detectModes(data: FigmaExport, collectionPath?: string): string[];
549
+ /**
550
+ * Transform Figma tokens to Style Dictionary format
551
+ */
552
+ declare function transformTokens(options: TransformOptions): TransformResult;
553
+ /**
554
+ * CLI entry point for token transformation
555
+ */
556
+ declare function transformTokensCLI(sourceDir: string, collectionsDir: string, options?: Partial<Omit<TransformOptions, 'sourceDir' | 'collectionsDir'>>): boolean;
557
+
558
+ /**
559
+ * @file Token Sync Module
560
+ * @description Synchronizes generated tokens from Style Dictionary output to TypeScript source
561
+ *
562
+ * This module handles syncing the generated tokens from dist/js/tokens.js
563
+ * to src/tokens-flat.ts so that tsup can bundle them correctly.
564
+ *
565
+ * This ensures that when font families or other tokens change in Figma,
566
+ * the changes automatically propagate to the TypeScript source.
567
+ *
568
+ * @module @dsai-io/tools/tokens/sync
569
+ */
570
+
571
+ /**
572
+ * Compute default file paths from tokens directory
573
+ */
574
+ declare function getDefaultSyncPaths(tokensDir: string): {
575
+ sourceFile: string;
576
+ targetFile: string;
577
+ };
578
+ /**
579
+ * Sync tokens from Style Dictionary output to TypeScript source
580
+ *
581
+ * @example
582
+ * ```typescript
583
+ * // Sync with explicit paths
584
+ * const result = syncTokens({
585
+ * sourceFile: './packages/@dsai-io/tokens/dist/js/tokens.js',
586
+ * targetFile: './packages/@dsai-io/tokens/src/tokens-flat.ts',
587
+ * });
588
+ *
589
+ * // Sync with paths computed from tokens directory
590
+ * const paths = getDefaultSyncPaths('./packages/@dsai-io/tokens');
591
+ * const result = syncTokens(paths);
592
+ * ```
593
+ */
594
+ declare function syncTokens(options: SyncOptions): SyncResult;
595
+ /**
596
+ * CLI entry point for token sync
597
+ */
598
+ declare function syncTokensCLI(tokensDir: string): boolean;
599
+
600
+ /**
601
+ * @file Token Build Module
602
+ * @description Orchestrates the complete token build pipeline
603
+ *
604
+ * Runs all token build steps in sequence with clear logging:
605
+ * 1. Validate tokens
606
+ * 2. Transform Figma tokens
607
+ * 3. Build Style Dictionary outputs (CSS, JS, TS, SCSS, JSON)
608
+ * 4. Sync tokens-flat.ts
609
+ * 5. Compile Bootstrap theme SCSS → CSS
610
+ * 6. Post-process theme CSS (data-bs-theme → data-dsai-theme)
611
+ * 7. Compile DSAi utilities SCSS → CSS
612
+ * 8. Bundle with tsup (ESM + CJS)
613
+ *
614
+ * The pipeline is configurable via dsai.config.mjs tokens.pipeline section.
615
+ * Packages can specify which steps to run and customize paths.
616
+ *
617
+ * @module @dsai-io/tools/tokens/build
618
+ */
619
+
620
+ /**
621
+ * Run the complete token build pipeline
622
+ *
623
+ * @example
624
+ * ```typescript
625
+ * // Full build
626
+ * const result = buildTokens({
627
+ * tokensDir: './packages/@dsai-io/tokens',
628
+ * toolsDir: './tools/scripts/tokens',
629
+ * });
630
+ *
631
+ * // Skip validation
632
+ * const result = buildTokens({
633
+ * tokensDir: './packages/@dsai-io/tokens',
634
+ * toolsDir: './tools/scripts/tokens',
635
+ * skipValidate: true,
636
+ * });
637
+ *
638
+ * // Only build theme CSS
639
+ * const result = buildTokens({
640
+ * tokensDir: './packages/@dsai-io/tokens',
641
+ * toolsDir: './tools/scripts/tokens',
642
+ * onlyTheme: true,
643
+ * });
644
+ * ```
645
+ */
646
+ declare function buildTokens(tokensDir: string, toolsDir: string, options?: BuildOptions): BuildResult;
647
+ /**
648
+ * CLI entry point for token build
649
+ */
650
+ declare function buildTokensCLI(tokensDir: string, toolsDir: string, args?: string[]): boolean;
651
+ /**
652
+ * Parse CLI arguments and run build
653
+ * Used as the main entry point when called directly
654
+ */
655
+ declare function runBuildCLI(tokensDir: string, toolsDir: string): void;
656
+
657
+ /**
658
+ * @file Token Clean Module
659
+ * @description Provides functionality to clean token output directories before builds.
660
+ *
661
+ * This module supports:
662
+ * - Cleaning individual output directories (dist/css, dist/js, etc.)
663
+ * - Cleaning all build outputs
664
+ * - Dry-run mode to preview what would be deleted
665
+ * - Safe deletion with directory validation
666
+ *
667
+ * @module @dsai-io/tools/tokens/clean
668
+ */
669
+ /**
670
+ * Clean operation options
671
+ */
672
+ interface CleanOptions {
673
+ /**
674
+ * Base directory for cleaning (typically the package root)
675
+ * @default process.cwd()
676
+ */
677
+ baseDir?: string;
678
+ /**
679
+ * Directories to clean relative to baseDir
680
+ * @default ['dist']
681
+ */
682
+ directories?: string[];
683
+ /**
684
+ * Show what would be deleted without actually deleting
685
+ * @default false
686
+ */
687
+ dryRun?: boolean;
688
+ /**
689
+ * Enable verbose logging
690
+ * @default false
691
+ */
692
+ verbose?: boolean;
693
+ /**
694
+ * File patterns to preserve (glob patterns)
695
+ * Files matching these patterns will not be deleted
696
+ * @example ['.gitkeep', 'README.md']
697
+ */
698
+ preserve?: string[];
699
+ }
700
+ /**
701
+ * Information about a cleaned directory
702
+ */
703
+ interface CleanedDirectory {
704
+ /** Path to the cleaned directory */
705
+ path: string;
706
+ /** Number of files removed */
707
+ filesRemoved: number;
708
+ /** Number of directories removed */
709
+ directoriesRemoved: number;
710
+ /** Whether the directory existed before cleaning */
711
+ existed: boolean;
712
+ }
713
+ /**
714
+ * Result of a clean operation
715
+ */
716
+ interface CleanResult {
717
+ /** Whether the clean operation completed successfully */
718
+ success: boolean;
719
+ /** List of cleaned directories with details */
720
+ cleaned: CleanedDirectory[];
721
+ /** Total number of files removed */
722
+ totalFilesRemoved: number;
723
+ /** Total number of directories removed */
724
+ totalDirectoriesRemoved: number;
725
+ /** Any errors encountered */
726
+ errors: string[];
727
+ /** Any warnings (non-blocking issues) */
728
+ warnings: string[];
729
+ /** Whether this was a dry run */
730
+ dryRun: boolean;
731
+ /** Duration of the operation in milliseconds */
732
+ duration: number;
733
+ }
734
+ /**
735
+ * Default directories to clean for token builds
736
+ */
737
+ declare const DEFAULT_CLEAN_DIRECTORIES: readonly ["dist"];
738
+ /**
739
+ * Clean token output directories
740
+ *
741
+ * Removes build artifacts from output directories to ensure a fresh build.
742
+ * Supports dry-run mode, preserve patterns, and safety validation.
743
+ *
744
+ * @param options - Clean operation options
745
+ * @returns Clean operation result
746
+ *
747
+ * @example
748
+ * // Clean default dist directory
749
+ * const result = cleanTokenOutputs();
750
+ *
751
+ * @example
752
+ * // Clean specific directories with dry-run
753
+ * const result = cleanTokenOutputs({
754
+ * directories: ['dist/css', 'dist/js'],
755
+ * dryRun: true,
756
+ * verbose: true,
757
+ * });
758
+ *
759
+ * @example
760
+ * // Clean with preserved files
761
+ * const result = cleanTokenOutputs({
762
+ * preserve: ['README.md', '*.d.ts'],
763
+ * });
764
+ */
765
+ declare function cleanTokenOutputs(options?: CleanOptions): CleanResult;
766
+ /**
767
+ * CLI wrapper for cleanTokenOutputs
768
+ *
769
+ * Provides formatted output suitable for CLI usage.
770
+ *
771
+ * @param baseDir - Base directory for the clean operation
772
+ * @param options - Clean options
773
+ * @returns Whether the clean was successful
774
+ */
775
+ declare function cleanTokensCLI(baseDir: string, options?: Omit<CleanOptions, 'baseDir'>): boolean;
776
+
777
+ /**
778
+ * @file CSS Post-processing Module
779
+ * @description Post-processes CSS files after SASS compilation
780
+ *
781
+ * This module applies DSAi-specific transformations to compiled CSS:
782
+ * - Replaces `data-bs-theme` with `data-dsai-theme` for custom theme attribute
783
+ * - Applies configurable text replacements
784
+ *
785
+ * @module @dsai-io/tools/tokens/postprocess
786
+ */
787
+
788
+ /**
789
+ * Post-process a single CSS file
790
+ *
791
+ * @example
792
+ * ```typescript
793
+ * const result = postprocessCss({
794
+ * inputFile: './dist/css/theme.css',
795
+ * replacements: [
796
+ * { from: /data-bs-theme/g, to: 'data-dsai-theme', description: 'Theme attribute' }
797
+ * ],
798
+ * });
799
+ * ```
800
+ */
801
+ declare function postprocessCss(options: PostprocessOptions): PostprocessResult;
802
+ /**
803
+ * Post-process multiple CSS files in a directory
804
+ *
805
+ * @example
806
+ * ```typescript
807
+ * const results = postprocessCssFiles({
808
+ * cssDir: './packages/@dsai-io/tokens/dist/css',
809
+ * files: ['dsai-theme-bs.css', 'dsai-theme-bs.min.css'],
810
+ * });
811
+ * ```
812
+ */
813
+ declare function postprocessCssFiles(options: {
814
+ cssDir: string;
815
+ files?: string[];
816
+ replacements?: ReplacementRule[];
817
+ dryRun?: boolean;
818
+ verbose?: boolean;
819
+ }): {
820
+ success: boolean;
821
+ filesModified: number;
822
+ totalReplacements: number;
823
+ errors: string[];
824
+ };
825
+ /**
826
+ * CLI entry point for CSS post-processing
827
+ */
828
+ declare function postprocessCLI(tokensDir: string): boolean;
829
+ /**
830
+ * Get the default CSS distribution directory path
831
+ */
832
+ declare function getDefaultCssDir(tokensDir: string): string;
833
+ /**
834
+ * Get the default files to process
835
+ */
836
+ declare function getDefaultFiles(): string[];
837
+ /**
838
+ * Get the default transformation rules
839
+ */
840
+ declare function getDefaultTransformations(): ReplacementRule[];
841
+
842
+ /**
843
+ * @file Token Collections Merge Module
844
+ * @description Merge multiple Figma Tokens Studio collection files into one unified collection
845
+ *
846
+ * Features:
847
+ * - Intelligently merges nested token structures
848
+ * - Preserves all metadata ($codeSyntax, $scopes, $type, etc.)
849
+ * - Maintains token references and aliases
850
+ * - Handles mode-based tokens (Light Mode, Dark Mode)
851
+ * - Deep merges sections without overwriting
852
+ * - Normalizes reference format to lowercase {colors.path}
853
+ * - Adds $libraryName and $collectionName to aliased tokens
854
+ * - Sorts properties alphabetically for consistency
855
+ * - Removes duplicate sections (like "hue" that duplicates "brand")
856
+ *
857
+ * @module @dsai-io/tools/tokens/merge
858
+ */
859
+
860
+ /**
861
+ * Merge multiple collection files into one
862
+ *
863
+ * @example
864
+ * ```typescript
865
+ * const result = mergeCollections({
866
+ * sourceFiles: ['colors-scales.json', 'colors.json'],
867
+ * outputFile: 'merged-colors.json',
868
+ * });
869
+ * ```
870
+ */
871
+ declare function mergeCollections(options: MergeOptions): MergeResult;
872
+ /**
873
+ * CLI entry point for merging collections
874
+ */
875
+ declare function mergeCollectionsCLI(source1: string, source2: string, output: string): boolean;
876
+
877
+ /**
878
+ * Style merge and bundle type definitions
879
+ *
880
+ * @packageDocumentation
881
+ */
882
+
883
+ /**
884
+ * Configuration for merging additional stylesheets
885
+ */
886
+ interface MergeConfig {
887
+ /**
888
+ * Additional SCSS directories to scan
889
+ * Relative to config file location
890
+ */
891
+ scssDirectories: string[];
892
+ /**
893
+ * Additional CSS directories to scan
894
+ * Relative to config file location
895
+ */
896
+ cssDirectories: string[];
897
+ /**
898
+ * Order of merging
899
+ * - 'before': User styles before token styles
900
+ * - 'after': User styles after token styles
901
+ */
902
+ mergeOrder: 'before' | 'after';
903
+ /**
904
+ * Create combined bundle files
905
+ */
906
+ createBundle: boolean;
907
+ /**
908
+ * SCSS file to import at top of generated files
909
+ */
910
+ scssImportHeader?: string | string[];
911
+ /**
912
+ * File patterns to ignore when scanning
913
+ * @default ['_index.scss', '*.test.scss']
914
+ */
915
+ ignorePatterns?: string[];
916
+ /**
917
+ * Sort order for collected files
918
+ * - 'alphabetical': Sort A-Z by filename
919
+ * - 'directory-first': Group by directory, then alphabetical
920
+ * - 'explicit': Use order from config
921
+ */
922
+ sortOrder?: 'alphabetical' | 'directory-first' | 'explicit';
923
+ }
924
+ /**
925
+ * Configuration for output file locations
926
+ */
927
+ interface OutputConfig {
928
+ /**
929
+ * Default output directory (applies to all formats)
930
+ */
931
+ baseDir: string;
932
+ /**
933
+ * Per-format output directories
934
+ * Overrides baseDir for specific formats
935
+ */
936
+ formatDirs: Partial<Record<OutputFormat, string>>;
937
+ /**
938
+ * Per-format file names with placeholder support
939
+ * Placeholders: {theme}, {name}, {format}, {date}
940
+ */
941
+ fileNames: Partial<Record<OutputFormat, string>>;
942
+ /**
943
+ * Create directories if they don't exist
944
+ * @default true
945
+ */
946
+ createDirs?: boolean;
947
+ }
948
+ /**
949
+ * Scanned stylesheet file information
950
+ */
951
+ interface StyleScannedFile {
952
+ /** Absolute path to file */
953
+ absolutePath: string;
954
+ /** Relative path from source directory */
955
+ relativePath: string;
956
+ /** File name without extension */
957
+ name: string;
958
+ /** File extension (scss, css) */
959
+ extension: 'scss' | 'css';
960
+ /** File size in bytes */
961
+ size: number;
962
+ /** Last modified timestamp */
963
+ mtime: Date;
964
+ /** Directory depth from source root */
965
+ depth: number;
966
+ }
967
+ /**
968
+ * Style scanner options
969
+ */
970
+ interface StyleScannerOptions {
971
+ /** Directories to scan */
972
+ directories: string[];
973
+ /** File extension to look for */
974
+ extension: 'scss' | 'css';
975
+ /** Patterns to ignore */
976
+ ignorePatterns?: string[];
977
+ /** Follow symlinks */
978
+ followSymlinks?: boolean;
979
+ /** Max directory depth */
980
+ maxDepth?: number;
981
+ }
982
+ /**
983
+ * Style scanner result
984
+ */
985
+ interface StyleScannerResult {
986
+ /** Scanned files */
987
+ files: StyleScannedFile[];
988
+ /** Directories that were scanned */
989
+ directories: string[];
990
+ /** Directories that were missing */
991
+ missingDirectories: string[];
992
+ /** Total file count */
993
+ totalFiles: number;
994
+ /** Total size in bytes */
995
+ totalSize: number;
996
+ }
997
+ /**
998
+ * Content to merge
999
+ */
1000
+ interface MergeContent {
1001
+ /** Source file path */
1002
+ source: string;
1003
+ /** File content */
1004
+ content: string;
1005
+ /** Content type */
1006
+ type: 'token' | 'user';
1007
+ /** Format */
1008
+ format: 'scss' | 'css';
1009
+ /** Theme name (if applicable) */
1010
+ theme?: string;
1011
+ }
1012
+ /**
1013
+ * Merge result
1014
+ */
1015
+ interface StyleMergeResult {
1016
+ /** Merged content */
1017
+ content: string;
1018
+ /** Source map (if generated) */
1019
+ sourceMap?: string;
1020
+ /** Files included in merge */
1021
+ sources: string[];
1022
+ /** Warnings during merge */
1023
+ warnings: string[];
1024
+ }
1025
+ /**
1026
+ * Bundle configuration
1027
+ */
1028
+ interface BundleConfig {
1029
+ /** Bundle name (without extension) */
1030
+ name: string;
1031
+ /** Include source comments */
1032
+ includeSourceComments: boolean;
1033
+ /** Generate sourcemaps */
1034
+ sourcemaps: boolean;
1035
+ /** Minify output */
1036
+ minify: boolean;
1037
+ /** Output directory */
1038
+ outputDir: string;
1039
+ }
1040
+ /**
1041
+ * Bundle result
1042
+ */
1043
+ interface BundleResult {
1044
+ /** Bundle content */
1045
+ content: string;
1046
+ /** Sourcemap content (if generated) */
1047
+ sourcemap?: string;
1048
+ /** Output file path */
1049
+ outputPath: string;
1050
+ /** Files included in bundle */
1051
+ files: string[];
1052
+ /** Bundle size in bytes */
1053
+ size: number;
1054
+ /** Minified size (if minified) */
1055
+ minifiedSize?: number;
1056
+ }
1057
+ /**
1058
+ * Placeholder values for file naming
1059
+ */
1060
+ interface PlaceholderValues {
1061
+ /** Theme name (e.g., 'light', 'dark') */
1062
+ theme?: string;
1063
+ /** Token name or identifier */
1064
+ name?: string;
1065
+ /** Output format */
1066
+ format?: OutputFormat;
1067
+ /** Current date in ISO format */
1068
+ date?: string;
1069
+ /** Timestamp */
1070
+ timestamp?: string;
1071
+ }
1072
+
1073
+ /**
1074
+ * Scanner for finding stylesheet files in directories
1075
+ *
1076
+ * @packageDocumentation
1077
+ */
1078
+
1079
+ /**
1080
+ * Scan directories for stylesheet files
1081
+ *
1082
+ * @param options Scanner options
1083
+ * @returns Scanner result with found files
1084
+ *
1085
+ * @example
1086
+ * ```typescript
1087
+ * const result = await scanDirectories({
1088
+ * directories: ['src/styles/overrides', 'src/styles/custom'],
1089
+ * extension: 'scss',
1090
+ * });
1091
+ *
1092
+ * console.log(`Found ${result.totalFiles} files`);
1093
+ * ```
1094
+ */
1095
+ declare function scanDirectories(options: StyleScannerOptions): Promise<StyleScannerResult>;
1096
+ /**
1097
+ * Sort scanned files according to specified order
1098
+ *
1099
+ * @param files Files to sort
1100
+ * @param order Sort order
1101
+ * @returns Sorted files
1102
+ */
1103
+ declare function sortFiles(files: StyleScannedFile[], order?: 'alphabetical' | 'directory-first'): StyleScannedFile[];
1104
+ /**
1105
+ * Filter files matching patterns
1106
+ *
1107
+ * @param files Files to filter
1108
+ * @param patterns Glob patterns to match
1109
+ * @param include If true, keep matching files; if false, exclude matching
1110
+ * @returns Filtered files
1111
+ */
1112
+ declare function filterFiles(files: StyleScannedFile[], patterns: string[], include?: boolean): StyleScannedFile[];
1113
+ /**
1114
+ * Get default ignore patterns
1115
+ */
1116
+ declare function getDefaultIgnorePatterns(): string[];
1117
+
1118
+ /**
1119
+ * Merge stylesheet content
1120
+ *
1121
+ * @packageDocumentation
1122
+ */
1123
+
1124
+ /**
1125
+ * Merge stylesheet content in specified order
1126
+ *
1127
+ * @param tokenContent Generated token content
1128
+ * @param userContent User stylesheet content
1129
+ * @param config Merge configuration
1130
+ * @returns Merged result
1131
+ *
1132
+ * @example
1133
+ * ```typescript
1134
+ * const result = await mergeContent(
1135
+ * { content: ':root { --color-primary: blue; }', format: 'css' },
1136
+ * [{ source: 'overrides.css', content: ':root { --color-bg: white; }' }],
1137
+ * { mergeOrder: 'after' }
1138
+ * );
1139
+ * ```
1140
+ */
1141
+ declare function mergeContent(tokenContent: {
1142
+ content: string;
1143
+ format: 'scss' | 'css';
1144
+ }, userContent: MergeContent[], config?: Partial<MergeConfig>): Promise<StyleMergeResult>;
1145
+ /**
1146
+ * Load content from files
1147
+ *
1148
+ * @param files File paths to load
1149
+ * @param type Content type (token or user)
1150
+ * @param format File format
1151
+ * @returns Loaded content
1152
+ */
1153
+ declare function loadContent(files: string[], type: 'token' | 'user', format: 'scss' | 'css'): Promise<MergeContent[]>;
1154
+ /**
1155
+ * Process SCSS imports header
1156
+ *
1157
+ * @param importHeader Import header configuration
1158
+ * @param configDir Config directory for resolving relative paths
1159
+ * @returns Processed import statements
1160
+ */
1161
+ declare function processScssImportHeader(importHeader: string | string[] | undefined, configDir: string): string;
1162
+ /**
1163
+ * Add SCSS import header to content
1164
+ *
1165
+ * @param content SCSS content
1166
+ * @param importHeader Import header to add
1167
+ * @param configDir Config directory for resolving paths
1168
+ * @returns Content with import header
1169
+ */
1170
+ declare function addScssImportHeader(content: string, importHeader: string | string[] | undefined, configDir: string): string;
1171
+
1172
+ /**
1173
+ * Bundle generator for combined stylesheets
1174
+ *
1175
+ * @packageDocumentation
1176
+ */
1177
+
1178
+ /**
1179
+ * Create a stylesheet bundle
1180
+ *
1181
+ * @param mergeResult Result from merge operation
1182
+ * @param config Bundle configuration
1183
+ * @returns Bundle result
1184
+ *
1185
+ * @example
1186
+ * ```typescript
1187
+ * const bundle = await createBundle(mergeResult, {
1188
+ * name: 'tokens-bundle',
1189
+ * outputDir: 'dist',
1190
+ * includeSourceComments: true,
1191
+ * sourcemaps: true,
1192
+ * minify: false,
1193
+ * });
1194
+ * ```
1195
+ */
1196
+ declare function createBundle(mergeResult: StyleMergeResult, config: BundleConfig): Promise<BundleResult>;
1197
+ /**
1198
+ * Create both CSS and SCSS bundles
1199
+ *
1200
+ * @param tokenCss Generated CSS tokens
1201
+ * @param tokenScss Generated SCSS tokens
1202
+ * @param cssFiles User CSS files (StyleScannedFile objects)
1203
+ * @param scssFiles User SCSS files (StyleScannedFile objects)
1204
+ * @param config Bundle configuration
1205
+ * @returns Map of bundle type to result
1206
+ */
1207
+ declare function createBundles(tokenCss: string, tokenScss: string, cssFiles: StyleScannedFile[], scssFiles: StyleScannedFile[], config: Omit<BundleConfig, 'name'> & {
1208
+ baseName?: string;
1209
+ }): Promise<{
1210
+ css?: BundleResult;
1211
+ scss?: BundleResult;
1212
+ }>;
1213
+ /**
1214
+ * Create a bundle from scanned files (no token content)
1215
+ *
1216
+ * @param files Scanned files to bundle
1217
+ * @param format Output format
1218
+ * @param config Bundle configuration
1219
+ * @returns Bundle result
1220
+ */
1221
+ declare function createBundleFromFiles(files: StyleScannedFile[], format: 'css' | 'scss', config: BundleConfig): Promise<BundleResult>;
1222
+
1223
+ /**
1224
+ * Output path resolver with placeholder support
1225
+ *
1226
+ * @packageDocumentation
1227
+ */
1228
+
1229
+ /**
1230
+ * Default file names per format
1231
+ */
1232
+ declare const DEFAULT_FILE_NAMES: Record<OutputFormat, string>;
1233
+ /**
1234
+ * Replace placeholders in a string
1235
+ *
1236
+ * @param template Template string with placeholders
1237
+ * @param values Values to replace
1238
+ * @returns String with placeholders replaced
1239
+ */
1240
+ declare function replacePlaceholders(template: string, values: PlaceholderValues): string;
1241
+ /**
1242
+ * Resolve output path for a specific format
1243
+ *
1244
+ * @param format Output format
1245
+ * @param config Output configuration
1246
+ * @param values Placeholder values
1247
+ * @returns Resolved output path
1248
+ *
1249
+ * @example
1250
+ * ```typescript
1251
+ * const outputPath = resolveOutputPath('css', {
1252
+ * baseDir: 'dist',
1253
+ * formatDirs: { css: 'dist/css' },
1254
+ * fileNames: { css: 'design-tokens-{theme}.css' },
1255
+ * }, { theme: 'light' });
1256
+ *
1257
+ * // Returns: 'dist/css/design-tokens-light.css'
1258
+ * ```
1259
+ */
1260
+ declare function resolveOutputPath(format: OutputFormat, config: OutputConfig, values?: PlaceholderValues): string;
1261
+ /**
1262
+ * Resolve all output paths for all formats
1263
+ *
1264
+ * @param formats Formats to generate
1265
+ * @param config Output configuration
1266
+ * @param values Placeholder values
1267
+ * @returns Map of format to output path
1268
+ */
1269
+ declare function resolveAllOutputPaths(formats: OutputFormat[], config: OutputConfig, values?: PlaceholderValues): Record<OutputFormat, string>;
1270
+ /**
1271
+ * Validate output paths don't conflict
1272
+ *
1273
+ * @param paths Output paths to validate
1274
+ * @returns Validation result with any conflicts found
1275
+ */
1276
+ declare function validateOutputPaths(paths: Record<string, string>): {
1277
+ valid: boolean;
1278
+ conflicts: [string, string][];
1279
+ };
1280
+ /**
1281
+ * Ensure all output directories exist
1282
+ *
1283
+ * @param paths Output paths
1284
+ * @returns Created directories
1285
+ */
1286
+ declare function ensureOutputDirs(paths: Record<string, string>): Promise<string[]>;
1287
+ /**
1288
+ * Create output configuration from token config
1289
+ *
1290
+ * @param tokenConfig Token configuration
1291
+ * @returns Output configuration
1292
+ */
1293
+ declare function createOutputConfig(tokenConfig: {
1294
+ outputDir?: string;
1295
+ outputDirs?: Partial<Record<OutputFormat, string>>;
1296
+ outputFileNames?: Partial<Record<OutputFormat, string>>;
1297
+ }): OutputConfig;
1298
+
1299
+ /**
1300
+ * Style Dictionary Type Definitions
1301
+ *
1302
+ * Types for Style Dictionary integration including tokens, transforms,
1303
+ * formats, preprocessors, and configuration.
1304
+ *
1305
+ * @packageDocumentation
1306
+ * @module @dsai-io/tools/tokens/style-dictionary/types
1307
+ */
1308
+ /**
1309
+ * Style Dictionary token (runtime representation)
1310
+ */
1311
+ interface SDToken {
1312
+ /** Token name (after name transforms) */
1313
+ name: string;
1314
+ /** Resolved value (after value transforms) */
1315
+ value: unknown;
1316
+ /** Original value (may contain references) */
1317
+ original: {
1318
+ value: unknown;
1319
+ $value?: unknown;
1320
+ };
1321
+ /** Token path segments */
1322
+ path: string[];
1323
+ /** DTCG $value property */
1324
+ $value?: unknown;
1325
+ /** Token type */
1326
+ type?: string;
1327
+ /** DTCG $type property */
1328
+ $type?: string;
1329
+ /** Token description */
1330
+ description?: string;
1331
+ /** DTCG $description property */
1332
+ $description?: string;
1333
+ /** Comment for documentation */
1334
+ comment?: string;
1335
+ /** DTCG $extensions */
1336
+ $extensions?: Record<string, unknown>;
1337
+ /** DTCG $scopes (from Figma Variables) */
1338
+ $scopes?: string[];
1339
+ /** CTI (Category/Type/Item) attributes */
1340
+ attributes?: {
1341
+ category?: string;
1342
+ type?: string;
1343
+ item?: string;
1344
+ subitem?: string;
1345
+ state?: string;
1346
+ };
1347
+ /** File path where token was defined */
1348
+ filePath?: string;
1349
+ /** Whether token is a reference to another token */
1350
+ isSource?: boolean;
1351
+ }
1352
+ /**
1353
+ * Style Dictionary dictionary containing all tokens
1354
+ */
1355
+ interface SDDictionary {
1356
+ /** Flat array of all tokens */
1357
+ allTokens: SDToken[];
1358
+ /** Nested token structure */
1359
+ tokens: Record<string, unknown>;
1360
+ /** Unfiltered tokens (before platform filtering) */
1361
+ unfilteredTokens: Record<string, unknown>;
1362
+ }
1363
+ /**
1364
+ * Transform type - what aspect of the token is being transformed
1365
+ */
1366
+ type TransformType = 'name' | 'value' | 'attribute';
1367
+ /**
1368
+ * Options passed to transform functions
1369
+ */
1370
+ interface SDTransformOptions {
1371
+ /** Base font size for rem conversion (default: 16) */
1372
+ basePxFontSize?: number;
1373
+ /** CSS variable prefix */
1374
+ prefix?: string;
1375
+ /** Additional options */
1376
+ [key: string]: unknown;
1377
+ }
1378
+ /**
1379
+ * Transform definition for Style Dictionary
1380
+ */
1381
+ interface TransformDefinition {
1382
+ /** Unique transform name (e.g., 'fontWeight/unitless') */
1383
+ name: string;
1384
+ /** Transform type */
1385
+ type: TransformType;
1386
+ /**
1387
+ * Filter function - return true to apply transform
1388
+ * If omitted, transform applies to all tokens
1389
+ */
1390
+ filter?: (token: SDToken) => boolean;
1391
+ /**
1392
+ * Transform function
1393
+ * @param token - The token being transformed
1394
+ * @param options - Transform options from platform config
1395
+ * @returns Transformed value
1396
+ */
1397
+ transform: (token: SDToken, options?: SDTransformOptions) => unknown;
1398
+ }
1399
+ /**
1400
+ * Transform group definition
1401
+ */
1402
+ interface TransformGroupDefinition {
1403
+ /** Unique group name (e.g., 'custom/css') */
1404
+ name: string;
1405
+ /** Ordered list of transform names to apply */
1406
+ transforms: string[];
1407
+ }
1408
+ /**
1409
+ * Platform configuration passed to formats
1410
+ */
1411
+ interface SDPlatform {
1412
+ /** Transform group to use */
1413
+ transformGroup?: string;
1414
+ /** Individual transforms (alternative to transformGroup) */
1415
+ transforms?: string[];
1416
+ /** Output path prefix */
1417
+ buildPath?: string;
1418
+ /** Files to generate */
1419
+ files?: SDFile[];
1420
+ /** Platform-specific options */
1421
+ options?: Record<string, unknown>;
1422
+ }
1423
+ /**
1424
+ * File configuration for platform output
1425
+ */
1426
+ interface SDFile {
1427
+ /** Output file name */
1428
+ destination: string;
1429
+ /** Format to use for generating content */
1430
+ format: string;
1431
+ /**
1432
+ * Filter tokens to include in this file
1433
+ * Can be a string (filter name) or function
1434
+ */
1435
+ filter?: string | ((token: SDToken) => boolean);
1436
+ /** File-specific options passed to format */
1437
+ options?: Record<string, unknown>;
1438
+ }
1439
+ /**
1440
+ * Arguments passed to format functions
1441
+ */
1442
+ interface SDFormatArgs {
1443
+ /** Dictionary containing all tokens */
1444
+ dictionary: SDDictionary;
1445
+ /** Options from file config */
1446
+ options: Record<string, unknown>;
1447
+ /** Platform configuration */
1448
+ platform: SDPlatform;
1449
+ /** File configuration */
1450
+ file: SDFile;
1451
+ }
1452
+ /**
1453
+ * Format definition for Style Dictionary
1454
+ */
1455
+ interface FormatDefinition {
1456
+ /** Unique format name (e.g., 'css/variables-with-comments') */
1457
+ name: string;
1458
+ /**
1459
+ * Format function - generates file content
1460
+ * @param args - Format arguments
1461
+ * @returns File content as string
1462
+ */
1463
+ format: (args: SDFormatArgs) => string;
1464
+ }
1465
+ /**
1466
+ * Preprocessor definition for Style Dictionary
1467
+ */
1468
+ interface PreprocessorDefinition {
1469
+ /** Unique preprocessor name */
1470
+ name: string;
1471
+ /**
1472
+ * Preprocessor function - modifies token dictionary before processing
1473
+ * @param dictionary - Raw token dictionary
1474
+ * @returns Modified dictionary
1475
+ */
1476
+ preprocessor: (dictionary: Record<string, unknown>) => Record<string, unknown>;
1477
+ }
1478
+ /**
1479
+ * Style Dictionary log configuration
1480
+ */
1481
+ interface SDLogConfig {
1482
+ /** Logging verbosity */
1483
+ verbosity?: 'default' | 'silent' | 'verbose';
1484
+ /** How to handle warnings */
1485
+ warnings?: 'warn' | 'error' | 'disabled';
1486
+ /** How to handle errors */
1487
+ errors?: 'error' | 'throw';
1488
+ }
1489
+ /**
1490
+ * Full Style Dictionary configuration
1491
+ */
1492
+ interface SDConfig {
1493
+ /** Logging configuration */
1494
+ log?: SDLogConfig;
1495
+ /** Preprocessors to run on source tokens */
1496
+ preprocessors?: string[];
1497
+ /** Source token file patterns */
1498
+ source?: string[];
1499
+ /** Additional files to include */
1500
+ include?: string[];
1501
+ /** Platform configurations */
1502
+ platforms?: Record<string, SDPlatform>;
1503
+ }
1504
+ /**
1505
+ * Options for creating Style Dictionary configuration
1506
+ */
1507
+ interface CreateSDConfigOptions {
1508
+ /** Token source files (glob patterns) */
1509
+ source?: string[];
1510
+ /** CSS variable prefix (default: '--dsai-') */
1511
+ prefix?: string;
1512
+ /** Output directory base path */
1513
+ buildPath?: string;
1514
+ /** Base font size for rem conversion (default: 16) */
1515
+ baseFontSize?: number;
1516
+ /** Whether to output references in generated files */
1517
+ outputReferences?: boolean;
1518
+ /** Additional transforms to register */
1519
+ customTransforms?: TransformDefinition[];
1520
+ /** Additional formats to register */
1521
+ customFormats?: FormatDefinition[];
1522
+ /** Additional preprocessors to register */
1523
+ customPreprocessors?: PreprocessorDefinition[];
1524
+ /** Platforms to include (default: all) */
1525
+ platforms?: SDPlatformType[];
1526
+ /** Enable verbose logging */
1527
+ verbose?: boolean;
1528
+ }
1529
+ /**
1530
+ * Available platform types
1531
+ */
1532
+ type SDPlatformType = 'css' | 'js' | 'ts' | 'scss' | 'scss-dist' | 'json';
1533
+ /**
1534
+ * Style Dictionary instance type (for registration functions)
1535
+ * This is a minimal interface - actual SD has more methods
1536
+ */
1537
+ interface StyleDictionaryInstance {
1538
+ registerTransform: (transform: {
1539
+ name: string;
1540
+ type: TransformType;
1541
+ filter?: (token: SDToken) => boolean;
1542
+ transform: (token: SDToken, options?: SDTransformOptions) => unknown;
1543
+ }) => void;
1544
+ registerTransformGroup: (group: {
1545
+ name: string;
1546
+ transforms: string[];
1547
+ }) => void;
1548
+ registerFormat: (format: {
1549
+ name: string;
1550
+ format: (args: SDFormatArgs) => string;
1551
+ }) => void;
1552
+ registerPreprocessor: (preprocessor: {
1553
+ name: string;
1554
+ preprocessor: (dictionary: Record<string, unknown>) => Record<string, unknown>;
1555
+ }) => void;
1556
+ }
1557
+ /**
1558
+ * Check if a value is an SD token
1559
+ */
1560
+ declare function isSDToken(obj: unknown): obj is SDToken;
1561
+ /**
1562
+ * Check if token has a DTCG $value
1563
+ */
1564
+ declare function hasDTCGValue(token: SDToken): boolean;
1565
+ /**
1566
+ * Get token value (DTCG or legacy format)
1567
+ */
1568
+ declare function getSDTokenValue(token: SDToken): unknown;
1569
+ /**
1570
+ * Get token type (DTCG or legacy format)
1571
+ */
1572
+ declare function getSDTokenType(token: SDToken): string | undefined;
1573
+
1574
+ /**
1575
+ * Style Dictionary Configuration Generator
1576
+ *
1577
+ * Creates Style Dictionary configuration from DSAi config.
1578
+ *
1579
+ * @packageDocumentation
1580
+ * @module @dsai-io/tools/tokens/style-dictionary/config
1581
+ */
1582
+
1583
+ /**
1584
+ * Create Style Dictionary configuration from DSAi config
1585
+ *
1586
+ * Generates a complete Style Dictionary configuration based on
1587
+ * the resolved DSAi configuration, with sensible defaults.
1588
+ *
1589
+ * @param dsaiConfig - Resolved DSAi configuration
1590
+ * @param options - Additional options to override defaults
1591
+ * @returns Style Dictionary configuration object
1592
+ *
1593
+ * @example
1594
+ * ```typescript
1595
+ * import StyleDictionary from 'style-dictionary';
1596
+ * import { loadConfig } from '@dsai-io/tools/config';
1597
+ * import { createStyleDictionaryConfig, registerAll } from '@dsai-io/tools/tokens/style-dictionary';
1598
+ *
1599
+ * const { config } = await loadConfig();
1600
+ * const sdConfig = createStyleDictionaryConfig(config);
1601
+ *
1602
+ * registerAll(StyleDictionary);
1603
+ *
1604
+ * const sd = new StyleDictionary(sdConfig);
1605
+ * await sd.buildAllPlatforms();
1606
+ * ```
1607
+ */
1608
+ declare function createStyleDictionaryConfig(dsaiConfig: ResolvedConfig, options?: Partial<CreateSDConfigOptions>): SDConfig;
1609
+ /**
1610
+ * Register all custom transforms, formats, preprocessors, and groups
1611
+ *
1612
+ * Must be called before creating a Style Dictionary instance with
1613
+ * a config generated by createStyleDictionaryConfig.
1614
+ *
1615
+ * @param sd - Style Dictionary instance (the imported module)
1616
+ * @param options - Custom extensions to register
1617
+ *
1618
+ * @example
1619
+ * ```typescript
1620
+ * import StyleDictionary from 'style-dictionary';
1621
+ * import { registerAll } from '@dsai-io/tools/tokens/style-dictionary';
1622
+ *
1623
+ * registerAll(StyleDictionary, {
1624
+ * customTransforms: [myCustomTransform],
1625
+ * customFormats: [myCustomFormat],
1626
+ * });
1627
+ * ```
1628
+ */
1629
+ declare function registerAll(sd: StyleDictionaryInstance, options?: Partial<CreateSDConfigOptions>): void;
1630
+ /**
1631
+ * Create and register a complete Style Dictionary setup
1632
+ *
1633
+ * Convenience function that combines registerAll and createStyleDictionaryConfig.
1634
+ *
1635
+ * @param sd - Style Dictionary instance
1636
+ * @param dsaiConfig - Resolved DSAi configuration
1637
+ * @param options - Additional options
1638
+ * @returns Style Dictionary configuration
1639
+ *
1640
+ * @example
1641
+ * ```typescript
1642
+ * import StyleDictionary from 'style-dictionary';
1643
+ * import { loadConfig } from '@dsai-io/tools/config';
1644
+ * import { setupStyleDictionary } from '@dsai-io/tools/tokens/style-dictionary';
1645
+ *
1646
+ * const { config } = await loadConfig();
1647
+ * const sdConfig = setupStyleDictionary(StyleDictionary, config);
1648
+ *
1649
+ * const sd = new StyleDictionary(sdConfig);
1650
+ * await sd.buildAllPlatforms();
1651
+ * ```
1652
+ */
1653
+ declare function setupStyleDictionary(sd: StyleDictionaryInstance, dsaiConfig: ResolvedConfig, options?: Partial<CreateSDConfigOptions>): SDConfig;
1654
+
1655
+ /**
1656
+ * Font Weight Transform
1657
+ *
1658
+ * Keeps font-weight values as unitless numbers (300, 400, 700, etc.)
1659
+ * CSS font-weight must be unitless for proper inheritance.
1660
+ *
1661
+ * @packageDocumentation
1662
+ * @module @dsai-io/tools/tokens/style-dictionary/transforms/font-weight
1663
+ */
1664
+
1665
+ /**
1666
+ * fontWeight/unitless transform
1667
+ *
1668
+ * Ensures font-weight values are unitless numbers.
1669
+ * Handles numeric values, string values, and named weights.
1670
+ *
1671
+ * @example
1672
+ * // Numeric input
1673
+ * Input: { $value: 700, $type: "fontWeight" }
1674
+ * Output: 700
1675
+ *
1676
+ * @example
1677
+ * // String input
1678
+ * Input: { $value: "700", $type: "fontWeight" }
1679
+ * Output: 700
1680
+ *
1681
+ * @example
1682
+ * // Named weight
1683
+ * Input: { $value: "bold", $type: "fontWeight" }
1684
+ * Output: 700
1685
+ */
1686
+ declare const fontWeightUnitless: TransformDefinition;
1687
+
1688
+ /**
1689
+ * Line Height Transform
1690
+ *
1691
+ * Keeps line-height values as unitless ratios (1, 1.5, 2, etc.)
1692
+ * CSS line-height should be unitless for proper inheritance.
1693
+ *
1694
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
1695
+ * @packageDocumentation
1696
+ * @module @dsai-io/tools/tokens/style-dictionary/transforms/line-height
1697
+ */
1698
+
1699
+ /**
1700
+ * lineHeight/unitless transform
1701
+ *
1702
+ * Converts line-height values to unitless ratios.
1703
+ * Handles numbers, percentages, and pixel values.
1704
+ *
1705
+ * @example
1706
+ * // Percentage input
1707
+ * Input: { $value: "150%", $type: "lineHeight" }
1708
+ * Output: 1.5
1709
+ *
1710
+ * @example
1711
+ * // Already unitless
1712
+ * Input: { $value: 1.5, $type: "lineHeight" }
1713
+ * Output: 1.5
1714
+ *
1715
+ * @example
1716
+ * // Pixel value from Figma
1717
+ * Input: { $value: 24, $type: "lineHeight" }
1718
+ * Output: 1.5 (assuming 16px base)
1719
+ */
1720
+ declare const lineHeightUnitless: TransformDefinition;
1721
+
1722
+ /**
1723
+ * Dimension Transform
1724
+ *
1725
+ * Converts dimension values to rem units.
1726
+ * Handles raw numbers and pixel strings.
1727
+ *
1728
+ * @packageDocumentation
1729
+ * @module @dsai-io/tools/tokens/style-dictionary/transforms/dimension
1730
+ */
1731
+
1732
+ /**
1733
+ * dimension/rem transform
1734
+ *
1735
+ * Converts dimension values to rem.
1736
+ * Uses basePxFontSize from options (default: 16).
1737
+ *
1738
+ * @example
1739
+ * // Numeric input
1740
+ * Input: { $value: 16, $type: "dimension" }
1741
+ * Output: "1rem"
1742
+ *
1743
+ * @example
1744
+ * // Pixel string
1745
+ * Input: { $value: "24px", $type: "dimension" }
1746
+ * Output: "1.5rem"
1747
+ *
1748
+ * @example
1749
+ * // Zero value
1750
+ * Input: { $value: 0, $type: "dimension" }
1751
+ * Output: "0"
1752
+ */
1753
+ declare const dimensionRem: TransformDefinition;
1754
+
1755
+ /**
1756
+ * Name Transform
1757
+ *
1758
+ * Converts token paths to kebab-case names.
1759
+ *
1760
+ * @packageDocumentation
1761
+ * @module @dsai-io/tools/tokens/style-dictionary/transforms/name
1762
+ */
1763
+
1764
+ /**
1765
+ * name/kebab transform
1766
+ *
1767
+ * Converts token path to kebab-case CSS variable name.
1768
+ * Replaces underscores with hyphens and lowercases.
1769
+ *
1770
+ * @example
1771
+ * Input: path = ['color', 'blue', '500']
1772
+ * Output: "color-blue-500"
1773
+ *
1774
+ * @example
1775
+ * Input: path = ['typography', 'fontWeight', 'bold']
1776
+ * Output: "typography-fontweight-bold"
1777
+ */
1778
+ declare const nameKebab: TransformDefinition;
1779
+
1780
+ /**
1781
+ * Style Dictionary Transforms
1782
+ *
1783
+ * Exports all built-in transforms and registration utilities.
1784
+ *
1785
+ * @packageDocumentation
1786
+ * @module @dsai-io/tools/tokens/style-dictionary/transforms
1787
+ */
1788
+
1789
+ /**
1790
+ * All built-in transforms
1791
+ */
1792
+ declare const builtInTransforms: TransformDefinition[];
1793
+ /**
1794
+ * Register all transforms with Style Dictionary
1795
+ *
1796
+ * @param sd - Style Dictionary instance
1797
+ * @param customTransforms - Additional custom transforms to register
1798
+ *
1799
+ * @example
1800
+ * ```typescript
1801
+ * import StyleDictionary from 'style-dictionary';
1802
+ * import { registerTransforms } from '@dsai-io/tools/tokens/style-dictionary';
1803
+ *
1804
+ * registerTransforms(StyleDictionary);
1805
+ * ```
1806
+ */
1807
+ declare function registerTransforms(sd: StyleDictionaryInstance, customTransforms?: TransformDefinition[]): void;
1808
+
1809
+ /**
1810
+ * CSS Variables Format
1811
+ *
1812
+ * Generates CSS custom properties with descriptive comments.
1813
+ *
1814
+ * @packageDocumentation
1815
+ * @module @dsai-io/tools/tokens/style-dictionary/formats/css-variables
1816
+ */
1817
+
1818
+ /**
1819
+ * css/variables-with-comments format
1820
+ *
1821
+ * Generates CSS custom properties with descriptive comments.
1822
+ * Supports configurable prefix via options.
1823
+ *
1824
+ * @example
1825
+ * Output:
1826
+ * ```css
1827
+ * :root {
1828
+ * /* Primary brand color *\/
1829
+ * --dsai-color-primary: #007bff;
1830
+ * --dsai-spacing-md: 1rem;
1831
+ * }
1832
+ * ```
1833
+ */
1834
+ declare const cssVariablesWithComments: FormatDefinition;
1835
+
1836
+ /**
1837
+ * TypeScript Declarations Format
1838
+ *
1839
+ * Generates TypeScript type declarations for design tokens.
1840
+ *
1841
+ * @packageDocumentation
1842
+ * @module @dsai-io/tools/tokens/style-dictionary/formats/typescript
1843
+ */
1844
+
1845
+ /**
1846
+ * typescript/declarations format
1847
+ *
1848
+ * Generates TypeScript declarations with:
1849
+ * - DesignTokens interface with nested structure
1850
+ * - String literal types for each token category
1851
+ * - Flat token exports with proper types
1852
+ *
1853
+ * @example
1854
+ * Output:
1855
+ * ```typescript
1856
+ * export type ColorTokenName =
1857
+ * | 'color.primary'
1858
+ * | 'color.secondary';
1859
+ *
1860
+ * export interface DesignTokens {
1861
+ * color: {
1862
+ * primary: string;
1863
+ * secondary: string;
1864
+ * };
1865
+ * }
1866
+ *
1867
+ * export declare const colorPrimary: string;
1868
+ * export declare const tokens: DesignTokens;
1869
+ * ```
1870
+ */
1871
+ declare const typescriptDeclarations: FormatDefinition;
1872
+
1873
+ /**
1874
+ * Style Dictionary Formats
1875
+ *
1876
+ * Exports all built-in formats and registration utilities.
1877
+ *
1878
+ * @packageDocumentation
1879
+ * @module @dsai-io/tools/tokens/style-dictionary/formats
1880
+ */
1881
+
1882
+ /**
1883
+ * All built-in formats
1884
+ */
1885
+ declare const builtInFormats: FormatDefinition[];
1886
+ /**
1887
+ * Register all formats with Style Dictionary
1888
+ *
1889
+ * @param sd - Style Dictionary instance
1890
+ * @param customFormats - Additional custom formats to register
1891
+ *
1892
+ * @example
1893
+ * ```typescript
1894
+ * import StyleDictionary from 'style-dictionary';
1895
+ * import { registerFormats } from '@dsai-io/tools/tokens/style-dictionary';
1896
+ *
1897
+ * registerFormats(StyleDictionary);
1898
+ * ```
1899
+ */
1900
+ declare function registerFormats(sd: StyleDictionaryInstance, customFormats?: FormatDefinition[]): void;
1901
+
1902
+ /**
1903
+ * Fix References Preprocessor
1904
+ *
1905
+ * Fixes token reference paths that may be mismatched between
1906
+ * Figma exports and the actual token structure.
1907
+ *
1908
+ * @packageDocumentation
1909
+ * @module @dsai-io/tools/tokens/style-dictionary/preprocessors/fix-references
1910
+ */
1911
+
1912
+ /**
1913
+ * fix-references preprocessor
1914
+ *
1915
+ * Fixes token reference paths that may be mismatched.
1916
+ * Our tokens use "color.blue.500" but Figma exports may reference
1917
+ * "{colors.brand.blue.500}" - this preprocessor fixes the mismatch.
1918
+ *
1919
+ * @example
1920
+ * Before: { $value: "{colors.brand.primary}" }
1921
+ * After: { $value: "{color.primary}" }
1922
+ */
1923
+ declare const fixReferences: PreprocessorDefinition;
1924
+ /**
1925
+ * Create a custom fix-references preprocessor with custom mappings
1926
+ *
1927
+ * @param mappings - Array of [from, to] path mapping pairs
1928
+ * @returns Custom preprocessor definition
1929
+ *
1930
+ * @example
1931
+ * ```typescript
1932
+ * const customFixReferences = createFixReferencesPreprocessor([
1933
+ * ['{colors.brand.', '{color.'],
1934
+ * ['{acme.', '{brand.'],
1935
+ * ]);
1936
+ * ```
1937
+ */
1938
+ declare function createFixReferencesPreprocessor(mappings: Array<[string, string]>): PreprocessorDefinition;
1939
+
1940
+ /**
1941
+ * Style Dictionary Preprocessors
1942
+ *
1943
+ * Exports all built-in preprocessors and registration utilities.
1944
+ *
1945
+ * @packageDocumentation
1946
+ * @module @dsai-io/tools/tokens/style-dictionary/preprocessors
1947
+ */
1948
+
1949
+ /**
1950
+ * All built-in preprocessors
1951
+ */
1952
+ declare const builtInPreprocessors: PreprocessorDefinition[];
1953
+ /**
1954
+ * Register all preprocessors with Style Dictionary
1955
+ *
1956
+ * @param sd - Style Dictionary instance
1957
+ * @param customPreprocessors - Additional custom preprocessors to register
1958
+ *
1959
+ * @example
1960
+ * ```typescript
1961
+ * import StyleDictionary from 'style-dictionary';
1962
+ * import { registerPreprocessors } from '@dsai-io/tools/tokens/style-dictionary';
1963
+ *
1964
+ * registerPreprocessors(StyleDictionary);
1965
+ * ```
1966
+ */
1967
+ declare function registerPreprocessors(sd: StyleDictionaryInstance, customPreprocessors?: PreprocessorDefinition[]): void;
1968
+
1969
+ /**
1970
+ * CSS Transform Group
1971
+ *
1972
+ * Transform group for generating CSS output.
1973
+ *
1974
+ * @packageDocumentation
1975
+ * @module @dsai-io/tools/tokens/style-dictionary/groups/css
1976
+ */
1977
+
1978
+ /**
1979
+ * custom/css transform group
1980
+ *
1981
+ * Transforms for generating CSS custom properties:
1982
+ * - attribute/cti: Add CTI attributes
1983
+ * - name/kebab: kebab-case names
1984
+ * - time/seconds: Convert time to seconds
1985
+ * - fontWeight/unitless: Keep font weights unitless
1986
+ * - lineHeight/unitless: Keep line heights unitless
1987
+ * - dimension/rem: Convert dimensions to rem
1988
+ * - color/css: Convert colors to CSS format
1989
+ */
1990
+ declare const cssTransformGroup: TransformGroupDefinition;
1991
+
1992
+ /**
1993
+ * JavaScript Transform Group
1994
+ *
1995
+ * Transform group for generating JavaScript output.
1996
+ *
1997
+ * @packageDocumentation
1998
+ * @module @dsai-io/tools/tokens/style-dictionary/groups/js
1999
+ */
2000
+
2001
+ /**
2002
+ * custom/js transform group
2003
+ *
2004
+ * Transforms for generating JavaScript/TypeScript exports:
2005
+ * - attribute/cti: Add CTI attributes
2006
+ * - name/camel: camelCase names
2007
+ * - fontWeight/unitless: Keep font weights unitless
2008
+ * - lineHeight/unitless: Keep line heights unitless
2009
+ * - dimension/rem: Convert dimensions to rem
2010
+ * - color/css: Convert colors to CSS format
2011
+ */
2012
+ declare const jsTransformGroup: TransformGroupDefinition;
2013
+
2014
+ /**
2015
+ * SCSS Transform Group
2016
+ *
2017
+ * Transform group for generating SCSS output.
2018
+ *
2019
+ * @packageDocumentation
2020
+ * @module @dsai-io/tools/tokens/style-dictionary/groups/scss
2021
+ */
2022
+
2023
+ /**
2024
+ * custom/scss transform group
2025
+ *
2026
+ * Transforms for generating SCSS variables:
2027
+ * - attribute/cti: Add CTI attributes
2028
+ * - name/kebab: kebab-case names
2029
+ * - time/seconds: Convert time to seconds
2030
+ * - fontWeight/unitless: Keep font weights unitless
2031
+ * - lineHeight/unitless: Keep line heights unitless
2032
+ * - dimension/rem: Convert dimensions to rem
2033
+ * - color/css: Convert colors to CSS format
2034
+ *
2035
+ * This follows Style Dictionary v5 best practices:
2036
+ * - Source tokens are raw numbers
2037
+ * - Transforms add appropriate units (or keep unitless for font-weight/line-height)
2038
+ */
2039
+ declare const scssTransformGroup: TransformGroupDefinition;
2040
+
2041
+ /**
2042
+ * Style Dictionary Transform Groups
2043
+ *
2044
+ * Exports all built-in transform groups and registration utilities.
2045
+ *
2046
+ * @packageDocumentation
2047
+ * @module @dsai-io/tools/tokens/style-dictionary/groups
2048
+ */
2049
+
2050
+ /**
2051
+ * All built-in transform groups
2052
+ */
2053
+ declare const transformGroups: TransformGroupDefinition[];
2054
+ /**
2055
+ * Register all transform groups with Style Dictionary
2056
+ *
2057
+ * @param sd - Style Dictionary instance
2058
+ * @param customGroups - Additional custom transform groups to register
2059
+ *
2060
+ * @example
2061
+ * ```typescript
2062
+ * import StyleDictionary from 'style-dictionary';
2063
+ * import { registerTransformGroups } from '@dsai-io/tools/tokens/style-dictionary';
2064
+ *
2065
+ * registerTransformGroups(StyleDictionary);
2066
+ * ```
2067
+ */
2068
+ declare function registerTransformGroups(sd: StyleDictionaryInstance, customGroups?: TransformGroupDefinition[]): void;
2069
+
2070
+ export { type BuildOptions, type BuildResult, type BuildStep, type BundleConfig, type BundleResult, type CleanOptions, type CleanResult, type CleanedDirectory, type CreateSDConfigOptions, DEFAULT_CLEAN_DIRECTORIES, DEFAULT_FILE_NAMES, type DTCGToken, type FigmaCollection, type FigmaExport, type FormatDefinition, type LegacyToken, type MergeConfig, type MergeContent, type MergeOptions, type MergeResult, type OutputConfig, type PlaceholderValues, type PostprocessOptions, type PostprocessResult, type PreprocessorDefinition, type ReplacementRule, type SDConfig, type SDDictionary, type SDFile, type SDFormatArgs, type SDLogConfig, type SDPlatform, type SDPlatformType, type SDToken, type SDTransformOptions, type StyleDictionaryInstance, type StyleMergeResult, type StyleScannedFile, type StyleScannerOptions, type StyleScannerResult, type SyncOptions, type SyncResult, type Token, type TokenCollection, type TransformOptions as TokenTransformOptions, type TransformResult as TokenTransformResult, type TokenType, type ValidationResult as TokenValidationResult, type TransformDefinition, type TransformGroupDefinition, type TransformType, VALID_TOKEN_TYPES, type ValidateOptions, type ValidationIssue, type ValidationSeverity, addScssImportHeader, buildTokens, buildTokensCLI, builtInFormats, builtInPreprocessors, builtInTransforms, cleanTokenOutputs, cleanTokensCLI, createBundle, createBundleFromFiles, createBundles, createFixReferencesPreprocessor, createOutputConfig, createStyleDictionaryConfig, cssTransformGroup, cssVariablesWithComments, detectModes$1 as detectFigmaModes, detectModes as detectTransformModes, dimensionRem, ensureOutputDirs, filterFiles, fixReferences, fontWeightUnitless, getDefaultCssDir, getDefaultFiles, getDefaultIgnorePatterns, getDefaultSyncPaths, getDefaultTransformations, getSDTokenType, getSDTokenValue, getTokenDescription, getTokenType, getTokenValue, hasDTCGValue, isDTCGToken, isLegacyToken, isSDToken, isToken, isTokenReference, isValidTokenType, jsTransformGroup, lineHeightUnitless, loadContent, mergeCollections, mergeCollectionsCLI, mergeContent, nameKebab, parseTokenReference, postprocessCLI, postprocessCss, postprocessCssFiles, processScssImportHeader, registerAll, registerFormats, registerPreprocessors, registerTransformGroups, registerTransforms, replacePlaceholders, resolveAllOutputPaths, resolveOutputPath, runBuildCLI, scanDirectories, scssTransformGroup, setupStyleDictionary, sortFiles, syncTokens, syncTokensCLI, toDTCGToken, transformGroups, transformToken, transformTokenTree, transformTokens, transformTokensCLI, transformType, transformValue, typescriptDeclarations, validateFigmaCLI, validateFigmaExports, validateFigmaFile, validateOutputPaths, validateTokens, validateTokensCLI };