dispersa 0.1.3 → 0.2.0
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 +21 -5
- package/dist/builders.cjs +1835 -66
- package/dist/builders.cjs.map +1 -1
- package/dist/builders.d.cts +151 -2
- package/dist/builders.d.ts +151 -2
- package/dist/builders.js +1834 -68
- package/dist/builders.js.map +1 -1
- package/dist/cli/cli.d.ts +11 -0
- package/dist/cli/cli.js +201 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/config.d.ts +8 -0
- package/dist/cli/config.js +8 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +203 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/filters.cjs +8 -7
- package/dist/filters.cjs.map +1 -1
- package/dist/filters.js +8 -7
- package/dist/filters.js.map +1 -1
- package/dist/{index-CPB9Ea9U.d.ts → index-BP52gB00.d.ts} +179 -56
- package/dist/{index-DKf9WMQG.d.cts → index-CePv_bgv.d.cts} +179 -56
- package/dist/index.cjs +2029 -241
- 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 +2028 -243
- package/dist/index.js.map +1 -1
- package/dist/preprocessors.cjs.map +1 -1
- package/dist/preprocessors.js.map +1 -1
- package/dist/renderers.cjs.map +1 -1
- package/dist/renderers.d.cts +2 -2
- package/dist/renderers.d.ts +2 -2
- package/dist/renderers.js.map +1 -1
- package/dist/transforms.cjs +5 -5
- package/dist/transforms.cjs.map +1 -1
- package/dist/transforms.js +5 -5
- package/dist/transforms.js.map +1 -1
- package/package.json +18 -1
|
@@ -4,71 +4,127 @@ import { T as Transform } from './types-DdPWYkgh.js';
|
|
|
4
4
|
import { R as ResolvedTokens } from './types-C1GpiJ6q.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @license MIT
|
|
8
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Options for Tailwind CSS v4 renderer
|
|
11
16
|
*
|
|
12
|
-
*
|
|
17
|
+
* Controls how tokens are converted to Tailwind v4 @theme CSS variables.
|
|
18
|
+
*
|
|
19
|
+
* @example Bundle with dark mode overrides
|
|
20
|
+
* ```typescript
|
|
21
|
+
* tailwind({
|
|
22
|
+
* name: 'tailwind',
|
|
23
|
+
* file: 'theme.css',
|
|
24
|
+
* preset: 'bundle',
|
|
25
|
+
* selector: (modifier, context, isBase) => {
|
|
26
|
+
* if (isBase) return ':root'
|
|
27
|
+
* return `[data-${modifier}="${context}"]`
|
|
28
|
+
* },
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
13
31
|
*/
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
$extensions?: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
type Modifier = {
|
|
24
|
-
contexts: Record<string, TokenSource[]>;
|
|
25
|
-
description?: string;
|
|
26
|
-
default?: string;
|
|
27
|
-
$extensions?: Record<string, unknown>;
|
|
28
|
-
};
|
|
29
|
-
type InlineSet = Set & {
|
|
30
|
-
name: string;
|
|
31
|
-
type: 'set';
|
|
32
|
-
};
|
|
33
|
-
type InlineModifier = Modifier & {
|
|
34
|
-
name: string;
|
|
35
|
-
type: 'modifier';
|
|
36
|
-
};
|
|
37
|
-
type ResolverDocument = {
|
|
38
|
-
$schema?: string;
|
|
39
|
-
name?: string;
|
|
40
|
-
version: '2025.10';
|
|
41
|
-
description?: string;
|
|
42
|
-
sets?: Record<string, Set>;
|
|
43
|
-
modifiers?: Record<string, Modifier>;
|
|
44
|
-
resolutionOrder: (ReferenceObject | InlineSet | InlineModifier)[];
|
|
45
|
-
$defs?: Record<string, unknown>;
|
|
32
|
+
type TailwindRendererOptions = {
|
|
33
|
+
preset?: 'bundle' | 'standalone';
|
|
34
|
+
includeImport?: boolean;
|
|
35
|
+
namespace?: string;
|
|
36
|
+
minify?: boolean;
|
|
37
|
+
selector?: string | SelectorFunction;
|
|
38
|
+
mediaQuery?: string | MediaQueryFunction;
|
|
46
39
|
};
|
|
40
|
+
|
|
47
41
|
/**
|
|
48
|
-
*
|
|
42
|
+
* @license MIT
|
|
43
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
49
44
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE file in the root directory of this source tree.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Options for iOS/SwiftUI renderer
|
|
51
|
+
*/
|
|
52
|
+
type IosRendererOptions = {
|
|
53
|
+
preset?: 'standalone';
|
|
54
|
+
accessLevel?: 'public' | 'internal';
|
|
55
|
+
/**
|
|
56
|
+
* Output structure:
|
|
57
|
+
* - `'enum'` — nested enums inside a single root enum
|
|
58
|
+
* - `'grouped'` — namespace enum with separate extensions per token group
|
|
59
|
+
*/
|
|
60
|
+
structure?: 'enum' | 'grouped';
|
|
61
|
+
enumName?: string;
|
|
62
|
+
/** Namespace enum name used in grouped mode (default: 'DesignTokens') */
|
|
63
|
+
extensionNamespace?: string;
|
|
64
|
+
colorSpace?: 'sRGB' | 'displayP3';
|
|
65
|
+
/**
|
|
66
|
+
* Target Swift language version.
|
|
67
|
+
* - `'5.9'` (default) — standard static let declarations
|
|
68
|
+
* - `'6.0'` — adds `nonisolated(unsafe)` to static properties for
|
|
69
|
+
* Swift 6 strict concurrency compliance
|
|
70
|
+
*/
|
|
71
|
+
swiftVersion?: '5.9' | '6.0';
|
|
72
|
+
/** Number of spaces per indentation level (default 4) */
|
|
73
|
+
indent?: number;
|
|
74
|
+
/** Add @frozen annotation to enums and structs for ABI stability (default false) */
|
|
75
|
+
frozen?: boolean;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @license MIT
|
|
80
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
52
81
|
*
|
|
53
|
-
*
|
|
82
|
+
* This source code is licensed under the MIT license found in the
|
|
83
|
+
* LICENSE file in the root directory of this source tree.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Options for Android/Jetpack Compose renderer
|
|
54
88
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* // Generic (default):
|
|
58
|
-
* const inputs: ModifierInputs = {
|
|
59
|
-
* theme: 'dark',
|
|
60
|
-
* platform: 'mobile'
|
|
61
|
-
* }
|
|
89
|
+
* Note: `packageName` is marked optional for type compatibility with the Renderer
|
|
90
|
+
* generic, but is validated as required at runtime in the renderer's format() method.
|
|
62
91
|
*
|
|
63
|
-
*
|
|
64
|
-
* type MyModifiers = { theme: 'light' | 'dark', platform: 'web' | 'mobile' }
|
|
65
|
-
* const inputs: ModifierInputs<MyModifiers> = {
|
|
66
|
-
* theme: 'dark', // ✅ Autocomplete!
|
|
67
|
-
* platform: 'mobile'
|
|
68
|
-
* }
|
|
69
|
-
* ```
|
|
92
|
+
* @experimental This type is experimental. Properties and behavior may change.
|
|
70
93
|
*/
|
|
71
|
-
type
|
|
94
|
+
type AndroidRendererOptions = {
|
|
95
|
+
preset?: 'standalone' | 'bundle';
|
|
96
|
+
packageName?: string;
|
|
97
|
+
objectName?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Color output format for Kotlin Color initializers.
|
|
100
|
+
* - `'argb_hex'` (default) — `Color(0xAARRGGBB)` hex literal
|
|
101
|
+
* - `'argb_float'` — `Color(r, g, b, a)` float components
|
|
102
|
+
*
|
|
103
|
+
* Legacy aliases: `'argb8'` maps to `'argb_hex'`, `'argb_floats'` maps to `'argb_float'`.
|
|
104
|
+
*/
|
|
105
|
+
colorFormat?: 'argb_hex' | 'argb_float' | 'argb8' | 'argb_floats';
|
|
106
|
+
/**
|
|
107
|
+
* Color space for generated Color values.
|
|
108
|
+
* - `'sRGB'` (default) — standard sRGB color space
|
|
109
|
+
* - `'displayP3'` — Display P3 wide gamut via `ColorSpaces.DisplayP3`
|
|
110
|
+
*/
|
|
111
|
+
colorSpace?: 'sRGB' | 'displayP3';
|
|
112
|
+
/**
|
|
113
|
+
* Structure mode for token organization.
|
|
114
|
+
* - `'nested'` (default) — mirror token path hierarchy as nested objects
|
|
115
|
+
* - `'flat'` — group tokens by $type into semantic sub-objects (Colors, Spacing, etc.)
|
|
116
|
+
*/
|
|
117
|
+
structure?: 'nested' | 'flat';
|
|
118
|
+
/**
|
|
119
|
+
* Kotlin visibility modifier for the generated object and its members.
|
|
120
|
+
* - `undefined` (default) — no explicit modifier, which means `public` in Kotlin
|
|
121
|
+
* - `'public'` — explicit `public object` / `public val`
|
|
122
|
+
* - `'internal'` — `internal object` / `internal val` (useful for KMP / multi-module)
|
|
123
|
+
*/
|
|
124
|
+
visibility?: 'public' | 'internal';
|
|
125
|
+
/** Number of spaces per indentation level (default 4) */
|
|
126
|
+
indent?: number;
|
|
127
|
+
};
|
|
72
128
|
|
|
73
129
|
/**
|
|
74
130
|
* @fileoverview Renderer system types for token output generation
|
|
@@ -299,6 +355,73 @@ type BuildResult = {
|
|
|
299
355
|
errors?: BuildError[];
|
|
300
356
|
};
|
|
301
357
|
|
|
358
|
+
/**
|
|
359
|
+
* @fileoverview DTCG Resolver types (2025.10 specification)
|
|
360
|
+
*
|
|
361
|
+
* The resolver system allows defining token sources, modifiers (themes, modes),
|
|
362
|
+
* and the order in which they should be resolved and merged.
|
|
363
|
+
*
|
|
364
|
+
* ResolverDocument type is defined here to match DTCG 2025.10.
|
|
365
|
+
*/
|
|
366
|
+
type ReferenceObject = {
|
|
367
|
+
$ref: string;
|
|
368
|
+
};
|
|
369
|
+
type TokenSource = ReferenceObject | Record<string, unknown>;
|
|
370
|
+
type Set = {
|
|
371
|
+
sources: TokenSource[];
|
|
372
|
+
description?: string;
|
|
373
|
+
$extensions?: Record<string, unknown>;
|
|
374
|
+
};
|
|
375
|
+
type Modifier = {
|
|
376
|
+
contexts: Record<string, TokenSource[]>;
|
|
377
|
+
description?: string;
|
|
378
|
+
default?: string;
|
|
379
|
+
$extensions?: Record<string, unknown>;
|
|
380
|
+
};
|
|
381
|
+
type InlineSet = Set & {
|
|
382
|
+
name: string;
|
|
383
|
+
type: 'set';
|
|
384
|
+
};
|
|
385
|
+
type InlineModifier = Modifier & {
|
|
386
|
+
name: string;
|
|
387
|
+
type: 'modifier';
|
|
388
|
+
};
|
|
389
|
+
type ResolverDocument = {
|
|
390
|
+
$schema?: string;
|
|
391
|
+
name?: string;
|
|
392
|
+
version: '2025.10';
|
|
393
|
+
description?: string;
|
|
394
|
+
sets?: Record<string, Set>;
|
|
395
|
+
modifiers?: Record<string, Modifier>;
|
|
396
|
+
resolutionOrder: (ReferenceObject | InlineSet | InlineModifier)[];
|
|
397
|
+
$defs?: Record<string, unknown>;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Map of modifier names to selected context values
|
|
401
|
+
*
|
|
402
|
+
* Used to specify which variation of each modifier to use when resolving tokens.
|
|
403
|
+
* Can be made type-safe by providing a generic type parameter.
|
|
404
|
+
*
|
|
405
|
+
* @template T - Optional specific type for modifier values (defaults to generic Record)
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```typescript
|
|
409
|
+
* // Generic (default):
|
|
410
|
+
* const inputs: ModifierInputs = {
|
|
411
|
+
* theme: 'dark',
|
|
412
|
+
* platform: 'mobile'
|
|
413
|
+
* }
|
|
414
|
+
*
|
|
415
|
+
* // Type-safe:
|
|
416
|
+
* type MyModifiers = { theme: 'light' | 'dark', platform: 'web' | 'mobile' }
|
|
417
|
+
* const inputs: ModifierInputs<MyModifiers> = {
|
|
418
|
+
* theme: 'dark', // ✅ Autocomplete!
|
|
419
|
+
* platform: 'mobile'
|
|
420
|
+
* }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
type ModifierInputs<T extends Record<string, string> = Record<string, string>> = T;
|
|
424
|
+
|
|
302
425
|
/**
|
|
303
426
|
* @fileoverview Validation configuration types
|
|
304
427
|
*/
|
|
@@ -578,4 +701,4 @@ type DispersaOptions = Omit<DispersaOptionsBase, 'validation'> & {
|
|
|
578
701
|
validation?: ValidationOptions;
|
|
579
702
|
};
|
|
580
703
|
|
|
581
|
-
export { type BuildConfig as B, type CssRendererOptions as C, type DispersaOptions as D, type ErrorCode as E, type FormatOptions as F, type LifecycleHooks as L, type ModifierInputs as M, type OutputConfig as O, type PermutationData as P, type ResolverDocument as R, type SelectorFunction as S, type ValidationOptions as V, type BuildResult as a, type ValidationMode as b, type BuildError as c, type BuildOutput as d, type MediaQueryFunction as e, type OutputTree as f, type Renderer as g, type RenderContext as h, type RenderMeta as i, type RenderOutput as j, defineRenderer as k };
|
|
704
|
+
export { type AndroidRendererOptions as A, type BuildConfig as B, type CssRendererOptions as C, type DispersaOptions as D, type ErrorCode as E, type FormatOptions as F, type IosRendererOptions as I, type LifecycleHooks as L, type ModifierInputs as M, type OutputConfig as O, type PermutationData as P, type ResolverDocument as R, type SelectorFunction as S, type TailwindRendererOptions as T, type ValidationOptions as V, type BuildResult as a, type ValidationMode as b, type BuildError as c, type BuildOutput as d, type MediaQueryFunction as e, type OutputTree as f, type Renderer as g, type RenderContext as h, type RenderMeta as i, type RenderOutput as j, defineRenderer as k };
|
|
@@ -4,71 +4,127 @@ import { T as Transform } from './types-DM5faYUn.cjs';
|
|
|
4
4
|
import { R as ResolvedTokens } from './types-C1GpiJ6q.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @license MIT
|
|
8
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Options for Tailwind CSS v4 renderer
|
|
11
16
|
*
|
|
12
|
-
*
|
|
17
|
+
* Controls how tokens are converted to Tailwind v4 @theme CSS variables.
|
|
18
|
+
*
|
|
19
|
+
* @example Bundle with dark mode overrides
|
|
20
|
+
* ```typescript
|
|
21
|
+
* tailwind({
|
|
22
|
+
* name: 'tailwind',
|
|
23
|
+
* file: 'theme.css',
|
|
24
|
+
* preset: 'bundle',
|
|
25
|
+
* selector: (modifier, context, isBase) => {
|
|
26
|
+
* if (isBase) return ':root'
|
|
27
|
+
* return `[data-${modifier}="${context}"]`
|
|
28
|
+
* },
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
13
31
|
*/
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
$extensions?: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
type Modifier = {
|
|
24
|
-
contexts: Record<string, TokenSource[]>;
|
|
25
|
-
description?: string;
|
|
26
|
-
default?: string;
|
|
27
|
-
$extensions?: Record<string, unknown>;
|
|
28
|
-
};
|
|
29
|
-
type InlineSet = Set & {
|
|
30
|
-
name: string;
|
|
31
|
-
type: 'set';
|
|
32
|
-
};
|
|
33
|
-
type InlineModifier = Modifier & {
|
|
34
|
-
name: string;
|
|
35
|
-
type: 'modifier';
|
|
36
|
-
};
|
|
37
|
-
type ResolverDocument = {
|
|
38
|
-
$schema?: string;
|
|
39
|
-
name?: string;
|
|
40
|
-
version: '2025.10';
|
|
41
|
-
description?: string;
|
|
42
|
-
sets?: Record<string, Set>;
|
|
43
|
-
modifiers?: Record<string, Modifier>;
|
|
44
|
-
resolutionOrder: (ReferenceObject | InlineSet | InlineModifier)[];
|
|
45
|
-
$defs?: Record<string, unknown>;
|
|
32
|
+
type TailwindRendererOptions = {
|
|
33
|
+
preset?: 'bundle' | 'standalone';
|
|
34
|
+
includeImport?: boolean;
|
|
35
|
+
namespace?: string;
|
|
36
|
+
minify?: boolean;
|
|
37
|
+
selector?: string | SelectorFunction;
|
|
38
|
+
mediaQuery?: string | MediaQueryFunction;
|
|
46
39
|
};
|
|
40
|
+
|
|
47
41
|
/**
|
|
48
|
-
*
|
|
42
|
+
* @license MIT
|
|
43
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
49
44
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE file in the root directory of this source tree.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Options for iOS/SwiftUI renderer
|
|
51
|
+
*/
|
|
52
|
+
type IosRendererOptions = {
|
|
53
|
+
preset?: 'standalone';
|
|
54
|
+
accessLevel?: 'public' | 'internal';
|
|
55
|
+
/**
|
|
56
|
+
* Output structure:
|
|
57
|
+
* - `'enum'` — nested enums inside a single root enum
|
|
58
|
+
* - `'grouped'` — namespace enum with separate extensions per token group
|
|
59
|
+
*/
|
|
60
|
+
structure?: 'enum' | 'grouped';
|
|
61
|
+
enumName?: string;
|
|
62
|
+
/** Namespace enum name used in grouped mode (default: 'DesignTokens') */
|
|
63
|
+
extensionNamespace?: string;
|
|
64
|
+
colorSpace?: 'sRGB' | 'displayP3';
|
|
65
|
+
/**
|
|
66
|
+
* Target Swift language version.
|
|
67
|
+
* - `'5.9'` (default) — standard static let declarations
|
|
68
|
+
* - `'6.0'` — adds `nonisolated(unsafe)` to static properties for
|
|
69
|
+
* Swift 6 strict concurrency compliance
|
|
70
|
+
*/
|
|
71
|
+
swiftVersion?: '5.9' | '6.0';
|
|
72
|
+
/** Number of spaces per indentation level (default 4) */
|
|
73
|
+
indent?: number;
|
|
74
|
+
/** Add @frozen annotation to enums and structs for ABI stability (default false) */
|
|
75
|
+
frozen?: boolean;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @license MIT
|
|
80
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
52
81
|
*
|
|
53
|
-
*
|
|
82
|
+
* This source code is licensed under the MIT license found in the
|
|
83
|
+
* LICENSE file in the root directory of this source tree.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Options for Android/Jetpack Compose renderer
|
|
54
88
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* // Generic (default):
|
|
58
|
-
* const inputs: ModifierInputs = {
|
|
59
|
-
* theme: 'dark',
|
|
60
|
-
* platform: 'mobile'
|
|
61
|
-
* }
|
|
89
|
+
* Note: `packageName` is marked optional for type compatibility with the Renderer
|
|
90
|
+
* generic, but is validated as required at runtime in the renderer's format() method.
|
|
62
91
|
*
|
|
63
|
-
*
|
|
64
|
-
* type MyModifiers = { theme: 'light' | 'dark', platform: 'web' | 'mobile' }
|
|
65
|
-
* const inputs: ModifierInputs<MyModifiers> = {
|
|
66
|
-
* theme: 'dark', // ✅ Autocomplete!
|
|
67
|
-
* platform: 'mobile'
|
|
68
|
-
* }
|
|
69
|
-
* ```
|
|
92
|
+
* @experimental This type is experimental. Properties and behavior may change.
|
|
70
93
|
*/
|
|
71
|
-
type
|
|
94
|
+
type AndroidRendererOptions = {
|
|
95
|
+
preset?: 'standalone' | 'bundle';
|
|
96
|
+
packageName?: string;
|
|
97
|
+
objectName?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Color output format for Kotlin Color initializers.
|
|
100
|
+
* - `'argb_hex'` (default) — `Color(0xAARRGGBB)` hex literal
|
|
101
|
+
* - `'argb_float'` — `Color(r, g, b, a)` float components
|
|
102
|
+
*
|
|
103
|
+
* Legacy aliases: `'argb8'` maps to `'argb_hex'`, `'argb_floats'` maps to `'argb_float'`.
|
|
104
|
+
*/
|
|
105
|
+
colorFormat?: 'argb_hex' | 'argb_float' | 'argb8' | 'argb_floats';
|
|
106
|
+
/**
|
|
107
|
+
* Color space for generated Color values.
|
|
108
|
+
* - `'sRGB'` (default) — standard sRGB color space
|
|
109
|
+
* - `'displayP3'` — Display P3 wide gamut via `ColorSpaces.DisplayP3`
|
|
110
|
+
*/
|
|
111
|
+
colorSpace?: 'sRGB' | 'displayP3';
|
|
112
|
+
/**
|
|
113
|
+
* Structure mode for token organization.
|
|
114
|
+
* - `'nested'` (default) — mirror token path hierarchy as nested objects
|
|
115
|
+
* - `'flat'` — group tokens by $type into semantic sub-objects (Colors, Spacing, etc.)
|
|
116
|
+
*/
|
|
117
|
+
structure?: 'nested' | 'flat';
|
|
118
|
+
/**
|
|
119
|
+
* Kotlin visibility modifier for the generated object and its members.
|
|
120
|
+
* - `undefined` (default) — no explicit modifier, which means `public` in Kotlin
|
|
121
|
+
* - `'public'` — explicit `public object` / `public val`
|
|
122
|
+
* - `'internal'` — `internal object` / `internal val` (useful for KMP / multi-module)
|
|
123
|
+
*/
|
|
124
|
+
visibility?: 'public' | 'internal';
|
|
125
|
+
/** Number of spaces per indentation level (default 4) */
|
|
126
|
+
indent?: number;
|
|
127
|
+
};
|
|
72
128
|
|
|
73
129
|
/**
|
|
74
130
|
* @fileoverview Renderer system types for token output generation
|
|
@@ -299,6 +355,73 @@ type BuildResult = {
|
|
|
299
355
|
errors?: BuildError[];
|
|
300
356
|
};
|
|
301
357
|
|
|
358
|
+
/**
|
|
359
|
+
* @fileoverview DTCG Resolver types (2025.10 specification)
|
|
360
|
+
*
|
|
361
|
+
* The resolver system allows defining token sources, modifiers (themes, modes),
|
|
362
|
+
* and the order in which they should be resolved and merged.
|
|
363
|
+
*
|
|
364
|
+
* ResolverDocument type is defined here to match DTCG 2025.10.
|
|
365
|
+
*/
|
|
366
|
+
type ReferenceObject = {
|
|
367
|
+
$ref: string;
|
|
368
|
+
};
|
|
369
|
+
type TokenSource = ReferenceObject | Record<string, unknown>;
|
|
370
|
+
type Set = {
|
|
371
|
+
sources: TokenSource[];
|
|
372
|
+
description?: string;
|
|
373
|
+
$extensions?: Record<string, unknown>;
|
|
374
|
+
};
|
|
375
|
+
type Modifier = {
|
|
376
|
+
contexts: Record<string, TokenSource[]>;
|
|
377
|
+
description?: string;
|
|
378
|
+
default?: string;
|
|
379
|
+
$extensions?: Record<string, unknown>;
|
|
380
|
+
};
|
|
381
|
+
type InlineSet = Set & {
|
|
382
|
+
name: string;
|
|
383
|
+
type: 'set';
|
|
384
|
+
};
|
|
385
|
+
type InlineModifier = Modifier & {
|
|
386
|
+
name: string;
|
|
387
|
+
type: 'modifier';
|
|
388
|
+
};
|
|
389
|
+
type ResolverDocument = {
|
|
390
|
+
$schema?: string;
|
|
391
|
+
name?: string;
|
|
392
|
+
version: '2025.10';
|
|
393
|
+
description?: string;
|
|
394
|
+
sets?: Record<string, Set>;
|
|
395
|
+
modifiers?: Record<string, Modifier>;
|
|
396
|
+
resolutionOrder: (ReferenceObject | InlineSet | InlineModifier)[];
|
|
397
|
+
$defs?: Record<string, unknown>;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Map of modifier names to selected context values
|
|
401
|
+
*
|
|
402
|
+
* Used to specify which variation of each modifier to use when resolving tokens.
|
|
403
|
+
* Can be made type-safe by providing a generic type parameter.
|
|
404
|
+
*
|
|
405
|
+
* @template T - Optional specific type for modifier values (defaults to generic Record)
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```typescript
|
|
409
|
+
* // Generic (default):
|
|
410
|
+
* const inputs: ModifierInputs = {
|
|
411
|
+
* theme: 'dark',
|
|
412
|
+
* platform: 'mobile'
|
|
413
|
+
* }
|
|
414
|
+
*
|
|
415
|
+
* // Type-safe:
|
|
416
|
+
* type MyModifiers = { theme: 'light' | 'dark', platform: 'web' | 'mobile' }
|
|
417
|
+
* const inputs: ModifierInputs<MyModifiers> = {
|
|
418
|
+
* theme: 'dark', // ✅ Autocomplete!
|
|
419
|
+
* platform: 'mobile'
|
|
420
|
+
* }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
type ModifierInputs<T extends Record<string, string> = Record<string, string>> = T;
|
|
424
|
+
|
|
302
425
|
/**
|
|
303
426
|
* @fileoverview Validation configuration types
|
|
304
427
|
*/
|
|
@@ -578,4 +701,4 @@ type DispersaOptions = Omit<DispersaOptionsBase, 'validation'> & {
|
|
|
578
701
|
validation?: ValidationOptions;
|
|
579
702
|
};
|
|
580
703
|
|
|
581
|
-
export { type BuildConfig as B, type CssRendererOptions as C, type DispersaOptions as D, type ErrorCode as E, type FormatOptions as F, type LifecycleHooks as L, type ModifierInputs as M, type OutputConfig as O, type PermutationData as P, type ResolverDocument as R, type SelectorFunction as S, type ValidationOptions as V, type BuildResult as a, type ValidationMode as b, type BuildError as c, type BuildOutput as d, type MediaQueryFunction as e, type OutputTree as f, type Renderer as g, type RenderContext as h, type RenderMeta as i, type RenderOutput as j, defineRenderer as k };
|
|
704
|
+
export { type AndroidRendererOptions as A, type BuildConfig as B, type CssRendererOptions as C, type DispersaOptions as D, type ErrorCode as E, type FormatOptions as F, type IosRendererOptions as I, type LifecycleHooks as L, type ModifierInputs as M, type OutputConfig as O, type PermutationData as P, type ResolverDocument as R, type SelectorFunction as S, type TailwindRendererOptions as T, type ValidationOptions as V, type BuildResult as a, type ValidationMode as b, type BuildError as c, type BuildOutput as d, type MediaQueryFunction as e, type OutputTree as f, type Renderer as g, type RenderContext as h, type RenderMeta as i, type RenderOutput as j, defineRenderer as k };
|