@bamboocss/generator 1.20.4 → 1.22.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/index.cjs +149 -113
- package/dist/index.d.cts +14 -39
- package/dist/index.d.mts +14 -39
- package/dist/index.mjs +152 -114
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -36,7 +36,7 @@ declare class Generator extends Context {
|
|
|
36
36
|
*
|
|
37
37
|
* `keep` carries references this cannot see for itself; see `collectTokenReferences`.
|
|
38
38
|
*/
|
|
39
|
-
pruneTokens: (sheet: Stylesheet, keep?: Set<string
|
|
39
|
+
pruneTokens: (sheet: Stylesheet, keep?: Set<string>, tokensReachableFromJs?: boolean) => {
|
|
40
40
|
removed: number;
|
|
41
41
|
kept: number;
|
|
42
42
|
removedProperties?: undefined;
|
|
@@ -45,6 +45,18 @@ declare class Generator extends Context {
|
|
|
45
45
|
removedProperties: number;
|
|
46
46
|
kept: number;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Drop the parts of the reset that style elements the source never renders.
|
|
50
|
+
*
|
|
51
|
+
* Off unless asked for. Unlike the token and keyframe passes there is no way to prove this
|
|
52
|
+
* from the build: an element rendered by a dependency, by `dangerouslySetInnerHTML` or by
|
|
53
|
+
* markdown is invisible to a scan of your own source, and the failure is an element quietly
|
|
54
|
+
* losing its reset rather than anything that reports itself.
|
|
55
|
+
*/
|
|
56
|
+
prunePreflight: (sheet: Stylesheet, rendered: Set<string>) => {
|
|
57
|
+
removedRules: number;
|
|
58
|
+
removedParts: number;
|
|
59
|
+
} | undefined;
|
|
48
60
|
/**
|
|
49
61
|
* Drop `@keyframes` nothing can reach. Same completeness requirement as
|
|
50
62
|
* `pruneTokens`: the sheet has to hold the whole stylesheet, or every keyframe looks
|
|
@@ -96,20 +108,6 @@ declare class Generator extends Context {
|
|
|
96
108
|
*/
|
|
97
109
|
private getAlwaysKeptTokenVars;
|
|
98
110
|
getParserCss: (decoder: StyleDecoder) => string;
|
|
99
|
-
/**
|
|
100
|
-
* The grouped class names this build emitted a rule for.
|
|
101
|
-
*
|
|
102
|
-
* Derived from the encoder rather than the decoder, so it is available as soon as
|
|
103
|
-
* extraction finishes and before a stylesheet exists. Both sides go through
|
|
104
|
-
* `groupClassName`, which is the same function the browser runtime calls — a registry
|
|
105
|
-
* built any other way would be a third spelling of a name that already has two.
|
|
106
|
-
*
|
|
107
|
-
* Unescaped, unlike `StyleDecoder`'s class names: this is compared against what `css()`
|
|
108
|
-
* returns into a `class` attribute, not against a selector. A grouped class is an opaque
|
|
109
|
-
* hash, so the two only differ in principle, but the principle is the one that matters
|
|
110
|
-
* here — the registry is only useful if it holds exactly what the runtime will ask about.
|
|
111
|
-
*/
|
|
112
|
-
getGroupRegistry: () => string[];
|
|
113
111
|
getCss: (stylesheet?: Stylesheet) => string;
|
|
114
112
|
/**
|
|
115
113
|
* Get CSS for a specific layer from the stylesheet
|
|
@@ -138,27 +136,4 @@ declare class Generator extends Context {
|
|
|
138
136
|
*/
|
|
139
137
|
declare function getThemeCss(ctx: Context, themeName: string): string;
|
|
140
138
|
//#endregion
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* The grouped classes the build emitted a rule for.
|
|
144
|
-
*
|
|
145
|
-
* Under `cssMode: 'grouped'` a class names a whole `css()` call, so the build has to have
|
|
146
|
-
* seen that exact call to emit its rule. This is how the runtime tells the difference: a
|
|
147
|
-
* class in here has CSS behind it, and one that is not falls back to naming its
|
|
148
|
-
* declarations atomically as well.
|
|
149
|
-
*
|
|
150
|
-
* Written by two passes. `codegen` emits whatever the encoder already holds — usually
|
|
151
|
-
* nothing, since it runs on config change before anything is extracted, but not blank when
|
|
152
|
-
* it runs after a build. The CSS build then rewrites it with the set it emitted.
|
|
153
|
-
*
|
|
154
|
-
* An empty or stale registry is safe by construction: the runtime *adds* to the group class
|
|
155
|
-
* rather than replacing it, so the worst a miss can do is name a class that matches nothing.
|
|
156
|
-
*/
|
|
157
|
-
declare function generateGroupRegistry(ctx: Pick<Context, 'encoder' | 'utility'>, classNames?: string[]): {
|
|
158
|
-
js: string;
|
|
159
|
-
dts: string;
|
|
160
|
-
};
|
|
161
|
-
/** Where the registry lives, so the writer and the importer cannot disagree about it. */
|
|
162
|
-
declare const GROUP_REGISTRY_FILE = "groups";
|
|
163
|
-
//#endregion
|
|
164
|
-
export { GROUP_REGISTRY_FILE, Generator, SplitCssArtifact, SplitCssResult, generateGroupRegistry, getThemeCss };
|
|
139
|
+
export { Generator, SplitCssArtifact, SplitCssResult, getThemeCss };
|