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