dispersa 0.1.2 → 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 +86 -42
- package/dist/builders.cjs +1838 -69
- 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 +1837 -71
- 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 +2032 -244
- 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 +2031 -246
- 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
package/dist/builders.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as ModifierInputs, L as LifecycleHooks, C as CssRendererOptions, O as OutputConfig } from './index-
|
|
1
|
+
import { M as ModifierInputs, L as LifecycleHooks, C as CssRendererOptions, O as OutputConfig, T as TailwindRendererOptions, I as IosRendererOptions, A as AndroidRendererOptions } from './index-CePv_bgv.cjs';
|
|
2
2
|
import { F as Filter } from './types-BDY1xBmD.cjs';
|
|
3
3
|
import { T as Transform } from './types-DM5faYUn.cjs';
|
|
4
4
|
import { a as JsonRendererOptions, J as JsModuleRendererOptions } from './types-DbufGPrb.cjs';
|
|
@@ -224,5 +224,154 @@ type JsBuilderConfig = BuilderConfigBase & JsModuleRendererOptions;
|
|
|
224
224
|
* ```
|
|
225
225
|
*/
|
|
226
226
|
declare function js(config: JsBuilderConfig): OutputConfig<JsModuleRendererOptions>;
|
|
227
|
+
/**
|
|
228
|
+
* Tailwind CSS v4 builder configuration with flattened options
|
|
229
|
+
*/
|
|
230
|
+
type TailwindBuilderConfig = BuilderConfigBase & TailwindRendererOptions;
|
|
231
|
+
/**
|
|
232
|
+
* Create Tailwind CSS v4 output configuration with flattened options
|
|
233
|
+
*
|
|
234
|
+
* Creates an OutputConfig for Tailwind v4 @theme CSS output. All Tailwind-specific
|
|
235
|
+
* options (includeImport, namespace, etc.) are provided at the top level for
|
|
236
|
+
* improved discoverability.
|
|
237
|
+
*
|
|
238
|
+
* @param config - Tailwind builder configuration with flattened options
|
|
239
|
+
* @returns Complete OutputConfig ready for use in build()
|
|
240
|
+
*
|
|
241
|
+
* @remarks
|
|
242
|
+
* The preset defaults to 'bundle' for Tailwind, meaning the base permutation tokens
|
|
243
|
+
* are used to define the @theme vocabulary. Use preset: 'standalone' for separate files.
|
|
244
|
+
*
|
|
245
|
+
* @example Bundle Tailwind theme with transforms
|
|
246
|
+
* ```typescript
|
|
247
|
+
* import { tailwind } from 'dispersa'
|
|
248
|
+
* import { nameKebabCase } from 'dispersa/transforms'
|
|
249
|
+
*
|
|
250
|
+
* const config = tailwind({
|
|
251
|
+
* name: 'tailwind',
|
|
252
|
+
* file: 'theme.css',
|
|
253
|
+
* preset: 'bundle',
|
|
254
|
+
* includeImport: true,
|
|
255
|
+
* transforms: [nameKebabCase()]
|
|
256
|
+
* })
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* @example Standalone files per theme
|
|
260
|
+
* ```typescript
|
|
261
|
+
* import { tailwind } from 'dispersa'
|
|
262
|
+
*
|
|
263
|
+
* const config = tailwind({
|
|
264
|
+
* name: 'tailwind',
|
|
265
|
+
* file: 'theme-{theme}.css',
|
|
266
|
+
* preset: 'standalone',
|
|
267
|
+
* includeImport: false,
|
|
268
|
+
* })
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
declare function tailwind(config: TailwindBuilderConfig): OutputConfig<TailwindRendererOptions>;
|
|
272
|
+
/**
|
|
273
|
+
* iOS/SwiftUI builder configuration with flattened options
|
|
274
|
+
*/
|
|
275
|
+
type IosBuilderConfig = BuilderConfigBase & IosRendererOptions;
|
|
276
|
+
/**
|
|
277
|
+
* Create iOS/SwiftUI output configuration with flattened options
|
|
278
|
+
*
|
|
279
|
+
* Creates an OutputConfig for Swift code generation targeting SwiftUI (iOS 17+, Swift 6).
|
|
280
|
+
* All iOS-specific options (accessLevel, structure, etc.) are provided at the top level.
|
|
281
|
+
*
|
|
282
|
+
* @param config - iOS builder configuration with flattened options
|
|
283
|
+
* @returns Complete OutputConfig ready for use in build()
|
|
284
|
+
*
|
|
285
|
+
* @remarks
|
|
286
|
+
* Only standalone preset is supported. Each permutation generates a separate Swift file.
|
|
287
|
+
*
|
|
288
|
+
* @example Enum-based SwiftUI tokens
|
|
289
|
+
* ```typescript
|
|
290
|
+
* import { ios } from 'dispersa'
|
|
291
|
+
*
|
|
292
|
+
* const config = ios({
|
|
293
|
+
* name: 'ios',
|
|
294
|
+
* file: 'DesignTokens-{theme}.swift',
|
|
295
|
+
* accessLevel: 'public',
|
|
296
|
+
* structure: 'enum',
|
|
297
|
+
* enumName: 'DesignTokens',
|
|
298
|
+
* colorSpace: 'sRGB',
|
|
299
|
+
* })
|
|
300
|
+
* ```
|
|
301
|
+
*
|
|
302
|
+
* @example Grouped SwiftUI tokens (namespace enum + extensions per group)
|
|
303
|
+
* ```typescript
|
|
304
|
+
* import { ios } from 'dispersa'
|
|
305
|
+
*
|
|
306
|
+
* const config = ios({
|
|
307
|
+
* name: 'ios-tokens',
|
|
308
|
+
* file: 'Tokens-{theme}.swift',
|
|
309
|
+
* structure: 'grouped',
|
|
310
|
+
* colorSpace: 'displayP3',
|
|
311
|
+
* })
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
declare function ios(config: IosBuilderConfig): OutputConfig<IosRendererOptions>;
|
|
315
|
+
/**
|
|
316
|
+
* Android/Jetpack Compose builder configuration with flattened options
|
|
317
|
+
*/
|
|
318
|
+
type AndroidBuilderConfig = BuilderConfigBase & AndroidRendererOptions;
|
|
319
|
+
/**
|
|
320
|
+
* Create Android/Jetpack Compose output configuration with flattened options
|
|
321
|
+
*
|
|
322
|
+
* Creates an OutputConfig for Kotlin code generation targeting Jetpack Compose
|
|
323
|
+
* with Material 3. All Android-specific options (packageName, objectName, etc.)
|
|
324
|
+
* are provided at the top level.
|
|
325
|
+
*
|
|
326
|
+
* @experimental This builder is experimental. Options and generated output may change.
|
|
327
|
+
* @param config - Android builder configuration with flattened options
|
|
328
|
+
* @returns Complete OutputConfig ready for use in build()
|
|
329
|
+
*
|
|
330
|
+
* @remarks
|
|
331
|
+
* The `packageName` option is required (Kotlin convention). Supports both
|
|
332
|
+
* `'standalone'` (default, one file per permutation) and `'bundle'` (all
|
|
333
|
+
* permutations in a single file) presets.
|
|
334
|
+
*
|
|
335
|
+
* @example Standalone Compose tokens with hex colors
|
|
336
|
+
* ```typescript
|
|
337
|
+
* import { android } from 'dispersa'
|
|
338
|
+
*
|
|
339
|
+
* const config = android({
|
|
340
|
+
* name: 'android',
|
|
341
|
+
* file: 'DesignTokens-{theme}.kt',
|
|
342
|
+
* packageName: 'com.example.tokens',
|
|
343
|
+
* objectName: 'DesignTokens',
|
|
344
|
+
* colorFormat: 'argb_hex',
|
|
345
|
+
* })
|
|
346
|
+
* ```
|
|
347
|
+
*
|
|
348
|
+
* @example Flat structure with Display P3 colors
|
|
349
|
+
* ```typescript
|
|
350
|
+
* import { android } from 'dispersa'
|
|
351
|
+
*
|
|
352
|
+
* const config = android({
|
|
353
|
+
* name: 'android-tokens',
|
|
354
|
+
* file: 'Tokens-{theme}.kt',
|
|
355
|
+
* packageName: 'com.example.design',
|
|
356
|
+
* structure: 'flat',
|
|
357
|
+
* colorSpace: 'displayP3',
|
|
358
|
+
* colorFormat: 'argb_float',
|
|
359
|
+
* })
|
|
360
|
+
* ```
|
|
361
|
+
*
|
|
362
|
+
* @example Bundle mode — all themes in one file
|
|
363
|
+
* ```typescript
|
|
364
|
+
* import { android } from 'dispersa'
|
|
365
|
+
*
|
|
366
|
+
* const config = android({
|
|
367
|
+
* name: 'android-bundle',
|
|
368
|
+
* file: 'DesignTokens.kt',
|
|
369
|
+
* packageName: 'com.example.tokens',
|
|
370
|
+
* preset: 'bundle',
|
|
371
|
+
* structure: 'flat',
|
|
372
|
+
* })
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
declare function android(config: AndroidBuilderConfig): OutputConfig<AndroidRendererOptions>;
|
|
227
376
|
|
|
228
|
-
export { type CssBuilderConfig, type JsBuilderConfig, type JsonBuilderConfig, css, js, json };
|
|
377
|
+
export { type AndroidBuilderConfig, type CssBuilderConfig, type IosBuilderConfig, type JsBuilderConfig, type JsonBuilderConfig, type TailwindBuilderConfig, android, css, ios, js, json, tailwind };
|
package/dist/builders.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as ModifierInputs, L as LifecycleHooks, C as CssRendererOptions, O as OutputConfig } from './index-
|
|
1
|
+
import { M as ModifierInputs, L as LifecycleHooks, C as CssRendererOptions, O as OutputConfig, T as TailwindRendererOptions, I as IosRendererOptions, A as AndroidRendererOptions } from './index-BP52gB00.js';
|
|
2
2
|
import { F as Filter } from './types-Cl-1UYGD.js';
|
|
3
3
|
import { T as Transform } from './types-DdPWYkgh.js';
|
|
4
4
|
import { a as JsonRendererOptions, J as JsModuleRendererOptions } from './types-DJH6_4U9.js';
|
|
@@ -224,5 +224,154 @@ type JsBuilderConfig = BuilderConfigBase & JsModuleRendererOptions;
|
|
|
224
224
|
* ```
|
|
225
225
|
*/
|
|
226
226
|
declare function js(config: JsBuilderConfig): OutputConfig<JsModuleRendererOptions>;
|
|
227
|
+
/**
|
|
228
|
+
* Tailwind CSS v4 builder configuration with flattened options
|
|
229
|
+
*/
|
|
230
|
+
type TailwindBuilderConfig = BuilderConfigBase & TailwindRendererOptions;
|
|
231
|
+
/**
|
|
232
|
+
* Create Tailwind CSS v4 output configuration with flattened options
|
|
233
|
+
*
|
|
234
|
+
* Creates an OutputConfig for Tailwind v4 @theme CSS output. All Tailwind-specific
|
|
235
|
+
* options (includeImport, namespace, etc.) are provided at the top level for
|
|
236
|
+
* improved discoverability.
|
|
237
|
+
*
|
|
238
|
+
* @param config - Tailwind builder configuration with flattened options
|
|
239
|
+
* @returns Complete OutputConfig ready for use in build()
|
|
240
|
+
*
|
|
241
|
+
* @remarks
|
|
242
|
+
* The preset defaults to 'bundle' for Tailwind, meaning the base permutation tokens
|
|
243
|
+
* are used to define the @theme vocabulary. Use preset: 'standalone' for separate files.
|
|
244
|
+
*
|
|
245
|
+
* @example Bundle Tailwind theme with transforms
|
|
246
|
+
* ```typescript
|
|
247
|
+
* import { tailwind } from 'dispersa'
|
|
248
|
+
* import { nameKebabCase } from 'dispersa/transforms'
|
|
249
|
+
*
|
|
250
|
+
* const config = tailwind({
|
|
251
|
+
* name: 'tailwind',
|
|
252
|
+
* file: 'theme.css',
|
|
253
|
+
* preset: 'bundle',
|
|
254
|
+
* includeImport: true,
|
|
255
|
+
* transforms: [nameKebabCase()]
|
|
256
|
+
* })
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* @example Standalone files per theme
|
|
260
|
+
* ```typescript
|
|
261
|
+
* import { tailwind } from 'dispersa'
|
|
262
|
+
*
|
|
263
|
+
* const config = tailwind({
|
|
264
|
+
* name: 'tailwind',
|
|
265
|
+
* file: 'theme-{theme}.css',
|
|
266
|
+
* preset: 'standalone',
|
|
267
|
+
* includeImport: false,
|
|
268
|
+
* })
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
declare function tailwind(config: TailwindBuilderConfig): OutputConfig<TailwindRendererOptions>;
|
|
272
|
+
/**
|
|
273
|
+
* iOS/SwiftUI builder configuration with flattened options
|
|
274
|
+
*/
|
|
275
|
+
type IosBuilderConfig = BuilderConfigBase & IosRendererOptions;
|
|
276
|
+
/**
|
|
277
|
+
* Create iOS/SwiftUI output configuration with flattened options
|
|
278
|
+
*
|
|
279
|
+
* Creates an OutputConfig for Swift code generation targeting SwiftUI (iOS 17+, Swift 6).
|
|
280
|
+
* All iOS-specific options (accessLevel, structure, etc.) are provided at the top level.
|
|
281
|
+
*
|
|
282
|
+
* @param config - iOS builder configuration with flattened options
|
|
283
|
+
* @returns Complete OutputConfig ready for use in build()
|
|
284
|
+
*
|
|
285
|
+
* @remarks
|
|
286
|
+
* Only standalone preset is supported. Each permutation generates a separate Swift file.
|
|
287
|
+
*
|
|
288
|
+
* @example Enum-based SwiftUI tokens
|
|
289
|
+
* ```typescript
|
|
290
|
+
* import { ios } from 'dispersa'
|
|
291
|
+
*
|
|
292
|
+
* const config = ios({
|
|
293
|
+
* name: 'ios',
|
|
294
|
+
* file: 'DesignTokens-{theme}.swift',
|
|
295
|
+
* accessLevel: 'public',
|
|
296
|
+
* structure: 'enum',
|
|
297
|
+
* enumName: 'DesignTokens',
|
|
298
|
+
* colorSpace: 'sRGB',
|
|
299
|
+
* })
|
|
300
|
+
* ```
|
|
301
|
+
*
|
|
302
|
+
* @example Grouped SwiftUI tokens (namespace enum + extensions per group)
|
|
303
|
+
* ```typescript
|
|
304
|
+
* import { ios } from 'dispersa'
|
|
305
|
+
*
|
|
306
|
+
* const config = ios({
|
|
307
|
+
* name: 'ios-tokens',
|
|
308
|
+
* file: 'Tokens-{theme}.swift',
|
|
309
|
+
* structure: 'grouped',
|
|
310
|
+
* colorSpace: 'displayP3',
|
|
311
|
+
* })
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
declare function ios(config: IosBuilderConfig): OutputConfig<IosRendererOptions>;
|
|
315
|
+
/**
|
|
316
|
+
* Android/Jetpack Compose builder configuration with flattened options
|
|
317
|
+
*/
|
|
318
|
+
type AndroidBuilderConfig = BuilderConfigBase & AndroidRendererOptions;
|
|
319
|
+
/**
|
|
320
|
+
* Create Android/Jetpack Compose output configuration with flattened options
|
|
321
|
+
*
|
|
322
|
+
* Creates an OutputConfig for Kotlin code generation targeting Jetpack Compose
|
|
323
|
+
* with Material 3. All Android-specific options (packageName, objectName, etc.)
|
|
324
|
+
* are provided at the top level.
|
|
325
|
+
*
|
|
326
|
+
* @experimental This builder is experimental. Options and generated output may change.
|
|
327
|
+
* @param config - Android builder configuration with flattened options
|
|
328
|
+
* @returns Complete OutputConfig ready for use in build()
|
|
329
|
+
*
|
|
330
|
+
* @remarks
|
|
331
|
+
* The `packageName` option is required (Kotlin convention). Supports both
|
|
332
|
+
* `'standalone'` (default, one file per permutation) and `'bundle'` (all
|
|
333
|
+
* permutations in a single file) presets.
|
|
334
|
+
*
|
|
335
|
+
* @example Standalone Compose tokens with hex colors
|
|
336
|
+
* ```typescript
|
|
337
|
+
* import { android } from 'dispersa'
|
|
338
|
+
*
|
|
339
|
+
* const config = android({
|
|
340
|
+
* name: 'android',
|
|
341
|
+
* file: 'DesignTokens-{theme}.kt',
|
|
342
|
+
* packageName: 'com.example.tokens',
|
|
343
|
+
* objectName: 'DesignTokens',
|
|
344
|
+
* colorFormat: 'argb_hex',
|
|
345
|
+
* })
|
|
346
|
+
* ```
|
|
347
|
+
*
|
|
348
|
+
* @example Flat structure with Display P3 colors
|
|
349
|
+
* ```typescript
|
|
350
|
+
* import { android } from 'dispersa'
|
|
351
|
+
*
|
|
352
|
+
* const config = android({
|
|
353
|
+
* name: 'android-tokens',
|
|
354
|
+
* file: 'Tokens-{theme}.kt',
|
|
355
|
+
* packageName: 'com.example.design',
|
|
356
|
+
* structure: 'flat',
|
|
357
|
+
* colorSpace: 'displayP3',
|
|
358
|
+
* colorFormat: 'argb_float',
|
|
359
|
+
* })
|
|
360
|
+
* ```
|
|
361
|
+
*
|
|
362
|
+
* @example Bundle mode — all themes in one file
|
|
363
|
+
* ```typescript
|
|
364
|
+
* import { android } from 'dispersa'
|
|
365
|
+
*
|
|
366
|
+
* const config = android({
|
|
367
|
+
* name: 'android-bundle',
|
|
368
|
+
* file: 'DesignTokens.kt',
|
|
369
|
+
* packageName: 'com.example.tokens',
|
|
370
|
+
* preset: 'bundle',
|
|
371
|
+
* structure: 'flat',
|
|
372
|
+
* })
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
declare function android(config: AndroidBuilderConfig): OutputConfig<AndroidRendererOptions>;
|
|
227
376
|
|
|
228
|
-
export { type CssBuilderConfig, type JsBuilderConfig, type JsonBuilderConfig, css, js, json };
|
|
377
|
+
export { type AndroidBuilderConfig, type CssBuilderConfig, type IosBuilderConfig, type JsBuilderConfig, type JsonBuilderConfig, type TailwindBuilderConfig, android, css, ios, js, json, tailwind };
|