@barocss/kit 0.4.0 → 0.5.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
@@ -1,3 +1,6 @@
1
+ /** Arbitrary property class `[prop:value]` (parser sets token.property). */
2
+ export declare const arbitraryPropertyRegistration: UtilityRegistration;
3
+
1
4
  /**
2
5
  * AST cache management
3
6
  */
@@ -203,6 +206,12 @@ export declare type AstNode = {
203
206
  * default: true (full preflight)
204
207
  */
205
208
  preflight?: PreflightLevel;
209
+ /**
210
+ * Enable kit console diagnostics (off by default).
211
+ * This sets a process-wide flag (see setDebug): it affects every context, and a
212
+ * config without this key leaves the current flag unchanged.
213
+ */
214
+ debug?: boolean;
206
215
  /**
207
216
  * @deprecated Contexts now own their caches. Creating a context does not
208
217
  * clear caches that belong to another context.
@@ -248,6 +257,13 @@ export declare type AstNode = {
248
257
 
249
258
  export declare function escapeClassName(className: string): string;
250
259
 
260
+ /**
261
+ * Add Tailwind-style spacing inside calc()/min()/max()/clamp():
262
+ * `calc(100%-2rem)` -> `calc(100% - 2rem)`. Leaves nested non-math functions
263
+ * (var(--x-y)), unary signs and exponents (1e-3) alone.
264
+ */
265
+ export declare function expandThemeFunctions(value: string): string;
266
+
251
267
  declare type Function_2 = (...args: unknown[]) => unknown;
252
268
 
253
269
  export declare function functionalModifier(match: ModifierRegistration['match'], modifySelector: ModifierRegistration['modifySelector'], wrap?: ModifierRegistration['wrap'], options?: Partial<ModifierRegistration>, ctx?: Context): void;
@@ -536,6 +552,14 @@ export declare type AstNode = {
536
552
 
537
553
  export declare function getUtility(ctx?: Context): UtilityRegistration[];
538
554
 
555
+ /**
556
+ * #224: true when a utility value (or a whole utility token) cannot change the structure of the declaration block it
557
+ * is pasted into. Rejects, outside quotes: `{`, `}`, `;`, unbalanced or mismatched ()/[], and a quote left open.
558
+ * Commas are allowed (values are not selector lists), so this is isSafeVariantValue with top-level commas allowed.
559
+ */
560
+ /** #248: a comment opener or closer anywhere in a variant (quoted or not) could leave a comment unclosed in the output. */
561
+ export declare function hasCommentToken(value: string): boolean;
562
+
539
563
  export declare type HasItems = {
540
564
  items?: AstNode[];
541
565
  };
@@ -763,6 +787,19 @@ export declare type AstNode = {
763
787
  getProcessedClasses(): string[];
764
788
  }
765
789
 
790
+ export declare function isDebug(): boolean;
791
+
792
+ /**
793
+ * #221: isSafeVariantValue for a whole variant token, except that has-[…]/not-[…] (optionally group-/peer-) may
794
+ * carry a comma at the top level of their bracket value: those variants wrap the value in `:has()`/`:not()`.
795
+ * The value itself must still be balanced and free of `{`, `}` and `;`, so it cannot close the pseudo-class.
796
+ */
797
+ export declare function isSafeVariantToken(value: string): boolean;
798
+
799
+ export declare function isSafeVariantValue(value: string, allowTopLevelComma?: boolean): boolean;
800
+
801
+ export declare function isStructureSafeValue(value: string): boolean;
802
+
766
803
  /**
767
804
  * Converts a single BaroJsonInput object into an AST tree.
768
805
  * Bypasses string parsing and directly invokes utility/modifier handlers.
@@ -812,6 +849,8 @@ export declare type AstNode = {
812
849
  source?: string;
813
850
  };
814
851
 
852
+ export declare function normalizeMathSpacing(value: string): string;
853
+
815
854
  /**
816
855
  * optimizeAst
817
856
  * Merges/organizes AST generated by parseClassToAst into an optimized AST tree based on decl-to-root path.
@@ -881,6 +920,8 @@ export declare type AstNode = {
881
920
  opacity?: string;
882
921
  priority?: number;
883
922
  important?: boolean;
923
+ /** Set for an arbitrary property class (`[prop:value]`); `value` holds the raw value. */
924
+ property?: string;
884
925
  [key: string]: unknown;
885
926
  }
886
927
 
@@ -926,13 +967,17 @@ export declare type AstNode = {
926
967
 
927
968
  export declare function resolveTheme(config: Config): Theme;
928
969
 
929
- export declare function rootToCss(nodes: AstNode[]): string;
970
+ export declare function rootToCss(nodes: AstNode[], opts?: {
971
+ minify?: boolean;
972
+ }): string;
930
973
 
931
974
  export declare function rule(selector: string, nodes: AstNode[], source?: string): AstNode;
932
975
 
933
976
  /** Internal hook for caches owned by contexts. */
934
977
  export declare function setContextCacheReset(reset: () => void): void;
935
978
 
979
+ export declare function setDebug(enabled: boolean): void;
980
+
936
981
  /**
937
982
  * staticModifier: A helper that registers a modifier name and an array of CSS selectors directly to the registry
938
983
  *