@mochi-css/vanilla 2.1.0 → 3.0.1

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/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # 🧁 Mochi-CSS/vanilla
2
2
 
3
3
  This package is part of the [Mochi-CSS project](https://github.com/Niikelion/mochi-css).
4
- It provides type-safe CSS-in-JS styling functions with static extraction support, allowing you to write styles in TypeScript that get extracted to plain CSS at build time.
4
+ It provides type-safe CSS-in-JS styling functions with static extraction support,
5
+ allowing you to write styles in TypeScript that get extracted to plain CSS at build time.
5
6
 
6
7
  ## Installation
7
8
 
@@ -45,7 +46,8 @@ const buttonStyles = css(textStyles, {
45
46
 
46
47
  ### `globalCss(styles)`
47
48
 
48
- `globalCss` injects styles into the global scope they are not scoped to any class and apply to all matching elements. Use it for resets, base typography, or any styles that must target plain HTML elements.
49
+ `globalCss` injects styles into the global scope - they are not scoped to any class and apply to all matching elements.
50
+ Use it for resets, base typography, or any styles that must target plain HTML elements.
49
51
 
50
52
  ```ts
51
53
  import { globalCss } from "@mochi-css/vanilla"
@@ -59,10 +61,11 @@ globalCss({
59
61
 
60
62
  ### `styled(component, ...styles)`
61
63
 
62
- `styled` creates a styled component by combining a base element or component with style definitions. It automatically applies the generated class names and forwards variant props.
64
+ `styled` creates a styled component by combining a base element or component with style definitions.
65
+ It automatically applies the generated class names and forwards variant props.
63
66
 
64
67
  ```tsx
65
- import {styled} from "@mochi-css/vanilla"
68
+ import { styled } from "@mochi-css/react"
66
69
 
67
70
  const Button = styled("button", {
68
71
  borderRadius: 10,
@@ -127,7 +130,8 @@ A style definition is either a bundle of styles returned by `css`, or an object
127
130
 
128
131
  ## Nested Selectors
129
132
 
130
- Mochi-CSS supports nested selectors, allowing you to define styles for child elements, pseudo-classes, and pseudo-elements directly within your style definitions.
133
+ Mochi-CSS supports nested selectors, allowing you to define styles for child elements, pseudo-classes,
134
+ and pseudo-elements directly within your style definitions.
131
135
 
132
136
  The `&` character represents the parent selector and must be included in every nested selector:
133
137
 
@@ -400,11 +404,14 @@ const redButtonStyle = css(baseButtonStyle, {
400
404
  })
401
405
  ```
402
406
 
403
- This works, but requires you to either manually select which style to apply in your component logic, or create separate components for each variant.
404
- Mochi-CSS allows you to define variants directly in your style definition and automatically generates the corresponding props for your component.
407
+ This works, but requires you to either manually select which style to apply in your component logic,
408
+ or create separate components for each variant.
409
+ Mochi-CSS allows you to define variants directly in your style definition
410
+ and automatically generates the corresponding props for your component.
405
411
 
406
412
  ```tsx
407
- import {styled, css} from "@mochi-css/vanilla"
413
+ import { css } from "@mochi-css/vanilla"
414
+ import { styled } from "@mochi-css/react"
408
415
 
409
416
  const buttonStyle = css({
410
417
  border: "2px solid black",
@@ -433,13 +440,16 @@ const SomeComponent = () => <div>
433
440
  </div>
434
441
  ```
435
442
 
436
- `defaultVariants` is optional, but specifying defaults for all variants ensures predictable styling when variant props are omitted.
443
+ `defaultVariants` is optional,
444
+ but specifying defaults for all variants ensures predictable styling when variant props are omitted.
437
445
 
438
446
  ## Tokens
439
447
 
440
- Mochi-CSS provides typed wrappers around CSS variables to help with type safety. Tokens ensure that only valid values are assigned to your CSS variables.
448
+ Mochi-CSS provides typed wrappers around CSS variables to help with type safety.
449
+ Tokens ensure that only valid values are assigned to your CSS variables.
441
450
 
442
- Create tokens using the `createToken<T>(name)` function, where `T` is a CSS value type like `CssColorLike`, `CssLengthLike`, or `string`:
451
+ Create tokens using the `createToken<T>(name)` function,
452
+ where `T` is a CSS value type like `CssColorLike`, `CssLengthLike`, or `string`:
443
453
 
444
454
  ```ts
445
455
  import {createToken, css, CssColorLike} from "@mochi-css/vanilla"
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
- import { ComponentProps, ComponentType, FC, HTMLElementType } from "react";
2
- import { ObsoleteProperties, Properties } from "csstype";
1
+ import { ObsoleteProperties, Properties, PropertiesHyphen } from "csstype";
3
2
 
4
3
  //#region src/values/index.d.ts
5
4
  type CssVar = `--${string}`;
@@ -275,7 +274,6 @@ declare const propertyUnits: {
275
274
  readonly interestDelay: "ms";
276
275
  readonly interestDelayEnd: "ms";
277
276
  readonly interestDelayStart: "ms";
278
- readonly itemFlow: "px";
279
277
  readonly left: "px";
280
278
  readonly letterSpacing: "px";
281
279
  readonly lineHeight: "px";
@@ -415,12 +413,12 @@ declare const propertyUnits: {
415
413
  readonly textSizeAdjust: "%";
416
414
  readonly textUnderlineOffset: "px";
417
415
  readonly timelineTrigger: "px";
418
- readonly timelineTriggerExitRange: "px";
419
- readonly timelineTriggerExitRangeEnd: "px";
420
- readonly timelineTriggerExitRangeStart: "px";
421
- readonly timelineTriggerRange: "px";
422
- readonly timelineTriggerRangeEnd: "px";
423
- readonly timelineTriggerRangeStart: "px";
416
+ readonly timelineTriggerActivationRange: "px";
417
+ readonly timelineTriggerActivationRangeEnd: "px";
418
+ readonly timelineTriggerActivationRangeStart: "px";
419
+ readonly timelineTriggerActiveRange: "px";
420
+ readonly timelineTriggerActiveRangeEnd: "px";
421
+ readonly timelineTriggerActiveRangeStart: "px";
424
422
  readonly top: "px";
425
423
  readonly transformOrigin: "px";
426
424
  readonly transition: "ms";
@@ -450,7 +448,11 @@ type PropsWithUnit = PropertyWithUnit & keyof Props;
450
448
  /**
451
449
  * Converts a kebab-case string to camelCase.
452
450
  */
453
-
451
+ declare function kebabToCamel(str: string): string;
452
+ /**
453
+ * Converts a camelCase string to kebab-case.
454
+ */
455
+ declare function camelToKebab(str: string): string;
454
456
  /**
455
457
  * Checks if a key represents a CSS at-rule (media, container, supports, layer).
456
458
  */
@@ -542,10 +544,11 @@ declare class CssObjectBlock {
542
544
  readonly subBlocks: CssObjectSubBlock[];
543
545
  /**
544
546
  * Creates a new CSS block from style properties.
545
- * Generates a unique class name based on the content hash.
547
+ * Generates a unique class name based on the content hash, or uses the provided class name.
546
548
  * @param styles - The style properties to compile
549
+ * @param className - Optional stable class name; if omitted, a content-hash-based name is generated
547
550
  */
548
- constructor(styles: StyleProps);
551
+ constructor(styles: StyleProps, className?: string);
549
552
  /**
550
553
  * Gets the CSS class selector for this block.
551
554
  */
@@ -632,13 +635,18 @@ declare class CSSObject<V extends AllVariants = DefaultVariants> {
632
635
  /**
633
636
  * Creates a new CSSObject from style props.
634
637
  * Compiles main styles and all variant options into CSS blocks.
638
+ * @param props - Base style props plus variant definitions
639
+ * @param props.variants - Named variant groups, each mapping variant values to style props
640
+ * @param props.defaultVariants - Default value for each variant when none is provided at runtime
641
+ * @param props.compoundVariants - Style props applied when a specific combination of variants is active
642
+ * @param className - Optional stable class name for the main block
635
643
  */
636
644
  constructor({
637
645
  variants,
638
646
  defaultVariants,
639
647
  compoundVariants,
640
648
  ...props
641
- }: MochiCSSProps<V>);
649
+ }: MochiCSSProps<V>, className?: string);
642
650
  /**
643
651
  * Serializes the entire CSS object to a CSS string.
644
652
  * Outputs main block first, then all variant blocks in sorted order.
@@ -649,6 +657,20 @@ declare class CSSObject<V extends AllVariants = DefaultVariants> {
649
657
  //#endregion
650
658
  //#region src/css.d.ts
651
659
  declare function isMochiCSS(value: unknown): value is MochiCSS;
660
+ /**
661
+ * Runtime representation of a CSS style definition with variant support.
662
+ * Holds generated class names and provides methods to compute the final
663
+ * className string based on selected variants.
664
+ *
665
+ * @template V - The variant definitions type mapping variant names to their options
666
+ *
667
+ * @example
668
+ * const styles = MochiCSS.from(new CSSObject({
669
+ * color: 'blue',
670
+ * variants: { size: { small: { fontSize: 12 }, large: { fontSize: 18 } } }
671
+ * }))
672
+ * styles.variant({ size: 'large' }) // Returns combined class names
673
+ */
652
674
  declare class MochiCSS<V extends AllVariants = DefaultVariants> {
653
675
  readonly classNames: string[];
654
676
  readonly variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } };
@@ -669,6 +691,12 @@ declare class MochiCSS<V extends AllVariants = DefaultVariants> {
669
691
  * @returns Combined className string for use in components
670
692
  */
671
693
  variant(props: Partial<RefineVariants<V>>): string;
694
+ /**
695
+ * Returns the CSS selector for this style (e.g. `.abc123`).
696
+ * Useful for targeting this component from another style.
697
+ */
698
+ get selector(): string;
699
+ toString(): string;
672
700
  /**
673
701
  * Creates a MochiCSS instance from a CSSObject.
674
702
  * Extracts class names from the compiled CSS blocks.
@@ -685,46 +713,7 @@ declare class MochiCSS<V extends AllVariants = DefaultVariants> {
685
713
  * @returns A new MochiCSS instance with all styles combined
686
714
  */
687
715
  declare function mergeMochiCss<V extends AllVariants[]>(instances: MochiCSS<AllVariants>[]): MochiCSS<MergeCSSVariants<V>>;
688
- declare function css<V extends AllVariants[]>(...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS }): MochiCSS<MergeCSSVariants<V>>;
689
- //#endregion
690
- //#region src/styled.d.ts
691
- /** Props added by MochiCSS to styled components */
692
- type MochiProps<V extends AllVariants[]> = {
693
- className?: string;
694
- } & Partial<RefineVariants<MergeCSSVariants<V>>>;
695
- /** Minimal interface for components that accept className */
696
- type Cls = {
697
- className?: string;
698
- };
699
- /**
700
- * Creates a styled React component with CSS-in-JS support and variant props.
701
- * Similar to styled-components or Stitches, but with zero runtime overhead.
702
- *
703
- * @template T - The base element type or component type
704
- * @template V - The variant definitions tuple type
705
- * @param target - The HTML element tag name or React component to style
706
- * @param props - One or more style objects with optional variants
707
- * @returns A React functional component with merged props and variant support
708
- *
709
- * @example
710
- * const Button = styled('button', {
711
- * padding: 8,
712
- * borderRadius: 4,
713
- * variants: {
714
- * size: {
715
- * small: { padding: 4 },
716
- * large: { padding: 16 }
717
- * },
718
- * variant: {
719
- * primary: { backgroundColor: 'blue' },
720
- * secondary: { backgroundColor: 'gray' }
721
- * }
722
- * }
723
- * })
724
- *
725
- * // Usage: <Button size="large" variant="primary">Click me</Button>
726
- */
727
- declare function styled<T extends HTMLElementType | ComponentType<Cls>, V extends AllVariants[]>(target: T, ...props: { [K in keyof V]: MochiCSSProps<V[K]> }): FC<Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>>;
716
+ declare function css<V extends AllVariants[]>(...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS | string }): MochiCSS<MergeCSSVariants<V>>;
728
717
  //#endregion
729
718
  //#region src/keyframesObject.d.ts
730
719
  type KeyframeStops = Record<string, SimpleStyleProps>;
@@ -747,7 +736,11 @@ declare class MochiKeyframes {
747
736
  declare function keyframes(stops: KeyframeStops): MochiKeyframes;
748
737
  //#endregion
749
738
  //#region src/globalCssObject.d.ts
750
- type GlobalCssStyles = Record<string, StyleProps>;
739
+ /** CSS properties accepting both camelCase and kebab-case names with permissive string values */
740
+ type GlobalCssProperties = { [K in keyof (Properties & PropertiesHyphen)]?: string | number } & Record<string, unknown>;
741
+ type GlobalCssStyles = {
742
+ [selector: string]: GlobalCssProperties | GlobalCssStyles;
743
+ };
751
744
  /**
752
745
  * CSS object model for global (non-scoped) styles.
753
746
  * Accepts a map of CSS selectors to style objects and serializes them
@@ -821,4 +814,28 @@ interface SupportsHelper {
821
814
  /** Helper for constructing `@supports` at-rule keys. */
822
815
  declare const supports: SupportsHelper;
823
816
  //#endregion
824
- export { AllVariants, type AtRuleKey, CSSObject, CompoundVariant, CssLike, CssLikeObject, CssObjectBlock, CssObjectSubBlock, CssVar, CssVarVal, DefaultVariants, GlobalCssObject, type GlobalCssStyles, type KeyframeStops, KeyframesObject, MergeCSSVariants, MochiCSS, MochiCSSProps, MochiKeyframes, MochiSelector, RefineVariants, type StyleProps, Token, VariantProps, container, createToken, css, cssFromProps, globalCss, isAtRuleKey, isMochiCSS, keyframes, media, mergeMochiCss, styled, supports };
817
+ //#region src/hash.d.ts
818
+ /**
819
+ * Hashing utilities for generating short, deterministic class names.
820
+ * Uses djb2 algorithm for fast string hashing.
821
+ * @module hash
822
+ */
823
+ /**
824
+ * Converts a number to a base-62 string representation.
825
+ * @param num - The number to convert
826
+ * @param maxLength - Optional maximum length of the output string
827
+ * @returns Base-62 encoded string representation of the number
828
+ */
829
+ declare function numberToBase62(num: number, maxLength?: number): string;
830
+ /**
831
+ * Generates a short hash string from input using the djb2 algorithm.
832
+ * Used to create unique, deterministic CSS class names from style content.
833
+ * @param input - The string to hash
834
+ * @param length - Maximum length of the hash output (default: 8)
835
+ * @returns A short, css-safe hash string
836
+ * @example
837
+ * shortHash("color: red;") // Returns something like "A1b2C3d4"
838
+ */
839
+ declare function shortHash(input: string, length?: number): string;
840
+ //#endregion
841
+ export { AllVariants, type AtRuleKey, CSSObject, CompoundVariant, CssLike, CssLikeObject, CssObjectBlock, CssObjectSubBlock, CssVar, CssVarVal, DefaultVariants, GlobalCssObject, GlobalCssProperties, type GlobalCssStyles, type KeyframeStops, KeyframesObject, MergeCSSVariants, MochiCSS, MochiCSSProps, MochiKeyframes, MochiSelector, RefineVariantType, RefineVariants, type StyleProps, Token, VariantProps, camelToKebab, container, createToken, css, cssFromProps, globalCss, isAtRuleKey, isMochiCSS, kebabToCamel, keyframes, media, mergeMochiCss, numberToBase62, shortHash, supports };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { ObsoleteProperties, Properties } from "csstype";
2
- import { ComponentProps, ComponentType, FC, HTMLElementType } from "react";
1
+ import { ObsoleteProperties, Properties, PropertiesHyphen } from "csstype";
3
2
 
4
3
  //#region src/values/index.d.ts
5
4
  type CssVar = `--${string}`;
@@ -275,7 +274,6 @@ declare const propertyUnits: {
275
274
  readonly interestDelay: "ms";
276
275
  readonly interestDelayEnd: "ms";
277
276
  readonly interestDelayStart: "ms";
278
- readonly itemFlow: "px";
279
277
  readonly left: "px";
280
278
  readonly letterSpacing: "px";
281
279
  readonly lineHeight: "px";
@@ -415,12 +413,12 @@ declare const propertyUnits: {
415
413
  readonly textSizeAdjust: "%";
416
414
  readonly textUnderlineOffset: "px";
417
415
  readonly timelineTrigger: "px";
418
- readonly timelineTriggerExitRange: "px";
419
- readonly timelineTriggerExitRangeEnd: "px";
420
- readonly timelineTriggerExitRangeStart: "px";
421
- readonly timelineTriggerRange: "px";
422
- readonly timelineTriggerRangeEnd: "px";
423
- readonly timelineTriggerRangeStart: "px";
416
+ readonly timelineTriggerActivationRange: "px";
417
+ readonly timelineTriggerActivationRangeEnd: "px";
418
+ readonly timelineTriggerActivationRangeStart: "px";
419
+ readonly timelineTriggerActiveRange: "px";
420
+ readonly timelineTriggerActiveRangeEnd: "px";
421
+ readonly timelineTriggerActiveRangeStart: "px";
424
422
  readonly top: "px";
425
423
  readonly transformOrigin: "px";
426
424
  readonly transition: "ms";
@@ -450,7 +448,11 @@ type PropsWithUnit = PropertyWithUnit & keyof Props;
450
448
  /**
451
449
  * Converts a kebab-case string to camelCase.
452
450
  */
453
-
451
+ declare function kebabToCamel(str: string): string;
452
+ /**
453
+ * Converts a camelCase string to kebab-case.
454
+ */
455
+ declare function camelToKebab(str: string): string;
454
456
  /**
455
457
  * Checks if a key represents a CSS at-rule (media, container, supports, layer).
456
458
  */
@@ -542,10 +544,11 @@ declare class CssObjectBlock {
542
544
  readonly subBlocks: CssObjectSubBlock[];
543
545
  /**
544
546
  * Creates a new CSS block from style properties.
545
- * Generates a unique class name based on the content hash.
547
+ * Generates a unique class name based on the content hash, or uses the provided class name.
546
548
  * @param styles - The style properties to compile
549
+ * @param className - Optional stable class name; if omitted, a content-hash-based name is generated
547
550
  */
548
- constructor(styles: StyleProps);
551
+ constructor(styles: StyleProps, className?: string);
549
552
  /**
550
553
  * Gets the CSS class selector for this block.
551
554
  */
@@ -632,13 +635,18 @@ declare class CSSObject<V extends AllVariants = DefaultVariants> {
632
635
  /**
633
636
  * Creates a new CSSObject from style props.
634
637
  * Compiles main styles and all variant options into CSS blocks.
638
+ * @param props - Base style props plus variant definitions
639
+ * @param props.variants - Named variant groups, each mapping variant values to style props
640
+ * @param props.defaultVariants - Default value for each variant when none is provided at runtime
641
+ * @param props.compoundVariants - Style props applied when a specific combination of variants is active
642
+ * @param className - Optional stable class name for the main block
635
643
  */
636
644
  constructor({
637
645
  variants,
638
646
  defaultVariants,
639
647
  compoundVariants,
640
648
  ...props
641
- }: MochiCSSProps<V>);
649
+ }: MochiCSSProps<V>, className?: string);
642
650
  /**
643
651
  * Serializes the entire CSS object to a CSS string.
644
652
  * Outputs main block first, then all variant blocks in sorted order.
@@ -649,6 +657,20 @@ declare class CSSObject<V extends AllVariants = DefaultVariants> {
649
657
  //#endregion
650
658
  //#region src/css.d.ts
651
659
  declare function isMochiCSS(value: unknown): value is MochiCSS;
660
+ /**
661
+ * Runtime representation of a CSS style definition with variant support.
662
+ * Holds generated class names and provides methods to compute the final
663
+ * className string based on selected variants.
664
+ *
665
+ * @template V - The variant definitions type mapping variant names to their options
666
+ *
667
+ * @example
668
+ * const styles = MochiCSS.from(new CSSObject({
669
+ * color: 'blue',
670
+ * variants: { size: { small: { fontSize: 12 }, large: { fontSize: 18 } } }
671
+ * }))
672
+ * styles.variant({ size: 'large' }) // Returns combined class names
673
+ */
652
674
  declare class MochiCSS<V extends AllVariants = DefaultVariants> {
653
675
  readonly classNames: string[];
654
676
  readonly variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } };
@@ -669,6 +691,12 @@ declare class MochiCSS<V extends AllVariants = DefaultVariants> {
669
691
  * @returns Combined className string for use in components
670
692
  */
671
693
  variant(props: Partial<RefineVariants<V>>): string;
694
+ /**
695
+ * Returns the CSS selector for this style (e.g. `.abc123`).
696
+ * Useful for targeting this component from another style.
697
+ */
698
+ get selector(): string;
699
+ toString(): string;
672
700
  /**
673
701
  * Creates a MochiCSS instance from a CSSObject.
674
702
  * Extracts class names from the compiled CSS blocks.
@@ -685,46 +713,7 @@ declare class MochiCSS<V extends AllVariants = DefaultVariants> {
685
713
  * @returns A new MochiCSS instance with all styles combined
686
714
  */
687
715
  declare function mergeMochiCss<V extends AllVariants[]>(instances: MochiCSS<AllVariants>[]): MochiCSS<MergeCSSVariants<V>>;
688
- declare function css<V extends AllVariants[]>(...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS }): MochiCSS<MergeCSSVariants<V>>;
689
- //#endregion
690
- //#region src/styled.d.ts
691
- /** Props added by MochiCSS to styled components */
692
- type MochiProps<V extends AllVariants[]> = {
693
- className?: string;
694
- } & Partial<RefineVariants<MergeCSSVariants<V>>>;
695
- /** Minimal interface for components that accept className */
696
- type Cls = {
697
- className?: string;
698
- };
699
- /**
700
- * Creates a styled React component with CSS-in-JS support and variant props.
701
- * Similar to styled-components or Stitches, but with zero runtime overhead.
702
- *
703
- * @template T - The base element type or component type
704
- * @template V - The variant definitions tuple type
705
- * @param target - The HTML element tag name or React component to style
706
- * @param props - One or more style objects with optional variants
707
- * @returns A React functional component with merged props and variant support
708
- *
709
- * @example
710
- * const Button = styled('button', {
711
- * padding: 8,
712
- * borderRadius: 4,
713
- * variants: {
714
- * size: {
715
- * small: { padding: 4 },
716
- * large: { padding: 16 }
717
- * },
718
- * variant: {
719
- * primary: { backgroundColor: 'blue' },
720
- * secondary: { backgroundColor: 'gray' }
721
- * }
722
- * }
723
- * })
724
- *
725
- * // Usage: <Button size="large" variant="primary">Click me</Button>
726
- */
727
- declare function styled<T extends HTMLElementType | ComponentType<Cls>, V extends AllVariants[]>(target: T, ...props: { [K in keyof V]: MochiCSSProps<V[K]> }): FC<Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>>;
716
+ declare function css<V extends AllVariants[]>(...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS | string }): MochiCSS<MergeCSSVariants<V>>;
728
717
  //#endregion
729
718
  //#region src/keyframesObject.d.ts
730
719
  type KeyframeStops = Record<string, SimpleStyleProps>;
@@ -747,7 +736,11 @@ declare class MochiKeyframes {
747
736
  declare function keyframes(stops: KeyframeStops): MochiKeyframes;
748
737
  //#endregion
749
738
  //#region src/globalCssObject.d.ts
750
- type GlobalCssStyles = Record<string, StyleProps>;
739
+ /** CSS properties accepting both camelCase and kebab-case names with permissive string values */
740
+ type GlobalCssProperties = { [K in keyof (Properties & PropertiesHyphen)]?: string | number } & Record<string, unknown>;
741
+ type GlobalCssStyles = {
742
+ [selector: string]: GlobalCssProperties | GlobalCssStyles;
743
+ };
751
744
  /**
752
745
  * CSS object model for global (non-scoped) styles.
753
746
  * Accepts a map of CSS selectors to style objects and serializes them
@@ -821,5 +814,29 @@ interface SupportsHelper {
821
814
  /** Helper for constructing `@supports` at-rule keys. */
822
815
  declare const supports: SupportsHelper;
823
816
  //#endregion
824
- export { AllVariants, type AtRuleKey, CSSObject, CompoundVariant, CssLike, CssLikeObject, CssObjectBlock, CssObjectSubBlock, CssVar, CssVarVal, DefaultVariants, GlobalCssObject, type GlobalCssStyles, type KeyframeStops, KeyframesObject, MergeCSSVariants, MochiCSS, MochiCSSProps, MochiKeyframes, MochiSelector, RefineVariants, type StyleProps, Token, VariantProps, container, createToken, css, cssFromProps, globalCss, isAtRuleKey, isMochiCSS, keyframes, media, mergeMochiCss, styled, supports };
817
+ //#region src/hash.d.ts
818
+ /**
819
+ * Hashing utilities for generating short, deterministic class names.
820
+ * Uses djb2 algorithm for fast string hashing.
821
+ * @module hash
822
+ */
823
+ /**
824
+ * Converts a number to a base-62 string representation.
825
+ * @param num - The number to convert
826
+ * @param maxLength - Optional maximum length of the output string
827
+ * @returns Base-62 encoded string representation of the number
828
+ */
829
+ declare function numberToBase62(num: number, maxLength?: number): string;
830
+ /**
831
+ * Generates a short hash string from input using the djb2 algorithm.
832
+ * Used to create unique, deterministic CSS class names from style content.
833
+ * @param input - The string to hash
834
+ * @param length - Maximum length of the hash output (default: 8)
835
+ * @returns A short, css-safe hash string
836
+ * @example
837
+ * shortHash("color: red;") // Returns something like "A1b2C3d4"
838
+ */
839
+ declare function shortHash(input: string, length?: number): string;
840
+ //#endregion
841
+ export { AllVariants, type AtRuleKey, CSSObject, CompoundVariant, CssLike, CssLikeObject, CssObjectBlock, CssObjectSubBlock, CssVar, CssVarVal, DefaultVariants, GlobalCssObject, GlobalCssProperties, type GlobalCssStyles, type KeyframeStops, KeyframesObject, MergeCSSVariants, MochiCSS, MochiCSSProps, MochiKeyframes, MochiSelector, RefineVariantType, RefineVariants, type StyleProps, Token, VariantProps, camelToKebab, container, createToken, css, cssFromProps, globalCss, isAtRuleKey, isMochiCSS, kebabToCamel, keyframes, media, mergeMochiCss, numberToBase62, shortHash, supports };
825
842
  //# sourceMappingURL=index.d.ts.map