@bamboocss/types 1.30.0 → 1.31.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.
@@ -37,7 +37,7 @@ type TextStyleProperty =
37
37
  | 'fontVariationSettings'
38
38
  | 'fontWeight'
39
39
  | 'hangingPunctuation'
40
- | 'hypens'
40
+ | 'hyphens'
41
41
  | 'hyphenateCharacter'
42
42
  | 'hyphenateLimitChars'
43
43
  | 'letterSpacing'
package/dist/config.d.ts CHANGED
@@ -24,24 +24,50 @@ export interface Patterns {
24
24
  [pattern: string]: PatternConfig
25
25
  }
26
26
 
27
- export interface PresetCore {
28
- /**
29
- * The css selectors or media queries shortcuts.
30
- * @example `{ hover: "&:hover" }`
31
- */
32
- conditions: Conditions
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
- globalCss: GlobalStyleObject
39
+ css: GlobalStyleObject
37
40
  /**
38
41
  * The global fontface for your project.
39
42
  */
40
- globalFontface?: GlobalFontface
43
+ fontface?: GlobalFontface
41
44
  /**
42
45
  * The global custom position try fallback option
43
46
  */
44
- globalPositionTry?: GlobalPositionTry
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
- * The global styles for your project.
147
- */
148
- globalCss?: ExtendableGlobalStyleObject
149
- /**
150
- * The global fontface for your project.
151
- */
152
- globalFontface?: ExtendableGlobalFontface
153
- /**
154
- * The global custom position try fallback option
157
+ * Styles, fontfaces, position-try fallbacks and css variables emitted at the document level.
155
158
  */
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
- * Whether to drop token css variables that nothing in the generated css can reach.
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
301
+ * What to drop from the generated stylesheet. See `PruneOptions`.
349
302
  */
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
396
- */
397
- prunePreflight?: boolean
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: boolean; className: boolean }
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
- * Whether to force consistent type extensions for generated typescript .d.ts files.
463
- * If set to `true` and `outExtension` is set to `mjs`, the generated typescript .d.ts files will have the extension `.d.mts`.
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,7 +382,20 @@ interface CodegenOptions {
468
382
 
469
383
  interface PresetOptions {
470
384
  /**
471
- * Used to create reusable config presets for your project or team.
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
  }
@@ -485,6 +412,139 @@ export interface PluginsOptions {
485
412
  plugins?: BambooPlugin[]
486
413
  }
487
414
 
415
+ /**
416
+ * What to drop from the generated stylesheet, and how to account for it.
417
+ *
418
+ * These were three top-level options — `pruneUnusedTokens`, `pruneUnusedKeyframes` and
419
+ * `prunePreflight` — which disagreed with each other on all three of naming, default and
420
+ * value type. Grouping them is what makes one default reading of "prune" possible.
421
+ */
422
+ export interface PruneOptions {
423
+ /**
424
+ * How to decide which token css variables to keep.
425
+ *
426
+ * The token layer declares every token in the theme, and an app typically uses a small
427
+ * fraction of them, so this is usually the largest single saving in render-blocking css.
428
+ *
429
+ * - `off` keeps every token declaration.
430
+ * - `reachable` keeps what the generated css reaches. Because `token()` can name any
431
+ * token, a project that calls it from javascript *anywhere* keeps every declaration —
432
+ * on the default preset that is 468 names against the 68 a narrower exemption kept, and
433
+ * a token layer of 442 declarations rather than 2. The exemption is skipped entirely for
434
+ * a project that never reaches for a token from javascript, so the saving is
435
+ * all-or-nothing: one caller keeps every declaration.
436
+ * - `accounted` reads the token paths out of your source and keeps only those. `token()`
437
+ * and `token.value()` calls are resolved through a constant or a template literal the
438
+ * extractor can follow, not only through a path spelled at the call, as is any literal
439
+ * `var(--x)` written by hand.
440
+ *
441
+ * Under `accounted`, a path the build cannot follow makes the keep set fall back to
442
+ * `reachable`'s blanket keep rather than silently dropping a declaration — which is why
443
+ * `unresolvedPath` exists, and why setting it to `error` is what makes `accounted` worth
444
+ * asking for: it guarantees you are shipping the exact set rather than the fallback.
445
+ *
446
+ * Three things stay invisible to `accounted`: a token named by a path assembled from a
447
+ * value that only exists at runtime, one referenced only from a stylesheet outside
448
+ * `include`, and one used by a separate package consuming the output as design tokens. The
449
+ * scan reads `include`, which scopes style extraction rather than everything that may
450
+ * 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`. Use
452
+ * `staticCss` to keep those.
453
+ *
454
+ * A custom property declared by `global.css` or `global.vars` is not one of these cases:
455
+ * the declaration ships whether or not anything in the stylesheet reads it, so whatever it
456
+ * references is kept alongside it.
457
+ *
458
+ * @default 'reachable'
459
+ */
460
+ tokens?: 'off' | 'reachable' | 'accounted'
461
+ /**
462
+ * What to do about a token path `accounted` cannot follow.
463
+ *
464
+ * 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, so this decides whether that
466
+ * happens quietly, loudly, or not at all.
467
+ *
468
+ * - `off` falls back and says nothing.
469
+ * - `warn` falls back and reports what it could not follow.
470
+ * - `error` fails the build, so the fallback can never ship unnoticed.
471
+ *
472
+ * Inert under `tokens: 'off'` and `tokens: 'reachable'`, which run no accounting pass.
473
+ *
474
+ * Named for what it checks rather than `strict`, which already means something unrelated
475
+ * here: `strictTokens` and `strictPropertyValues` narrow generated *typescript*, and
476
+ * neither implies nor is implied by this.
477
+ *
478
+ * @default 'warn'
479
+ */
480
+ unresolvedPath?: 'off' | 'warn' | 'error'
481
+ /**
482
+ * Drop an `@property` registration the finished stylesheet neither declares nor reads.
483
+ *
484
+ * A preset registers what its utilities compose — filters, gradients, transforms,
485
+ * transitions — and ships the whole set regardless of what the app draws, so an app using
486
+ * none of them carries all of it for nothing.
487
+ *
488
+ * Its own flag rather than a side effect of `tokens`, which is what it used to be: the
489
+ * registrations were dropped even under the old `tokens: false`, so an option documented
490
+ * as keeping every token declaration quietly removed something else. These are not tokens
491
+ * — nothing hands one to javascript and none appear in the `token()` surface — so the
492
+ * reachability problem that makes `tokens` cautious does not apply to them.
493
+ *
494
+ * Registrations declared through `global.vars` are yours and are never removed.
495
+ *
496
+ * @default true
497
+ */
498
+ propertyRegistrations?: boolean
499
+ /**
500
+ * Drop `@keyframes` rules nothing can reach.
501
+ *
502
+ * A preset declares every animation it offers and an app uses a handful, so the rest
503
+ * are dead weight in the stylesheet that blocks first paint. Only keyframes the theme
504
+ * declares are ever removed — one emitted by `global.css` is left alone.
505
+ *
506
+ * A name is kept when any declaration in the generated css names it, and when it
507
+ * appears anywhere under `include`, which covers an animation assembled at runtime or
508
+ * applied through an inline `style` rather than through bamboo. That textual fallback
509
+ * is deliberately over-inclusive: keeping an unused keyframe costs bytes, dropping a
510
+ * used one breaks the animation.
511
+ *
512
+ * @default true
513
+ */
514
+ 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
+ }
547
+
488
548
  export interface Config
489
549
  extends
490
550
  ExtendableOptions,
@@ -495,19 +555,20 @@ export interface Config
495
555
  HooksOptions,
496
556
  PluginsOptions {
497
557
  /**
498
- * Whether to opt-out of the defaults config presets: [`@bamboocss/preset-base`, `@bamboocss/preset-bamboo`]
499
- * @default 'false'
500
- */
501
- eject?: boolean
502
- /**
503
- * The validation strictness to use when validating the config.
504
- * - When set to 'none', no validation will be performed.
505
- * - When set to 'warn', warnings will be logged when validation fails.
506
- * - When set to 'error', errors will be thrown when validation fails.
558
+ * What to do when the config does not validate.
559
+ *
560
+ * - `off` performs no validation.
561
+ * - `warn` logs what failed.
562
+ * - `error` throws.
563
+ *
564
+ * A retired spelling is checked ahead of this and is not silenceable by it — that is
565
+ * output which is already broken rather than an opinion about a config that still
566
+ * builds. Neither is a removed option: `off` used to switch off the one mechanism that
567
+ * tells an upgrader their setting is no longer read.
507
568
  *
508
569
  * @default 'warn'
509
570
  */
510
- validation?: 'none' | 'warn' | 'error'
571
+ validation?: 'off' | 'warn' | 'error'
511
572
  }
512
573
 
513
574
  export interface Preset extends ExtendableOptions, PresetOptions {
@@ -556,8 +617,10 @@ export interface PrefixOptions {
556
617
  type ReqConf = Required<UserConfig>
557
618
 
558
619
  export type ConfigPath = Exclude<
559
- | Exclude<NonNullable<Keys<ReqConf>>, 'theme'>
620
+ | Exclude<NonNullable<Keys<ReqConf>>, 'theme' | 'global' | 'prune'>
560
621
  | PathIn<ReqConf, 'theme'>
622
+ | PathIn<ReqConf, 'global'>
623
+ | PathIn<ReqConf, 'prune'>
561
624
  | PathIn<ReqConf, 'patterns'>
562
625
  | PathIn<ReqConf, 'staticCss'>
563
626
  | (string & {}),
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
- * Whether to only generate types for the specified properties.
53
- * This will disallow css properties
54
- */
55
- strict?: boolean
56
- /**
57
- * @experimental
58
- * Disallow certain css properties for this pattern
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
- blocklist?: LiteralUnion<CssProperty>[]
76
+ cssProps?: 'all' | 'none' | { except: LiteralUnion<CssProperty>[] }
61
77
  }
package/dist/theme.d.ts CHANGED
@@ -71,9 +71,28 @@ export interface Theme {
71
71
  * The color palette configuration for your project.
72
72
  */
73
73
  colorPalette?: ColorPaletteOptions
74
+ /**
75
+ * Alternate token sets, selectable at runtime.
76
+ *
77
+ * Was a top-level `themes`, one character from `theme` and impossible for TypeScript to
78
+ * tell apart — both spellings were valid keys, so the typo resolved to a different
79
+ * feature rather than to an error. A variant is part of the theme, so it lives in it.
80
+ */
81
+ variants?: ThemeVariantsMap
82
+ }
83
+
84
+ export interface ThemeVariant extends Pick<Theme, 'tokens' | 'semanticTokens'> {}
85
+
86
+ export interface ThemeVariantsMap {
87
+ [name: string]: ThemeVariant
74
88
  }
75
89
 
76
- interface PartialTheme extends Omit<Theme, 'recipes' | 'slotRecipes'> {
90
+ interface ExtendableThemeVariantsMap {
91
+ [name: string]: ThemeVariantsMap | ThemeVariant | undefined
92
+ extend?: ThemeVariantsMap | undefined
93
+ }
94
+
95
+ interface PartialTheme extends Omit<Theme, 'recipes' | 'slotRecipes' | 'variants'> {
77
96
  /**
78
97
  * Multi-variant style definitions for your project.
79
98
  * Useful for defining component styles.
@@ -87,8 +106,13 @@ interface PartialTheme extends Omit<Theme, 'recipes' | 'slotRecipes'> {
87
106
  * The color palette configuration for your project.
88
107
  */
89
108
  colorPalette?: Partial<ColorPaletteOptions>
109
+ /**
110
+ * Alternate token sets, selectable at runtime.
111
+ */
112
+ variants?: ExtendableThemeVariantsMap
90
113
  }
91
114
 
92
- export interface ExtendableTheme extends Theme {
115
+ export interface ExtendableTheme extends Omit<Theme, 'variants'> {
116
+ variants?: ExtendableThemeVariantsMap
93
117
  extend?: PartialTheme | undefined
94
118
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@bamboocss/types",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "description": "The types for css bamboo",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
7
7
  "author": "Gajus Kuizinas <gajus@gajus.com>",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/bamboocss/bamboo.git",
10
+ "url": "git+https://github.com/gajus/bamboocss.git",
11
11
  "directory": "packages/types"
12
12
  },
13
13
  "files": [
@@ -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.30.0"
35
+ "@bamboocss/extractor": "1.31.0"
36
36
  },
37
37
  "scripts": {
38
38
  "dev": "tsx scripts/watch.ts",