@bamboocss/types 1.31.0 → 1.33.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 +135 -54
- package/dist/index.d.ts +0 -1
- 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 +3 -11
- 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
|
-
| 'hyphens'
|
|
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
|
@@ -267,12 +267,65 @@ interface FileSystemOptions {
|
|
|
267
267
|
logFilter?: string
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
+
export interface PreflightOptions {
|
|
271
|
+
/**
|
|
272
|
+
* A selector the reset is confined to, so it does not style the whole document.
|
|
273
|
+
*/
|
|
274
|
+
scope?: string
|
|
275
|
+
/**
|
|
276
|
+
* Where the scope is written. `parent` gives `.app table`, `element` gives `table.app`.
|
|
277
|
+
* @default 'parent'
|
|
278
|
+
*/
|
|
279
|
+
level?: 'element' | 'parent'
|
|
280
|
+
/**
|
|
281
|
+
* Whether to drop the parts of the reset that style elements your source never renders.
|
|
282
|
+
*
|
|
283
|
+
* Two thirds of the reset is bound to specific elements — 41 of them, covering `table`,
|
|
284
|
+
* `pre`, `kbd`, `optgroup` and the rest of the long tail. The reset is a fixed size, so it
|
|
285
|
+
* dominates a small stylesheet: a third of one sandbox's css here and four fifths of
|
|
286
|
+
* another's, of which 13% and 34% respectively is for elements those projects never render.
|
|
287
|
+
*
|
|
288
|
+
* A selector list loses only the parts naming unrendered elements, so a rule shared between
|
|
289
|
+
* `button` and `::file-selector-button` keeps the half that still applies. `html` and `body`
|
|
290
|
+
* are never removed.
|
|
291
|
+
*
|
|
292
|
+
* Off by default, and it cannot be made safe by default. Unlike the token and keyframe
|
|
293
|
+
* passes there is nothing to prove this against: an element rendered by a dependency's
|
|
294
|
+
* component, by `dangerouslySetInnerHTML`, or by markdown is invisible to a scan of your own
|
|
295
|
+
* source. What you get wrong is an element quietly losing its reset — no error, no warning.
|
|
296
|
+
* Reach for it when you control the markup and have measured that it pays.
|
|
297
|
+
*
|
|
298
|
+
* The blind spot to check first is your own entry template. The scan reads `include`, and
|
|
299
|
+
* `include` conventionally covers components rather than markup — a glob rooted at `./src`
|
|
300
|
+
* does not match `index.html`, so an element appearing only there is dropped. Add the
|
|
301
|
+
* template to `include` to cover it — the scan reads any file listed, not only ones the
|
|
302
|
+
* parser understands, and reads it from disk rather than from the build's parsed copy, so
|
|
303
|
+
* a single-file component's markup survives the transform to tsx.
|
|
304
|
+
*
|
|
305
|
+
* A scoped reset is handled: `preflight: { scope: '.app', prune: true }` writes `.app table`,
|
|
306
|
+
* and the scope is stripped before an element is read out. `bamboo cssgen preflight` prunes
|
|
307
|
+
* too.
|
|
308
|
+
*
|
|
309
|
+
* @default false
|
|
310
|
+
*/
|
|
311
|
+
prune?: boolean
|
|
312
|
+
}
|
|
313
|
+
|
|
270
314
|
interface CssgenOptions {
|
|
271
315
|
/**
|
|
272
|
-
* Whether to include css reset styles in the generated css.
|
|
316
|
+
* Whether to include css reset styles in the generated css, and how.
|
|
317
|
+
*
|
|
318
|
+
* `true` is shorthand for `{}` — on, with the defaults. `false` is the only form that means
|
|
319
|
+
* off, so it has no object spelling.
|
|
320
|
+
*
|
|
321
|
+
* `prune` used to be `prune.preflight`, a second key of the same name one level away, so a
|
|
322
|
+
* config could ask for a reset in one place and reshape it in another. It lives here because
|
|
323
|
+
* everything it needs is here: pruning a scoped reset means stripping `scope` before an
|
|
324
|
+
* element can be read out of a selector.
|
|
325
|
+
*
|
|
273
326
|
* @default false
|
|
274
327
|
*/
|
|
275
|
-
preflight?: boolean |
|
|
328
|
+
preflight?: boolean | PreflightOptions
|
|
276
329
|
/**
|
|
277
330
|
* The namespace prefix for the generated css classes and css variables.
|
|
278
331
|
* @default ''
|
|
@@ -400,12 +453,19 @@ interface PresetOptions {
|
|
|
400
453
|
presets?: (string | Preset | Promise<Preset>)[]
|
|
401
454
|
}
|
|
402
455
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
456
|
+
/**
|
|
457
|
+
* A named set of hooks.
|
|
458
|
+
*
|
|
459
|
+
* The name is the point. Hooks used to be registrable two ways — here, and as a bare
|
|
460
|
+
* `hooks` key on the config — with the config's own set treated as a nameless plugin
|
|
461
|
+
* appended last. That gave one mechanism two spellings and an ordering rule you had to
|
|
462
|
+
* know, while every diagnostic about a hook had a name to print for one of them and not
|
|
463
|
+
* the other. Your own hooks are now a plugin like any other, so ordering is just the order
|
|
464
|
+
* of this array.
|
|
465
|
+
*/
|
|
466
|
+
export interface BambooPlugin {
|
|
408
467
|
name: string
|
|
468
|
+
hooks?: Partial<BambooHooks>
|
|
409
469
|
}
|
|
410
470
|
|
|
411
471
|
export interface PluginsOptions {
|
|
@@ -443,13 +503,19 @@ export interface PruneOptions {
|
|
|
443
503
|
* `unresolvedPath` exists, and why setting it to `error` is what makes `accounted` worth
|
|
444
504
|
* asking for: it guarantees you are shipping the exact set rather than the fallback.
|
|
445
505
|
*
|
|
506
|
+
* A template literal is bounded rather than declined: `` token(`colors.${shade}`) `` cannot
|
|
507
|
+
* say which token it wants, but it says which it *cannot*, so the `colors` category is kept
|
|
508
|
+
* and nothing else. That covers the commonest dynamic read outright. What it does not cover
|
|
509
|
+
* is a path with no static head — `token(key)`, `token('colors.' + shade)` — and there
|
|
510
|
+
* `keepTokens` is the answer.
|
|
511
|
+
*
|
|
446
512
|
* Three things stay invisible to `accounted`: a token named by a path assembled from a
|
|
447
513
|
* value that only exists at runtime, one referenced only from a stylesheet outside
|
|
448
514
|
* `include`, and one used by a separate package consuming the output as design tokens. The
|
|
449
515
|
* scan reads `include`, which scopes style extraction rather than everything that may
|
|
450
516
|
* import — so a script, a config, or a sibling workspace package that calls `token()` is
|
|
451
|
-
* not covered, nor is a binding renamed away from `token`, as in `const t = token`.
|
|
452
|
-
*
|
|
517
|
+
* not covered, nor is a binding renamed away from `token`, as in `const t = token`. Name
|
|
518
|
+
* them with `keepTokens`.
|
|
453
519
|
*
|
|
454
520
|
* A custom property declared by `global.css` or `global.vars` is not one of these cases:
|
|
455
521
|
* the declaration ships whether or not anything in the stylesheet reads it, so whatever it
|
|
@@ -458,12 +524,54 @@ export interface PruneOptions {
|
|
|
458
524
|
* @default 'reachable'
|
|
459
525
|
*/
|
|
460
526
|
tokens?: 'off' | 'reachable' | 'accounted'
|
|
527
|
+
/**
|
|
528
|
+
* Token paths to keep whatever the build can see, as exact names or `*` patterns.
|
|
529
|
+
*
|
|
530
|
+
* ```ts
|
|
531
|
+
* prune: { tokens: 'accounted', keepTokens: ['colors.*'] }
|
|
532
|
+
* ```
|
|
533
|
+
*
|
|
534
|
+
* This is the bound the build could not infer, written by hand. It exists because the
|
|
535
|
+
* fallback is otherwise total: **one** reference the accounting cannot follow keeps every
|
|
536
|
+
* declaration in the project, so a codebase with a single `token(key)` in it gets the same
|
|
537
|
+
* stylesheet as one that never prunes — and the codebases that reach for `token()` most are
|
|
538
|
+
* exactly the ones that end up there. Naming the category those dynamic reads land in is a
|
|
539
|
+
* far smaller answer than keeping everything, and it is the same answer the build already
|
|
540
|
+
* derives for itself from a template literal's static head.
|
|
541
|
+
*
|
|
542
|
+
* So under `accounted` this does two things: it keeps what it matches, and it stands in for
|
|
543
|
+
* what could not be followed, in place of the blanket keep. Saying `keepTokens: ['colors.*']`
|
|
544
|
+
* is saying *the reads you cannot follow land in `colors`* — an assertion about your own
|
|
545
|
+
* code, which is why nothing infers it for you. Declines are still reported, so you can see
|
|
546
|
+
* what you are covering; `unresolvedPath: 'error'` still fails, because asserting every path
|
|
547
|
+
* resolves and declaring a bound for the ones that do not are contradictory requests.
|
|
548
|
+
*
|
|
549
|
+
* Under `reachable` it is additive only, for a token nothing in the stylesheet references
|
|
550
|
+
* and no javascript here reads — one consumed by a sibling package, or by css outside
|
|
551
|
+
* `include`. It is inert under `tokens: 'off'`, which keeps everything already.
|
|
552
|
+
*
|
|
553
|
+
* Patterns match the dotted token *path*, anchored and case-sensitively, with `*` standing
|
|
554
|
+
* for any run of characters and a leading `!` excluding. `colors.*` keeps every colour,
|
|
555
|
+
* `colors.brand.*` one palette, `colors.red.300` one token, `['colors.*', '!colors.legacy.*']`
|
|
556
|
+
* every colour but one palette.
|
|
557
|
+
*
|
|
558
|
+
* The path, not the css variable: a token is `fontSizes.3xl` and its declaration is
|
|
559
|
+
* `--font-sizes-3xl`, so `font-sizes.*` — the natural thing to write after reading
|
|
560
|
+
* `styles.css` — matches nothing at all. A pattern matching no token is reported, and names
|
|
561
|
+
* the spelling that would have worked, because keeping nothing is otherwise silent in a build
|
|
562
|
+
* whose whole job here is dropping things.
|
|
563
|
+
*
|
|
564
|
+
* This replaces `staticCss` as the way to keep a category alive. `staticCss` emits utility
|
|
565
|
+
* *classes* — keeping the colours meant shipping a rule per colour to hold the declarations
|
|
566
|
+
* up, which is a larger stylesheet than the pruning saved.
|
|
567
|
+
*/
|
|
568
|
+
keepTokens?: string[]
|
|
461
569
|
/**
|
|
462
570
|
* What to do about a token path `accounted` cannot follow.
|
|
463
571
|
*
|
|
464
572
|
* A path spelled at the call resolves; one assembled at runtime does not. An unfollowable
|
|
465
|
-
* path is what forces `accounted` back onto the blanket keep
|
|
466
|
-
* happens quietly, loudly, or not at all.
|
|
573
|
+
* path is what forces `accounted` back onto the blanket keep — unless `keepTokens` names
|
|
574
|
+
* the bound — so this decides whether that happens quietly, loudly, or not at all.
|
|
467
575
|
*
|
|
468
576
|
* - `off` falls back and says nothing.
|
|
469
577
|
* - `warn` falls back and reports what it could not follow.
|
|
@@ -471,6 +579,10 @@ export interface PruneOptions {
|
|
|
471
579
|
*
|
|
472
580
|
* Inert under `tokens: 'off'` and `tokens: 'reachable'`, which run no accounting pass.
|
|
473
581
|
*
|
|
582
|
+
* `error` and `keepTokens` do not combine: one asserts every path resolves, the other
|
|
583
|
+
* declares where the ones that do not will land. A project that cannot make the first
|
|
584
|
+
* assertion wants `warn`, which still prints every reference being covered.
|
|
585
|
+
*
|
|
474
586
|
* Named for what it checks rather than `strict`, which already means something unrelated
|
|
475
587
|
* here: `strictTokens` and `strictPropertyValues` narrow generated *typescript*, and
|
|
476
588
|
* neither implies nor is implied by this.
|
|
@@ -512,48 +624,10 @@ export interface PruneOptions {
|
|
|
512
624
|
* @default true
|
|
513
625
|
*/
|
|
514
626
|
keyframes?: boolean
|
|
515
|
-
/**
|
|
516
|
-
* Whether to drop the parts of the reset that style elements your source never renders.
|
|
517
|
-
*
|
|
518
|
-
* Two thirds of the reset is bound to specific elements — 41 of them, covering `table`,
|
|
519
|
-
* `pre`, `kbd`, `optgroup` and the rest of the long tail. The reset is a fixed size, so it
|
|
520
|
-
* dominates a small stylesheet: a third of one sandbox's css here and four fifths of
|
|
521
|
-
* another's, of which 13% and 34% respectively is for elements those projects never render.
|
|
522
|
-
*
|
|
523
|
-
* A selector list loses only the parts naming unrendered elements, so a rule shared between
|
|
524
|
-
* `button` and `::file-selector-button` keeps the half that still applies. `html` and `body`
|
|
525
|
-
* are never removed.
|
|
526
|
-
*
|
|
527
|
-
* Off by default, and it cannot be made safe by default. Unlike the token and keyframe
|
|
528
|
-
* passes there is nothing to prove this against: an element rendered by a dependency's
|
|
529
|
-
* component, by `dangerouslySetInnerHTML`, or by markdown is invisible to a scan of your own
|
|
530
|
-
* source. What you get wrong is an element quietly losing its reset — no error, no warning.
|
|
531
|
-
* Reach for it when you control the markup and have measured that it pays.
|
|
532
|
-
*
|
|
533
|
-
* The blind spot to check first is your own entry template. The scan reads `include`, and
|
|
534
|
-
* `include` conventionally covers components rather than markup — a glob rooted at `./src`
|
|
535
|
-
* does not match `index.html`, so an element appearing only there is dropped. Add the
|
|
536
|
-
* template to `include` to cover it — the scan reads any file listed, not only ones the
|
|
537
|
-
* parser understands, and reads it from disk rather than from the build's parsed copy, so
|
|
538
|
-
* a single-file component's markup survives the transform to tsx.
|
|
539
|
-
*
|
|
540
|
-
* A scoped reset is handled: `preflight: { scope: '.app' }` writes `.app table`, and the
|
|
541
|
-
* scope is stripped before an element is read out. `bamboo cssgen preflight` prunes too.
|
|
542
|
-
*
|
|
543
|
-
* @default false
|
|
544
|
-
*/
|
|
545
|
-
preflight?: boolean
|
|
546
627
|
}
|
|
547
628
|
|
|
548
629
|
export interface Config
|
|
549
|
-
extends
|
|
550
|
-
ExtendableOptions,
|
|
551
|
-
CssgenOptions,
|
|
552
|
-
CodegenOptions,
|
|
553
|
-
FileSystemOptions,
|
|
554
|
-
PresetOptions,
|
|
555
|
-
HooksOptions,
|
|
556
|
-
PluginsOptions {
|
|
630
|
+
extends ExtendableOptions, CssgenOptions, CodegenOptions, FileSystemOptions, PresetOptions, PluginsOptions {
|
|
557
631
|
/**
|
|
558
632
|
* What to do when the config does not validate.
|
|
559
633
|
*
|
|
@@ -561,10 +635,17 @@ export interface Config
|
|
|
561
635
|
* - `warn` logs what failed.
|
|
562
636
|
* - `error` throws.
|
|
563
637
|
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
638
|
+
* This grades opinions about a config that still builds. Two checks are not that, run
|
|
639
|
+
* ahead of it, and answer to nothing here: a retired token spelling, which is output that
|
|
640
|
+
* is already broken; and an option that has been removed, which is proof the config
|
|
641
|
+
* predates the version reading it. Both throw at any setting, including `off`.
|
|
642
|
+
*
|
|
643
|
+
* A removed option throws rather than warns because a warning is not a signal anything
|
|
644
|
+
* acts on. Removals ship in minor versions, so a warning is what an automated dependency
|
|
645
|
+
* upgrade merges without a person reading it — while the option itself is silent in every
|
|
646
|
+
* other way, reverting to the default and taking the assertion it asked for with it. An
|
|
647
|
+
* unknown key is a different case and still tolerated: it may be forward-compatible, a
|
|
648
|
+
* setting for a version not installed yet. A *removed* key can only be backward.
|
|
568
649
|
*
|
|
569
650
|
* @default 'warn'
|
|
570
651
|
*/
|
package/dist/index.d.ts
CHANGED
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.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.33.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsx scripts/watch.ts",
|