@bamboocss/types 1.32.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.
Files changed (2) hide show
  1. package/dist/config.d.ts +55 -33
  2. package/package.json +2 -2
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 | { scope: string; level?: 'element' | 'parent' }
328
+ preflight?: boolean | PreflightOptions
276
329
  /**
277
330
  * The namespace prefix for the generated css classes and css variables.
278
331
  * @default ''
@@ -571,37 +624,6 @@ export interface PruneOptions {
571
624
  * @default true
572
625
  */
573
626
  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
627
  }
606
628
 
607
629
  export interface Config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/types",
3
- "version": "1.32.0",
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.32.0"
35
+ "@bamboocss/extractor": "1.33.0"
36
36
  },
37
37
  "scripts": {
38
38
  "dev": "tsx scripts/watch.ts",