@bamboocss/generator 1.14.0 → 1.16.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.d.cts CHANGED
@@ -91,6 +91,20 @@ declare class Generator extends Context {
91
91
  */
92
92
  private getAlwaysKeptTokenVars;
93
93
  getParserCss: (decoder: StyleDecoder) => string;
94
+ /**
95
+ * The grouped class names this build emitted a rule for.
96
+ *
97
+ * Derived from the encoder rather than the decoder, so it is available as soon as
98
+ * extraction finishes and before a stylesheet exists. Both sides go through
99
+ * `groupClassName`, which is the same function the browser runtime calls — a registry
100
+ * built any other way would be a third spelling of a name that already has two.
101
+ *
102
+ * Unescaped, unlike `StyleDecoder`'s class names: this is compared against what `css()`
103
+ * returns into a `class` attribute, not against a selector. A grouped class is an opaque
104
+ * hash, so the two only differ in principle, but the principle is the one that matters
105
+ * here — the registry is only useful if it holds exactly what the runtime will ask about.
106
+ */
107
+ getGroupRegistry: () => string[];
94
108
  getCss: (stylesheet?: Stylesheet) => string;
95
109
  /**
96
110
  * Get CSS for a specific layer from the stylesheet
@@ -119,4 +133,27 @@ declare class Generator extends Context {
119
133
  */
120
134
  declare function getThemeCss(ctx: Context, themeName: string): string;
121
135
  //#endregion
122
- export { Generator, SplitCssArtifact, SplitCssResult, getThemeCss };
136
+ //#region src/artifacts/js/group-registry.d.ts
137
+ /**
138
+ * The grouped classes the build emitted a rule for.
139
+ *
140
+ * Under `cssMode: 'grouped'` a class names a whole `css()` call, so the build has to have
141
+ * seen that exact call to emit its rule. This is how the runtime tells the difference: a
142
+ * class in here has CSS behind it, and one that is not falls back to naming its
143
+ * declarations atomically as well.
144
+ *
145
+ * Written by two passes. `codegen` emits whatever the encoder already holds — usually
146
+ * nothing, since it runs on config change before anything is extracted, but not blank when
147
+ * it runs after a build. The CSS build then rewrites it with the set it emitted.
148
+ *
149
+ * An empty or stale registry is safe by construction: the runtime *adds* to the group class
150
+ * rather than replacing it, so the worst a miss can do is name a class that matches nothing.
151
+ */
152
+ declare function generateGroupRegistry(ctx: Pick<Context, 'encoder' | 'utility'>, classNames?: string[]): {
153
+ js: string;
154
+ dts: string;
155
+ };
156
+ /** Where the registry lives, so the writer and the importer cannot disagree about it. */
157
+ declare const GROUP_REGISTRY_FILE = "groups";
158
+ //#endregion
159
+ export { GROUP_REGISTRY_FILE, Generator, SplitCssArtifact, SplitCssResult, generateGroupRegistry, getThemeCss };
package/dist/index.d.mts CHANGED
@@ -91,6 +91,20 @@ declare class Generator extends Context {
91
91
  */
92
92
  private getAlwaysKeptTokenVars;
93
93
  getParserCss: (decoder: StyleDecoder) => string;
94
+ /**
95
+ * The grouped class names this build emitted a rule for.
96
+ *
97
+ * Derived from the encoder rather than the decoder, so it is available as soon as
98
+ * extraction finishes and before a stylesheet exists. Both sides go through
99
+ * `groupClassName`, which is the same function the browser runtime calls — a registry
100
+ * built any other way would be a third spelling of a name that already has two.
101
+ *
102
+ * Unescaped, unlike `StyleDecoder`'s class names: this is compared against what `css()`
103
+ * returns into a `class` attribute, not against a selector. A grouped class is an opaque
104
+ * hash, so the two only differ in principle, but the principle is the one that matters
105
+ * here — the registry is only useful if it holds exactly what the runtime will ask about.
106
+ */
107
+ getGroupRegistry: () => string[];
94
108
  getCss: (stylesheet?: Stylesheet) => string;
95
109
  /**
96
110
  * Get CSS for a specific layer from the stylesheet
@@ -119,4 +133,27 @@ declare class Generator extends Context {
119
133
  */
120
134
  declare function getThemeCss(ctx: Context, themeName: string): string;
121
135
  //#endregion
122
- export { Generator, SplitCssArtifact, SplitCssResult, getThemeCss };
136
+ //#region src/artifacts/js/group-registry.d.ts
137
+ /**
138
+ * The grouped classes the build emitted a rule for.
139
+ *
140
+ * Under `cssMode: 'grouped'` a class names a whole `css()` call, so the build has to have
141
+ * seen that exact call to emit its rule. This is how the runtime tells the difference: a
142
+ * class in here has CSS behind it, and one that is not falls back to naming its
143
+ * declarations atomically as well.
144
+ *
145
+ * Written by two passes. `codegen` emits whatever the encoder already holds — usually
146
+ * nothing, since it runs on config change before anything is extracted, but not blank when
147
+ * it runs after a build. The CSS build then rewrites it with the set it emitted.
148
+ *
149
+ * An empty or stale registry is safe by construction: the runtime *adds* to the group class
150
+ * rather than replacing it, so the worst a miss can do is name a class that matches nothing.
151
+ */
152
+ declare function generateGroupRegistry(ctx: Pick<Context, 'encoder' | 'utility'>, classNames?: string[]): {
153
+ js: string;
154
+ dts: string;
155
+ };
156
+ /** Where the registry lives, so the writer and the importer cannot disagree about it. */
157
+ declare const GROUP_REGISTRY_FILE = "groups";
158
+ //#endregion
159
+ export { GROUP_REGISTRY_FILE, Generator, SplitCssArtifact, SplitCssResult, generateGroupRegistry, getThemeCss };