@barocss/kit 0.8.1 → 0.9.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.ts CHANGED
@@ -289,7 +289,15 @@ export declare type AstNode = {
289
289
 
290
290
  export declare type FunctionalUtilityExtra = {
291
291
  opacity?: string;
292
+ /** The theme key that matched, set when it is a colour key (or the utility lists no `colors` namespace). */
292
293
  realThemeValue?: string;
294
+ /**
295
+ * #338: the theme namespace that resolved the key and the key itself. On a root shared by colours and another
296
+ * namespace (`border-*`: colors + borderWidth), a key from the other namespace leaves `realThemeValue` unset so the
297
+ * colour branch does not claim it; the handler dispatches on `themeNamespace` instead.
298
+ */
299
+ themeNamespace?: string;
300
+ themeKey?: string;
293
301
  };
294
302
 
295
303
  export declare type FunctionalUtilityOptions = {
@@ -568,11 +576,6 @@ export declare type AstNode = {
568
576
  */
569
577
  export declare function hasCommentDelimiter(text: string): boolean;
570
578
 
571
- /**
572
- * #224: true when a utility value (or a whole utility token) cannot change the structure of the declaration block it
573
- * is pasted into. Rejects, outside quotes: `{`, `}`, `;`, unbalanced or mismatched ()/[], and a quote left open.
574
- * Commas are allowed (values are not selector lists), so this is isSafeVariantValue with top-level commas allowed.
575
- */
576
579
  /** #248: a comment opener or closer anywhere in a variant (quoted or not) could leave a comment unclosed in the output. */
577
580
  export declare function hasCommentToken(value: string): boolean;
578
581
 
@@ -817,6 +820,14 @@ export declare type AstNode = {
817
820
  getProcessedClasses(): string[];
818
821
  }
819
822
 
823
+ /**
824
+ * #332: true when an emitted selector or at-rule prelude has balanced, correctly nested `()`, `[]` and `{}` and
825
+ * no open quote. CSS escapes (backslash pairs) and quoted strings are skipped, so escaped brackets from a class
826
+ * name never count. Top-level commas are allowed (selector lists, `:is(a, b)`). Checked on the final composed
827
+ * string: an unbalanced prelude in concatenated CSS text would swallow the rules that follow it.
828
+ */
829
+ export declare function isBalancedPrelude(text: string): boolean;
830
+
820
831
  export declare function isDebug(): boolean;
821
832
 
822
833
  /**
@@ -830,6 +841,19 @@ export declare type AstNode = {
830
841
 
831
842
  export declare function isStructureSafeValue(value: string): boolean;
832
843
 
844
+ /**
845
+ * #224: true when a utility value (or a whole utility token) cannot change the structure of the declaration block it
846
+ * is pasted into. Rejects, outside quotes: `{`, `}`, `;`, unbalanced or mismatched ()/[], and a quote left open.
847
+ * Commas are allowed (values are not selector lists), so this is isSafeVariantValue with top-level commas allowed.
848
+ */
849
+ /**
850
+ * #332: a variant token's bracket groups must be well formed. An empty group (`[]`, as in an empty
851
+ * `has-[]`/`group-has-[]`/`[]` variant) has nothing to select and emits nothing. A token that opens with `[`
852
+ * is one arbitrary variant: its first group must close at the token's last character, so two adjacent groups
853
+ * are never read as a single variant whose inner text is unbalanced. CSS escapes and quoted strings are skipped.
854
+ */
855
+ export declare function isWellFormedVariantBrackets(value: string): boolean;
856
+
833
857
  /**
834
858
  * Converts a single BaroJsonInput object into an AST tree.
835
859
  * Bypasses string parsing and directly invokes utility/modifier handlers.
@@ -1120,6 +1144,12 @@ export declare type AstNode = {
1120
1144
  */
1121
1145
  export declare function themeGetter(themeObj: Theme, ...path: (string | number)[]): unknown;
1122
1146
 
1147
+ /** #300: the literal value of `theme.<namespace>.<key>` when it is a string, else null. */
1148
+ export declare function themeKeyValue(ctx: Context, namespace: string, key: string): string | null;
1149
+
1150
+ /** #300: `var(--<varPrefix>-<key>)` when `theme.<namespace>.<key>` exists (the :root var BaroCSS emits for it), else null. */
1151
+ export declare function themeKeyVar(ctx: Context, namespace: string, key: string, varPrefix: string): string | null;
1152
+
1123
1153
  export declare function themeToCssVars(theme: Theme): string;
1124
1154
 
1125
1155
  export declare interface Token {