@bamboocss/core 1.12.2 → 1.12.3

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,1023 @@
1
+ import { toHash } from "@bamboocss/shared";
2
+ import postcss, { AtRule, Root } from "postcss";
3
+ import { TokenDictionary } from "@bamboocss/token-dictionary";
4
+ import { ArtifactFilters, AtRuleCondition, AtomicRecipeRule, AtomicRule, AtomicStyleResult, BambooHooks, CascadeLayer, CascadeLayers, ConditionDetails, ConditionQuery, Conditions as Conditions$1, Config, CssKeyframes, CssRule, Dict, EncoderJson, GlobalFontface, GlobalPositionTry, GlobalVarsDefinition, GroupedResult, GroupedRule, HashOptions, ImportMapInput, ImportMapOutput, LoadConfigResult, PartialBy, PatternConfig, PatternHelpers, PatternProperty, PatternRule, PrefixOptions, PropertyConfig, RecipeBaseResult, RecipeConfig, RecipeDefinition, RecipeRule, RecipeVariantsRule, RequiredBy, ResultItem, SlotRecipeConfig, SlotRecipeDefinition, StaticCssOptions, StudioOptions, StyleEntry, StyleProps, StyleResultObject, SystemStyleObject, TSConfig, Theme, ThemeVariantsMap, UserConfig, UtilityConfig } from "@bamboocss/types";
5
+ import { CssOptions as CssOptions$1, RecipeNode as RecipeNode$1, Stylesheet as Stylesheet$1 } from "@bamboocss/core";
6
+
7
+ //#region src/breakpoints.d.ts
8
+ declare class Breakpoints {
9
+ private breakpoints;
10
+ sorted: ReturnType<typeof sortBreakpoints>;
11
+ values: Record<string, BreakpointEntry>;
12
+ keys: string[];
13
+ ranges: Record<string, string>;
14
+ conditions: Record<string, AtRuleCondition>;
15
+ constructor(breakpoints: Record<string, string>);
16
+ get: (name: string) => BreakpointEntry;
17
+ build: ({
18
+ min,
19
+ max
20
+ }: {
21
+ min?: string | null;
22
+ max?: string | null;
23
+ }) => string;
24
+ only: (name: string) => string;
25
+ private getRanges;
26
+ private getConditions;
27
+ getCondition: (key: string) => ConditionDetails | undefined;
28
+ expandScreenAtRule: (root: Root) => void;
29
+ }
30
+ type BreakpointEntry = {
31
+ name: string;
32
+ min?: string | null;
33
+ max?: string | null;
34
+ };
35
+ type Entries = [string, BreakpointEntry][];
36
+ declare function sortBreakpoints(breakpoints: Record<string, string>): Entries;
37
+ //#endregion
38
+ //#region src/conditions.d.ts
39
+ interface Options {
40
+ conditions?: Conditions$1;
41
+ breakpoints?: Record<string, string>;
42
+ containerNames?: string[];
43
+ containerSizes?: Record<string, string>;
44
+ themes?: ThemeVariantsMap;
45
+ }
46
+ declare class Conditions {
47
+ private options;
48
+ values: Record<string, ConditionDetails>;
49
+ breakpoints: Breakpoints;
50
+ constructor(options: Options);
51
+ private setupContainers;
52
+ private setupThemes;
53
+ getThemeSelector: (name: string) => string;
54
+ getThemeName: (theme: string) => string;
55
+ finalize: (paths: string[]) => string[];
56
+ shift: (paths: string[]) => string[];
57
+ segment: (paths: string[]) => {
58
+ condition: string[];
59
+ selector: string[];
60
+ };
61
+ has: (key: string) => boolean;
62
+ isCondition: (key: string) => boolean;
63
+ isEmpty: () => boolean;
64
+ get: (key: string) => ConditionQuery | undefined;
65
+ getRaw: (condNameOrQuery: ConditionQuery) => ConditionDetails | undefined;
66
+ sort: (conditions: string[]) => ConditionDetails[];
67
+ normalize: (condition: ConditionQuery | ConditionDetails) => ConditionDetails | undefined;
68
+ keys: () => string[];
69
+ saveOne: (key: string, value: string) => void;
70
+ remove(key: string): void;
71
+ getSortedKeys: () => string[];
72
+ }
73
+ //#endregion
74
+ //#region src/file.d.ts
75
+ declare class FileEngine {
76
+ private context;
77
+ constructor(context: Pick<Context, 'config'>);
78
+ private get forceConsistentTypeExtension();
79
+ private get outExtension();
80
+ ext(file: string): string;
81
+ extDts(file: string): string;
82
+ private __extDts;
83
+ import(mod: string, file: string): string;
84
+ importType(mod: string, file: string): string;
85
+ exportType(mod: string, file: string): string;
86
+ exportStar(file: string): string;
87
+ exportTypeStar(file: string): string;
88
+ isTypeFile(file: string): boolean;
89
+ jsDocComment(comment: string | undefined, options?: {
90
+ deprecated?: boolean | string;
91
+ default?: string;
92
+ }): string;
93
+ /**
94
+ * convert import type { CompositionStyleObject } from './system-types'
95
+ * to import type { CompositionStyleObject } from './system-types.d.ts'
96
+ */
97
+ rewriteTypeImport(code: string): string;
98
+ }
99
+ //#endregion
100
+ //#region src/global-fontface.d.ts
101
+ interface GlobalFontfaceOptions$1 {
102
+ globalFontface?: GlobalFontface;
103
+ }
104
+ declare class GlobalFontface$1 {
105
+ private options;
106
+ names: string[];
107
+ constructor(options: GlobalFontfaceOptions$1);
108
+ isEmpty(): boolean;
109
+ toString(): string;
110
+ }
111
+ //#endregion
112
+ //#region src/global-position-try.d.ts
113
+ interface GlobalFontfaceOptions {
114
+ globalPositionTry?: GlobalPositionTry;
115
+ }
116
+ declare class GlobalPositionTry$1 {
117
+ private opts;
118
+ names: string[];
119
+ constructor(opts: GlobalFontfaceOptions);
120
+ isEmpty(): boolean;
121
+ toString(): string;
122
+ }
123
+ //#endregion
124
+ //#region src/global-vars.d.ts
125
+ interface GlobalVarsOptions {
126
+ globalVars?: GlobalVarsDefinition;
127
+ cssVarRoot: string;
128
+ }
129
+ declare class GlobalVars {
130
+ private options;
131
+ keys: Set<string>;
132
+ vars: string[];
133
+ names: string[];
134
+ constructor(options: GlobalVarsOptions);
135
+ isEmpty(): boolean;
136
+ toString(): string;
137
+ }
138
+ //#endregion
139
+ //#region src/style-encoder.d.ts
140
+ declare class StyleEncoder {
141
+ private context;
142
+ static separator: string;
143
+ static conditionSeparator: string;
144
+ atomic: Set<string>;
145
+ compound_variants: Set<string>;
146
+ recipes: Map<string, Set<string>>;
147
+ recipes_base: Map<string, Set<string>>;
148
+ grouped: Map<string, Set<string>>;
149
+ constructor(context: Pick<Context, 'isTemplateLiteralSyntax' | 'isValidProperty' | 'recipes' | 'patterns' | 'conditions' | 'utility'>);
150
+ filterStyleProps: (props: Dict) => Dict;
151
+ clone: () => StyleEncoder;
152
+ isEmpty: () => boolean;
153
+ get results(): {
154
+ atomic: Set<string>;
155
+ recipes: Map<string, Set<string>>;
156
+ recipes_base: Map<string, Set<string>>;
157
+ grouped: Map<string, Set<string>>;
158
+ };
159
+ /**
160
+ * Hashes a style object and adds the resulting hashes to a set.
161
+ * @param set - The set to add the resulting hashes to.
162
+ * @param obj - The style object to hash.
163
+ * @param baseEntry - An optional base style entry to use when hashing the style object.
164
+ */
165
+ hashStyleObject: (set: Set<string>, obj: ResultItem["data"][number], baseEntry?: Partial<Omit<StyleEntry, "prop" | "value" | "cond">>) => void;
166
+ processAtomic: (styles: StyleResultObject) => void;
167
+ processGrouped: (styles: StyleResultObject) => void;
168
+ processStyleProps: (styleProps: StyleProps, grouped?: boolean) => void;
169
+ processConfigSlotRecipeBase: (recipeName: string, config: SlotRecipeDefinition) => void;
170
+ processConfigSlotRecipe: (recipeName: string, variants: Record<string, any>) => void;
171
+ processConfigRecipeBase: (recipeName: string, config: RecipeConfig) => void;
172
+ processConfigRecipe: (recipeName: string, variants: Record<string, any>) => void;
173
+ processRecipe: (recipeName: string, variants: Record<string, any>) => void;
174
+ processRecipeBase(recipeName: string): void;
175
+ processPattern: (name: string, patternProps: StyleResultObject, type?: "pattern" | "jsx-pattern", jsxName?: string | undefined) => void;
176
+ processAtomicRecipe: (recipe: Pick<RecipeConfig, "base" | "variants" | "compoundVariants">) => void;
177
+ processAtomicSlotRecipe: (recipe: PartialBy<SlotRecipeDefinition, "slots">) => void;
178
+ getConfigRecipeHash: (recipeName: string) => {
179
+ atomic: Set<string>;
180
+ base: Set<string>;
181
+ variants: Set<string>;
182
+ };
183
+ getConfigSlotRecipeHash: (recipeName: string) => {
184
+ atomic: Set<string>;
185
+ base: Dict;
186
+ variants: Set<string>;
187
+ };
188
+ getRecipeHash: (recipeName: string) => {
189
+ atomic: Set<string>;
190
+ base: Set<string>;
191
+ variants: Set<string>;
192
+ } | {
193
+ atomic: Set<string>;
194
+ base: Dict;
195
+ variants: Set<string>;
196
+ };
197
+ toJSON: () => {
198
+ schemaVersion: string;
199
+ styles: Record<string, any>;
200
+ };
201
+ fromJSON: (json: EncoderJson) => this;
202
+ }
203
+ //#endregion
204
+ //#region src/style-decoder.d.ts
205
+ declare class StyleDecoder {
206
+ private context;
207
+ constructor(context: Pick<Context, 'conditions' | 'utility' | 'recipes' | 'hash'>);
208
+ classNames: Map<string, AtomicStyleResult | RecipeBaseResult | GroupedResult>;
209
+ atomic_cache: Map<string, AtomicStyleResult>;
210
+ group_cache: Map<string, GroupedResult>;
211
+ recipe_base_cache: Map<string, RecipeBaseResult>;
212
+ atomic: Set<AtomicStyleResult>;
213
+ grouped: Set<GroupedResult>;
214
+ recipes: Map<string, Set<AtomicStyleResult>>;
215
+ recipes_base: Map<string, Set<RecipeBaseResult>>;
216
+ clone: () => StyleDecoder;
217
+ isEmpty: () => boolean;
218
+ get results(): {
219
+ atomic: Set<AtomicStyleResult>;
220
+ grouped: Set<GroupedResult>;
221
+ recipes: Map<string, Set<AtomicStyleResult>>;
222
+ recipes_base: Map<string, Set<RecipeBaseResult>>;
223
+ };
224
+ private formatSelector;
225
+ private getRecipeName;
226
+ private getTransformResult;
227
+ resolveCondition: (condition: ConditionDetails) => string | string[];
228
+ /**
229
+ * Expands multi-block conditions into separate sets of conditions.
230
+ * Each block becomes an independent condition set that produces its own CSS block.
231
+ * When multiple multi-block conditions are stacked (e.g. two custom multi-block
232
+ * conditions used together), the cartesian product of all blocks is produced.
233
+ * Returns null if no multi-block condition is found.
234
+ */
235
+ private expandMultiBlock;
236
+ private getAtomic;
237
+ getGroup: (hashSet: Set<string>, key: string) => GroupedResult;
238
+ private getRecipeBase;
239
+ collectAtomic: (encoder: StyleEncoder) => this;
240
+ private processClassName;
241
+ collectRecipe: (encoder: StyleEncoder) => void;
242
+ collectRecipeBase: (encoder: StyleEncoder) => void;
243
+ collectGrouped: (encoder: StyleEncoder) => void;
244
+ /**
245
+ * Collect and re-create all styles and recipes objects from the style encoder
246
+ * So that we can just iterate over them and transform resulting CSS objects into CSS strings
247
+ */
248
+ collect: (encoder: StyleEncoder) => this;
249
+ getConfigRecipeResult: (recipeName: string) => {
250
+ atomic: Set<AtomicStyleResult>;
251
+ base: Set<RecipeBaseResult>;
252
+ variants: Set<AtomicStyleResult>;
253
+ };
254
+ getConfigSlotRecipeResult: (recipeName: string) => {
255
+ atomic: Set<AtomicStyleResult>;
256
+ base: Dict;
257
+ variants: Set<AtomicStyleResult>;
258
+ };
259
+ getRecipeResult: (recipeName: string) => {
260
+ atomic: Set<AtomicStyleResult>;
261
+ base: Set<RecipeBaseResult>;
262
+ variants: Set<AtomicStyleResult>;
263
+ } | {
264
+ atomic: Set<AtomicStyleResult>;
265
+ base: Dict;
266
+ variants: Set<AtomicStyleResult>;
267
+ };
268
+ }
269
+ //#endregion
270
+ //#region src/rule-processor.d.ts
271
+ declare class RuleProcessor {
272
+ private context;
273
+ encoder: StyleEncoder;
274
+ decoder: StyleDecoder;
275
+ sheet: Stylesheet$1;
276
+ constructor(context: Context);
277
+ getParamsOrThrow(): {
278
+ encoder: StyleEncoder;
279
+ decoder: StyleDecoder;
280
+ sheet: Stylesheet$1;
281
+ };
282
+ clone(): this;
283
+ toCss(options?: CssOptions$1): string;
284
+ css(styles: SystemStyleObject): AtomicRule;
285
+ grouped(styles: SystemStyleObject): GroupedRule;
286
+ cva(recipeConfig: RecipeDefinition<any>): AtomicRecipeRule;
287
+ sva(recipeConfig: SlotRecipeDefinition<string, any>): AtomicRecipeRule;
288
+ recipe(name: string, variants?: Record<string, any>): RecipeVariantsRule | undefined;
289
+ }
290
+ //#endregion
291
+ //#region src/hooks-api.d.ts
292
+ declare class HooksApi {
293
+ private ctx;
294
+ processor: RuleProcessor;
295
+ constructor(ctx: Context);
296
+ get config(): import("@bamboocss/types").UserConfig;
297
+ get configPath(): string;
298
+ get configDependencies(): string[];
299
+ get classNames(): Map<string, string>;
300
+ get generatedClassNames(): Map<string, import("@bamboocss/types").AtomicStyleResult | import("@bamboocss/types").RecipeBaseResult | import("@bamboocss/types").GroupedResult>;
301
+ }
302
+ //#endregion
303
+ //#region src/file-matcher.d.ts
304
+ interface ImportResult {
305
+ /** @example 'hstack' */
306
+ name: string;
307
+ /** @example 'bambooHStack' */
308
+ alias: string;
309
+ /**
310
+ * @example '../../styled-system/patterns'
311
+ * @example '@styles/patterns'
312
+ */
313
+ mod: string;
314
+ importMapValue?: string;
315
+ kind?: 'named' | 'namespace';
316
+ }
317
+ interface FileMatcherOptions {
318
+ importMap: ImportMapOutput<string>;
319
+ value: ImportResult[];
320
+ }
321
+ declare class FileMatcher {
322
+ private context;
323
+ imports: ImportResult[];
324
+ namespaces: Map<string, ImportResult>;
325
+ private importMap;
326
+ private cssAliases;
327
+ private cvaAliases;
328
+ private svaAliases;
329
+ private tokenAliases;
330
+ private jsxFactoryAliases;
331
+ private recipeAliases;
332
+ private patternAliases;
333
+ private propertiesMap;
334
+ private functions;
335
+ private components;
336
+ constructor(context: Pick<Context, 'jsx' | 'patterns' | 'recipes' | 'isValidProperty'>, opts: FileMatcherOptions);
337
+ private assignAliases;
338
+ private assignProperties;
339
+ isEmpty: () => boolean;
340
+ toString: () => string;
341
+ find: (id: string) => ImportResult | undefined;
342
+ private createMatch;
343
+ match: (id: string) => boolean;
344
+ getName: (id: string) => string;
345
+ getAliases: (id: string) => string[];
346
+ private _patternsMatcher;
347
+ isValidPattern: (id: string) => boolean;
348
+ private _recipesMatcher;
349
+ isValidRecipe: (id: string) => boolean;
350
+ isRawFn: (fnName: string) => boolean;
351
+ isNamespaced: (fnName: string) => boolean;
352
+ normalizeFnName: (fnName: string) => string;
353
+ isAliasFnName: (fnName: string) => boolean | undefined;
354
+ isTokenAlias: (fnName: string) => boolean;
355
+ matchFn: (fnName: string) => boolean;
356
+ isJsxFactory: (tagName: string) => boolean | undefined;
357
+ isBambooComponent: (tagName: string) => boolean;
358
+ matchTag: (tagName: string) => boolean;
359
+ matchTagProp: (tagName: string, propName: string) => boolean;
360
+ }
361
+ //#endregion
362
+ //#region src/import-map.d.ts
363
+ interface ImportMatcher {
364
+ mods: string[];
365
+ regex: RegExp;
366
+ match(value: string): boolean;
367
+ }
368
+ declare class ImportMap {
369
+ private context;
370
+ value: ImportMapOutput<string>;
371
+ matchers: Record<keyof ImportMapOutput, ImportMatcher>;
372
+ outdir: string;
373
+ constructor(context: Pick<Context, 'jsx' | 'config' | 'conf' | 'isValidProperty' | 'recipes' | 'patterns'>);
374
+ /**
375
+ * Normalize one/many import map inputs to a single import map output with absolute paths.
376
+ * @example
377
+ * ```ts
378
+ * importMap: '@acme/org'
379
+ * ```
380
+ *
381
+ * will be normalized to
382
+ * ```ts
383
+ * {
384
+ * css: ['@acme/org/css'],
385
+ * recipe: ['@acme/org/recipes'],
386
+ * pattern: ['@acme/org/patterns'],
387
+ * jsx: ['@acme/org/jsx'],
388
+ * tokens: ['@acme/org/tokens'],
389
+ * }
390
+ * ```
391
+ *
392
+ * @exammple
393
+ * importMap: ['@acme/org', '@foo/org', '@bar/org']
394
+ * ```
395
+ *
396
+ * will be normalized to
397
+ * ```ts
398
+ * {
399
+ * css: ['@acme/org/css', '@foo/org/css', '@bar/org/css'],
400
+ * recipe: ['@acme/org/recipes', '@foo/org/recipes', '@bar/org/recipes'],
401
+ * pattern: ['@acme/org/patterns', '@foo/org/patterns', '@bar/org/patterns'],
402
+ * jsx: ['@acme/org/jsx', '@foo/org/jsx', '@bar/org/jsx'],
403
+ * tokens: ['@acme/org/tokens', '@foo/org/tokens', '@bar/org/tokens'],
404
+ * }
405
+ * ```
406
+ */
407
+ buildImportMap: (option: UserConfig["importMap"]) => ImportMapOutput<string>;
408
+ private fromString;
409
+ private fromInput;
410
+ private getOutdir;
411
+ normalize: (map: string | ImportMapInput | undefined) => ImportMapOutput;
412
+ private createMatcher;
413
+ match: (result: ImportResult | undefined, resolveTsPath?: (mod: string) => string | undefined) => boolean;
414
+ file: (results: ImportResult[]) => FileMatcher;
415
+ }
416
+ //#endregion
417
+ //#region src/layers.d.ts
418
+ declare class Layers {
419
+ private names;
420
+ root: Root;
421
+ reset: AtRule;
422
+ base: AtRule;
423
+ tokens: AtRule;
424
+ recipes: AtRule;
425
+ recipes_base: AtRule;
426
+ recipes_slots: AtRule;
427
+ recipes_slots_base: AtRule;
428
+ utilities: AtRule;
429
+ compositions: AtRule;
430
+ private utilityRuleMap;
431
+ constructor(names: CascadeLayers);
432
+ getLayerRoot(layer: CascadeLayer): postcss.AtRule | postcss.Root;
433
+ insert(): postcss.Root;
434
+ get layerNames(): string[];
435
+ get params(): string;
436
+ }
437
+ //#endregion
438
+ //#region src/serialize.d.ts
439
+ interface SerializeContext extends Omit<StylesheetContext, 'layers' | 'helpers' | 'hash' | 'cssVarRoot'> {}
440
+ //#endregion
441
+ //#region src/recipes.d.ts
442
+ interface RecipeRecord {
443
+ [key: string]: RecipeConfig | SlotRecipeConfig;
444
+ }
445
+ declare class Recipes {
446
+ private recipes;
447
+ slotSeparator: string;
448
+ keys: string[];
449
+ private deprecated;
450
+ private context;
451
+ get config(): RecipeRecord;
452
+ constructor(recipes?: RecipeRecord);
453
+ private getPropKey;
454
+ private get separator();
455
+ private getClassName;
456
+ prune: () => void;
457
+ save: (context: SerializeContext) => void;
458
+ saveOne: (name: string, recipe: RecipeConfig | SlotRecipeConfig) => void;
459
+ remove(name: string): void;
460
+ inferJsxSlots: (name: string, recipe: RecipeConfig | SlotRecipeConfig) => (string | RegExp)[];
461
+ private assignRecipe;
462
+ getSlotKey: (name: string, slot: string) => string;
463
+ isEmpty: () => boolean;
464
+ isDeprecated: (name: string) => boolean;
465
+ getNames: (name: string) => {
466
+ baseName: string;
467
+ upperName: string;
468
+ dashName: string;
469
+ jsxName: string;
470
+ };
471
+ getRecipe: (name: string) => RecipeNode | undefined;
472
+ getConfig: (name: string) => RecipeConfig<import("@bamboocss/types").RecipeVariantRecord> | SlotRecipeConfig;
473
+ getConfigOrThrow: (name: string) => RecipeConfig<import("@bamboocss/types").RecipeVariantRecord> | SlotRecipeConfig;
474
+ find: (jsxName: string) => RecipeNode | undefined;
475
+ filter: (jsxName: string) => RecipeNode[];
476
+ get details(): RecipeNode[];
477
+ splitProps: (recipeName: string, props: Dict) => Dict[];
478
+ isSlotRecipe: (name: string) => boolean;
479
+ static isSlotRecipeConfig: (config: RecipeConfig | SlotRecipeConfig) => config is SlotRecipeConfig;
480
+ normalize: (name: string, config: RecipeConfig) => Required<RecipeConfig<import("@bamboocss/types").RecipeVariantRecord>>;
481
+ getTransform: (name: string, slot?: boolean) => (variant: string, value: string) => {
482
+ layer: string;
483
+ className: string;
484
+ styles: SystemStyleObject;
485
+ } | {
486
+ className: string;
487
+ styles: SystemStyleObject;
488
+ layer?: undefined;
489
+ };
490
+ filterDetails: (filters?: ArtifactFilters) => RecipeNode[];
491
+ static inferSlots: (recipe: PartialBy<SlotRecipeDefinition, "slots">) => string[];
492
+ static isValidNode: (node: unknown) => node is RecipeNode;
493
+ }
494
+ //#endregion
495
+ //#region src/types.d.ts
496
+ interface TransformResult {
497
+ layer?: string;
498
+ className: string;
499
+ styles: Dict;
500
+ }
501
+ interface StylesheetContext extends Pick<Context, 'utility' | 'conditions' | 'encoder' | 'decoder' | 'isValidProperty' | 'hooks' | 'globalVars' | 'globalFontface' | 'globalPositionTry'> {
502
+ layers: Layers;
503
+ helpers: PatternHelpers;
504
+ hash?: boolean;
505
+ browserslist?: string[];
506
+ polyfill?: boolean;
507
+ cssVarRoot: string;
508
+ }
509
+ interface RecipeNode {
510
+ /**
511
+ * The name of the recipe
512
+ */
513
+ baseName: string;
514
+ /**
515
+ * The class name of the recipe. Defaults to the baseName if not specified.
516
+ */
517
+ className: string;
518
+ /**
519
+ * Discriminant
520
+ */
521
+ type: 'recipe';
522
+ /**
523
+ * The keys of the variants
524
+ */
525
+ variantKeys: string[];
526
+ /**
527
+ * The map of the variant keys to their possible values
528
+ */
529
+ variantKeyMap: Record<string, string[]>;
530
+ /**
531
+ * The jsx keys or regex to match the recipe
532
+ */
533
+ jsx: (string | RegExp)[];
534
+ /**
535
+ * The name of the recipe in upper case
536
+ */
537
+ upperName: string;
538
+ /**
539
+ * The name of the recipe in dash case
540
+ */
541
+ dashName: string;
542
+ /**
543
+ * The name of the recipe in camel case
544
+ */
545
+ jsxName: string;
546
+ /**
547
+ * The regex to match the recipe
548
+ */
549
+ match: RegExp;
550
+ /**
551
+ * The transformed recipe config
552
+ */
553
+ config: RecipeConfig | SlotRecipeConfig;
554
+ /**
555
+ * The function to split the props
556
+ */
557
+ splitProps: (props: Dict) => [Dict, Dict];
558
+ /**
559
+ * The props of the recipe
560
+ */
561
+ props: string[];
562
+ }
563
+ interface CssOptions extends Pick<UserConfig, 'minify'> {}
564
+ interface ProcessOptions {
565
+ styles: Dict;
566
+ layer: LayerName;
567
+ }
568
+ type LayerName = 'base' | 'reset' | 'recipes_slots_base' | 'recipes_base' | 'tokens' | 'recipes' | 'utilities' | 'recipes_slots' | 'compositions';
569
+ interface ParserOptions {
570
+ hash: HashOptions;
571
+ imports: ImportMap;
572
+ jsx: JsxEngine;
573
+ config: Config;
574
+ recipes: Recipes;
575
+ tokens: TokenDictionary;
576
+ patterns: Patterns;
577
+ utility: Utility;
578
+ conditions: Conditions;
579
+ encoder: StyleEncoder;
580
+ join: (...paths: string[]) => string;
581
+ compilerOptions: TSConfig['compilerOptions'];
582
+ tsOptions: LoadConfigResult['tsOptions'];
583
+ }
584
+ //#endregion
585
+ //#region src/utility.d.ts
586
+ interface UtilityOptions {
587
+ config?: UtilityConfig;
588
+ tokens: TokenDictionary;
589
+ separator?: string;
590
+ prefix?: string;
591
+ shorthands?: boolean;
592
+ strictTokens?: boolean;
593
+ keyframes?: CssKeyframes;
594
+ }
595
+ declare class Utility {
596
+ private options;
597
+ /**
598
+ * The token map or dictionary of tokens
599
+ */
600
+ tokens: TokenDictionary;
601
+ /**
602
+ * [cache] The map of property names to their resolved class names
603
+ */
604
+ classNames: Map<string, string>;
605
+ /**
606
+ * [cache] The map of the property to their resolved styless
607
+ */
608
+ styles: Map<string, Dict>;
609
+ /**
610
+ * Map of shorthand properties to their longhand properties
611
+ */
612
+ shorthands: Map<string, string>;
613
+ /**
614
+ * The map of possible values for each property
615
+ */
616
+ types: Map<string, Set<string>>;
617
+ /**
618
+ * The map of the property keys
619
+ */
620
+ propertyTypeKeys: Map<string, Set<string>>;
621
+ /**
622
+ * The utility config
623
+ */
624
+ config: UtilityConfig;
625
+ /**
626
+ * The map of property names to their transform functions
627
+ */
628
+ private transforms;
629
+ /**
630
+ * The map of property names to their config
631
+ */
632
+ private configs;
633
+ /**
634
+ * The map of deprecated properties
635
+ */
636
+ private deprecated;
637
+ separator: string;
638
+ prefix: string;
639
+ strictTokens: boolean;
640
+ constructor(options: UtilityOptions);
641
+ defaultHashFn: typeof toHash;
642
+ toHash: (path: string[], hashFn: (str: string) => string) => string;
643
+ private normalizeConfig;
644
+ private assignDeprecated;
645
+ register: (property: string, config: PropertyConfig) => void;
646
+ private assignShorthands;
647
+ private assignColorPaletteProperty;
648
+ resolveShorthand: (prop: string) => string;
649
+ get hasShorthand(): boolean;
650
+ get isEmpty(): boolean;
651
+ entries: () => [string, string][];
652
+ private getPropKey;
653
+ private hash;
654
+ /**
655
+ * Get all the possible values for the defined property
656
+ */
657
+ getPropertyValues: (config: PropertyConfig, resolveFn?: (key: string) => string) => {
658
+ type: string;
659
+ } | Record<string, string> | {
660
+ [x: string]: Record<string, string>;
661
+ } | undefined;
662
+ getPropertyRawValue(config: PropertyConfig, value: string): string;
663
+ getToken: (path: string) => string;
664
+ getTokenCategoryValues: (category: string) => Record<string, string> | undefined;
665
+ /**
666
+ * Normalize the property config
667
+ */
668
+ normalize: (propertyConfig: PropertyConfig | undefined) => PropertyConfig | undefined;
669
+ private assignProperty;
670
+ private assignProperties;
671
+ assignPropertiesValues: () => this;
672
+ private assignPropertyValues;
673
+ getPropertyKeys: (prop: string) => string[];
674
+ getPropertyTypeKeys: (property: string) => string[];
675
+ private assignPropertyType;
676
+ private assignPropertyTypes;
677
+ addPropertyType: (property: string, type: string[]) => void;
678
+ /**
679
+ * Returns the Typescript type for the define properties
680
+ */
681
+ getTypes: () => Map<string, string[]>;
682
+ defaultTransform: (value: string, prop: string) => {
683
+ [x: string]: string;
684
+ };
685
+ private setTransform;
686
+ private getTokenFn;
687
+ resolveColorMix: (value: string) => {
688
+ invalid: boolean;
689
+ value: string;
690
+ color?: undefined;
691
+ } | {
692
+ invalid: boolean;
693
+ color: string;
694
+ value: string;
695
+ };
696
+ private getTransformArgs;
697
+ private setStyles;
698
+ formatClassName: (className: string) => string;
699
+ /**
700
+ * Returns the resolved className for a given property and value
701
+ */
702
+ getClassName: (property: string, raw: string) => string;
703
+ getOrCreateClassName: (property: string, raw: string) => string;
704
+ /**
705
+ * Whether a given property exists in the config
706
+ */
707
+ has: (prop: string) => boolean;
708
+ /**
709
+ * Get or create the resolved styles for a given property and value
710
+ */
711
+ private getOrCreateStyle;
712
+ /**
713
+ * Returns the resolved className and styles for a given property and value
714
+ */
715
+ transform: (prop: string, value: string | undefined) => TransformResult;
716
+ /**
717
+ * All keys including shorthand keys
718
+ */
719
+ keys: () => string[];
720
+ /**
721
+ * Returns a map of the property keys and their shorthands
722
+ */
723
+ getPropShorthandsMap: () => Map<string, string[]>;
724
+ /**
725
+ * Returns the shorthands for a given property
726
+ */
727
+ getPropShorthands: (prop: string) => string[];
728
+ /**
729
+ * Whether a given property is deprecated
730
+ */
731
+ isDeprecated: (prop: string) => boolean;
732
+ /**
733
+ * Returns the token type for a given property
734
+ */
735
+ getTokenType: (prop: string) => string | undefined;
736
+ }
737
+ //#endregion
738
+ //#region src/patterns.d.ts
739
+ interface PatternOptions {
740
+ config: UserConfig;
741
+ tokens: TokenDictionary;
742
+ utility: Utility;
743
+ helpers: PatternHelpers;
744
+ }
745
+ declare class Patterns {
746
+ private options;
747
+ patterns: Record<string, PatternConfig>;
748
+ details: PatternNode[];
749
+ keys: string[];
750
+ private utility;
751
+ private tokens;
752
+ private deprecated;
753
+ constructor(options: PatternOptions);
754
+ private createDetail;
755
+ getConfig(name: string): PatternConfig;
756
+ transform(name: string, styles: Dict): Dict;
757
+ getNames(name: string): PatternNames;
758
+ find: (jsxName: string) => string;
759
+ filter: (jsxName: string) => PatternNode[];
760
+ isEmpty(): boolean;
761
+ isDeprecated(name: string): boolean;
762
+ saveOne(name: string, pattern: PatternConfig): void;
763
+ remove(name: string): void;
764
+ filterDetails(filters?: ArtifactFilters): PatternNode[];
765
+ getPropertyValues: (patternName: string, property: string) => string[] | undefined;
766
+ getPropertyType: (prop: PatternProperty) => string;
767
+ static isValidNode: (node: unknown) => node is PatternNode;
768
+ }
769
+ interface PatternNames {
770
+ upperName: string;
771
+ baseName: string;
772
+ dashName: string;
773
+ styleFnName: string;
774
+ jsxName: string;
775
+ }
776
+ interface PatternNode extends PatternNames {
777
+ props: string[];
778
+ blocklistType: string;
779
+ config: PatternConfig;
780
+ type: 'pattern';
781
+ match: RegExp;
782
+ jsx: NonNullable<PatternConfig['jsx']>;
783
+ }
784
+ //#endregion
785
+ //#region src/jsx.d.ts
786
+ interface JsxMatcher {
787
+ string: Set<string>;
788
+ regex: RegExp[];
789
+ }
790
+ declare class JsxEngine {
791
+ private context;
792
+ nodes: Array<PatternNode | RecipeNode>;
793
+ names: string[];
794
+ recipeMatcher: JsxMatcher;
795
+ recipePropertiesByJsxName: Map<string, Set<string>>;
796
+ patternMatcher: JsxMatcher;
797
+ patternPropertiesByJsxName: Map<string, Set<string>>;
798
+ constructor(context: Pick<Context, 'patterns' | 'recipes' | 'config'>);
799
+ assignRecipeMatcher(): void;
800
+ assignPatternMatcher(): void;
801
+ private get jsxFactory();
802
+ get styleProps(): "all" | "none" | "minimal";
803
+ get framework(): (string & {}) | import("@bamboocss/types").JsxFramework | undefined;
804
+ get isEnabled(): boolean;
805
+ get factoryName(): string;
806
+ get upperName(): string;
807
+ get typeName(): string;
808
+ get variantName(): string;
809
+ get componentName(): string;
810
+ isJsxFactory: (name: string) => boolean;
811
+ isJsxTagRecipe: (tagName: string) => boolean;
812
+ isJsxTagPattern: (tagName: string) => boolean;
813
+ isRecipeOrPatternProp: (tagName: string, propName: string) => boolean;
814
+ }
815
+ //#endregion
816
+ //#region src/path.d.ts
817
+ declare class PathEngine {
818
+ private context;
819
+ constructor(context: Pick<Context, 'config'>);
820
+ private get cwd();
821
+ private get outdir();
822
+ getFilePath(file?: string): string[];
823
+ get root(): string[];
824
+ get css(): string[];
825
+ get token(): string[];
826
+ get types(): string[];
827
+ get recipe(): string[];
828
+ get pattern(): string[];
829
+ get outCss(): string[];
830
+ get jsx(): string[];
831
+ get themes(): string[];
832
+ get specs(): string[];
833
+ }
834
+ //#endregion
835
+ //#region src/static-css.d.ts
836
+ interface StaticCssResults {
837
+ css: Record<string, any>[];
838
+ recipes: Record<string, any>[];
839
+ patterns: Record<string, any>[];
840
+ }
841
+ type StaticCssContext = Pick<Context, 'encoder' | 'decoder' | 'utility' | 'patterns' | 'recipes' | 'createSheet' | 'config'>;
842
+ interface StaticCssEngine {
843
+ results: StaticCssResults;
844
+ sheet: Stylesheet$1;
845
+ }
846
+ declare class StaticCss {
847
+ private context;
848
+ encoder: StyleEncoder;
849
+ decoder: StyleDecoder;
850
+ private breakpointKeys;
851
+ private conditionKeys;
852
+ private wildcardCache;
853
+ constructor(context: StaticCssContext);
854
+ clone(): this;
855
+ private formatCondition;
856
+ private getConditionalValues;
857
+ private createRegex;
858
+ parse: (text: string) => string[];
859
+ /**
860
+ * Get property keys with memoization for wildcard expansion
861
+ * This is the main performance optimization - avoids redundant token lookups
862
+ */
863
+ private getCachedPropertyKeys;
864
+ /**
865
+ * Get pattern property values with memoization
866
+ */
867
+ private getCachedPatternPropertyValues;
868
+ private getCssObjects;
869
+ getCssRuleObjects: (rule: CssRule) => {
870
+ [x: string]: string | number | {
871
+ base: any;
872
+ };
873
+ }[];
874
+ private getPatternObjects;
875
+ getPatternRuleObjects: (name: string, pattern: PatternRule) => Dict[];
876
+ private getRecipeNode;
877
+ getRecipeRuleObjects: (name: string, recipe: RecipeRule, recipeNode: RecipeNode$1) => Dict[];
878
+ getRecipeCompoundVariantCssObjects: (recipeNode: RecipeNode$1) => Dict[];
879
+ /**
880
+ * This transforms a static css config into the same format as in the ParserResult,
881
+ * so that it can be processed by the same logic as styles found in app code.
882
+ *
883
+ * e.g.
884
+ * @example { css: [{ color: ['red', 'blue'] }] } => { css: [{ color: 'red }, { color: 'blue }] }
885
+ * @example { css: [{ color: ['red'], conditions: ['md'] }] } => { css: [{ color: { base: 'red', md: 'red' } }] }
886
+ *
887
+ */
888
+ getStyleObjects(options: StaticCssOptions): StaticCssResults;
889
+ process: (options: StaticCssOptions, stylesheet?: Stylesheet$1) => StaticCssEngine;
890
+ }
891
+ //#endregion
892
+ //#region src/stylesheet.d.ts
893
+ declare class Stylesheet {
894
+ private context;
895
+ constructor(context: StylesheetContext);
896
+ get layers(): Layers;
897
+ getLayer(layer: LayerName): postcss.AtRule | undefined;
898
+ process(options: ProcessOptions): void;
899
+ serialize: (styles: Dict) => Dict;
900
+ processResetCss: (styles: Dict) => void;
901
+ processGlobalCss: (styles: Dict) => void;
902
+ processCss: (styles: SystemStyleObject | undefined, layer: LayerName) => void;
903
+ processDecoder: (decoder: StyleDecoder) => void;
904
+ /**
905
+ * Process only the styles for a specific recipe from the decoder
906
+ */
907
+ processDecoderForRecipe: (decoder: StyleDecoder, recipeName: string) => void;
908
+ getLayerCss: (...layers: CascadeLayer[]) => string;
909
+ toCss: ({
910
+ minify
911
+ }?: CssOptions) => string;
912
+ }
913
+ //#endregion
914
+ //#region src/context.d.ts
915
+ declare class Context {
916
+ conf: LoadConfigResult;
917
+ studio: RequiredBy<NonNullable<StudioOptions['studio']>, 'outdir'>;
918
+ tokens: TokenDictionary;
919
+ utility: Utility;
920
+ recipes: Recipes;
921
+ conditions: Conditions;
922
+ patterns: Patterns;
923
+ staticCss: StaticCss;
924
+ jsx: JsxEngine;
925
+ imports: ImportMap;
926
+ paths: PathEngine;
927
+ file: FileEngine;
928
+ globalVars: GlobalVars;
929
+ globalFontface: GlobalFontface$1;
930
+ globalPositionTry: GlobalPositionTry$1;
931
+ encoder: StyleEncoder;
932
+ decoder: StyleDecoder;
933
+ hooksApi: HooksApi;
934
+ properties: Set<string>;
935
+ isValidProperty: (key: string) => boolean;
936
+ messages: Messages;
937
+ parserOptions: ParserOptions;
938
+ constructor(conf: LoadConfigResult);
939
+ get config(): UserConfig;
940
+ get hooks(): Partial<BambooHooks>;
941
+ get isTemplateLiteralSyntax(): boolean;
942
+ get hash(): HashOptions;
943
+ get prefix(): PrefixOptions;
944
+ createTokenDictionary: (theme: Theme, themeVariants?: ThemeVariantsMap) => TokenDictionary;
945
+ createUtility: (config: UserConfig) => Utility;
946
+ createConditions: (config: UserConfig) => Conditions;
947
+ createLayers: (layers: CascadeLayers) => Layers;
948
+ setupCompositions: (theme: Theme) => void;
949
+ private registerAnimationName;
950
+ private registerFontFamily;
951
+ setupProperties: () => void;
952
+ get baseSheetContext(): {
953
+ conditions: Conditions;
954
+ utility: Utility;
955
+ hash: boolean | undefined;
956
+ encoder: StyleEncoder;
957
+ decoder: StyleDecoder;
958
+ hooks: Partial<BambooHooks>;
959
+ isValidProperty: (key: string) => boolean;
960
+ browserslist: string[] | undefined;
961
+ polyfill: boolean | undefined;
962
+ cssVarRoot: string;
963
+ helpers: {
964
+ map: typeof import("@bamboocss/shared").mapObject;
965
+ isCssFunction: (v: unknown) => boolean;
966
+ isCssVar: (v: unknown) => boolean;
967
+ isCssUnit: (v: unknown) => boolean;
968
+ };
969
+ globalVars: GlobalVars;
970
+ globalFontface: GlobalFontface$1;
971
+ globalPositionTry: GlobalPositionTry$1;
972
+ };
973
+ createSheet: () => Stylesheet;
974
+ createRecipes: (theme: Theme) => Recipes;
975
+ isValidLayerParams: (params: string) => boolean;
976
+ }
977
+ declare namespace messages_d_exports {
978
+ export { Messages, artifactsGenerated, buildComplete, codegenComplete, configExists, configWatch, cssArtifactComplete, exclamation, getMessages, noExtract, thankYou, watch };
979
+ }
980
+ declare const artifactsGenerated: (ctx: Pick<Context, "config" | "recipes" | "patterns" | "tokens" | "jsx" | "isTemplateLiteralSyntax">) => () => string;
981
+ declare const configExists: (cmd: string) => string;
982
+ declare const thankYou: () => string;
983
+ declare const codegenComplete: () => string;
984
+ declare const noExtract: () => string;
985
+ declare const watch: () => string;
986
+ declare const configWatch: () => string;
987
+ declare const buildComplete: (count: number) => string;
988
+ declare const exclamation: () => string;
989
+ declare const cssArtifactComplete: (type: string) => string;
990
+ declare const getMessages: (ctx: Pick<Context, "config" | "recipes" | "patterns" | "tokens" | "jsx" | "isTemplateLiteralSyntax">) => {
991
+ artifactsGenerated: () => string;
992
+ configExists: (cmd: string) => string;
993
+ thankYou: () => string;
994
+ codegenComplete: () => string;
995
+ noExtract: () => string;
996
+ watch: () => string;
997
+ buildComplete: (count: number) => string;
998
+ configWatch: () => string;
999
+ cssArtifactComplete: (type: string) => string;
1000
+ exclamation: () => string;
1001
+ };
1002
+ type Messages = ReturnType<typeof getMessages>;
1003
+ //#endregion
1004
+ //#region src/optimize.d.ts
1005
+ interface OptimizeOptions {
1006
+ minify?: boolean;
1007
+ browserslist?: string[];
1008
+ hooks?: Partial<BambooHooks>;
1009
+ }
1010
+ declare function optimizeCss(code: string | Root, options?: OptimizeOptions): string;
1011
+ declare function expandNestedCss(code: string): string;
1012
+ //#endregion
1013
+ //#region src/selector.d.ts
1014
+ declare function extractParentSelectors(selector: string): string;
1015
+ declare function extractTrailingPseudos(selector: string): [string, string] | [null, string];
1016
+ //#endregion
1017
+ //#region src/stringify.d.ts
1018
+ /** Returns a string of CSS from an object of CSS. */
1019
+ declare function stringify(/** Style object defintion. */
1020
+
1021
+ value: Dict): string;
1022
+ //#endregion
1023
+ export { Breakpoints, Conditions, Context, type CssOptions, FileMatcher, ImportMap, type ImportResult, JsxEngine, Layers, type ParserOptions, type PatternNode, Patterns, type RecipeNode, Recipes, RuleProcessor, StaticCss, StyleDecoder, StyleEncoder, Stylesheet, type StylesheetContext, type TransformResult, Utility, expandNestedCss, extractParentSelectors, extractTrailingPseudos, messages_d_exports as messages, optimizeCss, stringify };