@bamboocss/types 1.21.0 → 1.23.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/config.d.ts CHANGED
@@ -277,6 +277,15 @@ interface CssgenOptions {
277
277
  separator?: '_' | '=' | '-'
278
278
  /**
279
279
  * Whether to minify the generated css.
280
+ *
281
+ * Worth about 21% of the raw stylesheet and 5–7% gzipped on the example apps here. The
282
+ * gzip figure is the smaller one because compression has already collapsed the indentation
283
+ * before you get there — but unlike renaming what is emitted, it never comes out negative.
284
+ *
285
+ * Off by default so the generated stylesheet stays readable, and because most projects
286
+ * hand it to a bundler that minifies css in production anyway. Worth turning on if you
287
+ * ship `styled-system/styles.css` directly, or pass `--minify` to the CLI for one build.
288
+ *
280
289
  * @default false
281
290
  */
282
291
  minify?: boolean
@@ -314,7 +323,21 @@ interface CssgenOptions {
314
323
  * negative token resolves to `calc(var(--spacing-4) * -1)`, so every token with a
315
324
  * negative counterpart pins its own declaration. Spacing scales generate one per entry,
316
325
  * which keeps the whole scale whether or not the app uses it — on the default preset
317
- * that is roughly a third of what survives pruning. There is no opt-out.
326
+ * that is roughly a third of what survives pruning.
327
+ *
328
+ * That exemption is now skipped entirely for a project that never reaches for a token from
329
+ * javascript. The tokens artifact is generated into the project rather than installed, so
330
+ * the import is written in your own source and a scan of `include` finds it — a call, or an
331
+ * import of any module the artifact could be. On the example apps here that is worth up to
332
+ * 20% of the stylesheet raw and 13% gzipped, and nothing at all on the one that does call
333
+ * `token()`, which is the point: a project with a 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.
318
341
  *
319
342
  * Setting this to `false` keeps every token declaration, but still drops the `@property`
320
343
  * registrations. Those are not tokens — nothing hands one to javascript and none appear
@@ -341,6 +364,37 @@ interface CssgenOptions {
341
364
  * @default true
342
365
  */
343
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
344
398
  /**
345
399
  * The root selector for the css variables.
346
400
  * @default ':where(:host, :root)'
@@ -410,19 +464,6 @@ interface CodegenOptions {
410
464
  * @default false
411
465
  */
412
466
  forceConsistentTypeExtension?: boolean
413
- /**
414
- * Controls how CSS utility classes are generated.
415
- * - `'atomic'` (default): one class per property (e.g. `c_red p_8px`)
416
- * - `'grouped'`: one class per `css()` call, grouping all properties together
417
- *
418
- * Grouped mode reduces the number of classes in the HTML at the cost of potential CSS duplication.
419
- *
420
- * A grouped class names a whole call, so the build has to have seen that exact call to emit its rule.
421
- * Where it cannot, the runtime falls back to atomic class names — and a few shapes lose their styles
422
- * entirely, without a warning. Read https://bamboocss.com/docs/references/config#cssmode before enabling it.
423
- * @default 'atomic'
424
- */
425
- cssMode?: 'atomic' | 'grouped'
426
467
  }
427
468
 
428
469
  interface PresetOptions {
@@ -12,10 +12,6 @@ export interface AtomicRule extends BaseRule {
12
12
  styles: SystemStyleObject
13
13
  }
14
14
 
15
- export interface GroupedRule extends BaseRule {
16
- styles: SystemStyleObject
17
- }
18
-
19
15
  export interface AtomicRecipeRule extends BaseRule {
20
16
  config: RecipeDefinition<any> | SlotRecipeDefinition<string, any>
21
17
  }
@@ -26,7 +22,6 @@ export interface RecipeVariantsRule extends BaseRule {
26
22
 
27
23
  export interface ProcessorInterface {
28
24
  css(styles: SystemStyleObject): AtomicRule
29
- grouped(styles: SystemStyleObject): GroupedRule
30
25
  cva(recipeConfig: RecipeDefinition<RecipeVariantRecord>): AtomicRecipeRule
31
26
  sva(recipeConfig: SlotRecipeDefinition<string, SlotRecipeVariantRecord<string>>): AtomicRecipeRule
32
27
  recipe(name: string, variants?: RecipeVariantRecord): RecipeVariantsRule | undefined
package/dist/parser.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { BoxNodeArray, BoxNodeLiteral, BoxNodeMap, Unboxed } from '@bambooc
3
3
  export interface ResultItem {
4
4
  name?: string
5
5
  data: Array<Unboxed['raw']>
6
- type?: 'css' | 'cva' | 'sva' | 'token' | 'pattern' | 'recipe' | 'jsx-recipe'
6
+ type?: 'css' | 'cva' | 'sva' | 'token' | 'pattern' | 'recipe' | 'jsx-recipe' | 'cva-call'
7
7
  box?: BoxNodeMap | BoxNodeLiteral | BoxNodeArray
8
8
  }
9
9
 
@@ -11,6 +11,8 @@ export interface ParserResultInterface {
11
11
  all: Array<ResultItem>
12
12
  css: Set<ResultItem>
13
13
  cva: Set<ResultItem>
14
+ /** Calls of a locally-bound inline recipe: `const b = cva(...)`, then `b({ ... })`. */
15
+ cvaCall: Set<ResultItem>
14
16
  sva: Set<ResultItem>
15
17
  token: Set<ResultItem>
16
18
  viewTransition: Set<ResultItem>
@@ -36,9 +38,6 @@ export interface EncoderJson {
36
38
  recipes?: {
37
39
  [name: string]: string[]
38
40
  }
39
- grouped?: {
40
- [groupId: string]: string[]
41
- }
42
41
  /** Bag class -> the `::view-transition-*` slot styles behind it. */
43
42
  viewTransitions?: {
44
43
  [className: string]: Record<string, any>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/types",
3
- "version": "1.21.0",
3
+ "version": "1.23.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.21.0"
35
+ "@bamboocss/extractor": "1.23.0"
36
36
  },
37
37
  "scripts": {
38
38
  "dev": "tsx scripts/watch.ts",