@bamboocss/types 1.15.0 → 1.16.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/dist/artifact.d.ts +0 -7
- package/dist/config.d.ts +4 -51
- package/dist/hooks.d.ts +1 -9
- package/dist/parser.d.ts +1 -3
- package/dist/pattern.d.ts +0 -16
- package/dist/recipe.d.ts +78 -7
- package/dist/reporter.d.ts +1 -11
- package/dist/spec.d.ts +0 -3
- package/dist/style-rules.d.ts +8 -0
- package/package.json +2 -2
package/dist/artifact.d.ts
CHANGED
|
@@ -19,16 +19,9 @@ export type ArtifactId =
|
|
|
19
19
|
| 'recipes-index'
|
|
20
20
|
| 'patterns'
|
|
21
21
|
| 'patterns-index'
|
|
22
|
-
| 'jsx-is-valid-prop'
|
|
23
|
-
| 'jsx-helpers'
|
|
24
|
-
| 'jsx-factory'
|
|
25
|
-
| 'jsx-patterns'
|
|
26
|
-
| 'jsx-create-style-context'
|
|
27
|
-
| 'jsx-patterns-index'
|
|
28
22
|
| 'css-index'
|
|
29
23
|
| 'themes'
|
|
30
24
|
| 'package.json'
|
|
31
|
-
| 'types-jsx'
|
|
32
25
|
| 'types-entry'
|
|
33
26
|
| 'types-styles'
|
|
34
27
|
| 'types-conditions'
|
package/dist/config.d.ts
CHANGED
|
@@ -184,7 +184,6 @@ export interface ImportMapInput {
|
|
|
184
184
|
css?: string | string[]
|
|
185
185
|
recipes?: string | string[]
|
|
186
186
|
patterns?: string | string[]
|
|
187
|
-
jsx?: string | string[]
|
|
188
187
|
tokens?: string | string[]
|
|
189
188
|
}
|
|
190
189
|
|
|
@@ -192,7 +191,6 @@ export interface ImportMapOutput<T = string> {
|
|
|
192
191
|
css: T[]
|
|
193
192
|
recipe: T[]
|
|
194
193
|
pattern: T[]
|
|
195
|
-
jsx: T[]
|
|
196
194
|
tokens: T[]
|
|
197
195
|
}
|
|
198
196
|
|
|
@@ -261,49 +259,6 @@ interface FileSystemOptions {
|
|
|
261
259
|
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent'
|
|
262
260
|
}
|
|
263
261
|
|
|
264
|
-
export type JsxFramework = 'react' | 'solid' | 'preact' | 'vue' | 'qwik'
|
|
265
|
-
|
|
266
|
-
interface JsxOptions {
|
|
267
|
-
/**
|
|
268
|
-
* The framework to use for generating supercharged elements.
|
|
269
|
-
*/
|
|
270
|
-
jsxFramework?: JsxFramework | (string & {})
|
|
271
|
-
/**
|
|
272
|
-
* The factory name of the element
|
|
273
|
-
* @default 'styled'
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
* ```jsx
|
|
277
|
-
* <styled.button marginTop="40px">Click me</styled.button>
|
|
278
|
-
* ```
|
|
279
|
-
*/
|
|
280
|
-
jsxFactory?: string
|
|
281
|
-
/**
|
|
282
|
-
* The style props allowed on generated JSX components
|
|
283
|
-
* - When set to 'all', all style props are allowed.
|
|
284
|
-
* - When set to 'minimal', only the `css` prop is allowed.
|
|
285
|
-
* - When set to 'none', no style props are allowed and therefore the jsxFactory will not be importable.
|
|
286
|
-
*
|
|
287
|
-
* @default 'all'
|
|
288
|
-
*
|
|
289
|
-
* @example with 'all':
|
|
290
|
-
* ```jsx
|
|
291
|
-
* <styled.button marginTop="40px">Click me</styled.button>
|
|
292
|
-
* ```
|
|
293
|
-
*
|
|
294
|
-
* @example with 'minimal':
|
|
295
|
-
* ```jsx
|
|
296
|
-
* <styled.button css={{ marginTop: "40px" }}>Click me</styled.button>
|
|
297
|
-
* ```
|
|
298
|
-
*
|
|
299
|
-
* @example with 'none':
|
|
300
|
-
* ```jsx
|
|
301
|
-
* <button className={css({ marginTop: "40px" })}>Click me</button>
|
|
302
|
-
* ```
|
|
303
|
-
*/
|
|
304
|
-
jsxStyleProps?: 'all' | 'minimal' | 'none'
|
|
305
|
-
}
|
|
306
|
-
|
|
307
262
|
interface CssgenOptions {
|
|
308
263
|
/**
|
|
309
264
|
* Whether to include css reset styles in the generated css.
|
|
@@ -370,11 +325,6 @@ interface CssgenOptions {
|
|
|
370
325
|
* @default ':where(:host, :root)'
|
|
371
326
|
*/
|
|
372
327
|
cssVarRoot?: string
|
|
373
|
-
/**
|
|
374
|
-
* The css syntax kind to use
|
|
375
|
-
* @default 'object-literal'
|
|
376
|
-
*/
|
|
377
|
-
syntax?: 'template-literal' | 'object-literal'
|
|
378
328
|
/**
|
|
379
329
|
* Whether to use `lightningcss` instead of `postcss` for css optimization.
|
|
380
330
|
* @default false
|
|
@@ -445,6 +395,10 @@ interface CodegenOptions {
|
|
|
445
395
|
* - `'grouped'`: one class per `css()` call, grouping all properties together
|
|
446
396
|
*
|
|
447
397
|
* Grouped mode reduces the number of classes in the HTML at the cost of potential CSS duplication.
|
|
398
|
+
*
|
|
399
|
+
* A grouped class names a whole call, so the build has to have seen that exact call to emit its rule.
|
|
400
|
+
* Where it cannot, the runtime falls back to atomic class names — and a few shapes lose their styles
|
|
401
|
+
* entirely, without a warning. Read https://bamboocss.com/docs/references/config#cssmode before enabling it.
|
|
448
402
|
* @default 'atomic'
|
|
449
403
|
*/
|
|
450
404
|
cssMode?: 'atomic' | 'grouped'
|
|
@@ -475,7 +429,6 @@ export interface Config
|
|
|
475
429
|
CssgenOptions,
|
|
476
430
|
CodegenOptions,
|
|
477
431
|
FileSystemOptions,
|
|
478
|
-
JsxOptions,
|
|
479
432
|
PresetOptions,
|
|
480
433
|
HooksOptions,
|
|
481
434
|
PluginsOptions {
|
package/dist/hooks.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Artifact, ArtifactId, DiffConfigResult } from './artifact'
|
|
|
2
2
|
import type { LoadConfigResult, UserConfig } from './config'
|
|
3
3
|
import type { HooksApiInterface } from './hooks-api'
|
|
4
4
|
import type { LoggerInterface } from './logger'
|
|
5
|
-
import type { ParserResultInterface
|
|
5
|
+
import type { ParserResultInterface } from './parser'
|
|
6
6
|
|
|
7
7
|
export interface BambooHooks {
|
|
8
8
|
/**
|
|
@@ -37,10 +37,6 @@ export interface BambooHooks {
|
|
|
37
37
|
* You can also use this hook to parse the file's content on your side using a custom parser, in this case you don't have to return anything.
|
|
38
38
|
*/
|
|
39
39
|
'parser:before': (args: ParserResultBeforeHookArgs) => string | void
|
|
40
|
-
/**
|
|
41
|
-
* @private USE IT ONLY IF YOU KNOW WHAT YOU ARE DOING
|
|
42
|
-
*/
|
|
43
|
-
'parser:preprocess': JsxFactoryResultTransform['transform']
|
|
44
40
|
/**
|
|
45
41
|
* Called after the file styles are extracted and processed into the resulting ParserResult object.
|
|
46
42
|
* You can also use this hook to add your own extraction results from your custom parser to the ParserResult object.
|
|
@@ -173,10 +169,6 @@ export interface ParserResultBeforeHookArgs {
|
|
|
173
169
|
original?: string
|
|
174
170
|
}
|
|
175
171
|
|
|
176
|
-
export interface JsxFactoryResultTransform {
|
|
177
|
-
transform: (result: { type: 'jsx-factory'; data: ResultItem['data'] }) => ResultItem['data']
|
|
178
|
-
}
|
|
179
|
-
|
|
180
172
|
export interface ParserResultAfterHookArgs {
|
|
181
173
|
filePath: string
|
|
182
174
|
result: ParserResultInterface | undefined
|
package/dist/parser.d.ts
CHANGED
|
@@ -3,13 +3,12 @@ import type { BoxNodeArray, BoxNodeLiteral, BoxNodeMap, Unboxed } from '@bambooc
|
|
|
3
3
|
export interface ResultItem {
|
|
4
4
|
name?: string
|
|
5
5
|
data: Array<Unboxed['raw']>
|
|
6
|
-
type?: 'css' | 'cva' | 'sva' | 'token' | 'pattern' | 'recipe' | 'jsx-
|
|
6
|
+
type?: 'css' | 'cva' | 'sva' | 'token' | 'pattern' | 'recipe' | 'jsx-recipe'
|
|
7
7
|
box?: BoxNodeMap | BoxNodeLiteral | BoxNodeArray
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface ParserResultInterface {
|
|
11
11
|
all: Array<ResultItem>
|
|
12
|
-
jsx: Set<ResultItem>
|
|
13
12
|
css: Set<ResultItem>
|
|
14
13
|
cva: Set<ResultItem>
|
|
15
14
|
sva: Set<ResultItem>
|
|
@@ -26,7 +25,6 @@ export interface ParserResultInterface {
|
|
|
26
25
|
setSva: (result: ResultItem) => void
|
|
27
26
|
setToken: (result: ResultItem) => void
|
|
28
27
|
setViewTransition: (result: ResultItem) => void
|
|
29
|
-
setJsx: (result: ResultItem) => void
|
|
30
28
|
setPattern: (name: string, result: ResultItem) => void
|
|
31
29
|
setRecipe: (name: string, result: ResultItem) => void
|
|
32
30
|
}
|
package/dist/pattern.d.ts
CHANGED
|
@@ -32,11 +32,6 @@ export interface PatternConfig<T extends PatternProperties = PatternProperties>
|
|
|
32
32
|
* The description of the pattern. This will be used in the JSDoc comment.
|
|
33
33
|
*/
|
|
34
34
|
description?: string
|
|
35
|
-
/**
|
|
36
|
-
* The JSX element rendered by the pattern
|
|
37
|
-
* @default 'div'
|
|
38
|
-
*/
|
|
39
|
-
jsxElement?: string
|
|
40
35
|
/**
|
|
41
36
|
* The properties of the pattern.
|
|
42
37
|
*/
|
|
@@ -53,17 +48,6 @@ export interface PatternConfig<T extends PatternProperties = PatternProperties>
|
|
|
53
48
|
* Whether the pattern is deprecated.
|
|
54
49
|
*/
|
|
55
50
|
deprecated?: boolean | string
|
|
56
|
-
/**
|
|
57
|
-
* The jsx element name this pattern will generate.
|
|
58
|
-
*/
|
|
59
|
-
jsxName?: string
|
|
60
|
-
/**
|
|
61
|
-
* The jsx elements to track for this pattern. Can be string or Regexp.
|
|
62
|
-
*
|
|
63
|
-
* @default capitalize(pattern.name)
|
|
64
|
-
* @example ['Button', 'Link', /Button$/]
|
|
65
|
-
*/
|
|
66
|
-
jsx?: Array<string | RegExp>
|
|
67
51
|
/**
|
|
68
52
|
* Whether to only generate types for the specified properties.
|
|
69
53
|
* This will disallow css properties
|
package/dist/recipe.d.ts
CHANGED
|
@@ -63,6 +63,20 @@ export interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantR
|
|
|
63
63
|
* The base styles of the recipe.
|
|
64
64
|
*/
|
|
65
65
|
base?: SystemStyleObject
|
|
66
|
+
/**
|
|
67
|
+
* The prefix every class this recipe emits is built from — `button` gives `button` for
|
|
68
|
+
* the base styles and `button--size_sm` for a variant.
|
|
69
|
+
*
|
|
70
|
+
* Required for a recipe declared in `theme.recipes`, where it is the key it is declared
|
|
71
|
+
* under. Optional for an inline `cva`, which is otherwise named by hashing its own
|
|
72
|
+
* config: `cva_a1b2c3--size_sm`. Setting it buys readable class names and nothing else —
|
|
73
|
+
* the CSS is identical either way.
|
|
74
|
+
*
|
|
75
|
+
* It has to be unique across every recipe in the build. Two recipes sharing a name emit
|
|
76
|
+
* rules under the same selectors, and the later one wins for any variant they both
|
|
77
|
+
* declare.
|
|
78
|
+
*/
|
|
79
|
+
className?: string
|
|
66
80
|
/**
|
|
67
81
|
* Whether the recipe is deprecated.
|
|
68
82
|
*/
|
|
@@ -84,10 +98,6 @@ export interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantR
|
|
|
84
98
|
export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>
|
|
85
99
|
|
|
86
100
|
interface RecipeConfigMeta {
|
|
87
|
-
/**
|
|
88
|
-
* The class name of the recipe.
|
|
89
|
-
*/
|
|
90
|
-
className: string
|
|
91
101
|
/**
|
|
92
102
|
* The description of the recipe. This will be used in the JSDoc comment.
|
|
93
103
|
*/
|
|
@@ -106,7 +116,10 @@ interface RecipeConfigMeta {
|
|
|
106
116
|
}
|
|
107
117
|
|
|
108
118
|
export interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>
|
|
109
|
-
extends RecipeDefinition<T>, RecipeConfigMeta {
|
|
119
|
+
extends RecipeDefinition<T>, RecipeConfigMeta {
|
|
120
|
+
/** Optional on `RecipeDefinition`, where an inline `cva` falls back to hashing its config. A recipe declared in `theme.recipes` always has one — the key it is declared under. */
|
|
121
|
+
className: string
|
|
122
|
+
}
|
|
110
123
|
|
|
111
124
|
/* -----------------------------------------------------------------------------
|
|
112
125
|
* Recipe / Slot
|
|
@@ -127,6 +140,20 @@ export interface SlotRecipeRuntimeFn<
|
|
|
127
140
|
raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>
|
|
128
141
|
variantKeys: (keyof T)[]
|
|
129
142
|
variantMap: RecipeVariantMap<T>
|
|
143
|
+
/** The config this recipe was created from. */
|
|
144
|
+
config: SlotRecipeDefinition<S, T>
|
|
145
|
+
/** Each slot's constant class, for targeting a slot in the DOM. */
|
|
146
|
+
classNameMap: Partial<Record<S, string>>
|
|
147
|
+
/**
|
|
148
|
+
* Which slots each variant writes styles for.
|
|
149
|
+
*
|
|
150
|
+
* A variant's styles reach a slot through a scope opened at an anchor, which covers every
|
|
151
|
+
* slot in that anchor's subtree. A slot under no anchor — moved out by a portal, with no
|
|
152
|
+
* second anchor named in `scopeRoots` — is not reached, and nothing at build time can
|
|
153
|
+
* detect that. This says which slots a variant has to get to, so whatever a scope cannot
|
|
154
|
+
* reach can be threaded by hand.
|
|
155
|
+
*/
|
|
156
|
+
slotsAffectedBy: Record<keyof T, S[]>
|
|
130
157
|
splitVariantProps<Props extends RecipeSelection<T>>(
|
|
131
158
|
props: Props,
|
|
132
159
|
): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]
|
|
@@ -142,7 +169,16 @@ export interface SlotRecipeDefinition<
|
|
|
142
169
|
T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,
|
|
143
170
|
> {
|
|
144
171
|
/**
|
|
145
|
-
*
|
|
172
|
+
* The prefix every class this recipe emits is built from, and the name to target its
|
|
173
|
+
* slots in the DOM by — `checkbox` gives `checkbox__control` for a slot and
|
|
174
|
+
* `checkbox__control--size_md` for that slot under a variant.
|
|
175
|
+
*
|
|
176
|
+
* Required for a recipe declared in `theme.slotRecipes`, where it is the key it is
|
|
177
|
+
* declared under. Optional for an inline `sva`, which is otherwise named by hashing its
|
|
178
|
+
* own config. Setting it buys readable class names and nothing else — the CSS is
|
|
179
|
+
* identical either way.
|
|
180
|
+
*
|
|
181
|
+
* It has to be unique across every recipe in the build.
|
|
146
182
|
*/
|
|
147
183
|
className?: string
|
|
148
184
|
/**
|
|
@@ -153,6 +189,37 @@ export interface SlotRecipeDefinition<
|
|
|
153
189
|
* The parts/slots of the recipe.
|
|
154
190
|
*/
|
|
155
191
|
slots: S[] | Readonly<S[]>
|
|
192
|
+
/**
|
|
193
|
+
* The slots that enclose other slots, used to scope their variant styles.
|
|
194
|
+
*
|
|
195
|
+
* A slot recipe's variants are chosen once, at the top, but the slots that react to them
|
|
196
|
+
* are authored by the consumer somewhere below. Naming the enclosing slots lets the build
|
|
197
|
+
* emit their variant styles as rules scoped by a class those slots already carry, so
|
|
198
|
+
* nothing has to be delivered to a slot at runtime and every other slot's class is a
|
|
199
|
+
* constant.
|
|
200
|
+
*
|
|
201
|
+
* A list, because a portal is a real discontinuity in the tree and no CSS mechanism
|
|
202
|
+
* crosses one. A `<Select>` occupies two disjoint subtrees — the trigger side under
|
|
203
|
+
* `root`, the listbox side under a portaled `positioner` — and a variant writes styles
|
|
204
|
+
* into both. One anchor can only ever reach one of them.
|
|
205
|
+
*
|
|
206
|
+
* ```ts
|
|
207
|
+
* scopeRoots: ['root', 'positioner']
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* Each named slot takes variant props; every other slot's class is a constant. The build
|
|
211
|
+
* emits each non-anchor slot's variant rules under *every* anchor, and only the anchor
|
|
212
|
+
* that is genuinely an ancestor matches — so the DOM shape never has to be declared.
|
|
213
|
+
*
|
|
214
|
+
* Defaults to `['root']` when a slot by that name exists. Set `[]` to turn scoping off
|
|
215
|
+
* and give every slot a variant class of its own, which is what a recipe whose slots are
|
|
216
|
+
* siblings wants.
|
|
217
|
+
*
|
|
218
|
+
* A slot under *no* anchor is still unreachable, and nothing at build time can detect
|
|
219
|
+
* that — reachability is a fact about the DOM. `recipe.slotsAffectedBy` says which slots
|
|
220
|
+
* a variant writes to, for whatever still needs threading by hand.
|
|
221
|
+
*/
|
|
222
|
+
scopeRoots?: S[] | Readonly<S[]>
|
|
156
223
|
/**
|
|
157
224
|
* The base styles of the recipe.
|
|
158
225
|
*/
|
|
@@ -178,4 +245,8 @@ export type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariant
|
|
|
178
245
|
export type SlotRecipeConfig<
|
|
179
246
|
S extends string = string,
|
|
180
247
|
T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,
|
|
181
|
-
> = SlotRecipeDefinition<S, T> &
|
|
248
|
+
> = SlotRecipeDefinition<S, T> &
|
|
249
|
+
RecipeConfigMeta & {
|
|
250
|
+
/** Optional on `SlotRecipeDefinition`, where an inline `sva` falls back to hashing its config. A recipe declared in `theme.slotRecipes` always has one — the key it is declared under. */
|
|
251
|
+
className: string
|
|
252
|
+
}
|
package/dist/reporter.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import type { ParserResultInterface } from './parser'
|
|
2
2
|
|
|
3
|
-
export type ReportItemType =
|
|
4
|
-
| 'css'
|
|
5
|
-
| 'cva'
|
|
6
|
-
| 'sva'
|
|
7
|
-
| 'token'
|
|
8
|
-
| 'pattern'
|
|
9
|
-
| 'recipe'
|
|
10
|
-
| 'jsx-factory'
|
|
11
|
-
| 'jsx-pattern'
|
|
12
|
-
| 'jsx-recipe'
|
|
13
|
-
| 'jsx'
|
|
3
|
+
export type ReportItemType = 'css' | 'cva' | 'sva' | 'token' | 'pattern' | 'recipe' | 'jsx-recipe'
|
|
14
4
|
|
|
15
5
|
type ComponentKind = 'component' | 'function'
|
|
16
6
|
|
package/dist/spec.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export type SpecType =
|
|
|
13
13
|
|
|
14
14
|
interface Examples {
|
|
15
15
|
functionExamples: string[]
|
|
16
|
-
jsxExamples: string[]
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
export interface TokenValue {
|
|
@@ -78,7 +77,6 @@ export interface PatternSpecDefinition extends Examples {
|
|
|
78
77
|
name: string
|
|
79
78
|
description?: string
|
|
80
79
|
properties: PatternSpecProperty[]
|
|
81
|
-
jsx?: string
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
export interface PatternSpec {
|
|
@@ -140,7 +138,6 @@ export interface ColorPaletteSpec {
|
|
|
140
138
|
data: {
|
|
141
139
|
values: string[]
|
|
142
140
|
functionExamples: string[]
|
|
143
|
-
jsxExamples: string[]
|
|
144
141
|
}
|
|
145
142
|
}
|
|
146
143
|
|
package/dist/style-rules.d.ts
CHANGED
|
@@ -24,6 +24,14 @@ export interface AtomicStyleResult {
|
|
|
24
24
|
className: string
|
|
25
25
|
conditions?: ConditionDetails[]
|
|
26
26
|
layer?: string
|
|
27
|
+
/**
|
|
28
|
+
* The rule selects through a `@scope` prelude rather than on `className`.
|
|
29
|
+
*
|
|
30
|
+
* A non-root slot's variant styles are reached from the class the *root* carries, so this
|
|
31
|
+
* result's own class names nothing. It still identifies the rule for bookkeeping, but
|
|
32
|
+
* reporting it would put a class on the element that no rule ever matches.
|
|
33
|
+
*/
|
|
34
|
+
scoped?: boolean
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
export interface GroupedResult extends Pick<AtomicStyleResult, 'result' | 'className'> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "The types for css bamboo",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"ncp": "2.0.0",
|
|
33
33
|
"pkg-types": "2.3.0",
|
|
34
34
|
"ts-morph": "28.0.0",
|
|
35
|
-
"@bamboocss/extractor": "1.
|
|
35
|
+
"@bamboocss/extractor": "1.16.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsx scripts/watch.ts",
|