@bamboocss/types 1.28.1 → 1.30.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 +20 -21
- package/dist/parser.d.ts +6 -4
- package/package.json +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -301,37 +301,36 @@ interface CssgenOptions {
|
|
|
301
301
|
* the app draws, so an app using none of them carries all of it for nothing. Registrations
|
|
302
302
|
* declared through `globalVars` are yours and are never removed.
|
|
303
303
|
*
|
|
304
|
-
* It is opt-in because reachability cannot be proven for every reference. `token()
|
|
305
|
-
* `token.
|
|
306
|
-
* by hand — and
|
|
307
|
-
* extractor can follow, not only through a path spelled out at the call. Three
|
|
308
|
-
* stay invisible: a token named by a path assembled from a value that only exists at
|
|
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
309
|
* runtime, one referenced only from a stylesheet outside `include`, and one used by a
|
|
310
310
|
* separate package consuming the output as design tokens. Use `staticCss` to keep those.
|
|
311
311
|
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
* `token.
|
|
315
|
-
*
|
|
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.
|
|
316
317
|
*
|
|
317
318
|
* A custom property declared by `globalCss` or `globalVars` is not one of these cases:
|
|
318
319
|
* the declaration ships whether or not anything in the stylesheet reads it, so whatever
|
|
319
320
|
* it references is kept alongside it.
|
|
320
321
|
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
* that is roughly a third of what survives pruning.
|
|
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
328
|
*
|
|
329
|
-
*
|
|
329
|
+
* The exemption is skipped entirely for a project that never reaches for a token from
|
|
330
330
|
* javascript. The tokens artifact is generated into the project rather than installed, so
|
|
331
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.
|
|
333
|
-
*
|
|
334
|
-
* `token()`, which is the point: a project with a caller keeps every declaration.
|
|
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.
|
|
335
334
|
*
|
|
336
335
|
* The scan reads `include`, which scopes style extraction rather than everything that may
|
|
337
336
|
* import — so a script, a config, or a sibling workspace package that calls `token()` is
|
|
@@ -348,7 +347,7 @@ interface CssgenOptions {
|
|
|
348
347
|
*
|
|
349
348
|
* @default true
|
|
350
349
|
*/
|
|
351
|
-
pruneUnusedTokens?: boolean
|
|
350
|
+
pruneUnusedTokens?: boolean | 'strict'
|
|
352
351
|
/**
|
|
353
352
|
* Drop `@keyframes` rules nothing can reach.
|
|
354
353
|
*
|
package/dist/parser.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ export interface ResultItem {
|
|
|
4
4
|
name?: string
|
|
5
5
|
data: Array<Unboxed['raw']>
|
|
6
6
|
/**
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
7
|
+
* `token` is `token(path)`, the variable reference. `tokenValue` is `token.value(path)`, the
|
|
8
|
+
* literal — distinct because
|
|
9
|
+
* inlining one as the other swaps a themeable reference for a fixed value.
|
|
10
|
+
*
|
|
9
11
|
* Both live in `ParserResult.token`, since every consumer that reads a token *path* out of
|
|
10
12
|
* a result wants both.
|
|
11
13
|
*/
|
|
12
|
-
type?: 'css' | 'cva' | 'sva' | 'token' | '
|
|
14
|
+
type?: 'css' | 'cva' | 'sva' | 'token' | 'tokenValue' | 'pattern' | 'recipe' | 'jsx-recipe' | 'cva-call'
|
|
13
15
|
box?: BoxNodeMap | BoxNodeLiteral | BoxNodeArray
|
|
14
16
|
/**
|
|
15
17
|
* For a `cva-call`, the module the recipe was declared in when that is not this one.
|
|
@@ -38,7 +40,7 @@ export interface ParserResultInterface {
|
|
|
38
40
|
setCss: (result: ResultItem) => void
|
|
39
41
|
setCva: (result: ResultItem) => void
|
|
40
42
|
setSva: (result: ResultItem) => void
|
|
41
|
-
setToken: (result: ResultItem, kind?: 'token' | '
|
|
43
|
+
setToken: (result: ResultItem, kind?: 'token' | 'tokenValue') => void
|
|
42
44
|
setViewTransition: (result: ResultItem) => void
|
|
43
45
|
setPattern: (name: string, result: ResultItem) => void
|
|
44
46
|
setRecipe: (name: string, result: ResultItem) => void
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.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.30.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsx scripts/watch.ts",
|