@bamboocss/types 1.30.1 → 1.32.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/composition.d.ts +28 -210
- package/dist/conditions.d.ts +0 -1
- package/dist/config.d.ts +301 -179
- package/dist/index.d.ts +0 -1
- package/dist/logger.d.ts +5 -0
- package/dist/pattern.d.ts +24 -8
- package/dist/recipe.d.ts +2 -2
- package/dist/spec.d.ts +7 -33
- package/dist/style-props.d.ts +2 -2
- package/dist/system-types.d.ts +3 -3
- package/dist/theme.d.ts +29 -13
- package/package.json +2 -2
- package/dist/parts.d.ts +0 -7
package/dist/composition.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Nested } from './conditions'
|
|
2
|
+
import type { CssVarProperties, SystemProperties } from './style-props'
|
|
2
3
|
|
|
3
4
|
interface Token<T> {
|
|
4
5
|
value: T
|
|
@@ -10,217 +11,34 @@ interface Recursive<T> {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
/* -----------------------------------------------------------------------------
|
|
13
|
-
*
|
|
14
|
+
* Mixins
|
|
14
15
|
* -----------------------------------------------------------------------------*/
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
| 'hypens'
|
|
41
|
-
| 'hyphenateCharacter'
|
|
42
|
-
| 'hyphenateLimitChars'
|
|
43
|
-
| 'letterSpacing'
|
|
44
|
-
| 'lineBreak'
|
|
45
|
-
| 'lineHeight'
|
|
46
|
-
| 'quotes'
|
|
47
|
-
| 'overflowWrap'
|
|
48
|
-
| 'tabSize'
|
|
49
|
-
| 'textAlign'
|
|
50
|
-
| 'textAlignLast'
|
|
51
|
-
| 'textBox'
|
|
52
|
-
| 'textBoxEdge'
|
|
53
|
-
| 'textBoxTrim'
|
|
54
|
-
| 'textCombineUpright'
|
|
55
|
-
| 'textDecoration'
|
|
56
|
-
| 'textDecorationColor'
|
|
57
|
-
| 'textDecorationLine'
|
|
58
|
-
| 'textDecorationSkip'
|
|
59
|
-
| 'textDecorationSkipBox'
|
|
60
|
-
| 'textDecorationSkipInk'
|
|
61
|
-
| 'textDecorationSkipInset'
|
|
62
|
-
| 'textDecorationStyle'
|
|
63
|
-
| 'textDecorationThickness'
|
|
64
|
-
| 'textEmphasis'
|
|
65
|
-
| 'textEmphasisColor'
|
|
66
|
-
| 'textEmphasisPosition'
|
|
67
|
-
| 'textEmphasisStyle'
|
|
68
|
-
| 'textIndent'
|
|
69
|
-
| 'textJustify'
|
|
70
|
-
| 'textOrientation'
|
|
71
|
-
| 'textOverflow'
|
|
72
|
-
| 'textRendering'
|
|
73
|
-
| 'textShadow'
|
|
74
|
-
| 'textStroke'
|
|
75
|
-
| 'textStrokeColor'
|
|
76
|
-
| 'textStrokeWidth'
|
|
77
|
-
| 'textTransform'
|
|
78
|
-
| 'textUnderlineOffset'
|
|
79
|
-
| 'textUnderlinePosition'
|
|
80
|
-
| 'textWrap'
|
|
81
|
-
| 'textWrapMode'
|
|
82
|
-
| 'textWrapStyle'
|
|
83
|
-
| 'unicodeBidi'
|
|
84
|
-
| 'verticalAlign'
|
|
85
|
-
| 'whiteSpace'
|
|
86
|
-
| 'wordBreak'
|
|
87
|
-
| 'wordSpacing'
|
|
88
|
-
| 'writingMode'
|
|
89
|
-
|
|
90
|
-
export type TextStyle = CompositionStyleObject<TextStyleProperty>
|
|
91
|
-
|
|
92
|
-
export type TextStyles = Recursive<Token<TextStyle>>
|
|
93
|
-
|
|
94
|
-
/* -----------------------------------------------------------------------------
|
|
95
|
-
* Layer styles
|
|
96
|
-
* -----------------------------------------------------------------------------*/
|
|
97
|
-
|
|
98
|
-
type LogicalPlacement = 'Inline' | 'Block' | 'InlineStart' | 'InlineEnd' | 'BlockStart' | 'BlockEnd'
|
|
99
|
-
|
|
100
|
-
type PhysicalPlacement = 'Top' | 'Right' | 'Bottom' | 'Left'
|
|
101
|
-
|
|
102
|
-
type Placement = PhysicalPlacement | LogicalPlacement
|
|
103
|
-
|
|
104
|
-
type Radius =
|
|
105
|
-
| `Top${'Right' | 'Left'}`
|
|
106
|
-
| `Bottom${'Right' | 'Left'}`
|
|
107
|
-
| `Start${'Start' | 'End'}`
|
|
108
|
-
| `End${'Start' | 'End'}`
|
|
109
|
-
|
|
110
|
-
type LayerStyleProperty =
|
|
111
|
-
| 'aspectRatio'
|
|
112
|
-
| 'background'
|
|
113
|
-
| 'backgroundColor'
|
|
114
|
-
| 'backgroundImage'
|
|
115
|
-
| 'border'
|
|
116
|
-
| 'borderColor'
|
|
117
|
-
| 'borderImage'
|
|
118
|
-
| 'borderImageOutset'
|
|
119
|
-
| 'borderImageRepeat'
|
|
120
|
-
| 'borderImageSlice'
|
|
121
|
-
| 'borderImageSource'
|
|
122
|
-
| 'borderImageWidth'
|
|
123
|
-
| 'borderRadius'
|
|
124
|
-
| 'borderStyle'
|
|
125
|
-
| 'borderWidth'
|
|
126
|
-
| `border${Placement}`
|
|
127
|
-
| `border${Placement}Color`
|
|
128
|
-
| `border${Placement}Style`
|
|
129
|
-
| `border${Placement}Width`
|
|
130
|
-
| 'borderRadius'
|
|
131
|
-
| `border${Radius}Radius`
|
|
132
|
-
| 'boxShadow'
|
|
133
|
-
| 'boxShadowColor'
|
|
134
|
-
| 'clipPath'
|
|
135
|
-
| 'color'
|
|
136
|
-
| 'contain'
|
|
137
|
-
| 'content'
|
|
138
|
-
| 'contentVisibility'
|
|
139
|
-
| 'cursor'
|
|
140
|
-
| 'display'
|
|
141
|
-
| 'filter'
|
|
142
|
-
| 'backdropFilter'
|
|
143
|
-
| 'height'
|
|
144
|
-
| 'width'
|
|
145
|
-
| 'minHeight'
|
|
146
|
-
| 'minWidth'
|
|
147
|
-
| 'maxHeight'
|
|
148
|
-
| 'maxWidth'
|
|
149
|
-
| `margin${Placement}`
|
|
150
|
-
| 'inset'
|
|
151
|
-
| `inset${LogicalPlacement}`
|
|
152
|
-
| Lowercase<PhysicalPlacement>
|
|
153
|
-
| 'isolation'
|
|
154
|
-
| 'mask'
|
|
155
|
-
| 'maskClip'
|
|
156
|
-
| 'maskComposite'
|
|
157
|
-
| 'maskImage'
|
|
158
|
-
| 'maskMode'
|
|
159
|
-
| 'maskOrigin'
|
|
160
|
-
| 'maskPosition'
|
|
161
|
-
| 'maskRepeat'
|
|
162
|
-
| 'maskSize'
|
|
163
|
-
| 'mixBlendMode'
|
|
164
|
-
| 'objectFit'
|
|
165
|
-
| 'objectPosition'
|
|
166
|
-
| 'opacity'
|
|
167
|
-
| 'outline'
|
|
168
|
-
| 'outlineColor'
|
|
169
|
-
| 'outlineOffset'
|
|
170
|
-
| 'outlineStyle'
|
|
171
|
-
| 'outlineWidth'
|
|
172
|
-
| 'overflow'
|
|
173
|
-
| 'overflowX'
|
|
174
|
-
| 'overflowY'
|
|
175
|
-
| 'padding'
|
|
176
|
-
| `padding${Placement}`
|
|
177
|
-
| 'pointerEvents'
|
|
178
|
-
| 'position'
|
|
179
|
-
| 'resize'
|
|
180
|
-
| 'transform'
|
|
181
|
-
| 'transition'
|
|
182
|
-
| 'visibility'
|
|
183
|
-
| 'willChange'
|
|
184
|
-
| 'zIndex'
|
|
185
|
-
| 'backgroundBlendMode'
|
|
186
|
-
| 'backgroundAttachment'
|
|
187
|
-
| 'backgroundClip'
|
|
188
|
-
| 'backgroundOrigin'
|
|
189
|
-
| 'backgroundPosition'
|
|
190
|
-
| 'backgroundRepeat'
|
|
191
|
-
| 'backgroundSize'
|
|
192
|
-
|
|
193
|
-
export type LayerStyle = CompositionStyleObject<LayerStyleProperty>
|
|
194
|
-
|
|
195
|
-
export type LayerStyles = Recursive<Token<LayerStyle>>
|
|
196
|
-
|
|
197
|
-
/* -----------------------------------------------------------------------------
|
|
198
|
-
* Motion styles
|
|
199
|
-
* -----------------------------------------------------------------------------*/
|
|
200
|
-
|
|
201
|
-
type AnimationStyleProperty =
|
|
202
|
-
| 'animation'
|
|
203
|
-
| 'animationComposition'
|
|
204
|
-
| 'animationDelay'
|
|
205
|
-
| 'animationDirection'
|
|
206
|
-
| 'animationDuration'
|
|
207
|
-
| 'animationFillMode'
|
|
208
|
-
| 'animationIterationCount'
|
|
209
|
-
| 'animationName'
|
|
210
|
-
| 'animationPlayState'
|
|
211
|
-
| 'animationTimingFunction'
|
|
212
|
-
| 'animationRange'
|
|
213
|
-
| 'animationRangeStart'
|
|
214
|
-
| 'animationRangeEnd'
|
|
215
|
-
| 'animationTimeline'
|
|
216
|
-
| 'transformOrigin'
|
|
217
|
-
|
|
218
|
-
export type AnimationStyle = CompositionStyleObject<AnimationStyleProperty>
|
|
219
|
-
|
|
220
|
-
export type AnimationStyles = Recursive<Token<AnimationStyle>>
|
|
17
|
+
/**
|
|
18
|
+
* A named bundle of declarations, applied by name through the `mixin` style property.
|
|
19
|
+
*
|
|
20
|
+
* This was three theme keys — `textStyles`, `layerStyles` and `animationStyles` — with three
|
|
21
|
+
* `define*` helpers, three spec artifacts and three style properties, all running through the
|
|
22
|
+
* same registration and differing only in which css properties the value was allowed to set.
|
|
23
|
+
*
|
|
24
|
+
* That partition was not a guard worth three concepts. It was arbitrary at the edges (`color`
|
|
25
|
+
* was legal in both a text style and a layer style, `transform` in a layer style but
|
|
26
|
+
* `transformOrigin` only in an animation style), and it cost something real in the middle: a
|
|
27
|
+
* bundle wanting a font *and* a border had to be split across two keys and applied twice,
|
|
28
|
+
* because neither key would accept the other's half.
|
|
29
|
+
*
|
|
30
|
+
* What the three allowlists did buy was rejecting a property that does not exist, and that is
|
|
31
|
+
* kept here rather than thrown away with them — which is why this is not simply
|
|
32
|
+
* `SystemStyleObject`. That type unions in an index signature so a style object can carry an
|
|
33
|
+
* arbitrary selector or at-rule, and an index signature accepts anything, including a typo.
|
|
34
|
+
* `TextStyleProperty` once listed `hypens` instead of `hyphens` and nothing could notice; under
|
|
35
|
+
* an index signature nothing would notice again. Conditions and nested selectors still work,
|
|
36
|
+
* because `Nested` supplies those keys itself.
|
|
37
|
+
*/
|
|
38
|
+
export type Mixin = Nested<SystemProperties & CssVarProperties>
|
|
39
|
+
|
|
40
|
+
export type Mixins = Recursive<Token<Mixin>>
|
|
221
41
|
|
|
222
42
|
export interface CompositionStyles {
|
|
223
|
-
|
|
224
|
-
layerStyles: LayerStyles
|
|
225
|
-
animationStyles: AnimationStyles
|
|
43
|
+
mixins: Mixins
|
|
226
44
|
}
|
package/dist/conditions.d.ts
CHANGED
package/dist/config.d.ts
CHANGED
|
@@ -24,24 +24,50 @@ export interface Patterns {
|
|
|
24
24
|
[pattern: string]: PatternConfig
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Everything emitted at the document level rather than against a class.
|
|
29
|
+
*
|
|
30
|
+
* These were four top-level keys — `globalCss`, `globalFontface`, `globalPositionTry` and
|
|
31
|
+
* `globalVars`. Grouping them is not only tidier: `globalVars` was the one of the four that
|
|
32
|
+
* `PresetCore` never listed, so it kept its `extend` wrapper in the *resolved* config while
|
|
33
|
+
* its three siblings lost theirs. One key cannot disagree with itself that way.
|
|
34
|
+
*/
|
|
35
|
+
export interface GlobalCore {
|
|
33
36
|
/**
|
|
34
37
|
* The global styles for your project.
|
|
35
38
|
*/
|
|
36
|
-
|
|
39
|
+
css: GlobalStyleObject
|
|
37
40
|
/**
|
|
38
41
|
* The global fontface for your project.
|
|
39
42
|
*/
|
|
40
|
-
|
|
43
|
+
fontface?: GlobalFontface
|
|
41
44
|
/**
|
|
42
45
|
* The global custom position try fallback option
|
|
43
46
|
*/
|
|
44
|
-
|
|
47
|
+
positionTry?: GlobalPositionTry
|
|
48
|
+
/**
|
|
49
|
+
* The css variables for your project.
|
|
50
|
+
*/
|
|
51
|
+
vars?: GlobalVarsDefinition
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface ExtendableGlobal {
|
|
55
|
+
css?: ExtendableGlobalStyleObject
|
|
56
|
+
fontface?: ExtendableGlobalFontface
|
|
57
|
+
positionTry?: ExtendableGlobalPositionTry
|
|
58
|
+
vars?: ExtendableGlobalVars
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PresetCore {
|
|
62
|
+
/**
|
|
63
|
+
* The css selectors or media queries shortcuts.
|
|
64
|
+
* @example `{ hover: "&:hover" }`
|
|
65
|
+
*/
|
|
66
|
+
conditions: Conditions
|
|
67
|
+
/**
|
|
68
|
+
* Styles, fontfaces, position-try fallbacks and css variables emitted at the document level.
|
|
69
|
+
*/
|
|
70
|
+
global: GlobalCore
|
|
45
71
|
/**
|
|
46
72
|
* Used to generate css utility classes for your project.
|
|
47
73
|
*/
|
|
@@ -58,10 +84,6 @@ export interface PresetCore {
|
|
|
58
84
|
* Common styling or layout patterns for your project.
|
|
59
85
|
*/
|
|
60
86
|
patterns: Record<string, PatternConfig>
|
|
61
|
-
/**
|
|
62
|
-
* Multiple themes for your project.
|
|
63
|
-
*/
|
|
64
|
-
themes?: ThemeVariantsMap
|
|
65
87
|
}
|
|
66
88
|
|
|
67
89
|
interface ExtendablePatterns {
|
|
@@ -125,17 +147,6 @@ interface ExtendableGlobalPositionTry {
|
|
|
125
147
|
extend?: GlobalPositionTry | undefined
|
|
126
148
|
}
|
|
127
149
|
|
|
128
|
-
export interface ThemeVariant extends Pick<Theme, 'tokens' | 'semanticTokens'> {}
|
|
129
|
-
|
|
130
|
-
export interface ThemeVariantsMap {
|
|
131
|
-
[name: string]: ThemeVariant
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
interface ExtendableThemeVariantsMap {
|
|
135
|
-
[name: string]: ThemeVariantsMap | ThemeVariant | undefined
|
|
136
|
-
extend?: ThemeVariantsMap | undefined
|
|
137
|
-
}
|
|
138
|
-
|
|
139
150
|
export interface ExtendableOptions {
|
|
140
151
|
/**
|
|
141
152
|
* The css selectors or media queries shortcuts.
|
|
@@ -143,17 +154,9 @@ export interface ExtendableOptions {
|
|
|
143
154
|
*/
|
|
144
155
|
conditions?: ExtendableConditions
|
|
145
156
|
/**
|
|
146
|
-
*
|
|
157
|
+
* Styles, fontfaces, position-try fallbacks and css variables emitted at the document level.
|
|
147
158
|
*/
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* The global fontface for your project.
|
|
151
|
-
*/
|
|
152
|
-
globalFontface?: ExtendableGlobalFontface
|
|
153
|
-
/**
|
|
154
|
-
* The global custom position try fallback option
|
|
155
|
-
*/
|
|
156
|
-
globalPositionTry?: ExtendableGlobalPositionTry
|
|
159
|
+
global?: ExtendableGlobal
|
|
157
160
|
/**
|
|
158
161
|
* Used to generate css utility classes for your project.
|
|
159
162
|
*/
|
|
@@ -170,14 +173,6 @@ export interface ExtendableOptions {
|
|
|
170
173
|
* Common styling or layout patterns for your project.
|
|
171
174
|
*/
|
|
172
175
|
patterns?: ExtendablePatterns
|
|
173
|
-
/**
|
|
174
|
-
* The css variables for your project.
|
|
175
|
-
*/
|
|
176
|
-
globalVars?: ExtendableGlobalVars
|
|
177
|
-
/**
|
|
178
|
-
* The theme variants for your project.
|
|
179
|
-
*/
|
|
180
|
-
themes?: ExtendableThemeVariantsMap
|
|
181
176
|
}
|
|
182
177
|
|
|
183
178
|
export interface ImportMapInput {
|
|
@@ -257,6 +252,19 @@ interface FileSystemOptions {
|
|
|
257
252
|
* @default 'info'
|
|
258
253
|
*/
|
|
259
254
|
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent'
|
|
255
|
+
/**
|
|
256
|
+
* Show only the log types matching this pattern, at debug level.
|
|
257
|
+
*
|
|
258
|
+
* Log types are namespaced — `vite:transform`, `tokens:unresolved`, `prune:tokens`,
|
|
259
|
+
* `config` — so `'prune:*'` follows one subsystem without raising `logLevel` and
|
|
260
|
+
* un-silencing everything else.
|
|
261
|
+
*
|
|
262
|
+
* The matcher already existed and was reachable only through the `BAMBOO_DEBUG`
|
|
263
|
+
* environment variable, which put it out of reach of a checked-in config.
|
|
264
|
+
*
|
|
265
|
+
* @example 'vite:*, prune:tokens'
|
|
266
|
+
*/
|
|
267
|
+
logFilter?: string
|
|
260
268
|
}
|
|
261
269
|
|
|
262
270
|
interface CssgenOptions {
|
|
@@ -290,121 +298,14 @@ interface CssgenOptions {
|
|
|
290
298
|
*/
|
|
291
299
|
minify?: boolean
|
|
292
300
|
/**
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
* The token layer declares every token in the theme, and an app typically uses a small
|
|
296
|
-
* fraction of them, so this is usually the largest single saving in render-blocking css.
|
|
297
|
-
*
|
|
298
|
-
* The same walk also drops an `@property` registration for a custom property the finished
|
|
299
|
-
* stylesheet neither declares nor reads. A preset registers what its utilities compose —
|
|
300
|
-
* filters, gradients, transforms, transitions — and ships the whole set regardless of what
|
|
301
|
-
* the app draws, so an app using none of them carries all of it for nothing. Registrations
|
|
302
|
-
* declared through `globalVars` are yours and are never removed.
|
|
303
|
-
*
|
|
304
|
-
* It is opt-in because reachability cannot be proven for every reference. `token()`,
|
|
305
|
-
* `token()` and `token.value()` calls are read out of the source, as is any literal
|
|
306
|
-
* `var(--x)` written by hand — and each form is resolved through a constant or a template
|
|
307
|
-
* literal the extractor can follow, not only through a path spelled out at the call. Three
|
|
308
|
-
* things stay invisible: a token named by a path assembled from a value that only exists at
|
|
309
|
-
* runtime, one referenced only from a stylesheet outside `include`, and one used by a
|
|
310
|
-
* separate package consuming the output as design tokens. Use `staticCss` to keep those.
|
|
311
|
-
*
|
|
312
|
-
* Both forms are a risk, which is a change. `token()` used to hand javascript a literal for
|
|
313
|
-
* a plain token, so a path it could not resolve cost nothing; it now returns `var(--x)` for
|
|
314
|
-
* *every* token. Only `token.value()` returns a literal, and only for a token that has one.
|
|
315
|
-
* So a path this pass cannot read is a declaration that has to survive whichever form asked
|
|
316
|
-
* for it.
|
|
317
|
-
*
|
|
318
|
-
* A custom property declared by `globalCss` or `globalVars` is not one of these cases:
|
|
319
|
-
* the declaration ships whether or not anything in the stylesheet reads it, so whatever
|
|
320
|
-
* it references is kept alongside it.
|
|
321
|
-
*
|
|
322
|
-
* The cost of that is bluntness. Because `token()` can name any token, a project that
|
|
323
|
-
* reaches for one from javascript keeps *every* token declaration — on the default preset
|
|
324
|
-
* that is 468 names against the 68 the old, narrower exemption kept, and a token layer of
|
|
325
|
-
* 442 declarations rather than 2. It used to cover only virtual tokens, tokens carrying a
|
|
326
|
-
* condition, and the positive counterpart each negative token pins through
|
|
327
|
-
* `calc(var(--spacing-4) * -1)`.
|
|
328
|
-
*
|
|
329
|
-
* The exemption is skipped entirely for a project that never reaches for a token from
|
|
330
|
-
* javascript. The tokens artifact is generated into the project rather than installed, so
|
|
331
|
-
* the import is written in your own source and a scan of `include` finds it — a call, or an
|
|
332
|
-
* import of any module the artifact could be. That is the whole saving, and it is
|
|
333
|
-
* all-or-nothing: a project with one caller keeps every declaration.
|
|
334
|
-
*
|
|
335
|
-
* The scan reads `include`, which scopes style extraction rather than everything that may
|
|
336
|
-
* import — so a script, a config, or a sibling workspace package that calls `token()` is
|
|
337
|
-
* not covered, nor is a binding renamed away from `token`, as in `const t = token`. Both
|
|
338
|
-
* are rare and neither reports itself: the declaration goes and the call returns a `var()`
|
|
339
|
-
* nothing declares. Setting this to `false` keeps every declaration if you are in that
|
|
340
|
-
* position.
|
|
341
|
-
*
|
|
342
|
-
* Setting this to `false` keeps every token declaration, but still drops the `@property`
|
|
343
|
-
* registrations. Those are not tokens — nothing hands one to javascript and none appear
|
|
344
|
-
* in the `token()` surface — so the reachability problem above does not apply to them,
|
|
345
|
-
* and opting out of token pruning should not mean shipping a preset's whole filter and
|
|
346
|
-
* gradient set for nothing.
|
|
347
|
-
*
|
|
348
|
-
* @default true
|
|
349
|
-
*/
|
|
350
|
-
pruneUnusedTokens?: boolean | 'strict'
|
|
351
|
-
/**
|
|
352
|
-
* Drop `@keyframes` rules nothing can reach.
|
|
353
|
-
*
|
|
354
|
-
* A preset declares every animation it offers and an app uses a handful, so the rest
|
|
355
|
-
* are dead weight in the stylesheet that blocks first paint. Only keyframes the theme
|
|
356
|
-
* declares are ever removed — one emitted by `globalCss` is left alone.
|
|
357
|
-
*
|
|
358
|
-
* A name is kept when any declaration in the generated css names it, and when it
|
|
359
|
-
* appears anywhere under `include`, which covers an animation assembled at runtime or
|
|
360
|
-
* applied through an inline `style` rather than through bamboo. That textual fallback
|
|
361
|
-
* is deliberately over-inclusive: keeping an unused keyframe costs bytes, dropping a
|
|
362
|
-
* used one breaks the animation.
|
|
363
|
-
*
|
|
364
|
-
* @default true
|
|
365
|
-
*/
|
|
366
|
-
pruneUnusedKeyframes?: boolean
|
|
367
|
-
/**
|
|
368
|
-
* Whether to drop the parts of the reset that style elements your source never renders.
|
|
369
|
-
*
|
|
370
|
-
* Two thirds of the reset is bound to specific elements — 41 of them, covering `table`,
|
|
371
|
-
* `pre`, `kbd`, `optgroup` and the rest of the long tail. The reset is a fixed size, so it
|
|
372
|
-
* dominates a small stylesheet: a third of one sandbox's css here and four fifths of
|
|
373
|
-
* another's, of which 13% and 34% respectively is for elements those projects never render.
|
|
374
|
-
*
|
|
375
|
-
* A selector list loses only the parts naming unrendered elements, so a rule shared between
|
|
376
|
-
* `button` and `::file-selector-button` keeps the half that still applies. `html` and `body`
|
|
377
|
-
* are never removed.
|
|
378
|
-
*
|
|
379
|
-
* Off by default, and it cannot be made safe by default. Unlike the token and keyframe
|
|
380
|
-
* passes there is nothing to prove this against: an element rendered by a dependency's
|
|
381
|
-
* component, by `dangerouslySetInnerHTML`, or by markdown is invisible to a scan of your own
|
|
382
|
-
* source. What you get wrong is an element quietly losing its reset — no error, no warning.
|
|
383
|
-
* Reach for it when you control the markup and have measured that it pays.
|
|
384
|
-
*
|
|
385
|
-
* The blind spot to check first is your own entry template. The scan reads `include`, and
|
|
386
|
-
* `include` conventionally covers components rather than markup — a glob rooted at `./src`
|
|
387
|
-
* does not match `index.html`, so an element appearing only there is dropped. Add the
|
|
388
|
-
* template to `include` to cover it — the scan reads any file listed, not only ones the
|
|
389
|
-
* parser understands, and reads it from disk rather than from the build's parsed copy, so
|
|
390
|
-
* a single-file component's markup survives the transform to tsx.
|
|
391
|
-
*
|
|
392
|
-
* A scoped reset is handled: `preflight: { scope: '.app' }` writes `.app table`, and the
|
|
393
|
-
* scope is stripped before an element is read out. `bamboo cssgen preflight` prunes too.
|
|
394
|
-
*
|
|
395
|
-
* @default false
|
|
301
|
+
* What to drop from the generated stylesheet. See `PruneOptions`.
|
|
396
302
|
*/
|
|
397
|
-
|
|
303
|
+
prune?: PruneOptions
|
|
398
304
|
/**
|
|
399
305
|
* The root selector for the css variables.
|
|
400
306
|
* @default ':where(:root, :host)'
|
|
401
307
|
*/
|
|
402
308
|
cssVarRoot?: string
|
|
403
|
-
/**
|
|
404
|
-
* Whether to use `lightningcss` instead of `postcss` for css optimization.
|
|
405
|
-
* @default false
|
|
406
|
-
*/
|
|
407
|
-
lightningcss?: boolean
|
|
408
309
|
/**
|
|
409
310
|
* Browserslist query to target specific browsers.
|
|
410
311
|
* @see https://www.npmjs.com/package/browserslist
|
|
@@ -434,7 +335,7 @@ interface CodegenOptions {
|
|
|
434
335
|
* This is useful if want to shorten the class names or css variables.
|
|
435
336
|
* @default false
|
|
436
337
|
*/
|
|
437
|
-
hash?: boolean | { cssVar
|
|
338
|
+
hash?: boolean | { cssVar?: boolean; className?: boolean }
|
|
438
339
|
/**
|
|
439
340
|
* Change generated typescript definitions to be more strict for property having a token or utility.
|
|
440
341
|
*/
|
|
@@ -459,8 +360,21 @@ interface CodegenOptions {
|
|
|
459
360
|
*/
|
|
460
361
|
outExtension?: 'mjs' | 'js'
|
|
461
362
|
/**
|
|
462
|
-
*
|
|
463
|
-
*
|
|
363
|
+
* Emit `.d.mts` declarations beside `.mjs`, and import them by their `.mjs` specifier.
|
|
364
|
+
*
|
|
365
|
+
* Off by default, which looks like the wrong default and is not. `moduleResolution:
|
|
366
|
+
* bundler` — Vite, Next, and most of what consumes this — resolves a directory import
|
|
367
|
+
* like `styled-system/css` by probing `index.ts`, `index.tsx`, `index.d.ts`, `index.js`.
|
|
368
|
+
* That list has no `.d.mts` in it, so turning this on makes every such import fail with
|
|
369
|
+
* `TS2307: Cannot find module`. It is for `node16`/`nodenext` consumers, who need the
|
|
370
|
+
* extensions to agree and who import by full specifier anyway.
|
|
371
|
+
*
|
|
372
|
+
* So this is a real fork in resolution behaviour rather than a flag with a correct
|
|
373
|
+
* setting, which is why it survived an attempt to delete it: making it unconditional
|
|
374
|
+
* broke every bundler-mode project in this repo.
|
|
375
|
+
*
|
|
376
|
+
* Only meaningful when `outExtension` is `mjs`.
|
|
377
|
+
*
|
|
464
378
|
* @default false
|
|
465
379
|
*/
|
|
466
380
|
forceConsistentTypeExtension?: boolean
|
|
@@ -468,46 +382,252 @@ interface CodegenOptions {
|
|
|
468
382
|
|
|
469
383
|
interface PresetOptions {
|
|
470
384
|
/**
|
|
471
|
-
*
|
|
385
|
+
* The complete list of presets, in order. Reusable across a project or team.
|
|
386
|
+
*
|
|
387
|
+
* Authoritative: what you write is what is loaded. Import `defaultPresets` to keep the
|
|
388
|
+
* defaults alongside your own.
|
|
389
|
+
*
|
|
390
|
+
* ```ts
|
|
391
|
+
* import { defaultPresets } from '@bamboocss/dev/presets'
|
|
392
|
+
* presets: [...defaultPresets, myPreset]
|
|
393
|
+
* ```
|
|
394
|
+
*
|
|
395
|
+
* Leaving it unset loads `defaultPresets`. Setting it to `[]` loads nothing — which is
|
|
396
|
+
* what the removed `eject: true` meant. Previously neither was true of a config that
|
|
397
|
+
* merely *listed* a preset: doing so kept `@bamboocss/preset-base` and silently dropped
|
|
398
|
+
* `@bamboocss/preset-bamboo`, so `presets` was neither additive nor replacing.
|
|
472
399
|
*/
|
|
473
400
|
presets?: (string | Preset | Promise<Preset>)[]
|
|
474
401
|
}
|
|
475
402
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
403
|
+
/**
|
|
404
|
+
* A named set of hooks.
|
|
405
|
+
*
|
|
406
|
+
* The name is the point. Hooks used to be registrable two ways — here, and as a bare
|
|
407
|
+
* `hooks` key on the config — with the config's own set treated as a nameless plugin
|
|
408
|
+
* appended last. That gave one mechanism two spellings and an ordering rule you had to
|
|
409
|
+
* know, while every diagnostic about a hook had a name to print for one of them and not
|
|
410
|
+
* the other. Your own hooks are now a plugin like any other, so ordering is just the order
|
|
411
|
+
* of this array.
|
|
412
|
+
*/
|
|
413
|
+
export interface BambooPlugin {
|
|
481
414
|
name: string
|
|
415
|
+
hooks?: Partial<BambooHooks>
|
|
482
416
|
}
|
|
483
417
|
|
|
484
418
|
export interface PluginsOptions {
|
|
485
419
|
plugins?: BambooPlugin[]
|
|
486
420
|
}
|
|
487
421
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
*
|
|
499
|
-
*
|
|
422
|
+
/**
|
|
423
|
+
* What to drop from the generated stylesheet, and how to account for it.
|
|
424
|
+
*
|
|
425
|
+
* These were three top-level options — `pruneUnusedTokens`, `pruneUnusedKeyframes` and
|
|
426
|
+
* `prunePreflight` — which disagreed with each other on all three of naming, default and
|
|
427
|
+
* value type. Grouping them is what makes one default reading of "prune" possible.
|
|
428
|
+
*/
|
|
429
|
+
export interface PruneOptions {
|
|
430
|
+
/**
|
|
431
|
+
* How to decide which token css variables to keep.
|
|
432
|
+
*
|
|
433
|
+
* The token layer declares every token in the theme, and an app typically uses a small
|
|
434
|
+
* fraction of them, so this is usually the largest single saving in render-blocking css.
|
|
435
|
+
*
|
|
436
|
+
* - `off` keeps every token declaration.
|
|
437
|
+
* - `reachable` keeps what the generated css reaches. Because `token()` can name any
|
|
438
|
+
* token, a project that calls it from javascript *anywhere* keeps every declaration —
|
|
439
|
+
* on the default preset that is 468 names against the 68 a narrower exemption kept, and
|
|
440
|
+
* a token layer of 442 declarations rather than 2. The exemption is skipped entirely for
|
|
441
|
+
* a project that never reaches for a token from javascript, so the saving is
|
|
442
|
+
* all-or-nothing: one caller keeps every declaration.
|
|
443
|
+
* - `accounted` reads the token paths out of your source and keeps only those. `token()`
|
|
444
|
+
* and `token.value()` calls are resolved through a constant or a template literal the
|
|
445
|
+
* extractor can follow, not only through a path spelled at the call, as is any literal
|
|
446
|
+
* `var(--x)` written by hand.
|
|
447
|
+
*
|
|
448
|
+
* Under `accounted`, a path the build cannot follow makes the keep set fall back to
|
|
449
|
+
* `reachable`'s blanket keep rather than silently dropping a declaration — which is why
|
|
450
|
+
* `unresolvedPath` exists, and why setting it to `error` is what makes `accounted` worth
|
|
451
|
+
* asking for: it guarantees you are shipping the exact set rather than the fallback.
|
|
452
|
+
*
|
|
453
|
+
* A template literal is bounded rather than declined: `` token(`colors.${shade}`) `` cannot
|
|
454
|
+
* say which token it wants, but it says which it *cannot*, so the `colors` category is kept
|
|
455
|
+
* and nothing else. That covers the commonest dynamic read outright. What it does not cover
|
|
456
|
+
* is a path with no static head — `token(key)`, `token('colors.' + shade)` — and there
|
|
457
|
+
* `keepTokens` is the answer.
|
|
458
|
+
*
|
|
459
|
+
* Three things stay invisible to `accounted`: a token named by a path assembled from a
|
|
460
|
+
* value that only exists at runtime, one referenced only from a stylesheet outside
|
|
461
|
+
* `include`, and one used by a separate package consuming the output as design tokens. The
|
|
462
|
+
* scan reads `include`, which scopes style extraction rather than everything that may
|
|
463
|
+
* import — so a script, a config, or a sibling workspace package that calls `token()` is
|
|
464
|
+
* not covered, nor is a binding renamed away from `token`, as in `const t = token`. Name
|
|
465
|
+
* them with `keepTokens`.
|
|
466
|
+
*
|
|
467
|
+
* A custom property declared by `global.css` or `global.vars` is not one of these cases:
|
|
468
|
+
* the declaration ships whether or not anything in the stylesheet reads it, so whatever it
|
|
469
|
+
* references is kept alongside it.
|
|
470
|
+
*
|
|
471
|
+
* @default 'reachable'
|
|
472
|
+
*/
|
|
473
|
+
tokens?: 'off' | 'reachable' | 'accounted'
|
|
474
|
+
/**
|
|
475
|
+
* Token paths to keep whatever the build can see, as exact names or `*` patterns.
|
|
476
|
+
*
|
|
477
|
+
* ```ts
|
|
478
|
+
* prune: { tokens: 'accounted', keepTokens: ['colors.*'] }
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* This is the bound the build could not infer, written by hand. It exists because the
|
|
482
|
+
* fallback is otherwise total: **one** reference the accounting cannot follow keeps every
|
|
483
|
+
* declaration in the project, so a codebase with a single `token(key)` in it gets the same
|
|
484
|
+
* stylesheet as one that never prunes — and the codebases that reach for `token()` most are
|
|
485
|
+
* exactly the ones that end up there. Naming the category those dynamic reads land in is a
|
|
486
|
+
* far smaller answer than keeping everything, and it is the same answer the build already
|
|
487
|
+
* derives for itself from a template literal's static head.
|
|
488
|
+
*
|
|
489
|
+
* So under `accounted` this does two things: it keeps what it matches, and it stands in for
|
|
490
|
+
* what could not be followed, in place of the blanket keep. Saying `keepTokens: ['colors.*']`
|
|
491
|
+
* is saying *the reads you cannot follow land in `colors`* — an assertion about your own
|
|
492
|
+
* code, which is why nothing infers it for you. Declines are still reported, so you can see
|
|
493
|
+
* what you are covering; `unresolvedPath: 'error'` still fails, because asserting every path
|
|
494
|
+
* resolves and declaring a bound for the ones that do not are contradictory requests.
|
|
495
|
+
*
|
|
496
|
+
* Under `reachable` it is additive only, for a token nothing in the stylesheet references
|
|
497
|
+
* and no javascript here reads — one consumed by a sibling package, or by css outside
|
|
498
|
+
* `include`. It is inert under `tokens: 'off'`, which keeps everything already.
|
|
499
|
+
*
|
|
500
|
+
* Patterns match the dotted token *path*, anchored and case-sensitively, with `*` standing
|
|
501
|
+
* for any run of characters and a leading `!` excluding. `colors.*` keeps every colour,
|
|
502
|
+
* `colors.brand.*` one palette, `colors.red.300` one token, `['colors.*', '!colors.legacy.*']`
|
|
503
|
+
* every colour but one palette.
|
|
504
|
+
*
|
|
505
|
+
* The path, not the css variable: a token is `fontSizes.3xl` and its declaration is
|
|
506
|
+
* `--font-sizes-3xl`, so `font-sizes.*` — the natural thing to write after reading
|
|
507
|
+
* `styles.css` — matches nothing at all. A pattern matching no token is reported, and names
|
|
508
|
+
* the spelling that would have worked, because keeping nothing is otherwise silent in a build
|
|
509
|
+
* whose whole job here is dropping things.
|
|
510
|
+
*
|
|
511
|
+
* This replaces `staticCss` as the way to keep a category alive. `staticCss` emits utility
|
|
512
|
+
* *classes* — keeping the colours meant shipping a rule per colour to hold the declarations
|
|
513
|
+
* up, which is a larger stylesheet than the pruning saved.
|
|
514
|
+
*/
|
|
515
|
+
keepTokens?: string[]
|
|
516
|
+
/**
|
|
517
|
+
* What to do about a token path `accounted` cannot follow.
|
|
518
|
+
*
|
|
519
|
+
* A path spelled at the call resolves; one assembled at runtime does not. An unfollowable
|
|
520
|
+
* path is what forces `accounted` back onto the blanket keep — unless `keepTokens` names
|
|
521
|
+
* the bound — so this decides whether that happens quietly, loudly, or not at all.
|
|
522
|
+
*
|
|
523
|
+
* - `off` falls back and says nothing.
|
|
524
|
+
* - `warn` falls back and reports what it could not follow.
|
|
525
|
+
* - `error` fails the build, so the fallback can never ship unnoticed.
|
|
526
|
+
*
|
|
527
|
+
* Inert under `tokens: 'off'` and `tokens: 'reachable'`, which run no accounting pass.
|
|
528
|
+
*
|
|
529
|
+
* `error` and `keepTokens` do not combine: one asserts every path resolves, the other
|
|
530
|
+
* declares where the ones that do not will land. A project that cannot make the first
|
|
531
|
+
* assertion wants `warn`, which still prints every reference being covered.
|
|
532
|
+
*
|
|
533
|
+
* Named for what it checks rather than `strict`, which already means something unrelated
|
|
534
|
+
* here: `strictTokens` and `strictPropertyValues` narrow generated *typescript*, and
|
|
535
|
+
* neither implies nor is implied by this.
|
|
536
|
+
*
|
|
537
|
+
* @default 'warn'
|
|
538
|
+
*/
|
|
539
|
+
unresolvedPath?: 'off' | 'warn' | 'error'
|
|
540
|
+
/**
|
|
541
|
+
* Drop an `@property` registration the finished stylesheet neither declares nor reads.
|
|
542
|
+
*
|
|
543
|
+
* A preset registers what its utilities compose — filters, gradients, transforms,
|
|
544
|
+
* transitions — and ships the whole set regardless of what the app draws, so an app using
|
|
545
|
+
* none of them carries all of it for nothing.
|
|
546
|
+
*
|
|
547
|
+
* Its own flag rather than a side effect of `tokens`, which is what it used to be: the
|
|
548
|
+
* registrations were dropped even under the old `tokens: false`, so an option documented
|
|
549
|
+
* as keeping every token declaration quietly removed something else. These are not tokens
|
|
550
|
+
* — nothing hands one to javascript and none appear in the `token()` surface — so the
|
|
551
|
+
* reachability problem that makes `tokens` cautious does not apply to them.
|
|
552
|
+
*
|
|
553
|
+
* Registrations declared through `global.vars` are yours and are never removed.
|
|
554
|
+
*
|
|
555
|
+
* @default true
|
|
500
556
|
*/
|
|
501
|
-
|
|
557
|
+
propertyRegistrations?: boolean
|
|
502
558
|
/**
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
559
|
+
* Drop `@keyframes` rules nothing can reach.
|
|
560
|
+
*
|
|
561
|
+
* A preset declares every animation it offers and an app uses a handful, so the rest
|
|
562
|
+
* are dead weight in the stylesheet that blocks first paint. Only keyframes the theme
|
|
563
|
+
* declares are ever removed — one emitted by `global.css` is left alone.
|
|
564
|
+
*
|
|
565
|
+
* A name is kept when any declaration in the generated css names it, and when it
|
|
566
|
+
* appears anywhere under `include`, which covers an animation assembled at runtime or
|
|
567
|
+
* applied through an inline `style` rather than through bamboo. That textual fallback
|
|
568
|
+
* is deliberately over-inclusive: keeping an unused keyframe costs bytes, dropping a
|
|
569
|
+
* used one breaks the animation.
|
|
570
|
+
*
|
|
571
|
+
* @default true
|
|
572
|
+
*/
|
|
573
|
+
keyframes?: boolean
|
|
574
|
+
/**
|
|
575
|
+
* Whether to drop the parts of the reset that style elements your source never renders.
|
|
576
|
+
*
|
|
577
|
+
* Two thirds of the reset is bound to specific elements — 41 of them, covering `table`,
|
|
578
|
+
* `pre`, `kbd`, `optgroup` and the rest of the long tail. The reset is a fixed size, so it
|
|
579
|
+
* dominates a small stylesheet: a third of one sandbox's css here and four fifths of
|
|
580
|
+
* another's, of which 13% and 34% respectively is for elements those projects never render.
|
|
581
|
+
*
|
|
582
|
+
* A selector list loses only the parts naming unrendered elements, so a rule shared between
|
|
583
|
+
* `button` and `::file-selector-button` keeps the half that still applies. `html` and `body`
|
|
584
|
+
* are never removed.
|
|
585
|
+
*
|
|
586
|
+
* Off by default, and it cannot be made safe by default. Unlike the token and keyframe
|
|
587
|
+
* passes there is nothing to prove this against: an element rendered by a dependency's
|
|
588
|
+
* component, by `dangerouslySetInnerHTML`, or by markdown is invisible to a scan of your own
|
|
589
|
+
* source. What you get wrong is an element quietly losing its reset — no error, no warning.
|
|
590
|
+
* Reach for it when you control the markup and have measured that it pays.
|
|
591
|
+
*
|
|
592
|
+
* The blind spot to check first is your own entry template. The scan reads `include`, and
|
|
593
|
+
* `include` conventionally covers components rather than markup — a glob rooted at `./src`
|
|
594
|
+
* does not match `index.html`, so an element appearing only there is dropped. Add the
|
|
595
|
+
* template to `include` to cover it — the scan reads any file listed, not only ones the
|
|
596
|
+
* parser understands, and reads it from disk rather than from the build's parsed copy, so
|
|
597
|
+
* a single-file component's markup survives the transform to tsx.
|
|
598
|
+
*
|
|
599
|
+
* A scoped reset is handled: `preflight: { scope: '.app' }` writes `.app table`, and the
|
|
600
|
+
* scope is stripped before an element is read out. `bamboo cssgen preflight` prunes too.
|
|
601
|
+
*
|
|
602
|
+
* @default false
|
|
603
|
+
*/
|
|
604
|
+
preflight?: boolean
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export interface Config
|
|
608
|
+
extends ExtendableOptions, CssgenOptions, CodegenOptions, FileSystemOptions, PresetOptions, PluginsOptions {
|
|
609
|
+
/**
|
|
610
|
+
* What to do when the config does not validate.
|
|
611
|
+
*
|
|
612
|
+
* - `off` performs no validation.
|
|
613
|
+
* - `warn` logs what failed.
|
|
614
|
+
* - `error` throws.
|
|
615
|
+
*
|
|
616
|
+
* This grades opinions about a config that still builds. Two checks are not that, run
|
|
617
|
+
* ahead of it, and answer to nothing here: a retired token spelling, which is output that
|
|
618
|
+
* is already broken; and an option that has been removed, which is proof the config
|
|
619
|
+
* predates the version reading it. Both throw at any setting, including `off`.
|
|
620
|
+
*
|
|
621
|
+
* A removed option throws rather than warns because a warning is not a signal anything
|
|
622
|
+
* acts on. Removals ship in minor versions, so a warning is what an automated dependency
|
|
623
|
+
* upgrade merges without a person reading it — while the option itself is silent in every
|
|
624
|
+
* other way, reverting to the default and taking the assertion it asked for with it. An
|
|
625
|
+
* unknown key is a different case and still tolerated: it may be forward-compatible, a
|
|
626
|
+
* setting for a version not installed yet. A *removed* key can only be backward.
|
|
507
627
|
*
|
|
508
628
|
* @default 'warn'
|
|
509
629
|
*/
|
|
510
|
-
validation?: '
|
|
630
|
+
validation?: 'off' | 'warn' | 'error'
|
|
511
631
|
}
|
|
512
632
|
|
|
513
633
|
export interface Preset extends ExtendableOptions, PresetOptions {
|
|
@@ -556,8 +676,10 @@ export interface PrefixOptions {
|
|
|
556
676
|
type ReqConf = Required<UserConfig>
|
|
557
677
|
|
|
558
678
|
export type ConfigPath = Exclude<
|
|
559
|
-
| Exclude<NonNullable<Keys<ReqConf>>, 'theme'>
|
|
679
|
+
| Exclude<NonNullable<Keys<ReqConf>>, 'theme' | 'global' | 'prune'>
|
|
560
680
|
| PathIn<ReqConf, 'theme'>
|
|
681
|
+
| PathIn<ReqConf, 'global'>
|
|
682
|
+
| PathIn<ReqConf, 'prune'>
|
|
561
683
|
| PathIn<ReqConf, 'patterns'>
|
|
562
684
|
| PathIn<ReqConf, 'staticCss'>
|
|
563
685
|
| (string & {}),
|
package/dist/index.d.ts
CHANGED
package/dist/logger.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export interface LogEntry {
|
|
|
8
8
|
|
|
9
9
|
export interface LoggerInterface {
|
|
10
10
|
level: 'debug' | 'info' | 'warn' | 'error' | 'silent'
|
|
11
|
+
/**
|
|
12
|
+
* Comma-separated globs over the namespaced log type. Non-empty shows only matching types,
|
|
13
|
+
* at debug level, whatever `level` is set to.
|
|
14
|
+
*/
|
|
15
|
+
filter: string
|
|
11
16
|
print(data: any): void
|
|
12
17
|
onLog?: (entry: LogEntry) => void
|
|
13
18
|
warn: (type: string, data: any) => void
|
package/dist/pattern.d.ts
CHANGED
|
@@ -12,6 +12,14 @@ export type PatternProperty =
|
|
|
12
12
|
|
|
13
13
|
export interface PatternHelpers {
|
|
14
14
|
map: (value: any, fn: (value: string) => string | undefined) => any
|
|
15
|
+
/**
|
|
16
|
+
* The css variable reference for a token path, or `fallback` when the path names no token.
|
|
17
|
+
*
|
|
18
|
+
* `token('spacing.4', '4')` is `var(--spacing-4)` where that token exists and `'4'` where it
|
|
19
|
+
* does not — so a pattern can accept either a token name or a raw css value without knowing
|
|
20
|
+
* the theme.
|
|
21
|
+
*/
|
|
22
|
+
token: (path: string, fallback?: string) => string | undefined
|
|
15
23
|
isCssUnit: (value: any) => boolean
|
|
16
24
|
isCssVar: (value: any) => boolean
|
|
17
25
|
isCssFunction: (value: any) => boolean
|
|
@@ -49,13 +57,21 @@ export interface PatternConfig<T extends PatternProperties = PatternProperties>
|
|
|
49
57
|
*/
|
|
50
58
|
deprecated?: boolean | string
|
|
51
59
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
*
|
|
60
|
+
* Which css properties this pattern accepts alongside its own `properties`.
|
|
61
|
+
*
|
|
62
|
+
* - `all` accepts any css property.
|
|
63
|
+
* - `none` accepts only the pattern's declared `properties`.
|
|
64
|
+
* - `{ except }` accepts any css property but the ones listed.
|
|
65
|
+
*
|
|
66
|
+
* One option because these were two — `strict: true` for "none" and an `@experimental`
|
|
67
|
+
* `blocklist` for "all but these" — and the pair had an unrepresentable combination that
|
|
68
|
+
* silently did nothing: the blocklist is applied only to the type that lists css
|
|
69
|
+
* properties, which `strict: true` does not emit, so setting both dropped the blocklist.
|
|
70
|
+
*
|
|
71
|
+
* Types only. Nothing strips a blocked property at runtime — one passed anyway reaches
|
|
72
|
+
* `transform` and emits css.
|
|
73
|
+
*
|
|
74
|
+
* @default 'all'
|
|
59
75
|
*/
|
|
60
|
-
|
|
76
|
+
cssProps?: 'all' | 'none' | { except: LiteralUnion<CssProperty>[] }
|
|
61
77
|
}
|
package/dist/recipe.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ type RecipeVariantMap<T extends RecipeVariantRecord> = {
|
|
|
38
38
|
|
|
39
39
|
export interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVariantFn<T> {
|
|
40
40
|
__type: RecipeSelection<T>
|
|
41
|
-
|
|
41
|
+
/** Each variant and the values it accepts. `Object.keys` it for the variant names. */
|
|
42
42
|
variantMap: RecipeVariantMap<T>
|
|
43
43
|
raw: (props?: RecipeSelection<T>) => SystemStyleObject
|
|
44
44
|
config: RecipeConfig<T>
|
|
@@ -138,7 +138,7 @@ export interface SlotRecipeRuntimeFn<
|
|
|
138
138
|
T extends SlotRecipeVariantRecord<S>,
|
|
139
139
|
> extends SlotRecipeVariantFn<S, T> {
|
|
140
140
|
raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>
|
|
141
|
-
|
|
141
|
+
/** Each variant and the values it accepts. `Object.keys` it for the variant names. */
|
|
142
142
|
variantMap: RecipeVariantMap<T>
|
|
143
143
|
/** The config this recipe was created from. */
|
|
144
144
|
config: SlotRecipeDefinition<S, T>
|
package/dist/spec.d.ts
CHANGED
|
@@ -5,9 +5,7 @@ export type SpecType =
|
|
|
5
5
|
| 'conditions'
|
|
6
6
|
| 'keyframes'
|
|
7
7
|
| 'semantic-tokens'
|
|
8
|
-
| '
|
|
9
|
-
| 'layer-styles'
|
|
10
|
-
| 'animation-styles'
|
|
8
|
+
| 'mixins'
|
|
11
9
|
| 'color-palette'
|
|
12
10
|
| 'themes'
|
|
13
11
|
|
|
@@ -103,34 +101,14 @@ export interface KeyframeSpec {
|
|
|
103
101
|
data: KeyframeSpecDefinition[]
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
export interface
|
|
104
|
+
export interface MixinSpecDefinition extends Examples {
|
|
107
105
|
name: string
|
|
108
106
|
description?: string
|
|
109
107
|
}
|
|
110
108
|
|
|
111
|
-
export interface
|
|
112
|
-
type: '
|
|
113
|
-
data:
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface LayerStyleSpecDefinition extends Examples {
|
|
117
|
-
name: string
|
|
118
|
-
description?: string
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface LayerStyleSpec {
|
|
122
|
-
type: 'layer-styles'
|
|
123
|
-
data: LayerStyleSpecDefinition[]
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface AnimationStyleSpecDefinition extends Examples {
|
|
127
|
-
name: string
|
|
128
|
-
description?: string
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface AnimationStyleSpec {
|
|
132
|
-
type: 'animation-styles'
|
|
133
|
-
data: AnimationStyleSpecDefinition[]
|
|
109
|
+
export interface MixinSpec {
|
|
110
|
+
type: 'mixins'
|
|
111
|
+
data: MixinSpecDefinition[]
|
|
134
112
|
}
|
|
135
113
|
|
|
136
114
|
export interface ColorPaletteSpec {
|
|
@@ -173,9 +151,7 @@ export type SpecFile =
|
|
|
173
151
|
| PatternSpec
|
|
174
152
|
| ConditionSpec
|
|
175
153
|
| KeyframeSpec
|
|
176
|
-
|
|
|
177
|
-
| LayerStyleSpec
|
|
178
|
-
| AnimationStyleSpec
|
|
154
|
+
| MixinSpec
|
|
179
155
|
| ColorPaletteSpec
|
|
180
156
|
| ThemesSpec
|
|
181
157
|
|
|
@@ -186,9 +162,7 @@ export interface SpecTypeMap {
|
|
|
186
162
|
patterns: PatternSpec
|
|
187
163
|
conditions: ConditionSpec
|
|
188
164
|
keyframes: KeyframeSpec
|
|
189
|
-
|
|
190
|
-
'layer-styles': LayerStyleSpec
|
|
191
|
-
'animation-styles': AnimationStyleSpec
|
|
165
|
+
mixins: MixinSpec
|
|
192
166
|
'color-palette': ColorPaletteSpec
|
|
193
167
|
themes: ThemesSpec
|
|
194
168
|
}
|
package/dist/style-props.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConditionalValue } from './conditions'
|
|
2
|
-
import type {
|
|
2
|
+
import type { Properties } from './csstype'
|
|
3
3
|
import type { PropertyValue } from './prop-type'
|
|
4
4
|
|
|
5
5
|
type String = string & {}
|
|
@@ -9,7 +9,7 @@ type Number = number & {}
|
|
|
9
9
|
* Shadowed export (in CLI): DO NOT REMOVE
|
|
10
10
|
* -----------------------------------------------------------------------------*/
|
|
11
11
|
|
|
12
|
-
type CssProperties =
|
|
12
|
+
type CssProperties = Properties<String | Number>
|
|
13
13
|
|
|
14
14
|
export type CssVarProperties = {
|
|
15
15
|
[key in `--${string}`]?: ConditionalValue<string | number>
|
package/dist/system-types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConditionalValue, Nested } from './conditions'
|
|
2
|
-
import type { AtRule, Globals,
|
|
2
|
+
import type { AtRule, Globals, Properties } from './csstype'
|
|
3
3
|
import type { SystemProperties, CssVarProperties } from './style-props'
|
|
4
4
|
|
|
5
5
|
type String = string & {}
|
|
@@ -63,9 +63,9 @@ export interface ModernCssProperties {
|
|
|
63
63
|
| String
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export type CssProperty = keyof
|
|
66
|
+
export type CssProperty = keyof Properties
|
|
67
67
|
|
|
68
|
-
export interface CssProperties extends
|
|
68
|
+
export interface CssProperties extends Properties<String | Number>, CssVarProperties, ModernCssProperties {}
|
|
69
69
|
|
|
70
70
|
export interface CssKeyframes {
|
|
71
71
|
[name: string]: {
|
package/dist/theme.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Mixins } from './composition'
|
|
2
2
|
import type { RecipeConfig, SlotRecipeConfig } from './recipe'
|
|
3
3
|
import type { CssKeyframes } from './system-types'
|
|
4
4
|
import type { SemanticTokens, Tokens } from './tokens'
|
|
@@ -39,17 +39,9 @@ export interface Theme {
|
|
|
39
39
|
*/
|
|
40
40
|
semanticTokens?: SemanticTokens
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Named bundles of declarations, applied by name through the `mixin` style property.
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The layer styles for your project.
|
|
47
|
-
*/
|
|
48
|
-
layerStyles?: LayerStyles
|
|
49
|
-
/**
|
|
50
|
-
* The animation styles for your project.
|
|
51
|
-
*/
|
|
52
|
-
animationStyles?: AnimationStyles
|
|
44
|
+
mixins?: Mixins
|
|
53
45
|
/**
|
|
54
46
|
* Multi-variant style definitions for your project.
|
|
55
47
|
* Useful for defining component styles.
|
|
@@ -71,9 +63,28 @@ export interface Theme {
|
|
|
71
63
|
* The color palette configuration for your project.
|
|
72
64
|
*/
|
|
73
65
|
colorPalette?: ColorPaletteOptions
|
|
66
|
+
/**
|
|
67
|
+
* Alternate token sets, selectable at runtime.
|
|
68
|
+
*
|
|
69
|
+
* Was a top-level `themes`, one character from `theme` and impossible for TypeScript to
|
|
70
|
+
* tell apart — both spellings were valid keys, so the typo resolved to a different
|
|
71
|
+
* feature rather than to an error. A variant is part of the theme, so it lives in it.
|
|
72
|
+
*/
|
|
73
|
+
variants?: ThemeVariantsMap
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
interface
|
|
76
|
+
export interface ThemeVariant extends Pick<Theme, 'tokens' | 'semanticTokens'> {}
|
|
77
|
+
|
|
78
|
+
export interface ThemeVariantsMap {
|
|
79
|
+
[name: string]: ThemeVariant
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface ExtendableThemeVariantsMap {
|
|
83
|
+
[name: string]: ThemeVariantsMap | ThemeVariant | undefined
|
|
84
|
+
extend?: ThemeVariantsMap | undefined
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface PartialTheme extends Omit<Theme, 'recipes' | 'slotRecipes' | 'variants'> {
|
|
77
88
|
/**
|
|
78
89
|
* Multi-variant style definitions for your project.
|
|
79
90
|
* Useful for defining component styles.
|
|
@@ -87,8 +98,13 @@ interface PartialTheme extends Omit<Theme, 'recipes' | 'slotRecipes'> {
|
|
|
87
98
|
* The color palette configuration for your project.
|
|
88
99
|
*/
|
|
89
100
|
colorPalette?: Partial<ColorPaletteOptions>
|
|
101
|
+
/**
|
|
102
|
+
* Alternate token sets, selectable at runtime.
|
|
103
|
+
*/
|
|
104
|
+
variants?: ExtendableThemeVariantsMap
|
|
90
105
|
}
|
|
91
106
|
|
|
92
|
-
export interface ExtendableTheme extends Theme {
|
|
107
|
+
export interface ExtendableTheme extends Omit<Theme, 'variants'> {
|
|
108
|
+
variants?: ExtendableThemeVariantsMap
|
|
93
109
|
extend?: PartialTheme | undefined
|
|
94
110
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.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.32.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsx scripts/watch.ts",
|