dispersa 1.2.0 → 1.3.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 +1 -2
- package/dist/{builders.d.cts → builders-B7_pBy58.d.cts} +180 -6
- package/dist/{builders.d.ts → builders-BEoMaLal.d.ts} +180 -6
- package/dist/{types-8MLtztK3.d.ts → config-schemas-DnEBhIg0.d.cts} +1 -158
- package/dist/{types-BHBHRm0a.d.cts → config-schemas-DnEBhIg0.d.ts} +1 -158
- package/dist/dispersa-DF2ZkG2O.d.ts +567 -0
- package/dist/dispersa-DJeCN0cP.d.cts +567 -0
- package/dist/index.cjs +2117 -2098
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +2117 -2098
- package/dist/index.js.map +1 -1
- package/dist/{lint.cjs → lint/index.cjs} +2 -2
- package/dist/lint/index.cjs.map +1 -0
- package/dist/{lint.d.ts → lint/index.d.cts} +8 -7
- package/dist/{lint.d.cts → lint/index.d.ts} +8 -7
- package/dist/{lint.js → lint/index.js} +2 -2
- package/dist/lint/index.js.map +1 -0
- package/dist/{renderers.d.ts → output-tree-BRbfWSmG.d.ts} +3 -10
- package/dist/{renderers.d.cts → output-tree-Hmi77EMv.d.cts} +3 -10
- package/dist/{builders.cjs → outputs/builders.cjs} +30 -30
- package/dist/outputs/builders.cjs.map +1 -0
- package/dist/outputs/builders.d.cts +7 -0
- package/dist/outputs/builders.d.ts +7 -0
- package/dist/{builders.js → outputs/builders.js} +30 -30
- package/dist/outputs/builders.js.map +1 -0
- package/dist/outputs/index.cjs +3750 -0
- package/dist/outputs/index.cjs.map +1 -0
- package/dist/outputs/index.d.cts +73 -0
- package/dist/outputs/index.d.ts +73 -0
- package/dist/outputs/index.js +3730 -0
- package/dist/outputs/index.js.map +1 -0
- package/dist/{filters.cjs → processing/filters/index.cjs} +24 -18
- package/dist/processing/filters/index.cjs.map +1 -0
- package/dist/processing/filters/index.d.cts +36 -0
- package/dist/processing/filters/index.d.ts +36 -0
- package/dist/{filters.js → processing/filters/index.js} +24 -18
- package/dist/processing/filters/index.js.map +1 -0
- package/dist/{preprocessors.cjs → processing/preprocessors/index.cjs} +3 -3
- package/dist/processing/preprocessors/index.cjs.map +1 -0
- package/dist/processing/preprocessors/index.d.cts +29 -0
- package/dist/processing/preprocessors/index.d.ts +29 -0
- package/dist/{preprocessors.js → processing/preprocessors/index.js} +3 -3
- package/dist/processing/preprocessors/index.js.map +1 -0
- package/dist/{transforms.cjs → processing/transforms/index.cjs} +2 -7
- package/dist/processing/transforms/index.cjs.map +1 -0
- package/dist/{transforms.d.ts → processing/transforms/index.d.cts} +2 -2
- package/dist/{transforms.d.cts → processing/transforms/index.d.ts} +2 -2
- package/dist/{transforms.js → processing/transforms/index.js} +2 -7
- package/dist/processing/transforms/index.js.map +1 -0
- package/dist/{errors.cjs → shared/errors/index.cjs} +12 -2
- package/dist/shared/errors/index.cjs.map +1 -0
- package/dist/{errors-qT4sJgSA.d.ts → shared/errors/index.d.cts} +11 -2
- package/dist/{errors-qT4sJgSA.d.cts → shared/errors/index.d.ts} +11 -2
- package/dist/{errors.js → shared/errors/index.js} +12 -3
- package/dist/shared/errors/index.js.map +1 -0
- package/dist/types-B0cI70Bt.d.cts +453 -0
- package/dist/types-BxDEUCos.d.ts +453 -0
- package/dist/types-DUc4vLZH.d.cts +36 -0
- package/dist/types-s3UoDRKl.d.ts +36 -0
- package/package.json +26 -36
- package/dist/android-CRDfSB3_.d.cts +0 -126
- package/dist/android-DANJjjPO.d.ts +0 -126
- package/dist/builders.cjs.map +0 -1
- package/dist/builders.js.map +0 -1
- package/dist/dispersa-BC1kDF5u.d.ts +0 -118
- package/dist/dispersa-DL3J_Pmz.d.cts +0 -118
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/filters.cjs.map +0 -1
- package/dist/filters.d.cts +0 -83
- package/dist/filters.d.ts +0 -83
- package/dist/filters.js.map +0 -1
- package/dist/index-Dajm5rvM.d.ts +0 -895
- package/dist/index-De6SjZYH.d.cts +0 -895
- package/dist/lint.cjs.map +0 -1
- package/dist/lint.js.map +0 -1
- package/dist/preprocessors.cjs.map +0 -1
- package/dist/preprocessors.d.cts +0 -17
- package/dist/preprocessors.d.ts +0 -17
- package/dist/preprocessors.js.map +0 -1
- package/dist/renderers.cjs +0 -28
- package/dist/renderers.cjs.map +0 -1
- package/dist/renderers.js +0 -24
- package/dist/renderers.js.map +0 -1
- package/dist/transforms.cjs.map +0 -1
- package/dist/transforms.js.map +0 -1
package/README.md
CHANGED
|
@@ -800,8 +800,7 @@ When calling `build()` or `buildOrThrow()`, pass a `BuildConfig` object:
|
|
|
800
800
|
| `dispersa` | Core functions (`build`, `lint`, etc.), builder functions, types |
|
|
801
801
|
| `dispersa/transforms` | Built-in transform factories |
|
|
802
802
|
| `dispersa/filters` | Built-in filter factories |
|
|
803
|
-
| `dispersa/
|
|
804
|
-
| `dispersa/renderers` | Renderer types, `defineRenderer`, and `outputTree` helper |
|
|
803
|
+
| `dispersa/outputs` | Renderer types, builder functions, `defineRenderer`, and `outputTree` |
|
|
805
804
|
| `dispersa/preprocessors` | Preprocessor type |
|
|
806
805
|
| `dispersa/errors` | Error classes (`DispersaError`, `TokenReferenceError`, etc.) |
|
|
807
806
|
| `dispersa/config` | `defineConfig` helper for CLI config files |
|
|
@@ -1,10 +1,184 @@
|
|
|
1
|
-
import { F as FileFunction, L as LifecycleHooks, C as CssRendererOptions, O as OutputConfig } from './
|
|
1
|
+
import { S as SelectorFunction, M as MediaQueryFunction, R as Renderer, F as FileFunction, L as LifecycleHooks, C as CssRendererOptions, O as OutputConfig } from './types-B0cI70Bt.cjs';
|
|
2
2
|
import { F as Filter } from './types-CAdUV-fa.cjs';
|
|
3
3
|
import { T as Transform } from './types-BltzwVYK.cjs';
|
|
4
|
-
import { a as JsonRendererOptions, J as JsModuleRendererOptions } from './
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { a as JsonRendererOptions, J as JsModuleRendererOptions } from './config-schemas-DnEBhIg0.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @license MIT
|
|
8
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
9
|
+
*
|
|
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
|
|
16
|
+
*
|
|
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
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
type TailwindRendererOptions = {
|
|
33
|
+
preset?: 'bundle' | 'standalone';
|
|
34
|
+
includeImport?: boolean;
|
|
35
|
+
namespace?: string;
|
|
36
|
+
minify?: boolean;
|
|
37
|
+
selector?: string | SelectorFunction;
|
|
38
|
+
mediaQuery?: string | MediaQueryFunction;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Tailwind CSS v4 renderer factory function.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* outputs: [{
|
|
46
|
+
* name: 'tailwind',
|
|
47
|
+
* renderer: tailwindRenderer(),
|
|
48
|
+
* options: {
|
|
49
|
+
* preset: 'bundle',
|
|
50
|
+
* includeImport: true,
|
|
51
|
+
* },
|
|
52
|
+
* file: 'theme.css'
|
|
53
|
+
* }]
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function tailwindRenderer(): Renderer<TailwindRendererOptions>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @license MIT
|
|
60
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
61
|
+
*
|
|
62
|
+
* This source code is licensed under the MIT license found in the
|
|
63
|
+
* LICENSE file in the root directory of this source tree.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Options for iOS/SwiftUI renderer
|
|
68
|
+
*/
|
|
69
|
+
type IosRendererOptions = {
|
|
70
|
+
preset?: 'standalone';
|
|
71
|
+
accessLevel?: 'public' | 'internal';
|
|
72
|
+
/**
|
|
73
|
+
* Output structure:
|
|
74
|
+
* - `'enum'` — nested enums inside a single root enum
|
|
75
|
+
* - `'grouped'` — namespace enum with separate extensions per token group
|
|
76
|
+
*/
|
|
77
|
+
structure?: 'enum' | 'grouped';
|
|
78
|
+
enumName?: string;
|
|
79
|
+
/** Namespace enum name used in grouped mode (default: 'DesignTokens') */
|
|
80
|
+
extensionNamespace?: string;
|
|
81
|
+
colorSpace?: 'sRGB' | 'displayP3';
|
|
82
|
+
/**
|
|
83
|
+
* Target Swift language version.
|
|
84
|
+
* - `'5.9'` (default) — standard static let declarations
|
|
85
|
+
* - `'6.0'` — adds `nonisolated(unsafe)` to static properties for
|
|
86
|
+
* Swift 6 strict concurrency compliance
|
|
87
|
+
*/
|
|
88
|
+
swiftVersion?: '5.9' | '6.0';
|
|
89
|
+
/** Number of spaces per indentation level (default 4) */
|
|
90
|
+
indent?: number;
|
|
91
|
+
/** Add @frozen annotation to enums and structs for ABI stability (default false) */
|
|
92
|
+
frozen?: boolean;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* iOS/SwiftUI renderer factory function.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* outputs: [{
|
|
100
|
+
* name: 'ios',
|
|
101
|
+
* renderer: iosRenderer(),
|
|
102
|
+
* options: {
|
|
103
|
+
* accessLevel: 'public',
|
|
104
|
+
* structure: 'enum', // or 'grouped' for extension-based layout
|
|
105
|
+
* enumName: 'DesignTokens',
|
|
106
|
+
* colorSpace: 'sRGB',
|
|
107
|
+
* },
|
|
108
|
+
* file: 'DesignTokens-{theme}.swift'
|
|
109
|
+
* }]
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare function iosRenderer(): Renderer<IosRendererOptions>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @license MIT
|
|
116
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the MIT license found in the
|
|
119
|
+
* LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Options for Android/Jetpack Compose renderer
|
|
124
|
+
*
|
|
125
|
+
* Note: `packageName` is marked optional for type compatibility with the Renderer
|
|
126
|
+
* generic, but is validated as required at runtime in the renderer's format() method.
|
|
127
|
+
*
|
|
128
|
+
* @experimental This type is experimental. Properties and behavior may change.
|
|
129
|
+
*/
|
|
130
|
+
type AndroidRendererOptions = {
|
|
131
|
+
preset?: 'standalone' | 'bundle';
|
|
132
|
+
packageName?: string;
|
|
133
|
+
objectName?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Color output format for Kotlin Color initializers.
|
|
136
|
+
* - `'argb_hex'` (default) — `Color(0xAARRGGBB)` hex literal
|
|
137
|
+
* - `'argb_float'` — `Color(r, g, b, a)` float components
|
|
138
|
+
*
|
|
139
|
+
* Legacy aliases: `'argb8'` maps to `'argb_hex'`, `'argb_floats'` maps to `'argb_float'`.
|
|
140
|
+
*/
|
|
141
|
+
colorFormat?: 'argb_hex' | 'argb_float' | 'argb8' | 'argb_floats';
|
|
142
|
+
/**
|
|
143
|
+
* Color space for generated Color values.
|
|
144
|
+
* - `'sRGB'` (default) — standard sRGB color space
|
|
145
|
+
* - `'displayP3'` — Display P3 wide gamut via `ColorSpaces.DisplayP3`
|
|
146
|
+
*/
|
|
147
|
+
colorSpace?: 'sRGB' | 'displayP3';
|
|
148
|
+
/**
|
|
149
|
+
* Structure mode for token organization.
|
|
150
|
+
* - `'nested'` (default) — mirror token path hierarchy as nested objects
|
|
151
|
+
* - `'flat'` — group tokens by $type into semantic sub-objects (Colors, Spacing, etc.)
|
|
152
|
+
*/
|
|
153
|
+
structure?: 'nested' | 'flat';
|
|
154
|
+
/**
|
|
155
|
+
* Kotlin visibility modifier for the generated object and its members.
|
|
156
|
+
* - `undefined` (default) — no explicit modifier, which means `public` in Kotlin
|
|
157
|
+
* - `'public'` — explicit `public object` / `public val`
|
|
158
|
+
* - `'internal'` — `internal object` / `internal val` (useful for KMP / multi-module)
|
|
159
|
+
*/
|
|
160
|
+
visibility?: 'public' | 'internal';
|
|
161
|
+
/** Number of spaces per indentation level (default 4) */
|
|
162
|
+
indent?: number;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Android/Jetpack Compose renderer factory function.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* outputs: [{
|
|
170
|
+
* name: 'android',
|
|
171
|
+
* renderer: androidRenderer(),
|
|
172
|
+
* options: {
|
|
173
|
+
* packageName: 'com.example.tokens',
|
|
174
|
+
* objectName: 'DesignTokens',
|
|
175
|
+
* colorFormat: 'argb_hex',
|
|
176
|
+
* },
|
|
177
|
+
* file: 'DesignTokens-{theme}.kt'
|
|
178
|
+
* }]
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
declare function androidRenderer(): Renderer<AndroidRendererOptions>;
|
|
8
182
|
|
|
9
183
|
/**
|
|
10
184
|
* @license
|
|
@@ -376,4 +550,4 @@ type AndroidBuilderConfig = BuilderConfigBase & AndroidRendererOptions;
|
|
|
376
550
|
*/
|
|
377
551
|
declare function android(config: AndroidBuilderConfig): OutputConfig<AndroidRendererOptions>;
|
|
378
552
|
|
|
379
|
-
export { type
|
|
553
|
+
export { type AndroidRendererOptions as A, type CssBuilderConfig as C, type IosRendererOptions as I, type JsBuilderConfig as J, type TailwindRendererOptions as T, js as a, android as b, css as c, type AndroidBuilderConfig as d, type IosBuilderConfig as e, type JsonBuilderConfig as f, type TailwindBuilderConfig as g, tailwindRenderer as h, ios as i, json as j, iosRenderer as k, androidRenderer as l, tailwind as t };
|
|
@@ -1,10 +1,184 @@
|
|
|
1
|
-
import { F as FileFunction, L as LifecycleHooks, C as CssRendererOptions, O as OutputConfig } from './
|
|
1
|
+
import { S as SelectorFunction, M as MediaQueryFunction, R as Renderer, F as FileFunction, L as LifecycleHooks, C as CssRendererOptions, O as OutputConfig } from './types-BxDEUCos.js';
|
|
2
2
|
import { F as Filter } from './types-ebxDimRz.js';
|
|
3
3
|
import { T as Transform } from './types-DztXKlka.js';
|
|
4
|
-
import { a as JsonRendererOptions, J as JsModuleRendererOptions } from './
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { a as JsonRendererOptions, J as JsModuleRendererOptions } from './config-schemas-DnEBhIg0.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @license MIT
|
|
8
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
9
|
+
*
|
|
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
|
|
16
|
+
*
|
|
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
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
type TailwindRendererOptions = {
|
|
33
|
+
preset?: 'bundle' | 'standalone';
|
|
34
|
+
includeImport?: boolean;
|
|
35
|
+
namespace?: string;
|
|
36
|
+
minify?: boolean;
|
|
37
|
+
selector?: string | SelectorFunction;
|
|
38
|
+
mediaQuery?: string | MediaQueryFunction;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Tailwind CSS v4 renderer factory function.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* outputs: [{
|
|
46
|
+
* name: 'tailwind',
|
|
47
|
+
* renderer: tailwindRenderer(),
|
|
48
|
+
* options: {
|
|
49
|
+
* preset: 'bundle',
|
|
50
|
+
* includeImport: true,
|
|
51
|
+
* },
|
|
52
|
+
* file: 'theme.css'
|
|
53
|
+
* }]
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function tailwindRenderer(): Renderer<TailwindRendererOptions>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @license MIT
|
|
60
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
61
|
+
*
|
|
62
|
+
* This source code is licensed under the MIT license found in the
|
|
63
|
+
* LICENSE file in the root directory of this source tree.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Options for iOS/SwiftUI renderer
|
|
68
|
+
*/
|
|
69
|
+
type IosRendererOptions = {
|
|
70
|
+
preset?: 'standalone';
|
|
71
|
+
accessLevel?: 'public' | 'internal';
|
|
72
|
+
/**
|
|
73
|
+
* Output structure:
|
|
74
|
+
* - `'enum'` — nested enums inside a single root enum
|
|
75
|
+
* - `'grouped'` — namespace enum with separate extensions per token group
|
|
76
|
+
*/
|
|
77
|
+
structure?: 'enum' | 'grouped';
|
|
78
|
+
enumName?: string;
|
|
79
|
+
/** Namespace enum name used in grouped mode (default: 'DesignTokens') */
|
|
80
|
+
extensionNamespace?: string;
|
|
81
|
+
colorSpace?: 'sRGB' | 'displayP3';
|
|
82
|
+
/**
|
|
83
|
+
* Target Swift language version.
|
|
84
|
+
* - `'5.9'` (default) — standard static let declarations
|
|
85
|
+
* - `'6.0'` — adds `nonisolated(unsafe)` to static properties for
|
|
86
|
+
* Swift 6 strict concurrency compliance
|
|
87
|
+
*/
|
|
88
|
+
swiftVersion?: '5.9' | '6.0';
|
|
89
|
+
/** Number of spaces per indentation level (default 4) */
|
|
90
|
+
indent?: number;
|
|
91
|
+
/** Add @frozen annotation to enums and structs for ABI stability (default false) */
|
|
92
|
+
frozen?: boolean;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* iOS/SwiftUI renderer factory function.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* outputs: [{
|
|
100
|
+
* name: 'ios',
|
|
101
|
+
* renderer: iosRenderer(),
|
|
102
|
+
* options: {
|
|
103
|
+
* accessLevel: 'public',
|
|
104
|
+
* structure: 'enum', // or 'grouped' for extension-based layout
|
|
105
|
+
* enumName: 'DesignTokens',
|
|
106
|
+
* colorSpace: 'sRGB',
|
|
107
|
+
* },
|
|
108
|
+
* file: 'DesignTokens-{theme}.swift'
|
|
109
|
+
* }]
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare function iosRenderer(): Renderer<IosRendererOptions>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @license MIT
|
|
116
|
+
* Copyright (c) 2025-present Dispersa Contributors
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the MIT license found in the
|
|
119
|
+
* LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Options for Android/Jetpack Compose renderer
|
|
124
|
+
*
|
|
125
|
+
* Note: `packageName` is marked optional for type compatibility with the Renderer
|
|
126
|
+
* generic, but is validated as required at runtime in the renderer's format() method.
|
|
127
|
+
*
|
|
128
|
+
* @experimental This type is experimental. Properties and behavior may change.
|
|
129
|
+
*/
|
|
130
|
+
type AndroidRendererOptions = {
|
|
131
|
+
preset?: 'standalone' | 'bundle';
|
|
132
|
+
packageName?: string;
|
|
133
|
+
objectName?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Color output format for Kotlin Color initializers.
|
|
136
|
+
* - `'argb_hex'` (default) — `Color(0xAARRGGBB)` hex literal
|
|
137
|
+
* - `'argb_float'` — `Color(r, g, b, a)` float components
|
|
138
|
+
*
|
|
139
|
+
* Legacy aliases: `'argb8'` maps to `'argb_hex'`, `'argb_floats'` maps to `'argb_float'`.
|
|
140
|
+
*/
|
|
141
|
+
colorFormat?: 'argb_hex' | 'argb_float' | 'argb8' | 'argb_floats';
|
|
142
|
+
/**
|
|
143
|
+
* Color space for generated Color values.
|
|
144
|
+
* - `'sRGB'` (default) — standard sRGB color space
|
|
145
|
+
* - `'displayP3'` — Display P3 wide gamut via `ColorSpaces.DisplayP3`
|
|
146
|
+
*/
|
|
147
|
+
colorSpace?: 'sRGB' | 'displayP3';
|
|
148
|
+
/**
|
|
149
|
+
* Structure mode for token organization.
|
|
150
|
+
* - `'nested'` (default) — mirror token path hierarchy as nested objects
|
|
151
|
+
* - `'flat'` — group tokens by $type into semantic sub-objects (Colors, Spacing, etc.)
|
|
152
|
+
*/
|
|
153
|
+
structure?: 'nested' | 'flat';
|
|
154
|
+
/**
|
|
155
|
+
* Kotlin visibility modifier for the generated object and its members.
|
|
156
|
+
* - `undefined` (default) — no explicit modifier, which means `public` in Kotlin
|
|
157
|
+
* - `'public'` — explicit `public object` / `public val`
|
|
158
|
+
* - `'internal'` — `internal object` / `internal val` (useful for KMP / multi-module)
|
|
159
|
+
*/
|
|
160
|
+
visibility?: 'public' | 'internal';
|
|
161
|
+
/** Number of spaces per indentation level (default 4) */
|
|
162
|
+
indent?: number;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Android/Jetpack Compose renderer factory function.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* outputs: [{
|
|
170
|
+
* name: 'android',
|
|
171
|
+
* renderer: androidRenderer(),
|
|
172
|
+
* options: {
|
|
173
|
+
* packageName: 'com.example.tokens',
|
|
174
|
+
* objectName: 'DesignTokens',
|
|
175
|
+
* colorFormat: 'argb_hex',
|
|
176
|
+
* },
|
|
177
|
+
* file: 'DesignTokens-{theme}.kt'
|
|
178
|
+
* }]
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
declare function androidRenderer(): Renderer<AndroidRendererOptions>;
|
|
8
182
|
|
|
9
183
|
/**
|
|
10
184
|
* @license
|
|
@@ -376,4 +550,4 @@ type AndroidBuilderConfig = BuilderConfigBase & AndroidRendererOptions;
|
|
|
376
550
|
*/
|
|
377
551
|
declare function android(config: AndroidBuilderConfig): OutputConfig<AndroidRendererOptions>;
|
|
378
552
|
|
|
379
|
-
export { type
|
|
553
|
+
export { type AndroidRendererOptions as A, type CssBuilderConfig as C, type IosRendererOptions as I, type JsBuilderConfig as J, type TailwindRendererOptions as T, js as a, android as b, css as c, type AndroidBuilderConfig as d, type IosBuilderConfig as e, type JsonBuilderConfig as f, type TailwindBuilderConfig as g, tailwindRenderer as h, ios as i, json as j, iosRenderer as k, androidRenderer as l, tailwind as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { K as InternalTokenDocument } from './types-TQHV1MrY.js';
|
|
2
1
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -88,123 +87,6 @@ declare const preprocessorPluginSchema: {
|
|
|
88
87
|
};
|
|
89
88
|
};
|
|
90
89
|
};
|
|
91
|
-
/**
|
|
92
|
-
* Output Configuration Schema
|
|
93
|
-
*
|
|
94
|
-
* Validates output-specific configuration including renderer,
|
|
95
|
-
* output file path, transforms, and filters.
|
|
96
|
-
*/
|
|
97
|
-
declare const outputConfigSchema: {
|
|
98
|
-
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
99
|
-
readonly type: "object";
|
|
100
|
-
readonly required: readonly ["name", "renderer"];
|
|
101
|
-
readonly properties: {
|
|
102
|
-
readonly name: {
|
|
103
|
-
readonly type: "string";
|
|
104
|
-
readonly minLength: 1;
|
|
105
|
-
readonly description: "Unique identifier for this output";
|
|
106
|
-
};
|
|
107
|
-
readonly renderer: {
|
|
108
|
-
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
109
|
-
readonly type: "object";
|
|
110
|
-
readonly required: readonly ["format"];
|
|
111
|
-
readonly properties: {
|
|
112
|
-
readonly preset: {
|
|
113
|
-
readonly type: "string";
|
|
114
|
-
readonly description: "Preset identifier (e.g., \"bundle\", \"standalone\", \"modifier\")";
|
|
115
|
-
};
|
|
116
|
-
readonly format: {
|
|
117
|
-
readonly description: "Format function for token-to-output conversion (validated at runtime)";
|
|
118
|
-
};
|
|
119
|
-
readonly name: {
|
|
120
|
-
readonly type: "string";
|
|
121
|
-
readonly minLength: 1;
|
|
122
|
-
readonly description: "Unique identifier for the plugin";
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
readonly additionalProperties: true;
|
|
126
|
-
readonly errorMessage: {
|
|
127
|
-
readonly required: {
|
|
128
|
-
readonly format: "Renderer must have a \"format\" function property";
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
readonly filters: {
|
|
133
|
-
readonly type: "array";
|
|
134
|
-
readonly items: {
|
|
135
|
-
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
136
|
-
readonly type: "object";
|
|
137
|
-
readonly required: readonly ["filter"];
|
|
138
|
-
readonly properties: {
|
|
139
|
-
readonly filter: {
|
|
140
|
-
readonly description: "Filter function (validated at runtime)";
|
|
141
|
-
};
|
|
142
|
-
readonly name: {
|
|
143
|
-
readonly type: "string";
|
|
144
|
-
readonly minLength: 1;
|
|
145
|
-
readonly description: "Unique identifier for the plugin";
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
readonly additionalProperties: true;
|
|
149
|
-
readonly errorMessage: {
|
|
150
|
-
readonly required: {
|
|
151
|
-
readonly filter: "Filter must have a \"filter\" function property";
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
readonly description: "Array of filter objects to apply";
|
|
156
|
-
};
|
|
157
|
-
readonly transforms: {
|
|
158
|
-
readonly type: "array";
|
|
159
|
-
readonly items: {
|
|
160
|
-
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
161
|
-
readonly type: "object";
|
|
162
|
-
readonly required: readonly ["transform"];
|
|
163
|
-
readonly properties: {
|
|
164
|
-
readonly matcher: {
|
|
165
|
-
readonly description: "Optional filter function (validated at runtime)";
|
|
166
|
-
};
|
|
167
|
-
readonly transform: {
|
|
168
|
-
readonly description: "Transform function (validated at runtime)";
|
|
169
|
-
};
|
|
170
|
-
readonly name: {
|
|
171
|
-
readonly type: "string";
|
|
172
|
-
readonly minLength: 1;
|
|
173
|
-
readonly description: "Unique identifier for the plugin";
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
readonly additionalProperties: true;
|
|
177
|
-
readonly errorMessage: {
|
|
178
|
-
readonly required: {
|
|
179
|
-
readonly name: "Transform must have a \"name\" property";
|
|
180
|
-
readonly transform: "Transform must have a \"transform\" function property";
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
readonly description: "Array of transform objects to apply";
|
|
185
|
-
};
|
|
186
|
-
readonly file: {
|
|
187
|
-
readonly description: "Output file path relative to buildPath. Supports subdirectories (e.g., \"css/tokens.css\"), pattern strings (e.g., \"tokens-{theme}.css\"), or function for dynamic naming";
|
|
188
|
-
};
|
|
189
|
-
readonly options: {
|
|
190
|
-
readonly type: "object";
|
|
191
|
-
readonly description: "Renderer-specific options passed to the formatter";
|
|
192
|
-
readonly additionalProperties: true;
|
|
193
|
-
};
|
|
194
|
-
readonly hooks: {
|
|
195
|
-
readonly type: "object";
|
|
196
|
-
readonly description: "Per-output lifecycle hooks (functions, validated at runtime)";
|
|
197
|
-
readonly additionalProperties: true;
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
readonly errorMessage: {
|
|
201
|
-
readonly required: {
|
|
202
|
-
readonly name: "Output must have a \"name\" property";
|
|
203
|
-
readonly renderer: "Output must have a \"renderer\" property";
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
readonly additionalProperties: false;
|
|
207
|
-
};
|
|
208
90
|
/**
|
|
209
91
|
* Dispersa Options Schema
|
|
210
92
|
*
|
|
@@ -427,13 +309,6 @@ type JsonRendererOptions = FromSchema<typeof jsonRendererOptionsSchema>;
|
|
|
427
309
|
* JS Module Renderer Options type generated from jsModuleRendererOptionsSchema
|
|
428
310
|
*/
|
|
429
311
|
type JsModuleRendererOptions = FromSchema<typeof jsModuleRendererOptionsSchema>;
|
|
430
|
-
/**
|
|
431
|
-
* Output Config type generated from outputConfigSchema
|
|
432
|
-
*
|
|
433
|
-
* Note: This is a base type. The actual OutputConfig type in config/index.ts
|
|
434
|
-
* extends this with additional TypeScript features like conditional types for options.
|
|
435
|
-
*/
|
|
436
|
-
type OutputConfigBase = FromSchema<typeof outputConfigSchema>;
|
|
437
312
|
/**
|
|
438
313
|
* Dispersa Options type generated from dispersaOptionsSchema
|
|
439
314
|
*/
|
|
@@ -450,36 +325,4 @@ type BuildConfigBase = FromSchema<typeof buildConfigSchema>;
|
|
|
450
325
|
*/
|
|
451
326
|
type PreprocessorPluginBase = FromSchema<typeof preprocessorPluginSchema>;
|
|
452
327
|
|
|
453
|
-
|
|
454
|
-
* @fileoverview Preprocessor system types for raw token transformation
|
|
455
|
-
*/
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Preprocessor definition for transforming raw token data
|
|
459
|
-
*
|
|
460
|
-
* Preprocessors operate on the raw token object before parsing and resolution.
|
|
461
|
-
* They are useful for normalizing data, stripping metadata, or adapting tokens
|
|
462
|
-
* from external sources to match expected formats.
|
|
463
|
-
*
|
|
464
|
-
* @example
|
|
465
|
-
* ```typescript
|
|
466
|
-
* const stripMetadata: Preprocessor = {
|
|
467
|
-
* name: 'strip-metadata',
|
|
468
|
-
* preprocess: (rawTokens) => {
|
|
469
|
-
* const { _metadata, ...tokens } = rawTokens
|
|
470
|
-
* return tokens
|
|
471
|
-
* }
|
|
472
|
-
* }
|
|
473
|
-
* ```
|
|
474
|
-
*/
|
|
475
|
-
type Preprocessor = Pick<PreprocessorPluginBase, 'name'> & {
|
|
476
|
-
/**
|
|
477
|
-
* Function that transforms raw token data
|
|
478
|
-
*
|
|
479
|
-
* @param rawTokens - Raw token object before parsing
|
|
480
|
-
* @returns Transformed token object (can be async)
|
|
481
|
-
*/
|
|
482
|
-
preprocess: (rawTokens: InternalTokenDocument) => InternalTokenDocument | Promise<InternalTokenDocument>;
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
export type { BuildConfigBase as B, DispersaOptionsBase as D, JsModuleRendererOptions as J, OutputConfigBase as O, Preprocessor as P, JsonRendererOptions as a };
|
|
328
|
+
export type { BuildConfigBase as B, DispersaOptionsBase as D, JsModuleRendererOptions as J, PreprocessorPluginBase as P, JsonRendererOptions as a };
|