@bamboocss/types 1.37.13 → 1.39.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 +32 -1
  2. package/package.json +2 -2
package/dist/config.d.ts CHANGED
@@ -391,8 +391,39 @@ interface CodegenOptions {
391
391
  hash?: boolean | { cssVar?: boolean; className?: boolean }
392
392
  /**
393
393
  * Change generated typescript definitions to be more strict for property having a token or utility.
394
+ *
395
+ * Three settings, not two:
396
+ *
397
+ * - `false` — every property also accepts `string`, so nothing about a value is checked. A
398
+ * misspelled token is a value the browser drops at compute time: the declaration ships, the
399
+ * style is simply absent, and it surfaces as "this colour never applied" a long way from the
400
+ * typo.
401
+ * - `'unknown-tokens'` — a value must be a token, a keyword the property actually enumerates,
402
+ * or *shaped* like a CSS value: it starts with a digit or `#` or `-`, or it contains a space,
403
+ * a comma or a function call. `'14px'`, `'100vh'`, `'1px solid red'` and `'rgb(0 0 0)'` all
404
+ * pass; `'mutedd'`, `'accnt'` and `'colors.acent'` do not, because a bare identifier that is
405
+ * neither a token nor a keyword is nothing else.
406
+ * - `true` — only tokens, and every raw value has to be written as `'[14px]'`.
407
+ *
408
+ * The middle setting exists because the other two are a day-one decision. Turning `true` on
409
+ * later reports every raw value in the codebase — 468 errors on one otherwise-correct app, of
410
+ * which 3 were the typo it was turned on for — so a project that did not start with it is
411
+ * realistically stuck with the unchecked default forever. `'unknown-tokens'` costs no
412
+ * migration and catches that class of mistake.
413
+ *
414
+ * Properties whose values *are* identifiers you invent — `animationName`, `gridArea`,
415
+ * `counterReset`, `containerName`, `fontFamily`, `content` and the rest — are left out of
416
+ * it: there is nothing to check them against, and a `@keyframes` name declared in CSS is an
417
+ * ordinary thing to write.
418
+ *
419
+ * Two costs follow from the rule being about shape. A typo that is *also* a plausible value
420
+ * passes — `'2xll'` starts with a digit like `'2rem'` does. And a value typed `string` is
421
+ * rejected, since nothing distinguishes it from a misspelled token; write `` `[${value}]` ``,
422
+ * the same as under `true`, and note the Vite compiler rejects an open runtime value anyway.
423
+ *
424
+ * @default false
394
425
  */
395
- strictTokens?: boolean
426
+ strictTokens?: boolean | 'unknown-tokens'
396
427
  /**
397
428
  * Change generated typescript definitions to be more strict for built-in CSS properties to only allow valid CSS values.
398
429
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/types",
3
- "version": "1.37.13",
3
+ "version": "1.39.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.37.13"
35
+ "@bamboocss/extractor": "1.39.0"
36
36
  },
37
37
  "scripts": {
38
38
  "dev": "tsx scripts/watch.ts",