@mochi-css/vanilla 1.0.1 → 1.1.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/README.md +5 -0
- package/dist/index.d.mts +43 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.js +57 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -386,6 +386,8 @@ const fadeInStyle = css({
|
|
|
386
386
|
For more control over animation timing, use percentage-based stops:
|
|
387
387
|
|
|
388
388
|
```ts
|
|
389
|
+
import { keyframes, css } from "@mochi-css/vanilla"
|
|
390
|
+
|
|
389
391
|
const bounce = keyframes({
|
|
390
392
|
"0%": { transform: "translateY(0)" },
|
|
391
393
|
"50%": { transform: "translateY(-20px)" },
|
|
@@ -402,6 +404,8 @@ const bouncingElement = css({
|
|
|
402
404
|
Each stop can contain multiple CSS properties with auto-units:
|
|
403
405
|
|
|
404
406
|
```ts
|
|
407
|
+
import { keyframes } from "@mochi-css/vanilla"
|
|
408
|
+
|
|
405
409
|
const grow = keyframes({
|
|
406
410
|
from: {
|
|
407
411
|
opacity: 0,
|
|
@@ -414,3 +418,4 @@ const grow = keyframes({
|
|
|
414
418
|
fontSize: 24 // becomes 24px
|
|
415
419
|
}
|
|
416
420
|
})
|
|
421
|
+
```
|
package/dist/index.d.mts
CHANGED
|
@@ -689,6 +689,13 @@ declare class MochiCSS<V extends AllVariants = DefaultVariants> {
|
|
|
689
689
|
*/
|
|
690
690
|
static from<V extends AllVariants = DefaultVariants>(object: CSSObject<V>): MochiCSS<V>;
|
|
691
691
|
}
|
|
692
|
+
/**
|
|
693
|
+
* Merges multiple MochiCSS instances into a single one, combining their
|
|
694
|
+
* class names, variant class names, and default variants.
|
|
695
|
+
* @param instances - The MochiCSS instances to merge
|
|
696
|
+
* @returns A new MochiCSS instance with all styles combined
|
|
697
|
+
*/
|
|
698
|
+
declare function mergeMochiCss<V extends AllVariants[]>(instances: MochiCSS<AllVariants>[]): MochiCSS<MergeCSSVariants<V>>;
|
|
692
699
|
declare function css<V extends AllVariants[]>(...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS }): MochiCSS<MergeCSSVariants<V>>;
|
|
693
700
|
//#endregion
|
|
694
701
|
//#region src/styled.d.ts
|
|
@@ -750,5 +757,40 @@ declare class MochiKeyframes {
|
|
|
750
757
|
}
|
|
751
758
|
declare function keyframes(stops: KeyframeStops): MochiKeyframes;
|
|
752
759
|
//#endregion
|
|
753
|
-
|
|
760
|
+
//#region src/globalCssObject.d.ts
|
|
761
|
+
type GlobalCssStyles = Record<string, StyleProps>;
|
|
762
|
+
/**
|
|
763
|
+
* CSS object model for global (non-scoped) styles.
|
|
764
|
+
* Accepts a map of CSS selectors to style objects and serializes them
|
|
765
|
+
* as plain CSS rules without class name scoping.
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* const obj = new GlobalCssObject({
|
|
769
|
+
* body: { margin: 0 },
|
|
770
|
+
* 'h1': { fontSize: 32 },
|
|
771
|
+
* })
|
|
772
|
+
* obj.asCssString() // "body {\n margin: 0;\n}\n\nh1 {\n font-size: 32px;\n}"
|
|
773
|
+
*/
|
|
774
|
+
declare class GlobalCssObject {
|
|
775
|
+
private readonly rules;
|
|
776
|
+
constructor(styles: GlobalCssStyles);
|
|
777
|
+
asCssString(): string;
|
|
778
|
+
}
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/globalCss.d.ts
|
|
781
|
+
/**
|
|
782
|
+
* Creates a global CSS definition.
|
|
783
|
+
* Styles are not scoped to any class — they apply to all matching elements.
|
|
784
|
+
*
|
|
785
|
+
* @param styles - Map of CSS selectors to style objects
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* globalCss({
|
|
789
|
+
* 'body': { margin: 0, padding: 0 },
|
|
790
|
+
* '*, *::before, *::after': { boxSizing: 'border-box' },
|
|
791
|
+
* })
|
|
792
|
+
*/
|
|
793
|
+
declare function globalCss(styles: GlobalCssStyles): void;
|
|
794
|
+
//#endregion
|
|
795
|
+
export { AllVariants, 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, createToken, css, cssFromProps, globalCss, keyframes, mergeMochiCss, styled };
|
|
754
796
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -689,6 +689,13 @@ declare class MochiCSS<V extends AllVariants = DefaultVariants> {
|
|
|
689
689
|
*/
|
|
690
690
|
static from<V extends AllVariants = DefaultVariants>(object: CSSObject<V>): MochiCSS<V>;
|
|
691
691
|
}
|
|
692
|
+
/**
|
|
693
|
+
* Merges multiple MochiCSS instances into a single one, combining their
|
|
694
|
+
* class names, variant class names, and default variants.
|
|
695
|
+
* @param instances - The MochiCSS instances to merge
|
|
696
|
+
* @returns A new MochiCSS instance with all styles combined
|
|
697
|
+
*/
|
|
698
|
+
declare function mergeMochiCss<V extends AllVariants[]>(instances: MochiCSS<AllVariants>[]): MochiCSS<MergeCSSVariants<V>>;
|
|
692
699
|
declare function css<V extends AllVariants[]>(...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS }): MochiCSS<MergeCSSVariants<V>>;
|
|
693
700
|
//#endregion
|
|
694
701
|
//#region src/styled.d.ts
|
|
@@ -750,5 +757,40 @@ declare class MochiKeyframes {
|
|
|
750
757
|
}
|
|
751
758
|
declare function keyframes(stops: KeyframeStops): MochiKeyframes;
|
|
752
759
|
//#endregion
|
|
753
|
-
|
|
760
|
+
//#region src/globalCssObject.d.ts
|
|
761
|
+
type GlobalCssStyles = Record<string, StyleProps>;
|
|
762
|
+
/**
|
|
763
|
+
* CSS object model for global (non-scoped) styles.
|
|
764
|
+
* Accepts a map of CSS selectors to style objects and serializes them
|
|
765
|
+
* as plain CSS rules without class name scoping.
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* const obj = new GlobalCssObject({
|
|
769
|
+
* body: { margin: 0 },
|
|
770
|
+
* 'h1': { fontSize: 32 },
|
|
771
|
+
* })
|
|
772
|
+
* obj.asCssString() // "body {\n margin: 0;\n}\n\nh1 {\n font-size: 32px;\n}"
|
|
773
|
+
*/
|
|
774
|
+
declare class GlobalCssObject {
|
|
775
|
+
private readonly rules;
|
|
776
|
+
constructor(styles: GlobalCssStyles);
|
|
777
|
+
asCssString(): string;
|
|
778
|
+
}
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/globalCss.d.ts
|
|
781
|
+
/**
|
|
782
|
+
* Creates a global CSS definition.
|
|
783
|
+
* Styles are not scoped to any class — they apply to all matching elements.
|
|
784
|
+
*
|
|
785
|
+
* @param styles - Map of CSS selectors to style objects
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* globalCss({
|
|
789
|
+
* 'body': { margin: 0, padding: 0 },
|
|
790
|
+
* '*, *::before, *::after': { boxSizing: 'border-box' },
|
|
791
|
+
* })
|
|
792
|
+
*/
|
|
793
|
+
declare function globalCss(styles: GlobalCssStyles): void;
|
|
794
|
+
//#endregion
|
|
795
|
+
export { AllVariants, 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, createToken, css, cssFromProps, globalCss, keyframes, mergeMochiCss, styled };
|
|
754
796
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -940,6 +940,16 @@ var MochiCSS = class MochiCSS {
|
|
|
940
940
|
* const combined = css(baseStyles, additionalStyles)
|
|
941
941
|
*/
|
|
942
942
|
const emptyMochiCSS = new MochiCSS([], {}, {});
|
|
943
|
+
/**
|
|
944
|
+
* Merges multiple MochiCSS instances into a single one, combining their
|
|
945
|
+
* class names, variant class names, and default variants.
|
|
946
|
+
* @param instances - The MochiCSS instances to merge
|
|
947
|
+
* @returns A new MochiCSS instance with all styles combined
|
|
948
|
+
*/
|
|
949
|
+
function mergeMochiCss(instances) {
|
|
950
|
+
if (instances.length === 0) return emptyMochiCSS;
|
|
951
|
+
return new MochiCSS(instances.flatMap((c) => c.classNames), instances.reduce((a, b) => Object.assign(a, b.variantClassNames), {}), instances.reduce((a, b) => Object.assign(a, b.defaultVariants), {}));
|
|
952
|
+
}
|
|
943
953
|
function css(...props) {
|
|
944
954
|
const cssToMerge = [];
|
|
945
955
|
for (const p of props) {
|
|
@@ -947,8 +957,7 @@ function css(...props) {
|
|
|
947
957
|
if (p instanceof MochiCSS) cssToMerge.push(p);
|
|
948
958
|
else cssToMerge.push(MochiCSS.from(new CSSObject(p)));
|
|
949
959
|
}
|
|
950
|
-
|
|
951
|
-
return new MochiCSS(cssToMerge.flatMap((css$1) => css$1.classNames), cssToMerge.reduce((a, b) => Object.assign(a, b.variantClassNames), {}), cssToMerge.reduce((a, b) => Object.assign(a, b.defaultVariants), {}));
|
|
960
|
+
return mergeMochiCss(cssToMerge);
|
|
952
961
|
}
|
|
953
962
|
|
|
954
963
|
//#endregion
|
|
@@ -1029,10 +1038,54 @@ function keyframes(stops) {
|
|
|
1029
1038
|
return MochiKeyframes.from(new KeyframesObject(stops));
|
|
1030
1039
|
}
|
|
1031
1040
|
|
|
1041
|
+
//#endregion
|
|
1042
|
+
//#region src/globalCssObject.ts
|
|
1043
|
+
/**
|
|
1044
|
+
* CSS object model for global (non-scoped) styles.
|
|
1045
|
+
* Accepts a map of CSS selectors to style objects and serializes them
|
|
1046
|
+
* as plain CSS rules without class name scoping.
|
|
1047
|
+
*
|
|
1048
|
+
* @example
|
|
1049
|
+
* const obj = new GlobalCssObject({
|
|
1050
|
+
* body: { margin: 0 },
|
|
1051
|
+
* 'h1': { fontSize: 32 },
|
|
1052
|
+
* })
|
|
1053
|
+
* obj.asCssString() // "body {\n margin: 0;\n}\n\nh1 {\n font-size: 32px;\n}"
|
|
1054
|
+
*/
|
|
1055
|
+
var GlobalCssObject = class {
|
|
1056
|
+
rules;
|
|
1057
|
+
constructor(styles) {
|
|
1058
|
+
this.rules = Object.entries(styles).toSorted(compareStringKey).map(([selector, props]) => ({
|
|
1059
|
+
selector,
|
|
1060
|
+
subBlocks: [...CssObjectSubBlock.fromProps(props)]
|
|
1061
|
+
}));
|
|
1062
|
+
}
|
|
1063
|
+
asCssString() {
|
|
1064
|
+
return this.rules.flatMap(({ selector, subBlocks }) => subBlocks.map((b) => b.asCssString(selector))).join("\n\n");
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
//#endregion
|
|
1069
|
+
//#region src/globalCss.ts
|
|
1070
|
+
/**
|
|
1071
|
+
* Creates a global CSS definition.
|
|
1072
|
+
* Styles are not scoped to any class — they apply to all matching elements.
|
|
1073
|
+
*
|
|
1074
|
+
* @param styles - Map of CSS selectors to style objects
|
|
1075
|
+
*
|
|
1076
|
+
* @example
|
|
1077
|
+
* globalCss({
|
|
1078
|
+
* 'body': { margin: 0, padding: 0 },
|
|
1079
|
+
* '*, *::before, *::after': { boxSizing: 'border-box' },
|
|
1080
|
+
* })
|
|
1081
|
+
*/
|
|
1082
|
+
function globalCss(styles) {}
|
|
1083
|
+
|
|
1032
1084
|
//#endregion
|
|
1033
1085
|
exports.CSSObject = CSSObject;
|
|
1034
1086
|
exports.CssObjectBlock = CssObjectBlock;
|
|
1035
1087
|
exports.CssObjectSubBlock = CssObjectSubBlock;
|
|
1088
|
+
exports.GlobalCssObject = GlobalCssObject;
|
|
1036
1089
|
exports.KeyframesObject = KeyframesObject;
|
|
1037
1090
|
exports.MochiCSS = MochiCSS;
|
|
1038
1091
|
exports.MochiKeyframes = MochiKeyframes;
|
|
@@ -1041,6 +1094,8 @@ exports.Token = Token;
|
|
|
1041
1094
|
exports.createToken = createToken;
|
|
1042
1095
|
exports.css = css;
|
|
1043
1096
|
exports.cssFromProps = cssFromProps;
|
|
1097
|
+
exports.globalCss = globalCss;
|
|
1044
1098
|
exports.keyframes = keyframes;
|
|
1099
|
+
exports.mergeMochiCss = mergeMochiCss;
|
|
1045
1100
|
exports.styled = styled;
|
|
1046
1101
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["name: string","properties","cssSelectors: string[]","mediaSelectors: string[]","cssProps: Record<string, string>","selector: MochiSelector","propsToProcess: { key: string; selector: MochiSelector; props: StyleProps }[]","props","selector","classNames: string[]","variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } }","defaultVariants: Partial<RefineVariants<V>>","cssToMerge: MochiCSS<AllVariants>[]","css","name: string"],"sources":["../src/token.ts","../src/propertyUnits.generated.ts","../src/props.ts","../src/selector.ts","../src/hash.ts","../src/compare.ts","../src/cssObject.ts","../src/css.ts","../src/styled.ts","../src/keyframesObject.ts","../src/keyframes.ts"],"sourcesContent":["/**\n * CSS custom property (design token) utilities.\n * Provides type-safe access to CSS variables with proper `var()` syntax.\n * @module token\n */\n\nimport { CssVar, CssVarVal } from \"@/values\"\n\n/**\n * Represents a CSS custom property (design token) with type information.\n * Provides convenient access to both the variable name and its `var()` reference.\n * @template T - The expected value type of the token (for type checking)\n * @example\n * const primaryColor = new Token<string>('primary-color')\n * primaryColor.variable // '--primary-color'\n * primaryColor.value // 'var(--primary-color)'\n */\nexport class Token {\n /**\n * Creates a new CSS token.\n * @param name - The token name (without the `--` prefix)\n */\n constructor(public readonly name: string) {}\n\n /**\n * Gets the CSS custom property name (with `--` prefix).\n * Use this when defining the variable.\n */\n get variable(): CssVar {\n return `--${this.name}`\n }\n\n /**\n * Gets the CSS `var()` reference to this token.\n * Use this when consuming the variable value.\n */\n get value(): CssVarVal {\n return `var(${this.variable})`\n }\n\n /**\n * Returns the variable name for string coercion.\n */\n toString(): CssVar {\n return this.variable\n }\n}\n\n/**\n * Creates a new CSS design token.\n * @template T - The expected value type of the token\n * @param name - The token name (without the `--` prefix)\n * @returns A new Token instance\n * @example\n * const spacing = createToken<number>('spacing-md')\n * // Use in styles: { gap: spacing.value }\n */\nexport function createToken(name: string): Token {\n return new Token(name)\n}\n","// Auto-generated from @webref/css - do not edit manually\n// Run \"yarn build\" to regenerate\n\nexport const propertyUnits = {\n animation: \"ms\",\n animationDelay: \"ms\",\n animationDuration: \"ms\",\n animationRange: \"px\",\n animationRangeCenter: \"px\",\n animationRangeEnd: \"px\",\n animationRangeStart: \"px\",\n background: \"px\",\n backgroundPosition: \"px\",\n backgroundPositionBlock: \"px\",\n backgroundPositionInline: \"px\",\n backgroundPositionX: \"px\",\n backgroundPositionY: \"px\",\n backgroundSize: \"px\",\n backgroundTbd: \"px\",\n baselineShift: \"px\",\n blockSize: \"px\",\n blockStep: \"px\",\n blockStepSize: \"px\",\n border: \"px\",\n borderBlock: \"px\",\n borderBlockClip: \"px\",\n borderBlockEnd: \"px\",\n borderBlockEndClip: \"px\",\n borderBlockEndRadius: \"px\",\n borderBlockEndWidth: \"px\",\n borderBlockStart: \"px\",\n borderBlockStartClip: \"px\",\n borderBlockStartRadius: \"px\",\n borderBlockStartWidth: \"px\",\n borderBlockWidth: \"px\",\n borderBottom: \"px\",\n borderBottomClip: \"px\",\n borderBottomLeftRadius: \"px\",\n borderBottomRadius: \"px\",\n borderBottomRightRadius: \"px\",\n borderBottomWidth: \"px\",\n borderClip: \"px\",\n borderEndEndRadius: \"px\",\n borderEndStartRadius: \"px\",\n borderImage: \"%\",\n borderImageOutset: \"px\",\n borderImageSlice: \"%\",\n borderImageWidth: \"px\",\n borderInline: \"px\",\n borderInlineClip: \"px\",\n borderInlineEnd: \"px\",\n borderInlineEndClip: \"px\",\n borderInlineEndRadius: \"px\",\n borderInlineEndWidth: \"px\",\n borderInlineStart: \"px\",\n borderInlineStartClip: \"px\",\n borderInlineStartRadius: \"px\",\n borderInlineStartWidth: \"px\",\n borderInlineWidth: \"px\",\n borderLeft: \"px\",\n borderLeftClip: \"px\",\n borderLeftRadius: \"px\",\n borderLeftWidth: \"px\",\n borderLimit: \"px\",\n borderRadius: \"px\",\n borderRight: \"px\",\n borderRightClip: \"px\",\n borderRightRadius: \"px\",\n borderRightWidth: \"px\",\n borderSpacing: \"px\",\n borderStartEndRadius: \"px\",\n borderStartStartRadius: \"px\",\n borderTop: \"px\",\n borderTopClip: \"px\",\n borderTopLeftRadius: \"px\",\n borderTopRadius: \"px\",\n borderTopRightRadius: \"px\",\n borderTopWidth: \"px\",\n borderWidth: \"px\",\n bottom: \"px\",\n boxShadow: \"px\",\n boxShadowBlur: \"px\",\n boxShadowOffset: \"px\",\n boxShadowSpread: \"px\",\n columnGap: \"px\",\n columnHeight: \"px\",\n columnRule: \"px\",\n columnRuleEdgeInset: \"px\",\n columnRuleEdgeInsetEnd: \"px\",\n columnRuleEdgeInsetStart: \"px\",\n columnRuleInset: \"px\",\n columnRuleInsetEnd: \"px\",\n columnRuleInsetStart: \"px\",\n columnRuleInteriorInset: \"px\",\n columnRuleInteriorInsetEnd: \"px\",\n columnRuleInteriorInsetStart: \"px\",\n columnRuleWidth: \"px\",\n columns: \"px\",\n columnWidth: \"px\",\n containIntrinsicBlockSize: \"px\",\n containIntrinsicHeight: \"px\",\n containIntrinsicInlineSize: \"px\",\n containIntrinsicSize: \"px\",\n containIntrinsicWidth: \"px\",\n corner: \"px\",\n cornerBlockEnd: \"px\",\n cornerBlockStart: \"px\",\n cornerBottom: \"px\",\n cornerBottomLeft: \"px\",\n cornerBottomRight: \"px\",\n cornerEndEnd: \"px\",\n cornerEndStart: \"px\",\n cornerInlineEnd: \"px\",\n cornerInlineStart: \"px\",\n cornerLeft: \"px\",\n cornerRight: \"px\",\n cornerStartEnd: \"px\",\n cornerStartStart: \"px\",\n cornerTop: \"px\",\n cornerTopLeft: \"px\",\n cornerTopRight: \"px\",\n cx: \"px\",\n cy: \"px\",\n fillOpacity: \"%\",\n fillPosition: \"px\",\n fillSize: \"px\",\n flex: \"px\",\n flexBasis: \"px\",\n floatOffset: \"px\",\n floodOpacity: \"%\",\n flowTolerance: \"px\",\n font: \"deg\",\n fontSize: \"px\",\n fontStretch: \"%\",\n fontStyle: \"deg\",\n fontWidth: \"%\",\n gap: \"px\",\n grid: \"px\",\n gridAutoColumns: \"px\",\n gridAutoRows: \"px\",\n gridColumnGap: \"px\",\n gridGap: \"px\",\n gridRowGap: \"px\",\n gridTemplate: \"px\",\n gridTemplateColumns: \"px\",\n gridTemplateRows: \"px\",\n height: \"px\",\n hyphenateLimitZone: \"px\",\n imageOrientation: \"deg\",\n imageResolution: \"dppx\",\n initialLetterWrap: \"px\",\n inlineSize: \"px\",\n inset: \"px\",\n insetBlock: \"px\",\n insetBlockEnd: \"px\",\n insetBlockStart: \"px\",\n insetInline: \"px\",\n insetInlineEnd: \"px\",\n insetInlineStart: \"px\",\n interestDelay: \"ms\",\n interestDelayEnd: \"ms\",\n interestDelayStart: \"ms\",\n itemFlow: \"px\",\n left: \"px\",\n letterSpacing: \"px\",\n lineHeight: \"px\",\n lineHeightStep: \"px\",\n linePadding: \"px\",\n margin: \"px\",\n marginBlock: \"px\",\n marginBlockEnd: \"px\",\n marginBlockStart: \"px\",\n marginBottom: \"px\",\n marginInline: \"px\",\n marginInlineEnd: \"px\",\n marginInlineStart: \"px\",\n marginLeft: \"px\",\n marginRight: \"px\",\n marginTop: \"px\",\n mask: \"px\",\n maskBorder: \"%\",\n maskBorderOutset: \"px\",\n maskBorderSlice: \"%\",\n maskBorderWidth: \"px\",\n maskPosition: \"px\",\n maskSize: \"px\",\n maxBlockSize: \"px\",\n maxHeight: \"px\",\n maxInlineSize: \"px\",\n maxWidth: \"px\",\n minBlockSize: \"px\",\n minHeight: \"px\",\n minInlineSize: \"px\",\n minWidth: \"px\",\n objectPosition: \"px\",\n offset: \"px\",\n offsetAnchor: \"px\",\n offsetDistance: \"px\",\n offsetPosition: \"px\",\n offsetRotate: \"deg\",\n opacity: \"%\",\n outline: \"px\",\n outlineOffset: \"px\",\n outlineWidth: \"px\",\n overflowClipMargin: \"px\",\n overflowClipMarginBlock: \"px\",\n overflowClipMarginBlockEnd: \"px\",\n overflowClipMarginBlockStart: \"px\",\n overflowClipMarginBottom: \"px\",\n overflowClipMarginInline: \"px\",\n overflowClipMarginInlineEnd: \"px\",\n overflowClipMarginInlineStart: \"px\",\n overflowClipMarginLeft: \"px\",\n overflowClipMarginRight: \"px\",\n overflowClipMarginTop: \"px\",\n padding: \"px\",\n paddingBlock: \"px\",\n paddingBlockEnd: \"px\",\n paddingBlockStart: \"px\",\n paddingBottom: \"px\",\n paddingInline: \"px\",\n paddingInlineEnd: \"px\",\n paddingInlineStart: \"px\",\n paddingLeft: \"px\",\n paddingRight: \"px\",\n paddingTop: \"px\",\n pause: \"ms\",\n pauseAfter: \"ms\",\n pauseBefore: \"ms\",\n perspective: \"px\",\n perspectiveOrigin: \"px\",\n r: \"px\",\n rest: \"ms\",\n restAfter: \"ms\",\n restBefore: \"ms\",\n right: \"px\",\n rotate: \"deg\",\n rowGap: \"px\",\n rowRule: \"px\",\n rowRuleEdgeInset: \"px\",\n rowRuleEdgeInsetEnd: \"px\",\n rowRuleEdgeInsetStart: \"px\",\n rowRuleInset: \"px\",\n rowRuleInsetEnd: \"px\",\n rowRuleInsetStart: \"px\",\n rowRuleInteriorInset: \"px\",\n rowRuleInteriorInsetEnd: \"px\",\n rowRuleInteriorInsetStart: \"px\",\n rowRuleWidth: \"px\",\n rule: \"px\",\n ruleEdgeInset: \"px\",\n ruleInset: \"px\",\n ruleInsetEnd: \"px\",\n ruleInsetStart: \"px\",\n ruleInteriorInset: \"px\",\n ruleWidth: \"px\",\n rx: \"px\",\n ry: \"px\",\n scale: \"%\",\n scrollMargin: \"px\",\n scrollMarginBlock: \"px\",\n scrollMarginBlockEnd: \"px\",\n scrollMarginBlockStart: \"px\",\n scrollMarginBottom: \"px\",\n scrollMarginInline: \"px\",\n scrollMarginInlineEnd: \"px\",\n scrollMarginInlineStart: \"px\",\n scrollMarginLeft: \"px\",\n scrollMarginRight: \"px\",\n scrollMarginTop: \"px\",\n scrollPadding: \"px\",\n scrollPaddingBlock: \"px\",\n scrollPaddingBlockEnd: \"px\",\n scrollPaddingBlockStart: \"px\",\n scrollPaddingBottom: \"px\",\n scrollPaddingInline: \"px\",\n scrollPaddingInlineEnd: \"px\",\n scrollPaddingInlineStart: \"px\",\n scrollPaddingLeft: \"px\",\n scrollPaddingRight: \"px\",\n scrollPaddingTop: \"px\",\n shapeImageThreshold: \"%\",\n shapeMargin: \"px\",\n shapePadding: \"px\",\n stopOpacity: \"%\",\n strokeDasharray: \"px\",\n strokeDashcorner: \"px\",\n strokeDashCorner: \"px\",\n strokeDashoffset: \"px\",\n strokeOpacity: \"%\",\n strokePosition: \"px\",\n strokeSize: \"px\",\n strokeWidth: \"px\",\n tabSize: \"px\",\n textDecoration: \"px\",\n textDecorationInset: \"px\",\n textDecorationThickness: \"px\",\n textIndent: \"px\",\n textShadow: \"px\",\n textSizeAdjust: \"%\",\n textUnderlineOffset: \"px\",\n timelineTrigger: \"px\",\n timelineTriggerExitRange: \"px\",\n timelineTriggerExitRangeEnd: \"px\",\n timelineTriggerExitRangeStart: \"px\",\n timelineTriggerRange: \"px\",\n timelineTriggerRangeEnd: \"px\",\n timelineTriggerRangeStart: \"px\",\n top: \"px\",\n transformOrigin: \"px\",\n transition: \"ms\",\n transitionDelay: \"ms\",\n transitionDuration: \"ms\",\n translate: \"px\",\n verticalAlign: \"px\",\n viewTimeline: \"px\",\n viewTimelineInset: \"px\",\n voiceDuration: \"ms\",\n voicePitch: \"Hz\",\n voiceRange: \"Hz\",\n voiceRate: \"%\",\n width: \"px\",\n wordSpacing: \"px\",\n x: \"px\",\n y: \"px\",\n zoom: \"%\",\n} as const\n\nexport type PropertyWithUnit = keyof typeof propertyUnits\n","/**\n * CSS property handling and type definitions.\n * Provides type-safe mappings from JavaScript objects to CSS properties,\n * with automatic unit conversion and value formatting.\n * @module props\n */\n\nimport { Properties, ObsoleteProperties } from \"csstype\"\nimport { CssLike, CssVar } from \"@/values\"\nimport properties from \"known-css-properties\"\nimport { propertyUnits, type PropertyWithUnit } from \"./propertyUnits.generated\"\n\n/** All non-obsolete CSS properties from csstype */\ntype Props = Required<Omit<Properties, keyof ObsoleteProperties>>\n\n/** Properties that have default units and are valid CSS properties */\ntype PropsWithUnit = PropertyWithUnit & keyof Props\n\n/**\n * Converts a kebab-case string to camelCase.\n */\nexport function kebabToCamel(str: string): string {\n return str.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())\n}\n\n/**\n * Converts a camelCase string to kebab-case.\n */\nexport function camelToKebab(str: string): string {\n return str.replace(/[A-Z]/g, (m) => \"-\" + m.toLowerCase())\n}\n\nfunction getUnitForProperty(propertyName: string): string | undefined {\n return propertyName in propertyUnits ? propertyUnits[propertyName as PropertyWithUnit] : undefined\n}\n\n/**\n * Converts a CSS-like value to its string representation.\n * For properties with known units, numbers are automatically suffixed.\n */\nfunction formatValue(value: CssLike<string | number>, propertyName: string, maxDepth = 10): string {\n if (maxDepth <= 0) return \"\"\n if (typeof value === \"string\") return value\n if (typeof value === \"number\") {\n const unit = getUnitForProperty(propertyName)\n if (unit === \"%\") return `${value * 100}${unit}`\n if (value === 0) return \"0\"\n return unit ? `${value}${unit}` : value.toString()\n }\n return formatValue(value.value, propertyName, maxDepth - 1)\n}\n\n//TODO: generate this list and drop known-css-properties package\nconst knownPropertySet = new Set<string>(properties.all.map(kebabToCamel))\n\n/**\n * Checks if a property name is a CSS custom property (variable).\n */\nexport function isCssVariableName(key: string): key is CssVar {\n return key.startsWith(\"--\")\n}\n\n/**\n * Converts a CSS-like value to a string for use as a CSS variable value.\n * @param value - The value to convert (string, number, or wrapped value)\n * @param maxDepth - Maximum recursion depth for evaluating the value\n * @returns The string representation\n */\nexport function asVar(value: CssLike<string | number>, maxDepth = 10): string {\n if (maxDepth <= 0) return \"\"\n switch (typeof value) {\n case \"string\":\n return value\n case \"number\":\n return value.toString()\n default:\n return asVar(value.value, maxDepth - 1)\n }\n}\n\n/**\n * Checks if a property name is a known CSS property.\n */\nexport function isKnownPropertyName(key: string): key is keyof Props {\n return knownPropertySet.has(key)\n}\n\n/**\n * Converts a value to a CSS property string.\n * Automatically appends units to numeric values for properties that require them.\n * @param value - The value to convert\n * @param key - The CSS property name\n * @returns The formatted CSS value string\n */\nexport function asKnownProp(value: unknown, key: keyof Props): string {\n return formatValue(value as CssLike<string | number>, key)\n}\n\n/**\n * Checks if a key represents a nested CSS selector.\n */\n//TODO: make better validation, provide human readable errors\nexport function isNestedSelector(key: string): key is NestedCssSelector {\n return key.includes(\"&\")\n}\n\n/**\n * Checks if a key represents a media query.\n */\n//TODO: make better validation, provide human readable errors\nexport function isMediaSelector(key: string): key is MediaSelector {\n return key.startsWith(\"@\")\n}\n\n/** A nested CSS selector pattern containing the parent reference `&` */\nexport type NestedCssSelector = `${string}&${string}`\n\n/** A CSS media query starting with `@` */\nexport type MediaSelector = `@${string}`\n\ntype NestedStyleKeys = MediaSelector | NestedCssSelector\n\n/**\n * Style properties without nesting support.\n * Includes all standard CSS properties with type-safe value converters,\n * plus CSS custom properties (variables).\n *\n * Properties with known units (e.g., width, height, padding) accept numbers\n * that are automatically converted with their default unit (e.g., px, ms).\n */\nexport type SimpleStyleProps = { [K in PropsWithUnit]?: CssLike<number | Props[K]> } & {\n [K in Exclude<keyof Props, PropsWithUnit>]?: CssLike<Props[K]>\n} & Partial<Record<CssVar, CssLike<string | number>>>\n\n/**\n * Full style properties type with support for nested selectors and media queries.\n * Extends SimpleStyleProps to allow recursive style definitions.\n *\n * @example\n * const styles: StyleProps = {\n * color: 'blue',\n * padding: 16,\n * '&:hover': { color: 'red' },\n * '@min-width: 768px': { padding: 24 }\n * }\n */\nexport type StyleProps = SimpleStyleProps & { [K in NestedStyleKeys]?: StyleProps | CssLike<string | number> }\n\n/**\n * Converts a SimpleStyleProps object to a CSS properties record.\n * Transforms camelCase property names to kebab-case and applies value converters.\n * @param props - The style properties object\n * @returns A record of CSS property names (kebab-case) to string values\n * @example\n * cssFromProps({ backgroundColor: 'blue', padding: 16 })\n * // { 'background-color': 'blue', 'padding': '16px' }\n */\nexport function cssFromProps(props: SimpleStyleProps): Record<string, string> {\n return Object.fromEntries(\n Object.entries(props)\n .map(([key, value]): [string, string] | undefined => {\n if (value === undefined) return undefined\n // transform variable\n if (isCssVariableName(key)) return [key, asVar(value as CssLike<string | number>)]\n // transform CSS prop\n if (isKnownPropertyName(key)) return [camelToKebab(key), asKnownProp(value, key)]\n return undefined\n })\n .filter((v) => v !== undefined),\n )\n}\n","/**\n * CSS selector building and manipulation utilities.\n * Handles nested selectors (using `&` placeholder) and media queries.\n * @module selector\n */\n\nimport { isMediaSelector, isNestedSelector } from \"@/props\"\n\n/**\n * Immutable CSS selector builder that handles nested selectors and media queries.\n * Uses the `&` character as a placeholder for parent selector substitution.\n *\n * @example\n * const selector = new MochiSelector(['.button'])\n * selector.extend('&:hover').cssSelector // '.button:hover'\n * selector.wrap('@media (min-width: 768px)').mediaQuery // '@media (min-width: 768px)'\n */\nexport class MochiSelector {\n /**\n * Creates a new MochiSelector instance.\n * @param cssSelectors - Array of CSS selectors (may contain `&` placeholders)\n * @param mediaSelectors - Array of media query conditions (without `@media` prefix)\n */\n constructor(\n private readonly cssSelectors: string[] = [],\n private readonly mediaSelectors: string[] = [],\n ) {}\n\n /**\n * Gets the combined CSS selector string.\n * Multiple selectors are joined with commas.\n * @returns The CSS selector, or \"*\" if no selectors are defined\n */\n get cssSelector(): string {\n if (this.cssSelectors.length === 0) return \"*\"\n return this.cssSelectors.join(\", \")\n }\n\n /**\n * Gets the combined media query string, if any.\n * @returns The full `@media` query string, or undefined if no media conditions\n */\n get mediaQuery(): string | undefined {\n if (this.mediaSelectors.length === 0) return undefined\n return `@media ${this.mediaSelectors.map((s) => `(${s})`).join(\" and \")}`\n }\n\n /**\n * Substitutes all `&` placeholders with the given root selector.\n * @param root - The selector to replace `&` with\n * @returns A new MochiSelector with substituted selectors\n */\n substitute(root: string): MochiSelector {\n return new MochiSelector(\n this.cssSelectors.map((selector) => selector.replace(/&/g, root)),\n this.mediaSelectors,\n )\n }\n\n /**\n * Extends this selector by nesting a child selector.\n * The `&` in the child selector is replaced with each parent selector.\n * @param child - The child selector pattern (must contain `&`)\n * @returns A new MochiSelector with the extended selectors\n * @example\n * new MochiSelector(['.btn']).extend('&:hover') // '.btn:hover'\n * new MochiSelector(['.btn']).extend('& .icon') // '.btn .icon'\n */\n extend(child: string): MochiSelector {\n if (!isNestedSelector(child)) return this\n const children = MochiSelector.split(child)\n const selectors = this.cssSelectors.flatMap((parentSelector) =>\n children.map((childSelector) => {\n return childSelector.replace(/&/g, parentSelector)\n }),\n )\n return new MochiSelector(selectors, this.mediaSelectors)\n }\n\n /**\n * Wraps this selector with a media query condition.\n * @param mediaQuery - The media query string (starting with `@`)\n * @returns A new MochiSelector with the added media condition\n * @example\n * selector.wrap('@min-width: 768px') // Adds media query condition\n */\n wrap(mediaQuery: string): MochiSelector {\n if (!isMediaSelector(mediaQuery)) return this\n const mediaQueryPart = mediaQuery.substring(1)\n return new MochiSelector(this.cssSelectors, [...this.mediaSelectors, mediaQueryPart])\n }\n\n /**\n * Splits a comma-separated selector string into individual selectors.\n * @param selector - The selector string to split\n * @returns Array of individual selector strings\n */\n private static split(selector: string): string[] {\n return [selector]\n }\n}\n","/**\n * Hashing utilities for generating short, deterministic class names.\n * Uses djb2 algorithm for fast string hashing.\n * @module hash\n */\n\n/** Characters used for base-62 encoding (css-name safe variant of base-64) */\nconst hashBase = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\"\nconst base = hashBase.length\n\n/**\n * Converts a number to a base-62 string representation.\n * @param num - The number to convert\n * @param maxLength - Optional maximum length of the output string\n * @returns Base-62 encoded string representation of the number\n */\nexport function numberToBase62(num: number, maxLength?: number): string {\n let out = \"\"\n while (num > 0 && out.length < (maxLength ?? Infinity)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n out = hashBase[num % base]! + out\n num = Math.floor(num / base)\n }\n return out.length > 0 ? out : \"0\"\n}\n\n/**\n * Generates a short hash string from input using the djb2 algorithm.\n * Used to create unique, deterministic CSS class names from style content.\n * @param input - The string to hash\n * @param length - Maximum length of the hash output (default: 8)\n * @returns A short, css-safe hash string\n * @example\n * shortHash(\"color: red;\") // Returns something like \"A1b2C3d4\"\n */\nexport function shortHash(input: string, length = 8): string {\n // fast 32-bit integer hash (djb2 variant)\n let h = 5381\n for (let i = 0; i < input.length; i++) {\n h = (h * 33) ^ input.charCodeAt(i)\n }\n // force unsigned\n h >>>= 0\n\n return numberToBase62(h, length)\n}\n","/**\n * String comparison utilities for deterministic sorting.\n * Used internally to ensure consistent CSS output order.\n * @module compare\n */\n\n/**\n * Compares two strings lexicographically.\n */\nexport function compareString<T extends string>(a: T, b: T) {\n return a < b ? -1 : a === b ? 0 : 1\n}\n\n/**\n * Compares two tuples by their first element (string key).\n * Useful for sorting Object.entries() results.\n */\nexport function compareStringKey<T extends [string, unknown]>(a: T, b: T) {\n return compareString(a[0], b[0])\n}\n\n/**\n * Creates a comparator function for objects with a specific string property.\n * @param name - The property name to compare by\n * @returns A comparator function that compares objects by the specified property\n * @example\n * const items = [{ key: 'b' }, { key: 'a' }]\n * items.sort(stringPropComparator('key')) // [{ key: 'a' }, { key: 'b' }]\n */\nexport function stringPropComparator<N extends string>(name: N) {\n return <T extends Record<N, string>>(a: T, b: T) => compareString(a[name], b[name])\n}\n","/**\n * CSS object model for representing and serializing styles.\n * Converts JavaScript style objects into CSS blocks with proper\n * selector handling, nesting support, and deterministic output.\n * @module cssObject\n */\n\nimport {\n asKnownProp,\n asVar,\n camelToKebab,\n isCssVariableName,\n isKnownPropertyName,\n isMediaSelector,\n isNestedSelector,\n StyleProps,\n} from \"@/props\"\nimport { shortHash } from \"@/hash\"\nimport { MochiSelector } from \"@/selector\"\nimport { compareStringKey, stringPropComparator } from \"@/compare\"\n\n/**\n * Represents a single CSS rule block with properties and a selector.\n * Handles conversion to CSS string format and hash generation.\n */\nexport class CssObjectSubBlock {\n /**\n * Creates a new CSS sub-block.\n * @param cssProps - Map of CSS property names (kebab-case) to values\n * @param selector - The selector this block applies to\n */\n constructor(\n public readonly cssProps: Record<string, string>,\n public readonly selector: MochiSelector,\n ) {}\n\n /**\n * Computes a deterministic hash of this block's CSS content.\n * Used for generating unique class names.\n */\n get hash(): string {\n const str = this.asCssString(\"&\")\n return shortHash(str)\n }\n\n /**\n * Converts this block to a CSS string.\n * Handles media query wrapping if the selector has media conditions.\n * @param root - The root selector to substitute for `&`\n * @returns Formatted CSS string\n */\n asCssString(root: string): string {\n const selector = this.selector.substitute(root)\n const mediaQuery = selector.mediaQuery\n\n const mediaIndent = mediaQuery === undefined ? \"\" : \" \"\n\n const props = Object.entries(this.cssProps)\n .toSorted(compareStringKey)\n .map(([k, v]) => `${mediaIndent} ${k}: ${v};\\n`)\n .join(\"\")\n\n const blockCss = `${mediaIndent}${selector.cssSelector} {\\n${props}${mediaIndent}}`\n\n return mediaQuery === undefined ? blockCss : `${mediaQuery} {\\n${blockCss}\\n}`\n }\n\n /**\n * Parses StyleProps into an array of CSS sub-blocks.\n * Recursively processes nested selectors and media queries.\n * Output order is deterministic for consistent hash generation.\n *\n * @param props - The style properties to parse\n * @param selector - The parent selector context (defaults to `&`)\n * @returns Non-empty array of sub-blocks (main block first, then nested)\n */\n static fromProps(props: StyleProps, selector?: MochiSelector): [CssObjectSubBlock, ...CssObjectSubBlock[]] {\n selector ??= new MochiSelector([\"&\"])\n\n const cssProps: Record<string, string> = {}\n const propsToProcess: { key: string; selector: MochiSelector; props: StyleProps }[] = []\n\n for (const [key, value] of Object.entries(props)) {\n // skip undefined value\n if (value === undefined) continue\n\n // transform variable\n if (isCssVariableName(key)) {\n cssProps[key] = asVar(value as StyleProps[typeof key] & {})\n continue\n }\n\n // transform known CSS prop\n if (isKnownPropertyName(key)) {\n cssProps[camelToKebab(key)] = asKnownProp(value, key)\n continue\n }\n\n // transform nested and media selectors\n if (isNestedSelector(key)) {\n propsToProcess.push({\n key,\n props: value as StyleProps,\n selector: selector.extend(key),\n })\n continue\n }\n\n // transform media selector\n if (isMediaSelector(key)) {\n propsToProcess.push({\n key,\n props: value as StyleProps,\n selector: selector.wrap(key),\n })\n continue\n }\n\n if (process.env[\"NODE_ENV\"] !== \"production\") {\n console.warn(`[mochi-css] Unknown style property \"${key}\" will be ignored`)\n }\n }\n\n return [\n new CssObjectSubBlock(cssProps, selector),\n ...propsToProcess\n .toSorted(stringPropComparator(\"key\"))\n .flatMap(({ props, selector }) => CssObjectSubBlock.fromProps(props, selector)),\n ] as const\n }\n}\n\n/**\n * Represents an abstract CSS block definition.\n * Contains one or more sub-blocks for nested selectors and media queries.\n */\nexport class CssObjectBlock {\n /** The generated unique class name for this block */\n public readonly className: string\n /** All sub-blocks (main styles and nested/media rules) */\n public readonly subBlocks: CssObjectSubBlock[] = []\n\n /**\n * Creates a new CSS block from style properties.\n * Generates a unique class name based on the content hash.\n * @param styles - The style properties to compile\n */\n constructor(styles: StyleProps) {\n const blocks = CssObjectSubBlock.fromProps(styles)\n\n this.className = \"c\" + shortHash(blocks.map((b) => b.hash).join(\"+\"))\n this.subBlocks = blocks\n }\n\n /**\n * Gets the CSS class selector for this block.\n */\n get selector(): string {\n return `.${this.className}`\n }\n\n /**\n * Converts style block to a CSS string.\n * @param root - The root selector to scope styles to\n * @returns Complete CSS string for this block\n */\n asCssString(root: string): string {\n return this.subBlocks\n .map((b) => b.asCssString(new MochiSelector([root]).extend(`&.${this.className}`).cssSelector))\n .join(\"\\n\\n\")\n }\n}\n\nexport type AllVariants = Record<string, Record<string, StyleProps>>\nexport type DefaultVariants = Record<never, Record<string, StyleProps>>\n\n/**\n * A compound variant entry that applies styles when multiple variant conditions match.\n * Each entry specifies a set of variant conditions and a `css` property with styles\n * that apply only when all conditions are satisfied simultaneously.\n *\n * @template V - The variant definitions type\n *\n * @example\n * { color: 'red', size: 'large', css: { fontWeight: 'bold' } }\n */\nexport type CompoundVariant<V extends AllVariants> = {\n [K in keyof V]?: keyof V[K]\n} & { css: StyleProps }\n\n/**\n * Refines string literal types to their proper runtime types.\n * Converts \"true\"/\"false\" strings to boolean literals.\n */\ntype RefineVariantType<T extends string> = T extends \"true\"\n ? true\n : T extends \"false\"\n ? false\n : T extends string\n ? T\n : string\n\n/**\n * Props for defining variants in a style object.\n * @template V - The variant definitions type\n */\nexport type VariantProps<V extends AllVariants> = {\n /** Variant definitions mapping names to options to styles */\n variants?: V\n /** Default variant selections for when not explicitly provided */\n defaultVariants?: { [K in keyof V]?: keyof V[K] extends string ? RefineVariantType<keyof V[K] & string> : never }\n /** Compound variant definitions that apply when multiple variant conditions match */\n compoundVariants?: CompoundVariant<V>[]\n}\n\n/** Combined type for style props with optional variants */\nexport type MochiCSSProps<V extends AllVariants> = StyleProps & VariantProps<V>\n\n/** Utility type to override properties of A with properties of B */\ntype Override<A extends object, B extends object> = B & Omit<A, keyof B>\n\n/** Recursively merges variant types from a tuple, with later types overriding earlier */\nexport type MergeCSSVariants<V extends AllVariants[]> = V extends [\n infer V1 extends AllVariants,\n ...infer VRest extends AllVariants[],\n]\n ? Override<V1, MergeCSSVariants<VRest>>\n : DefaultVariants\n\n/** Refines all values in a string record to their proper variant types */\ntype RefineVariantTypes<V extends Record<string, string>> = { [K in keyof V]: RefineVariantType<V[K]> }\n\n/** Extracts and refines variant option types from a DefaultVariants definition */\nexport type RefineVariants<T extends AllVariants> = RefineVariantTypes<{ [K in keyof T]: keyof T[K] & string }>\n\n/**\n * Complete CSS object representation with main and variant styles.\n *\n * @template V - The variant definitions type\n *\n * @example\n * const obj = new CSSObject({\n * color: 'blue',\n * variants: {\n * size: {\n * small: { fontSize: 12 },\n * large: { fontSize: 18 }\n * }\n * },\n * defaultVariants: { size: 'small' }\n * })\n * obj.asCssString() // Returns complete CSS with all variants\n */\nexport class CSSObject<V extends AllVariants = DefaultVariants> {\n /** The main style block (non-variant styles) */\n public readonly mainBlock: CssObjectBlock\n /** Compiled blocks for each variant option */\n public readonly variantBlocks: { [K in keyof V & string]: Record<keyof V[K] & string, CssObjectBlock> }\n /** Default variant selections */\n public readonly variantDefaults: Partial<RefineVariants<V>>\n /** Compound variant conditions and their parsed sub-blocks */\n public readonly compoundVariants: { conditions: Record<string, string>; subBlocks: CssObjectSubBlock[] }[]\n\n /**\n * Creates a new CSSObject from style props.\n * Compiles main styles and all variant options into CSS blocks.\n */\n public constructor({ variants, defaultVariants, compoundVariants, ...props }: MochiCSSProps<V>) {\n this.mainBlock = new CssObjectBlock(props)\n this.variantBlocks = {} as typeof this.variantBlocks\n this.variantDefaults = defaultVariants ?? {}\n this.compoundVariants = []\n\n if (variants) {\n for (const variantGroupName in variants) {\n this.variantBlocks[variantGroupName] =\n {} as (typeof this.variantBlocks)[keyof typeof this.variantBlocks]\n const variantGroup = variants[variantGroupName]\n for (const variantItemName in variantGroup) {\n this.variantBlocks[variantGroupName][variantItemName] = new CssObjectBlock(\n variantGroup[variantItemName] ?? {},\n )\n }\n }\n }\n\n if (compoundVariants) {\n for (const compound of compoundVariants) {\n const { css: styles, ...conditions } = compound\n this.compoundVariants.push({\n conditions: conditions as Record<string, string>,\n subBlocks: CssObjectSubBlock.fromProps(styles),\n })\n }\n }\n }\n\n /**\n * Serializes the entire CSS object to a CSS string.\n * Outputs main block first, then all variant blocks in sorted order.\n * @returns Complete CSS string ready for injection into a stylesheet\n */\n public asCssString(): string {\n return [\n this.mainBlock.asCssString(this.mainBlock.selector),\n ...Object.entries(this.variantBlocks)\n .toSorted(compareStringKey)\n .flatMap(([_, b]) => Object.entries(b).toSorted(compareStringKey))\n .map(([_, b]) => b.asCssString(this.mainBlock.selector)),\n ...this.compoundVariants.map(({ conditions, subBlocks }) => {\n const variantSelectors = Object.entries(conditions)\n .toSorted(compareStringKey)\n .map(([variantName, optionName]) => {\n const block = this.variantBlocks[variantName]?.[optionName]\n return block?.selector ?? \"\"\n })\n .filter(Boolean)\n .join(\"\")\n const combinedSelector = `${this.mainBlock.selector}${variantSelectors}`\n return subBlocks.map((b) => b.asCssString(combinedSelector)).join(\"\\n\\n\")\n }),\n ].join(\"\\n\\n\")\n }\n}\n","/**\n * Core CSS-in-JS runtime for generating and applying styles.\n * Provides the main `css` function and `MochiCSS` class for style management.\n * @module css\n */\n\nimport clsx from \"clsx\"\nimport { CSSObject, AllVariants, DefaultVariants, MergeCSSVariants, MochiCSSProps, RefineVariants } from \"@/cssObject\"\n\n/**\n * Runtime representation of a CSS style definition with variant support.\n * Holds generated class names and provides methods to compute the final\n * className string based on selected variants.\n *\n * @template V - The variant definitions type mapping variant names to their options\n *\n * @example\n * const styles = MochiCSS.from(new CSSObject({\n * color: 'blue',\n * variants: { size: { small: { fontSize: 12 }, large: { fontSize: 18 } } }\n * }))\n * styles.variant({ size: 'large' }) // Returns combined class names\n */\nexport class MochiCSS<V extends AllVariants = DefaultVariants> {\n /**\n * Creates a new MochiCSS instance.\n * @param classNames - Base class names to always include\n * @param variantClassNames - Mapping of variant names to option class names\n * @param defaultVariants - Default variant selections when not specified\n */\n constructor(\n public readonly classNames: string[],\n public readonly variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } },\n public readonly defaultVariants: Partial<RefineVariants<V>>,\n ) {}\n\n /**\n * Computes the final className string based on variant selections.\n * Compound variants are handled purely via CSS combined selectors,\n * so no runtime matching is needed here.\n * @param props - Variant selections\n * @returns Combined className string for use in components\n */\n variant(props: Partial<RefineVariants<V>>): string {\n const keys = new Set<keyof V & string>(\n [...Object.keys(props), ...Object.keys(this.defaultVariants)].filter((k) => k in this.variantClassNames),\n )\n\n return clsx(\n this.classNames,\n ...keys.values().map((k) => {\n const variantGroup = this.variantClassNames[k]\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!variantGroup) return false\n\n const variantKey = ((k in props ? props[k] : undefined) ?? this.defaultVariants[k])?.toString()\n if (variantKey == null) return false\n\n const selectedClassname = variantGroup[variantKey]\n if (selectedClassname !== undefined) return selectedClassname\n\n const defaultKey = this.defaultVariants[k]\n if (defaultKey == null) return false\n\n return variantGroup[defaultKey.toString()]\n }),\n )\n }\n\n /**\n * Creates a MochiCSS instance from a CSSObject.\n * Extracts class names from the compiled CSS blocks.\n * @template V - The variant definitions type\n * @param object - The compiled CSSObject to extract from\n * @returns A new MochiCSS instance with the extracted class names\n */\n static from<V extends AllVariants = DefaultVariants>(object: CSSObject<V>): MochiCSS<V> {\n return new MochiCSS<V>(\n [object.mainBlock.className],\n Object.fromEntries(\n Object.entries(object.variantBlocks).map(([key, variantOptions]) => {\n return [\n key,\n Object.fromEntries(\n Object.entries(variantOptions).map(([optionKey, block]) => {\n return [optionKey, block.className]\n }),\n ),\n ]\n }),\n ) as { [K in keyof V]: { [P in keyof V[K]]: string } },\n object.variantDefaults,\n )\n }\n}\n\n/**\n * Creates a CSS style definition.\n * The primary API for defining styles in Mochi-CSS.\n *\n * @template V - Tuple of variant definition types\n * @param props - One or more style objects or existing MochiCSS instances to merge\n * @returns A MochiCSS instance with all styles and variants combined\n *\n * @example\n * // Simple usage\n * const button = css({ padding: 8, borderRadius: 4 })\n *\n * @example\n * // With variants\n * const button = css({\n * padding: 8,\n * variants: {\n * size: {\n * small: { padding: 4 },\n * large: { padding: 16 }\n * }\n * },\n * defaultVariants: { size: 'small' }\n * })\n * button.variant({ size: 'large' }) // Get class names for large size\n *\n * @example\n * // Merging multiple styles\n * const combined = css(baseStyles, additionalStyles)\n */\nconst emptyMochiCSS = new MochiCSS<AllVariants>([], {}, {})\n\nexport function css<V extends AllVariants[]>(\n ...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS }\n): MochiCSS<MergeCSSVariants<V>> {\n const cssToMerge: MochiCSS<AllVariants>[] = []\n for (const p of props) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (p == null || typeof p !== \"object\") continue\n if (p instanceof MochiCSS) {\n cssToMerge.push(p)\n } else {\n cssToMerge.push(MochiCSS.from(new CSSObject<AllVariants>(p)))\n }\n }\n\n if (cssToMerge.length === 0) return emptyMochiCSS as MochiCSS<MergeCSSVariants<V>>\n\n return new MochiCSS<AllVariants>(\n cssToMerge.flatMap((css) => css.classNames),\n cssToMerge.reduce((a, b) => Object.assign(a, b.variantClassNames), {}),\n cssToMerge.reduce((a, b) => Object.assign(a, b.defaultVariants), {}),\n ) as MochiCSS<MergeCSSVariants<V>>\n}\n","/**\n * React styled component utilities.\n * Creates styled components with CSS-in-JS support and variant props.\n * @module styled\n */\n\nimport { ComponentProps, ComponentType, createElement, FC, HTMLElementType } from \"react\"\nimport { css } from \"@/css\"\nimport clsx from \"clsx\"\nimport { AllVariants, MergeCSSVariants, MochiCSSProps, RefineVariants } from \"@/cssObject\"\n\n/** Props added by MochiCSS to styled components */\ntype MochiProps<V extends AllVariants[]> = {\n className?: string\n} & Partial<RefineVariants<MergeCSSVariants<V>>>\n\n/** Minimal interface for components that accept className */\ntype Cls = { className?: string }\n\n/**\n * Creates a styled React component with CSS-in-JS support and variant props.\n * Similar to styled-components or Stitches, but with zero runtime overhead.\n *\n * @template T - The base element type or component type\n * @template V - The variant definitions tuple type\n * @param target - The HTML element tag name or React component to style\n * @param props - One or more style objects with optional variants\n * @returns A React functional component with merged props and variant support\n *\n * @example\n * const Button = styled('button', {\n * padding: 8,\n * borderRadius: 4,\n * variants: {\n * size: {\n * small: { padding: 4 },\n * large: { padding: 16 }\n * },\n * variant: {\n * primary: { backgroundColor: 'blue' },\n * secondary: { backgroundColor: 'gray' }\n * }\n * }\n * })\n *\n * // Usage: <Button size=\"large\" variant=\"primary\">Click me</Button>\n */\n//TODO: Move to dedicated \"styled\" package\nexport function styled<T extends HTMLElementType | ComponentType<Cls>, V extends AllVariants[]>(\n target: T,\n ...props: { [K in keyof V]: MochiCSSProps<V[K]> }\n): FC<Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>> {\n const styles = css<V>(...props)\n return ({ className, ...p }: Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>) =>\n //TODO: pick only variant props from p\n //TODO: omit variant props in p\n createElement(target, {\n className: clsx(styles.variant(p as unknown as Parameters<typeof styles.variant>[0]), className),\n ...p,\n })\n}\n","import { shortHash } from \"@/hash\"\nimport { cssFromProps, SimpleStyleProps } from \"@/props\"\nimport { compareStringKey } from \"@/compare\"\n\nexport type KeyframeStops = Record<string, SimpleStyleProps>\n\nexport class KeyframesObject {\n public readonly name: string\n private readonly body: string\n\n constructor(stops: KeyframeStops) {\n this.body = KeyframesObject.generateBody(stops)\n this.name = \"kf\" + shortHash(this.body)\n }\n\n asCssString(): string {\n return `@keyframes ${this.name} {\\n${this.body}\\n}`\n }\n\n private static generateBody(stops: KeyframeStops): string {\n return Object.entries(stops)\n .toSorted(compareStringKey)\n .map(([stopKey, props]) => {\n const cssProps = cssFromProps(props)\n const propsStr = Object.entries(cssProps)\n .toSorted(compareStringKey)\n .map(([k, v]) => ` ${k}: ${v};`)\n .join(\"\\n\")\n return ` ${stopKey} {\\n${propsStr}\\n }`\n })\n .join(\"\\n\\n\")\n }\n}\n","import { KeyframesObject, type KeyframeStops } from \"@/keyframesObject\"\nexport type { KeyframeStops } from \"@/keyframesObject\"\n\nexport class MochiKeyframes {\n constructor(public readonly name: string) {}\n\n toString(): string {\n return this.name\n }\n\n get value(): string {\n return this.name\n }\n\n static from(object: KeyframesObject): MochiKeyframes {\n return new MochiKeyframes(object.name)\n }\n}\n\nexport function keyframes(stops: KeyframeStops): MochiKeyframes {\n return MochiKeyframes.from(new KeyframesObject(stops))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAa,QAAb,MAAmB;;;;;CAKf,YAAY,AAAgBA,MAAc;EAAd;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AAK;;CAGhB,IAAI,QAAgB;AAChB,SAAO,KAAK;;CAGhB,OAAO,KAAK,QAAyC;AACjD,SAAO,IAAI,eAAe,OAAO,KAAK;;;AAI9C,SAAgB,UAAU,OAAsC;AAC5D,QAAO,eAAe,KAAK,IAAI,gBAAgB,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["name: string","properties","cssSelectors: string[]","mediaSelectors: string[]","cssProps: Record<string, string>","selector: MochiSelector","propsToProcess: { key: string; selector: MochiSelector; props: StyleProps }[]","props","selector","classNames: string[]","variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } }","defaultVariants: Partial<RefineVariants<V>>","cssToMerge: MochiCSS<AllVariants>[]","name: string"],"sources":["../src/token.ts","../src/propertyUnits.generated.ts","../src/props.ts","../src/selector.ts","../src/hash.ts","../src/compare.ts","../src/cssObject.ts","../src/css.ts","../src/styled.ts","../src/keyframesObject.ts","../src/keyframes.ts","../src/globalCssObject.ts","../src/globalCss.ts"],"sourcesContent":["/**\n * CSS custom property (design token) utilities.\n * Provides type-safe access to CSS variables with proper `var()` syntax.\n * @module token\n */\n\nimport { CssVar, CssVarVal } from \"@/values\"\n\n/**\n * Represents a CSS custom property (design token) with type information.\n * Provides convenient access to both the variable name and its `var()` reference.\n * @template T - The expected value type of the token (for type checking)\n * @example\n * const primaryColor = new Token<string>('primary-color')\n * primaryColor.variable // '--primary-color'\n * primaryColor.value // 'var(--primary-color)'\n */\nexport class Token {\n /**\n * Creates a new CSS token.\n * @param name - The token name (without the `--` prefix)\n */\n constructor(public readonly name: string) {}\n\n /**\n * Gets the CSS custom property name (with `--` prefix).\n * Use this when defining the variable.\n */\n get variable(): CssVar {\n return `--${this.name}`\n }\n\n /**\n * Gets the CSS `var()` reference to this token.\n * Use this when consuming the variable value.\n */\n get value(): CssVarVal {\n return `var(${this.variable})`\n }\n\n /**\n * Returns the variable name for string coercion.\n */\n toString(): CssVar {\n return this.variable\n }\n}\n\n/**\n * Creates a new CSS design token.\n * @template T - The expected value type of the token\n * @param name - The token name (without the `--` prefix)\n * @returns A new Token instance\n * @example\n * const spacing = createToken<number>('spacing-md')\n * // Use in styles: { gap: spacing.value }\n */\nexport function createToken(name: string): Token {\n return new Token(name)\n}\n","// Auto-generated from @webref/css - do not edit manually\n// Run \"yarn build\" to regenerate\n\nexport const propertyUnits = {\n animation: \"ms\",\n animationDelay: \"ms\",\n animationDuration: \"ms\",\n animationRange: \"px\",\n animationRangeCenter: \"px\",\n animationRangeEnd: \"px\",\n animationRangeStart: \"px\",\n background: \"px\",\n backgroundPosition: \"px\",\n backgroundPositionBlock: \"px\",\n backgroundPositionInline: \"px\",\n backgroundPositionX: \"px\",\n backgroundPositionY: \"px\",\n backgroundSize: \"px\",\n backgroundTbd: \"px\",\n baselineShift: \"px\",\n blockSize: \"px\",\n blockStep: \"px\",\n blockStepSize: \"px\",\n border: \"px\",\n borderBlock: \"px\",\n borderBlockClip: \"px\",\n borderBlockEnd: \"px\",\n borderBlockEndClip: \"px\",\n borderBlockEndRadius: \"px\",\n borderBlockEndWidth: \"px\",\n borderBlockStart: \"px\",\n borderBlockStartClip: \"px\",\n borderBlockStartRadius: \"px\",\n borderBlockStartWidth: \"px\",\n borderBlockWidth: \"px\",\n borderBottom: \"px\",\n borderBottomClip: \"px\",\n borderBottomLeftRadius: \"px\",\n borderBottomRadius: \"px\",\n borderBottomRightRadius: \"px\",\n borderBottomWidth: \"px\",\n borderClip: \"px\",\n borderEndEndRadius: \"px\",\n borderEndStartRadius: \"px\",\n borderImage: \"%\",\n borderImageOutset: \"px\",\n borderImageSlice: \"%\",\n borderImageWidth: \"px\",\n borderInline: \"px\",\n borderInlineClip: \"px\",\n borderInlineEnd: \"px\",\n borderInlineEndClip: \"px\",\n borderInlineEndRadius: \"px\",\n borderInlineEndWidth: \"px\",\n borderInlineStart: \"px\",\n borderInlineStartClip: \"px\",\n borderInlineStartRadius: \"px\",\n borderInlineStartWidth: \"px\",\n borderInlineWidth: \"px\",\n borderLeft: \"px\",\n borderLeftClip: \"px\",\n borderLeftRadius: \"px\",\n borderLeftWidth: \"px\",\n borderLimit: \"px\",\n borderRadius: \"px\",\n borderRight: \"px\",\n borderRightClip: \"px\",\n borderRightRadius: \"px\",\n borderRightWidth: \"px\",\n borderSpacing: \"px\",\n borderStartEndRadius: \"px\",\n borderStartStartRadius: \"px\",\n borderTop: \"px\",\n borderTopClip: \"px\",\n borderTopLeftRadius: \"px\",\n borderTopRadius: \"px\",\n borderTopRightRadius: \"px\",\n borderTopWidth: \"px\",\n borderWidth: \"px\",\n bottom: \"px\",\n boxShadow: \"px\",\n boxShadowBlur: \"px\",\n boxShadowOffset: \"px\",\n boxShadowSpread: \"px\",\n columnGap: \"px\",\n columnHeight: \"px\",\n columnRule: \"px\",\n columnRuleEdgeInset: \"px\",\n columnRuleEdgeInsetEnd: \"px\",\n columnRuleEdgeInsetStart: \"px\",\n columnRuleInset: \"px\",\n columnRuleInsetEnd: \"px\",\n columnRuleInsetStart: \"px\",\n columnRuleInteriorInset: \"px\",\n columnRuleInteriorInsetEnd: \"px\",\n columnRuleInteriorInsetStart: \"px\",\n columnRuleWidth: \"px\",\n columns: \"px\",\n columnWidth: \"px\",\n containIntrinsicBlockSize: \"px\",\n containIntrinsicHeight: \"px\",\n containIntrinsicInlineSize: \"px\",\n containIntrinsicSize: \"px\",\n containIntrinsicWidth: \"px\",\n corner: \"px\",\n cornerBlockEnd: \"px\",\n cornerBlockStart: \"px\",\n cornerBottom: \"px\",\n cornerBottomLeft: \"px\",\n cornerBottomRight: \"px\",\n cornerEndEnd: \"px\",\n cornerEndStart: \"px\",\n cornerInlineEnd: \"px\",\n cornerInlineStart: \"px\",\n cornerLeft: \"px\",\n cornerRight: \"px\",\n cornerStartEnd: \"px\",\n cornerStartStart: \"px\",\n cornerTop: \"px\",\n cornerTopLeft: \"px\",\n cornerTopRight: \"px\",\n cx: \"px\",\n cy: \"px\",\n fillOpacity: \"%\",\n fillPosition: \"px\",\n fillSize: \"px\",\n flex: \"px\",\n flexBasis: \"px\",\n floatOffset: \"px\",\n floodOpacity: \"%\",\n flowTolerance: \"px\",\n font: \"deg\",\n fontSize: \"px\",\n fontStretch: \"%\",\n fontStyle: \"deg\",\n fontWidth: \"%\",\n gap: \"px\",\n grid: \"px\",\n gridAutoColumns: \"px\",\n gridAutoRows: \"px\",\n gridColumnGap: \"px\",\n gridGap: \"px\",\n gridRowGap: \"px\",\n gridTemplate: \"px\",\n gridTemplateColumns: \"px\",\n gridTemplateRows: \"px\",\n height: \"px\",\n hyphenateLimitZone: \"px\",\n imageOrientation: \"deg\",\n imageResolution: \"dppx\",\n initialLetterWrap: \"px\",\n inlineSize: \"px\",\n inset: \"px\",\n insetBlock: \"px\",\n insetBlockEnd: \"px\",\n insetBlockStart: \"px\",\n insetInline: \"px\",\n insetInlineEnd: \"px\",\n insetInlineStart: \"px\",\n interestDelay: \"ms\",\n interestDelayEnd: \"ms\",\n interestDelayStart: \"ms\",\n itemFlow: \"px\",\n left: \"px\",\n letterSpacing: \"px\",\n lineHeight: \"px\",\n lineHeightStep: \"px\",\n linePadding: \"px\",\n margin: \"px\",\n marginBlock: \"px\",\n marginBlockEnd: \"px\",\n marginBlockStart: \"px\",\n marginBottom: \"px\",\n marginInline: \"px\",\n marginInlineEnd: \"px\",\n marginInlineStart: \"px\",\n marginLeft: \"px\",\n marginRight: \"px\",\n marginTop: \"px\",\n mask: \"px\",\n maskBorder: \"%\",\n maskBorderOutset: \"px\",\n maskBorderSlice: \"%\",\n maskBorderWidth: \"px\",\n maskPosition: \"px\",\n maskSize: \"px\",\n maxBlockSize: \"px\",\n maxHeight: \"px\",\n maxInlineSize: \"px\",\n maxWidth: \"px\",\n minBlockSize: \"px\",\n minHeight: \"px\",\n minInlineSize: \"px\",\n minWidth: \"px\",\n objectPosition: \"px\",\n offset: \"px\",\n offsetAnchor: \"px\",\n offsetDistance: \"px\",\n offsetPosition: \"px\",\n offsetRotate: \"deg\",\n opacity: \"%\",\n outline: \"px\",\n outlineOffset: \"px\",\n outlineWidth: \"px\",\n overflowClipMargin: \"px\",\n overflowClipMarginBlock: \"px\",\n overflowClipMarginBlockEnd: \"px\",\n overflowClipMarginBlockStart: \"px\",\n overflowClipMarginBottom: \"px\",\n overflowClipMarginInline: \"px\",\n overflowClipMarginInlineEnd: \"px\",\n overflowClipMarginInlineStart: \"px\",\n overflowClipMarginLeft: \"px\",\n overflowClipMarginRight: \"px\",\n overflowClipMarginTop: \"px\",\n padding: \"px\",\n paddingBlock: \"px\",\n paddingBlockEnd: \"px\",\n paddingBlockStart: \"px\",\n paddingBottom: \"px\",\n paddingInline: \"px\",\n paddingInlineEnd: \"px\",\n paddingInlineStart: \"px\",\n paddingLeft: \"px\",\n paddingRight: \"px\",\n paddingTop: \"px\",\n pause: \"ms\",\n pauseAfter: \"ms\",\n pauseBefore: \"ms\",\n perspective: \"px\",\n perspectiveOrigin: \"px\",\n r: \"px\",\n rest: \"ms\",\n restAfter: \"ms\",\n restBefore: \"ms\",\n right: \"px\",\n rotate: \"deg\",\n rowGap: \"px\",\n rowRule: \"px\",\n rowRuleEdgeInset: \"px\",\n rowRuleEdgeInsetEnd: \"px\",\n rowRuleEdgeInsetStart: \"px\",\n rowRuleInset: \"px\",\n rowRuleInsetEnd: \"px\",\n rowRuleInsetStart: \"px\",\n rowRuleInteriorInset: \"px\",\n rowRuleInteriorInsetEnd: \"px\",\n rowRuleInteriorInsetStart: \"px\",\n rowRuleWidth: \"px\",\n rule: \"px\",\n ruleEdgeInset: \"px\",\n ruleInset: \"px\",\n ruleInsetEnd: \"px\",\n ruleInsetStart: \"px\",\n ruleInteriorInset: \"px\",\n ruleWidth: \"px\",\n rx: \"px\",\n ry: \"px\",\n scale: \"%\",\n scrollMargin: \"px\",\n scrollMarginBlock: \"px\",\n scrollMarginBlockEnd: \"px\",\n scrollMarginBlockStart: \"px\",\n scrollMarginBottom: \"px\",\n scrollMarginInline: \"px\",\n scrollMarginInlineEnd: \"px\",\n scrollMarginInlineStart: \"px\",\n scrollMarginLeft: \"px\",\n scrollMarginRight: \"px\",\n scrollMarginTop: \"px\",\n scrollPadding: \"px\",\n scrollPaddingBlock: \"px\",\n scrollPaddingBlockEnd: \"px\",\n scrollPaddingBlockStart: \"px\",\n scrollPaddingBottom: \"px\",\n scrollPaddingInline: \"px\",\n scrollPaddingInlineEnd: \"px\",\n scrollPaddingInlineStart: \"px\",\n scrollPaddingLeft: \"px\",\n scrollPaddingRight: \"px\",\n scrollPaddingTop: \"px\",\n shapeImageThreshold: \"%\",\n shapeMargin: \"px\",\n shapePadding: \"px\",\n stopOpacity: \"%\",\n strokeDasharray: \"px\",\n strokeDashcorner: \"px\",\n strokeDashCorner: \"px\",\n strokeDashoffset: \"px\",\n strokeOpacity: \"%\",\n strokePosition: \"px\",\n strokeSize: \"px\",\n strokeWidth: \"px\",\n tabSize: \"px\",\n textDecoration: \"px\",\n textDecorationInset: \"px\",\n textDecorationThickness: \"px\",\n textIndent: \"px\",\n textShadow: \"px\",\n textSizeAdjust: \"%\",\n textUnderlineOffset: \"px\",\n timelineTrigger: \"px\",\n timelineTriggerExitRange: \"px\",\n timelineTriggerExitRangeEnd: \"px\",\n timelineTriggerExitRangeStart: \"px\",\n timelineTriggerRange: \"px\",\n timelineTriggerRangeEnd: \"px\",\n timelineTriggerRangeStart: \"px\",\n top: \"px\",\n transformOrigin: \"px\",\n transition: \"ms\",\n transitionDelay: \"ms\",\n transitionDuration: \"ms\",\n translate: \"px\",\n verticalAlign: \"px\",\n viewTimeline: \"px\",\n viewTimelineInset: \"px\",\n voiceDuration: \"ms\",\n voicePitch: \"Hz\",\n voiceRange: \"Hz\",\n voiceRate: \"%\",\n width: \"px\",\n wordSpacing: \"px\",\n x: \"px\",\n y: \"px\",\n zoom: \"%\",\n} as const\n\nexport type PropertyWithUnit = keyof typeof propertyUnits\n","/**\n * CSS property handling and type definitions.\n * Provides type-safe mappings from JavaScript objects to CSS properties,\n * with automatic unit conversion and value formatting.\n * @module props\n */\n\nimport { Properties, ObsoleteProperties } from \"csstype\"\nimport { CssLike, CssVar } from \"@/values\"\nimport properties from \"known-css-properties\"\nimport { propertyUnits, type PropertyWithUnit } from \"./propertyUnits.generated\"\n\n/** All non-obsolete CSS properties from csstype */\ntype Props = Required<Omit<Properties, keyof ObsoleteProperties>>\n\n/** Properties that have default units and are valid CSS properties */\ntype PropsWithUnit = PropertyWithUnit & keyof Props\n\n/**\n * Converts a kebab-case string to camelCase.\n */\nexport function kebabToCamel(str: string): string {\n return str.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())\n}\n\n/**\n * Converts a camelCase string to kebab-case.\n */\nexport function camelToKebab(str: string): string {\n return str.replace(/[A-Z]/g, (m) => \"-\" + m.toLowerCase())\n}\n\nfunction getUnitForProperty(propertyName: string): string | undefined {\n return propertyName in propertyUnits ? propertyUnits[propertyName as PropertyWithUnit] : undefined\n}\n\n/**\n * Converts a CSS-like value to its string representation.\n * For properties with known units, numbers are automatically suffixed.\n */\nfunction formatValue(value: CssLike<string | number>, propertyName: string, maxDepth = 10): string {\n if (maxDepth <= 0) return \"\"\n if (typeof value === \"string\") return value\n if (typeof value === \"number\") {\n const unit = getUnitForProperty(propertyName)\n if (unit === \"%\") return `${value * 100}${unit}`\n if (value === 0) return \"0\"\n return unit ? `${value}${unit}` : value.toString()\n }\n return formatValue(value.value, propertyName, maxDepth - 1)\n}\n\n//TODO: generate this list and drop known-css-properties package\nconst knownPropertySet = new Set<string>(properties.all.map(kebabToCamel))\n\n/**\n * Checks if a property name is a CSS custom property (variable).\n */\nexport function isCssVariableName(key: string): key is CssVar {\n return key.startsWith(\"--\")\n}\n\n/**\n * Converts a CSS-like value to a string for use as a CSS variable value.\n * @param value - The value to convert (string, number, or wrapped value)\n * @param maxDepth - Maximum recursion depth for evaluating the value\n * @returns The string representation\n */\nexport function asVar(value: CssLike<string | number>, maxDepth = 10): string {\n if (maxDepth <= 0) return \"\"\n switch (typeof value) {\n case \"string\":\n return value\n case \"number\":\n return value.toString()\n default:\n return asVar(value.value, maxDepth - 1)\n }\n}\n\n/**\n * Checks if a property name is a known CSS property.\n */\nexport function isKnownPropertyName(key: string): key is keyof Props {\n return knownPropertySet.has(key)\n}\n\n/**\n * Converts a value to a CSS property string.\n * Automatically appends units to numeric values for properties that require them.\n * @param value - The value to convert\n * @param key - The CSS property name\n * @returns The formatted CSS value string\n */\nexport function asKnownProp(value: unknown, key: keyof Props): string {\n return formatValue(value as CssLike<string | number>, key)\n}\n\n/**\n * Checks if a key represents a nested CSS selector.\n */\n//TODO: make better validation, provide human readable errors\nexport function isNestedSelector(key: string): key is NestedCssSelector {\n return key.includes(\"&\")\n}\n\n/**\n * Checks if a key represents a media query.\n */\n//TODO: make better validation, provide human readable errors\nexport function isMediaSelector(key: string): key is MediaSelector {\n return key.startsWith(\"@\")\n}\n\n/** A nested CSS selector pattern containing the parent reference `&` */\nexport type NestedCssSelector = `${string}&${string}`\n\n/** A CSS media query starting with `@` */\nexport type MediaSelector = `@${string}`\n\ntype NestedStyleKeys = MediaSelector | NestedCssSelector\n\n/**\n * Style properties without nesting support.\n * Includes all standard CSS properties with type-safe value converters,\n * plus CSS custom properties (variables).\n *\n * Properties with known units (e.g., width, height, padding) accept numbers\n * that are automatically converted with their default unit (e.g., px, ms).\n */\nexport type SimpleStyleProps = { [K in PropsWithUnit]?: CssLike<number | Props[K]> } & {\n [K in Exclude<keyof Props, PropsWithUnit>]?: CssLike<Props[K]>\n} & Partial<Record<CssVar, CssLike<string | number>>>\n\n/**\n * Full style properties type with support for nested selectors and media queries.\n * Extends SimpleStyleProps to allow recursive style definitions.\n *\n * @example\n * const styles: StyleProps = {\n * color: 'blue',\n * padding: 16,\n * '&:hover': { color: 'red' },\n * '@min-width: 768px': { padding: 24 }\n * }\n */\nexport type StyleProps = SimpleStyleProps & { [K in NestedStyleKeys]?: StyleProps | CssLike<string | number> }\n\n/**\n * Converts a SimpleStyleProps object to a CSS properties record.\n * Transforms camelCase property names to kebab-case and applies value converters.\n * @param props - The style properties object\n * @returns A record of CSS property names (kebab-case) to string values\n * @example\n * cssFromProps({ backgroundColor: 'blue', padding: 16 })\n * // { 'background-color': 'blue', 'padding': '16px' }\n */\nexport function cssFromProps(props: SimpleStyleProps): Record<string, string> {\n return Object.fromEntries(\n Object.entries(props)\n .map(([key, value]): [string, string] | undefined => {\n if (value === undefined) return undefined\n // transform variable\n if (isCssVariableName(key)) return [key, asVar(value as CssLike<string | number>)]\n // transform CSS prop\n if (isKnownPropertyName(key)) return [camelToKebab(key), asKnownProp(value, key)]\n return undefined\n })\n .filter((v) => v !== undefined),\n )\n}\n","/**\n * CSS selector building and manipulation utilities.\n * Handles nested selectors (using `&` placeholder) and media queries.\n * @module selector\n */\n\nimport { isMediaSelector, isNestedSelector } from \"@/props\"\n\n/**\n * Immutable CSS selector builder that handles nested selectors and media queries.\n * Uses the `&` character as a placeholder for parent selector substitution.\n *\n * @example\n * const selector = new MochiSelector(['.button'])\n * selector.extend('&:hover').cssSelector // '.button:hover'\n * selector.wrap('@media (min-width: 768px)').mediaQuery // '@media (min-width: 768px)'\n */\nexport class MochiSelector {\n /**\n * Creates a new MochiSelector instance.\n * @param cssSelectors - Array of CSS selectors (may contain `&` placeholders)\n * @param mediaSelectors - Array of media query conditions (without `@media` prefix)\n */\n constructor(\n private readonly cssSelectors: string[] = [],\n private readonly mediaSelectors: string[] = [],\n ) {}\n\n /**\n * Gets the combined CSS selector string.\n * Multiple selectors are joined with commas.\n * @returns The CSS selector, or \"*\" if no selectors are defined\n */\n get cssSelector(): string {\n if (this.cssSelectors.length === 0) return \"*\"\n return this.cssSelectors.join(\", \")\n }\n\n /**\n * Gets the combined media query string, if any.\n * @returns The full `@media` query string, or undefined if no media conditions\n */\n get mediaQuery(): string | undefined {\n if (this.mediaSelectors.length === 0) return undefined\n return `@media ${this.mediaSelectors.map((s) => `(${s})`).join(\" and \")}`\n }\n\n /**\n * Substitutes all `&` placeholders with the given root selector.\n * @param root - The selector to replace `&` with\n * @returns A new MochiSelector with substituted selectors\n */\n substitute(root: string): MochiSelector {\n return new MochiSelector(\n this.cssSelectors.map((selector) => selector.replace(/&/g, root)),\n this.mediaSelectors,\n )\n }\n\n /**\n * Extends this selector by nesting a child selector.\n * The `&` in the child selector is replaced with each parent selector.\n * @param child - The child selector pattern (must contain `&`)\n * @returns A new MochiSelector with the extended selectors\n * @example\n * new MochiSelector(['.btn']).extend('&:hover') // '.btn:hover'\n * new MochiSelector(['.btn']).extend('& .icon') // '.btn .icon'\n */\n extend(child: string): MochiSelector {\n if (!isNestedSelector(child)) return this\n const children = MochiSelector.split(child)\n const selectors = this.cssSelectors.flatMap((parentSelector) =>\n children.map((childSelector) => {\n return childSelector.replace(/&/g, parentSelector)\n }),\n )\n return new MochiSelector(selectors, this.mediaSelectors)\n }\n\n /**\n * Wraps this selector with a media query condition.\n * @param mediaQuery - The media query string (starting with `@`)\n * @returns A new MochiSelector with the added media condition\n * @example\n * selector.wrap('@min-width: 768px') // Adds media query condition\n */\n wrap(mediaQuery: string): MochiSelector {\n if (!isMediaSelector(mediaQuery)) return this\n const mediaQueryPart = mediaQuery.substring(1)\n return new MochiSelector(this.cssSelectors, [...this.mediaSelectors, mediaQueryPart])\n }\n\n /**\n * Splits a comma-separated selector string into individual selectors.\n * @param selector - The selector string to split\n * @returns Array of individual selector strings\n */\n private static split(selector: string): string[] {\n return [selector]\n }\n}\n","/**\n * Hashing utilities for generating short, deterministic class names.\n * Uses djb2 algorithm for fast string hashing.\n * @module hash\n */\n\n/** Characters used for base-62 encoding (css-name safe variant of base-64) */\nconst hashBase = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\"\nconst base = hashBase.length\n\n/**\n * Converts a number to a base-62 string representation.\n * @param num - The number to convert\n * @param maxLength - Optional maximum length of the output string\n * @returns Base-62 encoded string representation of the number\n */\nexport function numberToBase62(num: number, maxLength?: number): string {\n let out = \"\"\n while (num > 0 && out.length < (maxLength ?? Infinity)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n out = hashBase[num % base]! + out\n num = Math.floor(num / base)\n }\n return out.length > 0 ? out : \"0\"\n}\n\n/**\n * Generates a short hash string from input using the djb2 algorithm.\n * Used to create unique, deterministic CSS class names from style content.\n * @param input - The string to hash\n * @param length - Maximum length of the hash output (default: 8)\n * @returns A short, css-safe hash string\n * @example\n * shortHash(\"color: red;\") // Returns something like \"A1b2C3d4\"\n */\nexport function shortHash(input: string, length = 8): string {\n // fast 32-bit integer hash (djb2 variant)\n let h = 5381\n for (let i = 0; i < input.length; i++) {\n h = (h * 33) ^ input.charCodeAt(i)\n }\n // force unsigned\n h >>>= 0\n\n return numberToBase62(h, length)\n}\n","/**\n * String comparison utilities for deterministic sorting.\n * Used internally to ensure consistent CSS output order.\n * @module compare\n */\n\n/**\n * Compares two strings lexicographically.\n */\nexport function compareString<T extends string>(a: T, b: T) {\n return a < b ? -1 : a === b ? 0 : 1\n}\n\n/**\n * Compares two tuples by their first element (string key).\n * Useful for sorting Object.entries() results.\n */\nexport function compareStringKey<T extends [string, unknown]>(a: T, b: T) {\n return compareString(a[0], b[0])\n}\n\n/**\n * Creates a comparator function for objects with a specific string property.\n * @param name - The property name to compare by\n * @returns A comparator function that compares objects by the specified property\n * @example\n * const items = [{ key: 'b' }, { key: 'a' }]\n * items.sort(stringPropComparator('key')) // [{ key: 'a' }, { key: 'b' }]\n */\nexport function stringPropComparator<N extends string>(name: N) {\n return <T extends Record<N, string>>(a: T, b: T) => compareString(a[name], b[name])\n}\n","/**\n * CSS object model for representing and serializing styles.\n * Converts JavaScript style objects into CSS blocks with proper\n * selector handling, nesting support, and deterministic output.\n * @module cssObject\n */\n\nimport {\n asKnownProp,\n asVar,\n camelToKebab,\n isCssVariableName,\n isKnownPropertyName,\n isMediaSelector,\n isNestedSelector,\n StyleProps,\n} from \"@/props\"\nimport { shortHash } from \"@/hash\"\nimport { MochiSelector } from \"@/selector\"\nimport { compareStringKey, stringPropComparator } from \"@/compare\"\n\n/**\n * Represents a single CSS rule block with properties and a selector.\n * Handles conversion to CSS string format and hash generation.\n */\nexport class CssObjectSubBlock {\n /**\n * Creates a new CSS sub-block.\n * @param cssProps - Map of CSS property names (kebab-case) to values\n * @param selector - The selector this block applies to\n */\n constructor(\n public readonly cssProps: Record<string, string>,\n public readonly selector: MochiSelector,\n ) {}\n\n /**\n * Computes a deterministic hash of this block's CSS content.\n * Used for generating unique class names.\n */\n get hash(): string {\n const str = this.asCssString(\"&\")\n return shortHash(str)\n }\n\n /**\n * Converts this block to a CSS string.\n * Handles media query wrapping if the selector has media conditions.\n * @param root - The root selector to substitute for `&`\n * @returns Formatted CSS string\n */\n asCssString(root: string): string {\n const selector = this.selector.substitute(root)\n const mediaQuery = selector.mediaQuery\n\n const mediaIndent = mediaQuery === undefined ? \"\" : \" \"\n\n const props = Object.entries(this.cssProps)\n .toSorted(compareStringKey)\n .map(([k, v]) => `${mediaIndent} ${k}: ${v};\\n`)\n .join(\"\")\n\n const blockCss = `${mediaIndent}${selector.cssSelector} {\\n${props}${mediaIndent}}`\n\n return mediaQuery === undefined ? blockCss : `${mediaQuery} {\\n${blockCss}\\n}`\n }\n\n /**\n * Parses StyleProps into an array of CSS sub-blocks.\n * Recursively processes nested selectors and media queries.\n * Output order is deterministic for consistent hash generation.\n *\n * @param props - The style properties to parse\n * @param selector - The parent selector context (defaults to `&`)\n * @returns Non-empty array of sub-blocks (main block first, then nested)\n */\n static fromProps(props: StyleProps, selector?: MochiSelector): [CssObjectSubBlock, ...CssObjectSubBlock[]] {\n selector ??= new MochiSelector([\"&\"])\n\n const cssProps: Record<string, string> = {}\n const propsToProcess: { key: string; selector: MochiSelector; props: StyleProps }[] = []\n\n for (const [key, value] of Object.entries(props)) {\n // skip undefined value\n if (value === undefined) continue\n\n // transform variable\n if (isCssVariableName(key)) {\n cssProps[key] = asVar(value as StyleProps[typeof key] & {})\n continue\n }\n\n // transform known CSS prop\n if (isKnownPropertyName(key)) {\n cssProps[camelToKebab(key)] = asKnownProp(value, key)\n continue\n }\n\n // transform nested and media selectors\n if (isNestedSelector(key)) {\n propsToProcess.push({\n key,\n props: value as StyleProps,\n selector: selector.extend(key),\n })\n continue\n }\n\n // transform media selector\n if (isMediaSelector(key)) {\n propsToProcess.push({\n key,\n props: value as StyleProps,\n selector: selector.wrap(key),\n })\n continue\n }\n\n if (process.env[\"NODE_ENV\"] !== \"production\") {\n console.warn(`[mochi-css] Unknown style property \"${key}\" will be ignored`)\n }\n }\n\n return [\n new CssObjectSubBlock(cssProps, selector),\n ...propsToProcess\n .toSorted(stringPropComparator(\"key\"))\n .flatMap(({ props, selector }) => CssObjectSubBlock.fromProps(props, selector)),\n ] as const\n }\n}\n\n/**\n * Represents an abstract CSS block definition.\n * Contains one or more sub-blocks for nested selectors and media queries.\n */\nexport class CssObjectBlock {\n /** The generated unique class name for this block */\n public readonly className: string\n /** All sub-blocks (main styles and nested/media rules) */\n public readonly subBlocks: CssObjectSubBlock[] = []\n\n /**\n * Creates a new CSS block from style properties.\n * Generates a unique class name based on the content hash.\n * @param styles - The style properties to compile\n */\n constructor(styles: StyleProps) {\n const blocks = CssObjectSubBlock.fromProps(styles)\n\n this.className = \"c\" + shortHash(blocks.map((b) => b.hash).join(\"+\"))\n this.subBlocks = blocks\n }\n\n /**\n * Gets the CSS class selector for this block.\n */\n get selector(): string {\n return `.${this.className}`\n }\n\n /**\n * Converts style block to a CSS string.\n * @param root - The root selector to scope styles to\n * @returns Complete CSS string for this block\n */\n asCssString(root: string): string {\n return this.subBlocks\n .map((b) => b.asCssString(new MochiSelector([root]).extend(`&.${this.className}`).cssSelector))\n .join(\"\\n\\n\")\n }\n}\n\nexport type AllVariants = Record<string, Record<string, StyleProps>>\nexport type DefaultVariants = Record<never, Record<string, StyleProps>>\n\n/**\n * A compound variant entry that applies styles when multiple variant conditions match.\n * Each entry specifies a set of variant conditions and a `css` property with styles\n * that apply only when all conditions are satisfied simultaneously.\n *\n * @template V - The variant definitions type\n *\n * @example\n * { color: 'red', size: 'large', css: { fontWeight: 'bold' } }\n */\nexport type CompoundVariant<V extends AllVariants> = {\n [K in keyof V]?: keyof V[K]\n} & { css: StyleProps }\n\n/**\n * Refines string literal types to their proper runtime types.\n * Converts \"true\"/\"false\" strings to boolean literals.\n */\ntype RefineVariantType<T extends string> = T extends \"true\"\n ? true\n : T extends \"false\"\n ? false\n : T extends string\n ? T\n : string\n\n/**\n * Props for defining variants in a style object.\n * @template V - The variant definitions type\n */\nexport type VariantProps<V extends AllVariants> = {\n /** Variant definitions mapping names to options to styles */\n variants?: V\n /** Default variant selections for when not explicitly provided */\n defaultVariants?: { [K in keyof V]?: keyof V[K] extends string ? RefineVariantType<keyof V[K] & string> : never }\n /** Compound variant definitions that apply when multiple variant conditions match */\n compoundVariants?: CompoundVariant<V>[]\n}\n\n/** Combined type for style props with optional variants */\nexport type MochiCSSProps<V extends AllVariants> = StyleProps & VariantProps<V>\n\n/** Utility type to override properties of A with properties of B */\ntype Override<A extends object, B extends object> = B & Omit<A, keyof B>\n\n/** Recursively merges variant types from a tuple, with later types overriding earlier */\nexport type MergeCSSVariants<V extends AllVariants[]> = V extends [\n infer V1 extends AllVariants,\n ...infer VRest extends AllVariants[],\n]\n ? Override<V1, MergeCSSVariants<VRest>>\n : DefaultVariants\n\n/** Refines all values in a string record to their proper variant types */\ntype RefineVariantTypes<V extends Record<string, string>> = { [K in keyof V]: RefineVariantType<V[K]> }\n\n/** Extracts and refines variant option types from a DefaultVariants definition */\nexport type RefineVariants<T extends AllVariants> = RefineVariantTypes<{ [K in keyof T]: keyof T[K] & string }>\n\n/**\n * Complete CSS object representation with main and variant styles.\n *\n * @template V - The variant definitions type\n *\n * @example\n * const obj = new CSSObject({\n * color: 'blue',\n * variants: {\n * size: {\n * small: { fontSize: 12 },\n * large: { fontSize: 18 }\n * }\n * },\n * defaultVariants: { size: 'small' }\n * })\n * obj.asCssString() // Returns complete CSS with all variants\n */\nexport class CSSObject<V extends AllVariants = DefaultVariants> {\n /** The main style block (non-variant styles) */\n public readonly mainBlock: CssObjectBlock\n /** Compiled blocks for each variant option */\n public readonly variantBlocks: { [K in keyof V & string]: Record<keyof V[K] & string, CssObjectBlock> }\n /** Default variant selections */\n public readonly variantDefaults: Partial<RefineVariants<V>>\n /** Compound variant conditions and their parsed sub-blocks */\n public readonly compoundVariants: { conditions: Record<string, string>; subBlocks: CssObjectSubBlock[] }[]\n\n /**\n * Creates a new CSSObject from style props.\n * Compiles main styles and all variant options into CSS blocks.\n */\n public constructor({ variants, defaultVariants, compoundVariants, ...props }: MochiCSSProps<V>) {\n this.mainBlock = new CssObjectBlock(props)\n this.variantBlocks = {} as typeof this.variantBlocks\n this.variantDefaults = defaultVariants ?? {}\n this.compoundVariants = []\n\n if (variants) {\n for (const variantGroupName in variants) {\n this.variantBlocks[variantGroupName] =\n {} as (typeof this.variantBlocks)[keyof typeof this.variantBlocks]\n const variantGroup = variants[variantGroupName]\n for (const variantItemName in variantGroup) {\n this.variantBlocks[variantGroupName][variantItemName] = new CssObjectBlock(\n variantGroup[variantItemName] ?? {},\n )\n }\n }\n }\n\n if (compoundVariants) {\n for (const compound of compoundVariants) {\n const { css: styles, ...conditions } = compound\n this.compoundVariants.push({\n conditions: conditions as Record<string, string>,\n subBlocks: CssObjectSubBlock.fromProps(styles),\n })\n }\n }\n }\n\n /**\n * Serializes the entire CSS object to a CSS string.\n * Outputs main block first, then all variant blocks in sorted order.\n * @returns Complete CSS string ready for injection into a stylesheet\n */\n public asCssString(): string {\n return [\n this.mainBlock.asCssString(this.mainBlock.selector),\n ...Object.entries(this.variantBlocks)\n .toSorted(compareStringKey)\n .flatMap(([_, b]) => Object.entries(b).toSorted(compareStringKey))\n .map(([_, b]) => b.asCssString(this.mainBlock.selector)),\n ...this.compoundVariants.map(({ conditions, subBlocks }) => {\n const variantSelectors = Object.entries(conditions)\n .toSorted(compareStringKey)\n .map(([variantName, optionName]) => {\n const block = this.variantBlocks[variantName]?.[optionName]\n return block?.selector ?? \"\"\n })\n .filter(Boolean)\n .join(\"\")\n const combinedSelector = `${this.mainBlock.selector}${variantSelectors}`\n return subBlocks.map((b) => b.asCssString(combinedSelector)).join(\"\\n\\n\")\n }),\n ].join(\"\\n\\n\")\n }\n}\n","/**\n * Core CSS-in-JS runtime for generating and applying styles.\n * Provides the main `css` function and `MochiCSS` class for style management.\n * @module css\n */\n\nimport clsx from \"clsx\"\nimport { CSSObject, AllVariants, DefaultVariants, MergeCSSVariants, MochiCSSProps, RefineVariants } from \"@/cssObject\"\n\n/**\n * Runtime representation of a CSS style definition with variant support.\n * Holds generated class names and provides methods to compute the final\n * className string based on selected variants.\n *\n * @template V - The variant definitions type mapping variant names to their options\n *\n * @example\n * const styles = MochiCSS.from(new CSSObject({\n * color: 'blue',\n * variants: { size: { small: { fontSize: 12 }, large: { fontSize: 18 } } }\n * }))\n * styles.variant({ size: 'large' }) // Returns combined class names\n */\nexport class MochiCSS<V extends AllVariants = DefaultVariants> {\n /**\n * Creates a new MochiCSS instance.\n * @param classNames - Base class names to always include\n * @param variantClassNames - Mapping of variant names to option class names\n * @param defaultVariants - Default variant selections when not specified\n */\n constructor(\n public readonly classNames: string[],\n public readonly variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } },\n public readonly defaultVariants: Partial<RefineVariants<V>>,\n ) {}\n\n /**\n * Computes the final className string based on variant selections.\n * Compound variants are handled purely via CSS combined selectors,\n * so no runtime matching is needed here.\n * @param props - Variant selections\n * @returns Combined className string for use in components\n */\n variant(props: Partial<RefineVariants<V>>): string {\n const keys = new Set<keyof V & string>(\n [...Object.keys(props), ...Object.keys(this.defaultVariants)].filter((k) => k in this.variantClassNames),\n )\n\n return clsx(\n this.classNames,\n ...keys.values().map((k) => {\n const variantGroup = this.variantClassNames[k]\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!variantGroup) return false\n\n const variantKey = ((k in props ? props[k] : undefined) ?? this.defaultVariants[k])?.toString()\n if (variantKey == null) return false\n\n const selectedClassname = variantGroup[variantKey]\n if (selectedClassname !== undefined) return selectedClassname\n\n const defaultKey = this.defaultVariants[k]\n if (defaultKey == null) return false\n\n return variantGroup[defaultKey.toString()]\n }),\n )\n }\n\n /**\n * Creates a MochiCSS instance from a CSSObject.\n * Extracts class names from the compiled CSS blocks.\n * @template V - The variant definitions type\n * @param object - The compiled CSSObject to extract from\n * @returns A new MochiCSS instance with the extracted class names\n */\n static from<V extends AllVariants = DefaultVariants>(object: CSSObject<V>): MochiCSS<V> {\n return new MochiCSS<V>(\n [object.mainBlock.className],\n Object.fromEntries(\n Object.entries(object.variantBlocks).map(([key, variantOptions]) => {\n return [\n key,\n Object.fromEntries(\n Object.entries(variantOptions).map(([optionKey, block]) => {\n return [optionKey, block.className]\n }),\n ),\n ]\n }),\n ) as { [K in keyof V]: { [P in keyof V[K]]: string } },\n object.variantDefaults,\n )\n }\n}\n\n/**\n * Creates a CSS style definition.\n * The primary API for defining styles in Mochi-CSS.\n *\n * @template V - Tuple of variant definition types\n * @param props - One or more style objects or existing MochiCSS instances to merge\n * @returns A MochiCSS instance with all styles and variants combined\n *\n * @example\n * // Simple usage\n * const button = css({ padding: 8, borderRadius: 4 })\n *\n * @example\n * // With variants\n * const button = css({\n * padding: 8,\n * variants: {\n * size: {\n * small: { padding: 4 },\n * large: { padding: 16 }\n * }\n * },\n * defaultVariants: { size: 'small' }\n * })\n * button.variant({ size: 'large' }) // Get class names for large size\n *\n * @example\n * // Merging multiple styles\n * const combined = css(baseStyles, additionalStyles)\n */\nconst emptyMochiCSS = new MochiCSS<AllVariants>([], {}, {})\n\n/**\n * Merges multiple MochiCSS instances into a single one, combining their\n * class names, variant class names, and default variants.\n * @param instances - The MochiCSS instances to merge\n * @returns A new MochiCSS instance with all styles combined\n */\nexport function mergeMochiCss<V extends AllVariants[]>(\n instances: MochiCSS<AllVariants>[],\n): MochiCSS<MergeCSSVariants<V>> {\n if (instances.length === 0) return emptyMochiCSS as MochiCSS<MergeCSSVariants<V>>\n\n return new MochiCSS<AllVariants>(\n instances.flatMap((c) => c.classNames),\n instances.reduce((a, b) => Object.assign(a, b.variantClassNames), {}),\n instances.reduce((a, b) => Object.assign(a, b.defaultVariants), {}),\n ) as MochiCSS<MergeCSSVariants<V>>\n}\n\nexport function css<V extends AllVariants[]>(\n ...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS }\n): MochiCSS<MergeCSSVariants<V>> {\n const cssToMerge: MochiCSS<AllVariants>[] = []\n for (const p of props) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (p == null || typeof p !== \"object\") continue\n if (p instanceof MochiCSS) {\n cssToMerge.push(p)\n } else {\n cssToMerge.push(MochiCSS.from(new CSSObject<AllVariants>(p)))\n }\n }\n\n return mergeMochiCss(cssToMerge)\n}\n","/**\n * React styled component utilities.\n * Creates styled components with CSS-in-JS support and variant props.\n * @module styled\n */\n\nimport { ComponentProps, ComponentType, createElement, FC, HTMLElementType } from \"react\"\nimport { css } from \"@/css\"\nimport clsx from \"clsx\"\nimport { AllVariants, MergeCSSVariants, MochiCSSProps, RefineVariants } from \"@/cssObject\"\n\n/** Props added by MochiCSS to styled components */\ntype MochiProps<V extends AllVariants[]> = {\n className?: string\n} & Partial<RefineVariants<MergeCSSVariants<V>>>\n\n/** Minimal interface for components that accept className */\ntype Cls = { className?: string }\n\n/**\n * Creates a styled React component with CSS-in-JS support and variant props.\n * Similar to styled-components or Stitches, but with zero runtime overhead.\n *\n * @template T - The base element type or component type\n * @template V - The variant definitions tuple type\n * @param target - The HTML element tag name or React component to style\n * @param props - One or more style objects with optional variants\n * @returns A React functional component with merged props and variant support\n *\n * @example\n * const Button = styled('button', {\n * padding: 8,\n * borderRadius: 4,\n * variants: {\n * size: {\n * small: { padding: 4 },\n * large: { padding: 16 }\n * },\n * variant: {\n * primary: { backgroundColor: 'blue' },\n * secondary: { backgroundColor: 'gray' }\n * }\n * }\n * })\n *\n * // Usage: <Button size=\"large\" variant=\"primary\">Click me</Button>\n */\n//TODO: Move to dedicated \"styled\" package\nexport function styled<T extends HTMLElementType | ComponentType<Cls>, V extends AllVariants[]>(\n target: T,\n ...props: { [K in keyof V]: MochiCSSProps<V[K]> }\n): FC<Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>> {\n const styles = css<V>(...props)\n return ({ className, ...p }: Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>) =>\n //TODO: pick only variant props from p\n //TODO: omit variant props in p\n createElement(target, {\n className: clsx(styles.variant(p as unknown as Parameters<typeof styles.variant>[0]), className),\n ...p,\n })\n}\n","import { shortHash } from \"@/hash\"\nimport { cssFromProps, SimpleStyleProps } from \"@/props\"\nimport { compareStringKey } from \"@/compare\"\n\nexport type KeyframeStops = Record<string, SimpleStyleProps>\n\nexport class KeyframesObject {\n public readonly name: string\n private readonly body: string\n\n constructor(stops: KeyframeStops) {\n this.body = KeyframesObject.generateBody(stops)\n this.name = \"kf\" + shortHash(this.body)\n }\n\n asCssString(): string {\n return `@keyframes ${this.name} {\\n${this.body}\\n}`\n }\n\n private static generateBody(stops: KeyframeStops): string {\n return Object.entries(stops)\n .toSorted(compareStringKey)\n .map(([stopKey, props]) => {\n const cssProps = cssFromProps(props)\n const propsStr = Object.entries(cssProps)\n .toSorted(compareStringKey)\n .map(([k, v]) => ` ${k}: ${v};`)\n .join(\"\\n\")\n return ` ${stopKey} {\\n${propsStr}\\n }`\n })\n .join(\"\\n\\n\")\n }\n}\n","import { KeyframesObject, type KeyframeStops } from \"@/keyframesObject\"\nexport type { KeyframeStops } from \"@/keyframesObject\"\n\nexport class MochiKeyframes {\n constructor(public readonly name: string) {}\n\n toString(): string {\n return this.name\n }\n\n get value(): string {\n return this.name\n }\n\n static from(object: KeyframesObject): MochiKeyframes {\n return new MochiKeyframes(object.name)\n }\n}\n\nexport function keyframes(stops: KeyframeStops): MochiKeyframes {\n return MochiKeyframes.from(new KeyframesObject(stops))\n}\n","import { CssObjectSubBlock } from \"@/cssObject\"\nimport { compareStringKey } from \"@/compare\"\nimport { StyleProps } from \"@/props\"\n\nexport type GlobalCssStyles = Record<string, StyleProps>\n\n/**\n * CSS object model for global (non-scoped) styles.\n * Accepts a map of CSS selectors to style objects and serializes them\n * as plain CSS rules without class name scoping.\n *\n * @example\n * const obj = new GlobalCssObject({\n * body: { margin: 0 },\n * 'h1': { fontSize: 32 },\n * })\n * obj.asCssString() // \"body {\\n margin: 0;\\n}\\n\\nh1 {\\n font-size: 32px;\\n}\"\n */\nexport class GlobalCssObject {\n private readonly rules: { selector: string; subBlocks: CssObjectSubBlock[] }[]\n\n constructor(styles: GlobalCssStyles) {\n this.rules = Object.entries(styles)\n .toSorted(compareStringKey)\n .map(([selector, props]) => ({\n selector,\n subBlocks: [...CssObjectSubBlock.fromProps(props)],\n }))\n }\n\n asCssString(): string {\n return this.rules\n .flatMap(({ selector, subBlocks }) => subBlocks.map((b) => b.asCssString(selector)))\n .join(\"\\n\\n\")\n }\n}\n","import type { GlobalCssStyles } from \"@/globalCssObject\"\nexport type { GlobalCssStyles } from \"@/globalCssObject\"\n\n/**\n * Creates a global CSS definition.\n * Styles are not scoped to any class — they apply to all matching elements.\n *\n * @param styles - Map of CSS selectors to style objects\n *\n * @example\n * globalCss({\n * 'body': { margin: 0, padding: 0 },\n * '*, *::before, *::after': { boxSizing: 'border-box' },\n * })\n */\nexport function globalCss(styles: GlobalCssStyles): void {\n void styles // mark as used\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAa,QAAb,MAAmB;;;;;CAKf,YAAY,AAAgBA,MAAc;EAAd;;;;;;CAM5B,IAAI,WAAmB;AACnB,SAAO,KAAK,KAAK;;;;;;CAOrB,IAAI,QAAmB;AACnB,SAAO,OAAO,KAAK,SAAS;;;;;CAMhC,WAAmB;AACf,SAAO,KAAK;;;;;;;;;;;;AAapB,SAAgB,YAAY,MAAqB;AAC7C,QAAO,IAAI,MAAM,KAAK;;;;;ACvD1B,MAAa,gBAAgB;C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CAAC;;;;;;;;;;;;;;;;;ACF1D,IAAa,kBAAb,MAA6B;CACzB,AAAiB;CAEjB,YAAY,QAAyB;AACjC,OAAK,QAAQ,OAAO,QAAQ,OAAO,CAC9B,SAAS,iBAAiB,CAC1B,KAAK,CAAC,UAAU,YAAY;GACzB;GACA,WAAW,CAAC,GAAG,kBAAkB,UAAU,MAAM,CAAC;GACrD,EAAE;;CAGX,cAAsB;AAClB,SAAO,KAAK,MACP,SAAS,EAAE,UAAU,gBAAgB,UAAU,KAAK,MAAM,EAAE,YAAY,SAAS,CAAC,CAAC,CACnF,KAAK,OAAO;;;;;;;;;;;;;;;;;;AClBzB,SAAgB,UAAU,QAA+B"}
|
package/dist/index.mjs
CHANGED
|
@@ -914,6 +914,16 @@ var MochiCSS = class MochiCSS {
|
|
|
914
914
|
* const combined = css(baseStyles, additionalStyles)
|
|
915
915
|
*/
|
|
916
916
|
const emptyMochiCSS = new MochiCSS([], {}, {});
|
|
917
|
+
/**
|
|
918
|
+
* Merges multiple MochiCSS instances into a single one, combining their
|
|
919
|
+
* class names, variant class names, and default variants.
|
|
920
|
+
* @param instances - The MochiCSS instances to merge
|
|
921
|
+
* @returns A new MochiCSS instance with all styles combined
|
|
922
|
+
*/
|
|
923
|
+
function mergeMochiCss(instances) {
|
|
924
|
+
if (instances.length === 0) return emptyMochiCSS;
|
|
925
|
+
return new MochiCSS(instances.flatMap((c) => c.classNames), instances.reduce((a, b) => Object.assign(a, b.variantClassNames), {}), instances.reduce((a, b) => Object.assign(a, b.defaultVariants), {}));
|
|
926
|
+
}
|
|
917
927
|
function css(...props) {
|
|
918
928
|
const cssToMerge = [];
|
|
919
929
|
for (const p of props) {
|
|
@@ -921,8 +931,7 @@ function css(...props) {
|
|
|
921
931
|
if (p instanceof MochiCSS) cssToMerge.push(p);
|
|
922
932
|
else cssToMerge.push(MochiCSS.from(new CSSObject(p)));
|
|
923
933
|
}
|
|
924
|
-
|
|
925
|
-
return new MochiCSS(cssToMerge.flatMap((css$1) => css$1.classNames), cssToMerge.reduce((a, b) => Object.assign(a, b.variantClassNames), {}), cssToMerge.reduce((a, b) => Object.assign(a, b.defaultVariants), {}));
|
|
934
|
+
return mergeMochiCss(cssToMerge);
|
|
926
935
|
}
|
|
927
936
|
|
|
928
937
|
//#endregion
|
|
@@ -1004,5 +1013,48 @@ function keyframes(stops) {
|
|
|
1004
1013
|
}
|
|
1005
1014
|
|
|
1006
1015
|
//#endregion
|
|
1007
|
-
|
|
1016
|
+
//#region src/globalCssObject.ts
|
|
1017
|
+
/**
|
|
1018
|
+
* CSS object model for global (non-scoped) styles.
|
|
1019
|
+
* Accepts a map of CSS selectors to style objects and serializes them
|
|
1020
|
+
* as plain CSS rules without class name scoping.
|
|
1021
|
+
*
|
|
1022
|
+
* @example
|
|
1023
|
+
* const obj = new GlobalCssObject({
|
|
1024
|
+
* body: { margin: 0 },
|
|
1025
|
+
* 'h1': { fontSize: 32 },
|
|
1026
|
+
* })
|
|
1027
|
+
* obj.asCssString() // "body {\n margin: 0;\n}\n\nh1 {\n font-size: 32px;\n}"
|
|
1028
|
+
*/
|
|
1029
|
+
var GlobalCssObject = class {
|
|
1030
|
+
rules;
|
|
1031
|
+
constructor(styles) {
|
|
1032
|
+
this.rules = Object.entries(styles).toSorted(compareStringKey).map(([selector, props]) => ({
|
|
1033
|
+
selector,
|
|
1034
|
+
subBlocks: [...CssObjectSubBlock.fromProps(props)]
|
|
1035
|
+
}));
|
|
1036
|
+
}
|
|
1037
|
+
asCssString() {
|
|
1038
|
+
return this.rules.flatMap(({ selector, subBlocks }) => subBlocks.map((b) => b.asCssString(selector))).join("\n\n");
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/globalCss.ts
|
|
1044
|
+
/**
|
|
1045
|
+
* Creates a global CSS definition.
|
|
1046
|
+
* Styles are not scoped to any class — they apply to all matching elements.
|
|
1047
|
+
*
|
|
1048
|
+
* @param styles - Map of CSS selectors to style objects
|
|
1049
|
+
*
|
|
1050
|
+
* @example
|
|
1051
|
+
* globalCss({
|
|
1052
|
+
* 'body': { margin: 0, padding: 0 },
|
|
1053
|
+
* '*, *::before, *::after': { boxSizing: 'border-box' },
|
|
1054
|
+
* })
|
|
1055
|
+
*/
|
|
1056
|
+
function globalCss(styles) {}
|
|
1057
|
+
|
|
1058
|
+
//#endregion
|
|
1059
|
+
export { CSSObject, CssObjectBlock, CssObjectSubBlock, GlobalCssObject, KeyframesObject, MochiCSS, MochiKeyframes, MochiSelector, Token, createToken, css, cssFromProps, globalCss, keyframes, mergeMochiCss, styled };
|
|
1008
1060
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["name: string","cssSelectors: string[]","mediaSelectors: string[]","cssProps: Record<string, string>","selector: MochiSelector","propsToProcess: { key: string; selector: MochiSelector; props: StyleProps }[]","props","selector","classNames: string[]","variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } }","defaultVariants: Partial<RefineVariants<V>>","cssToMerge: MochiCSS<AllVariants>[]","css","name: string"],"sources":["../src/token.ts","../src/propertyUnits.generated.ts","../src/props.ts","../src/selector.ts","../src/hash.ts","../src/compare.ts","../src/cssObject.ts","../src/css.ts","../src/styled.ts","../src/keyframesObject.ts","../src/keyframes.ts"],"sourcesContent":["/**\n * CSS custom property (design token) utilities.\n * Provides type-safe access to CSS variables with proper `var()` syntax.\n * @module token\n */\n\nimport { CssVar, CssVarVal } from \"@/values\"\n\n/**\n * Represents a CSS custom property (design token) with type information.\n * Provides convenient access to both the variable name and its `var()` reference.\n * @template T - The expected value type of the token (for type checking)\n * @example\n * const primaryColor = new Token<string>('primary-color')\n * primaryColor.variable // '--primary-color'\n * primaryColor.value // 'var(--primary-color)'\n */\nexport class Token {\n /**\n * Creates a new CSS token.\n * @param name - The token name (without the `--` prefix)\n */\n constructor(public readonly name: string) {}\n\n /**\n * Gets the CSS custom property name (with `--` prefix).\n * Use this when defining the variable.\n */\n get variable(): CssVar {\n return `--${this.name}`\n }\n\n /**\n * Gets the CSS `var()` reference to this token.\n * Use this when consuming the variable value.\n */\n get value(): CssVarVal {\n return `var(${this.variable})`\n }\n\n /**\n * Returns the variable name for string coercion.\n */\n toString(): CssVar {\n return this.variable\n }\n}\n\n/**\n * Creates a new CSS design token.\n * @template T - The expected value type of the token\n * @param name - The token name (without the `--` prefix)\n * @returns A new Token instance\n * @example\n * const spacing = createToken<number>('spacing-md')\n * // Use in styles: { gap: spacing.value }\n */\nexport function createToken(name: string): Token {\n return new Token(name)\n}\n","// Auto-generated from @webref/css - do not edit manually\n// Run \"yarn build\" to regenerate\n\nexport const propertyUnits = {\n animation: \"ms\",\n animationDelay: \"ms\",\n animationDuration: \"ms\",\n animationRange: \"px\",\n animationRangeCenter: \"px\",\n animationRangeEnd: \"px\",\n animationRangeStart: \"px\",\n background: \"px\",\n backgroundPosition: \"px\",\n backgroundPositionBlock: \"px\",\n backgroundPositionInline: \"px\",\n backgroundPositionX: \"px\",\n backgroundPositionY: \"px\",\n backgroundSize: \"px\",\n backgroundTbd: \"px\",\n baselineShift: \"px\",\n blockSize: \"px\",\n blockStep: \"px\",\n blockStepSize: \"px\",\n border: \"px\",\n borderBlock: \"px\",\n borderBlockClip: \"px\",\n borderBlockEnd: \"px\",\n borderBlockEndClip: \"px\",\n borderBlockEndRadius: \"px\",\n borderBlockEndWidth: \"px\",\n borderBlockStart: \"px\",\n borderBlockStartClip: \"px\",\n borderBlockStartRadius: \"px\",\n borderBlockStartWidth: \"px\",\n borderBlockWidth: \"px\",\n borderBottom: \"px\",\n borderBottomClip: \"px\",\n borderBottomLeftRadius: \"px\",\n borderBottomRadius: \"px\",\n borderBottomRightRadius: \"px\",\n borderBottomWidth: \"px\",\n borderClip: \"px\",\n borderEndEndRadius: \"px\",\n borderEndStartRadius: \"px\",\n borderImage: \"%\",\n borderImageOutset: \"px\",\n borderImageSlice: \"%\",\n borderImageWidth: \"px\",\n borderInline: \"px\",\n borderInlineClip: \"px\",\n borderInlineEnd: \"px\",\n borderInlineEndClip: \"px\",\n borderInlineEndRadius: \"px\",\n borderInlineEndWidth: \"px\",\n borderInlineStart: \"px\",\n borderInlineStartClip: \"px\",\n borderInlineStartRadius: \"px\",\n borderInlineStartWidth: \"px\",\n borderInlineWidth: \"px\",\n borderLeft: \"px\",\n borderLeftClip: \"px\",\n borderLeftRadius: \"px\",\n borderLeftWidth: \"px\",\n borderLimit: \"px\",\n borderRadius: \"px\",\n borderRight: \"px\",\n borderRightClip: \"px\",\n borderRightRadius: \"px\",\n borderRightWidth: \"px\",\n borderSpacing: \"px\",\n borderStartEndRadius: \"px\",\n borderStartStartRadius: \"px\",\n borderTop: \"px\",\n borderTopClip: \"px\",\n borderTopLeftRadius: \"px\",\n borderTopRadius: \"px\",\n borderTopRightRadius: \"px\",\n borderTopWidth: \"px\",\n borderWidth: \"px\",\n bottom: \"px\",\n boxShadow: \"px\",\n boxShadowBlur: \"px\",\n boxShadowOffset: \"px\",\n boxShadowSpread: \"px\",\n columnGap: \"px\",\n columnHeight: \"px\",\n columnRule: \"px\",\n columnRuleEdgeInset: \"px\",\n columnRuleEdgeInsetEnd: \"px\",\n columnRuleEdgeInsetStart: \"px\",\n columnRuleInset: \"px\",\n columnRuleInsetEnd: \"px\",\n columnRuleInsetStart: \"px\",\n columnRuleInteriorInset: \"px\",\n columnRuleInteriorInsetEnd: \"px\",\n columnRuleInteriorInsetStart: \"px\",\n columnRuleWidth: \"px\",\n columns: \"px\",\n columnWidth: \"px\",\n containIntrinsicBlockSize: \"px\",\n containIntrinsicHeight: \"px\",\n containIntrinsicInlineSize: \"px\",\n containIntrinsicSize: \"px\",\n containIntrinsicWidth: \"px\",\n corner: \"px\",\n cornerBlockEnd: \"px\",\n cornerBlockStart: \"px\",\n cornerBottom: \"px\",\n cornerBottomLeft: \"px\",\n cornerBottomRight: \"px\",\n cornerEndEnd: \"px\",\n cornerEndStart: \"px\",\n cornerInlineEnd: \"px\",\n cornerInlineStart: \"px\",\n cornerLeft: \"px\",\n cornerRight: \"px\",\n cornerStartEnd: \"px\",\n cornerStartStart: \"px\",\n cornerTop: \"px\",\n cornerTopLeft: \"px\",\n cornerTopRight: \"px\",\n cx: \"px\",\n cy: \"px\",\n fillOpacity: \"%\",\n fillPosition: \"px\",\n fillSize: \"px\",\n flex: \"px\",\n flexBasis: \"px\",\n floatOffset: \"px\",\n floodOpacity: \"%\",\n flowTolerance: \"px\",\n font: \"deg\",\n fontSize: \"px\",\n fontStretch: \"%\",\n fontStyle: \"deg\",\n fontWidth: \"%\",\n gap: \"px\",\n grid: \"px\",\n gridAutoColumns: \"px\",\n gridAutoRows: \"px\",\n gridColumnGap: \"px\",\n gridGap: \"px\",\n gridRowGap: \"px\",\n gridTemplate: \"px\",\n gridTemplateColumns: \"px\",\n gridTemplateRows: \"px\",\n height: \"px\",\n hyphenateLimitZone: \"px\",\n imageOrientation: \"deg\",\n imageResolution: \"dppx\",\n initialLetterWrap: \"px\",\n inlineSize: \"px\",\n inset: \"px\",\n insetBlock: \"px\",\n insetBlockEnd: \"px\",\n insetBlockStart: \"px\",\n insetInline: \"px\",\n insetInlineEnd: \"px\",\n insetInlineStart: \"px\",\n interestDelay: \"ms\",\n interestDelayEnd: \"ms\",\n interestDelayStart: \"ms\",\n itemFlow: \"px\",\n left: \"px\",\n letterSpacing: \"px\",\n lineHeight: \"px\",\n lineHeightStep: \"px\",\n linePadding: \"px\",\n margin: \"px\",\n marginBlock: \"px\",\n marginBlockEnd: \"px\",\n marginBlockStart: \"px\",\n marginBottom: \"px\",\n marginInline: \"px\",\n marginInlineEnd: \"px\",\n marginInlineStart: \"px\",\n marginLeft: \"px\",\n marginRight: \"px\",\n marginTop: \"px\",\n mask: \"px\",\n maskBorder: \"%\",\n maskBorderOutset: \"px\",\n maskBorderSlice: \"%\",\n maskBorderWidth: \"px\",\n maskPosition: \"px\",\n maskSize: \"px\",\n maxBlockSize: \"px\",\n maxHeight: \"px\",\n maxInlineSize: \"px\",\n maxWidth: \"px\",\n minBlockSize: \"px\",\n minHeight: \"px\",\n minInlineSize: \"px\",\n minWidth: \"px\",\n objectPosition: \"px\",\n offset: \"px\",\n offsetAnchor: \"px\",\n offsetDistance: \"px\",\n offsetPosition: \"px\",\n offsetRotate: \"deg\",\n opacity: \"%\",\n outline: \"px\",\n outlineOffset: \"px\",\n outlineWidth: \"px\",\n overflowClipMargin: \"px\",\n overflowClipMarginBlock: \"px\",\n overflowClipMarginBlockEnd: \"px\",\n overflowClipMarginBlockStart: \"px\",\n overflowClipMarginBottom: \"px\",\n overflowClipMarginInline: \"px\",\n overflowClipMarginInlineEnd: \"px\",\n overflowClipMarginInlineStart: \"px\",\n overflowClipMarginLeft: \"px\",\n overflowClipMarginRight: \"px\",\n overflowClipMarginTop: \"px\",\n padding: \"px\",\n paddingBlock: \"px\",\n paddingBlockEnd: \"px\",\n paddingBlockStart: \"px\",\n paddingBottom: \"px\",\n paddingInline: \"px\",\n paddingInlineEnd: \"px\",\n paddingInlineStart: \"px\",\n paddingLeft: \"px\",\n paddingRight: \"px\",\n paddingTop: \"px\",\n pause: \"ms\",\n pauseAfter: \"ms\",\n pauseBefore: \"ms\",\n perspective: \"px\",\n perspectiveOrigin: \"px\",\n r: \"px\",\n rest: \"ms\",\n restAfter: \"ms\",\n restBefore: \"ms\",\n right: \"px\",\n rotate: \"deg\",\n rowGap: \"px\",\n rowRule: \"px\",\n rowRuleEdgeInset: \"px\",\n rowRuleEdgeInsetEnd: \"px\",\n rowRuleEdgeInsetStart: \"px\",\n rowRuleInset: \"px\",\n rowRuleInsetEnd: \"px\",\n rowRuleInsetStart: \"px\",\n rowRuleInteriorInset: \"px\",\n rowRuleInteriorInsetEnd: \"px\",\n rowRuleInteriorInsetStart: \"px\",\n rowRuleWidth: \"px\",\n rule: \"px\",\n ruleEdgeInset: \"px\",\n ruleInset: \"px\",\n ruleInsetEnd: \"px\",\n ruleInsetStart: \"px\",\n ruleInteriorInset: \"px\",\n ruleWidth: \"px\",\n rx: \"px\",\n ry: \"px\",\n scale: \"%\",\n scrollMargin: \"px\",\n scrollMarginBlock: \"px\",\n scrollMarginBlockEnd: \"px\",\n scrollMarginBlockStart: \"px\",\n scrollMarginBottom: \"px\",\n scrollMarginInline: \"px\",\n scrollMarginInlineEnd: \"px\",\n scrollMarginInlineStart: \"px\",\n scrollMarginLeft: \"px\",\n scrollMarginRight: \"px\",\n scrollMarginTop: \"px\",\n scrollPadding: \"px\",\n scrollPaddingBlock: \"px\",\n scrollPaddingBlockEnd: \"px\",\n scrollPaddingBlockStart: \"px\",\n scrollPaddingBottom: \"px\",\n scrollPaddingInline: \"px\",\n scrollPaddingInlineEnd: \"px\",\n scrollPaddingInlineStart: \"px\",\n scrollPaddingLeft: \"px\",\n scrollPaddingRight: \"px\",\n scrollPaddingTop: \"px\",\n shapeImageThreshold: \"%\",\n shapeMargin: \"px\",\n shapePadding: \"px\",\n stopOpacity: \"%\",\n strokeDasharray: \"px\",\n strokeDashcorner: \"px\",\n strokeDashCorner: \"px\",\n strokeDashoffset: \"px\",\n strokeOpacity: \"%\",\n strokePosition: \"px\",\n strokeSize: \"px\",\n strokeWidth: \"px\",\n tabSize: \"px\",\n textDecoration: \"px\",\n textDecorationInset: \"px\",\n textDecorationThickness: \"px\",\n textIndent: \"px\",\n textShadow: \"px\",\n textSizeAdjust: \"%\",\n textUnderlineOffset: \"px\",\n timelineTrigger: \"px\",\n timelineTriggerExitRange: \"px\",\n timelineTriggerExitRangeEnd: \"px\",\n timelineTriggerExitRangeStart: \"px\",\n timelineTriggerRange: \"px\",\n timelineTriggerRangeEnd: \"px\",\n timelineTriggerRangeStart: \"px\",\n top: \"px\",\n transformOrigin: \"px\",\n transition: \"ms\",\n transitionDelay: \"ms\",\n transitionDuration: \"ms\",\n translate: \"px\",\n verticalAlign: \"px\",\n viewTimeline: \"px\",\n viewTimelineInset: \"px\",\n voiceDuration: \"ms\",\n voicePitch: \"Hz\",\n voiceRange: \"Hz\",\n voiceRate: \"%\",\n width: \"px\",\n wordSpacing: \"px\",\n x: \"px\",\n y: \"px\",\n zoom: \"%\",\n} as const\n\nexport type PropertyWithUnit = keyof typeof propertyUnits\n","/**\n * CSS property handling and type definitions.\n * Provides type-safe mappings from JavaScript objects to CSS properties,\n * with automatic unit conversion and value formatting.\n * @module props\n */\n\nimport { Properties, ObsoleteProperties } from \"csstype\"\nimport { CssLike, CssVar } from \"@/values\"\nimport properties from \"known-css-properties\"\nimport { propertyUnits, type PropertyWithUnit } from \"./propertyUnits.generated\"\n\n/** All non-obsolete CSS properties from csstype */\ntype Props = Required<Omit<Properties, keyof ObsoleteProperties>>\n\n/** Properties that have default units and are valid CSS properties */\ntype PropsWithUnit = PropertyWithUnit & keyof Props\n\n/**\n * Converts a kebab-case string to camelCase.\n */\nexport function kebabToCamel(str: string): string {\n return str.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())\n}\n\n/**\n * Converts a camelCase string to kebab-case.\n */\nexport function camelToKebab(str: string): string {\n return str.replace(/[A-Z]/g, (m) => \"-\" + m.toLowerCase())\n}\n\nfunction getUnitForProperty(propertyName: string): string | undefined {\n return propertyName in propertyUnits ? propertyUnits[propertyName as PropertyWithUnit] : undefined\n}\n\n/**\n * Converts a CSS-like value to its string representation.\n * For properties with known units, numbers are automatically suffixed.\n */\nfunction formatValue(value: CssLike<string | number>, propertyName: string, maxDepth = 10): string {\n if (maxDepth <= 0) return \"\"\n if (typeof value === \"string\") return value\n if (typeof value === \"number\") {\n const unit = getUnitForProperty(propertyName)\n if (unit === \"%\") return `${value * 100}${unit}`\n if (value === 0) return \"0\"\n return unit ? `${value}${unit}` : value.toString()\n }\n return formatValue(value.value, propertyName, maxDepth - 1)\n}\n\n//TODO: generate this list and drop known-css-properties package\nconst knownPropertySet = new Set<string>(properties.all.map(kebabToCamel))\n\n/**\n * Checks if a property name is a CSS custom property (variable).\n */\nexport function isCssVariableName(key: string): key is CssVar {\n return key.startsWith(\"--\")\n}\n\n/**\n * Converts a CSS-like value to a string for use as a CSS variable value.\n * @param value - The value to convert (string, number, or wrapped value)\n * @param maxDepth - Maximum recursion depth for evaluating the value\n * @returns The string representation\n */\nexport function asVar(value: CssLike<string | number>, maxDepth = 10): string {\n if (maxDepth <= 0) return \"\"\n switch (typeof value) {\n case \"string\":\n return value\n case \"number\":\n return value.toString()\n default:\n return asVar(value.value, maxDepth - 1)\n }\n}\n\n/**\n * Checks if a property name is a known CSS property.\n */\nexport function isKnownPropertyName(key: string): key is keyof Props {\n return knownPropertySet.has(key)\n}\n\n/**\n * Converts a value to a CSS property string.\n * Automatically appends units to numeric values for properties that require them.\n * @param value - The value to convert\n * @param key - The CSS property name\n * @returns The formatted CSS value string\n */\nexport function asKnownProp(value: unknown, key: keyof Props): string {\n return formatValue(value as CssLike<string | number>, key)\n}\n\n/**\n * Checks if a key represents a nested CSS selector.\n */\n//TODO: make better validation, provide human readable errors\nexport function isNestedSelector(key: string): key is NestedCssSelector {\n return key.includes(\"&\")\n}\n\n/**\n * Checks if a key represents a media query.\n */\n//TODO: make better validation, provide human readable errors\nexport function isMediaSelector(key: string): key is MediaSelector {\n return key.startsWith(\"@\")\n}\n\n/** A nested CSS selector pattern containing the parent reference `&` */\nexport type NestedCssSelector = `${string}&${string}`\n\n/** A CSS media query starting with `@` */\nexport type MediaSelector = `@${string}`\n\ntype NestedStyleKeys = MediaSelector | NestedCssSelector\n\n/**\n * Style properties without nesting support.\n * Includes all standard CSS properties with type-safe value converters,\n * plus CSS custom properties (variables).\n *\n * Properties with known units (e.g., width, height, padding) accept numbers\n * that are automatically converted with their default unit (e.g., px, ms).\n */\nexport type SimpleStyleProps = { [K in PropsWithUnit]?: CssLike<number | Props[K]> } & {\n [K in Exclude<keyof Props, PropsWithUnit>]?: CssLike<Props[K]>\n} & Partial<Record<CssVar, CssLike<string | number>>>\n\n/**\n * Full style properties type with support for nested selectors and media queries.\n * Extends SimpleStyleProps to allow recursive style definitions.\n *\n * @example\n * const styles: StyleProps = {\n * color: 'blue',\n * padding: 16,\n * '&:hover': { color: 'red' },\n * '@min-width: 768px': { padding: 24 }\n * }\n */\nexport type StyleProps = SimpleStyleProps & { [K in NestedStyleKeys]?: StyleProps | CssLike<string | number> }\n\n/**\n * Converts a SimpleStyleProps object to a CSS properties record.\n * Transforms camelCase property names to kebab-case and applies value converters.\n * @param props - The style properties object\n * @returns A record of CSS property names (kebab-case) to string values\n * @example\n * cssFromProps({ backgroundColor: 'blue', padding: 16 })\n * // { 'background-color': 'blue', 'padding': '16px' }\n */\nexport function cssFromProps(props: SimpleStyleProps): Record<string, string> {\n return Object.fromEntries(\n Object.entries(props)\n .map(([key, value]): [string, string] | undefined => {\n if (value === undefined) return undefined\n // transform variable\n if (isCssVariableName(key)) return [key, asVar(value as CssLike<string | number>)]\n // transform CSS prop\n if (isKnownPropertyName(key)) return [camelToKebab(key), asKnownProp(value, key)]\n return undefined\n })\n .filter((v) => v !== undefined),\n )\n}\n","/**\n * CSS selector building and manipulation utilities.\n * Handles nested selectors (using `&` placeholder) and media queries.\n * @module selector\n */\n\nimport { isMediaSelector, isNestedSelector } from \"@/props\"\n\n/**\n * Immutable CSS selector builder that handles nested selectors and media queries.\n * Uses the `&` character as a placeholder for parent selector substitution.\n *\n * @example\n * const selector = new MochiSelector(['.button'])\n * selector.extend('&:hover').cssSelector // '.button:hover'\n * selector.wrap('@media (min-width: 768px)').mediaQuery // '@media (min-width: 768px)'\n */\nexport class MochiSelector {\n /**\n * Creates a new MochiSelector instance.\n * @param cssSelectors - Array of CSS selectors (may contain `&` placeholders)\n * @param mediaSelectors - Array of media query conditions (without `@media` prefix)\n */\n constructor(\n private readonly cssSelectors: string[] = [],\n private readonly mediaSelectors: string[] = [],\n ) {}\n\n /**\n * Gets the combined CSS selector string.\n * Multiple selectors are joined with commas.\n * @returns The CSS selector, or \"*\" if no selectors are defined\n */\n get cssSelector(): string {\n if (this.cssSelectors.length === 0) return \"*\"\n return this.cssSelectors.join(\", \")\n }\n\n /**\n * Gets the combined media query string, if any.\n * @returns The full `@media` query string, or undefined if no media conditions\n */\n get mediaQuery(): string | undefined {\n if (this.mediaSelectors.length === 0) return undefined\n return `@media ${this.mediaSelectors.map((s) => `(${s})`).join(\" and \")}`\n }\n\n /**\n * Substitutes all `&` placeholders with the given root selector.\n * @param root - The selector to replace `&` with\n * @returns A new MochiSelector with substituted selectors\n */\n substitute(root: string): MochiSelector {\n return new MochiSelector(\n this.cssSelectors.map((selector) => selector.replace(/&/g, root)),\n this.mediaSelectors,\n )\n }\n\n /**\n * Extends this selector by nesting a child selector.\n * The `&` in the child selector is replaced with each parent selector.\n * @param child - The child selector pattern (must contain `&`)\n * @returns A new MochiSelector with the extended selectors\n * @example\n * new MochiSelector(['.btn']).extend('&:hover') // '.btn:hover'\n * new MochiSelector(['.btn']).extend('& .icon') // '.btn .icon'\n */\n extend(child: string): MochiSelector {\n if (!isNestedSelector(child)) return this\n const children = MochiSelector.split(child)\n const selectors = this.cssSelectors.flatMap((parentSelector) =>\n children.map((childSelector) => {\n return childSelector.replace(/&/g, parentSelector)\n }),\n )\n return new MochiSelector(selectors, this.mediaSelectors)\n }\n\n /**\n * Wraps this selector with a media query condition.\n * @param mediaQuery - The media query string (starting with `@`)\n * @returns A new MochiSelector with the added media condition\n * @example\n * selector.wrap('@min-width: 768px') // Adds media query condition\n */\n wrap(mediaQuery: string): MochiSelector {\n if (!isMediaSelector(mediaQuery)) return this\n const mediaQueryPart = mediaQuery.substring(1)\n return new MochiSelector(this.cssSelectors, [...this.mediaSelectors, mediaQueryPart])\n }\n\n /**\n * Splits a comma-separated selector string into individual selectors.\n * @param selector - The selector string to split\n * @returns Array of individual selector strings\n */\n private static split(selector: string): string[] {\n return [selector]\n }\n}\n","/**\n * Hashing utilities for generating short, deterministic class names.\n * Uses djb2 algorithm for fast string hashing.\n * @module hash\n */\n\n/** Characters used for base-62 encoding (css-name safe variant of base-64) */\nconst hashBase = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\"\nconst base = hashBase.length\n\n/**\n * Converts a number to a base-62 string representation.\n * @param num - The number to convert\n * @param maxLength - Optional maximum length of the output string\n * @returns Base-62 encoded string representation of the number\n */\nexport function numberToBase62(num: number, maxLength?: number): string {\n let out = \"\"\n while (num > 0 && out.length < (maxLength ?? Infinity)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n out = hashBase[num % base]! + out\n num = Math.floor(num / base)\n }\n return out.length > 0 ? out : \"0\"\n}\n\n/**\n * Generates a short hash string from input using the djb2 algorithm.\n * Used to create unique, deterministic CSS class names from style content.\n * @param input - The string to hash\n * @param length - Maximum length of the hash output (default: 8)\n * @returns A short, css-safe hash string\n * @example\n * shortHash(\"color: red;\") // Returns something like \"A1b2C3d4\"\n */\nexport function shortHash(input: string, length = 8): string {\n // fast 32-bit integer hash (djb2 variant)\n let h = 5381\n for (let i = 0; i < input.length; i++) {\n h = (h * 33) ^ input.charCodeAt(i)\n }\n // force unsigned\n h >>>= 0\n\n return numberToBase62(h, length)\n}\n","/**\n * String comparison utilities for deterministic sorting.\n * Used internally to ensure consistent CSS output order.\n * @module compare\n */\n\n/**\n * Compares two strings lexicographically.\n */\nexport function compareString<T extends string>(a: T, b: T) {\n return a < b ? -1 : a === b ? 0 : 1\n}\n\n/**\n * Compares two tuples by their first element (string key).\n * Useful for sorting Object.entries() results.\n */\nexport function compareStringKey<T extends [string, unknown]>(a: T, b: T) {\n return compareString(a[0], b[0])\n}\n\n/**\n * Creates a comparator function for objects with a specific string property.\n * @param name - The property name to compare by\n * @returns A comparator function that compares objects by the specified property\n * @example\n * const items = [{ key: 'b' }, { key: 'a' }]\n * items.sort(stringPropComparator('key')) // [{ key: 'a' }, { key: 'b' }]\n */\nexport function stringPropComparator<N extends string>(name: N) {\n return <T extends Record<N, string>>(a: T, b: T) => compareString(a[name], b[name])\n}\n","/**\n * CSS object model for representing and serializing styles.\n * Converts JavaScript style objects into CSS blocks with proper\n * selector handling, nesting support, and deterministic output.\n * @module cssObject\n */\n\nimport {\n asKnownProp,\n asVar,\n camelToKebab,\n isCssVariableName,\n isKnownPropertyName,\n isMediaSelector,\n isNestedSelector,\n StyleProps,\n} from \"@/props\"\nimport { shortHash } from \"@/hash\"\nimport { MochiSelector } from \"@/selector\"\nimport { compareStringKey, stringPropComparator } from \"@/compare\"\n\n/**\n * Represents a single CSS rule block with properties and a selector.\n * Handles conversion to CSS string format and hash generation.\n */\nexport class CssObjectSubBlock {\n /**\n * Creates a new CSS sub-block.\n * @param cssProps - Map of CSS property names (kebab-case) to values\n * @param selector - The selector this block applies to\n */\n constructor(\n public readonly cssProps: Record<string, string>,\n public readonly selector: MochiSelector,\n ) {}\n\n /**\n * Computes a deterministic hash of this block's CSS content.\n * Used for generating unique class names.\n */\n get hash(): string {\n const str = this.asCssString(\"&\")\n return shortHash(str)\n }\n\n /**\n * Converts this block to a CSS string.\n * Handles media query wrapping if the selector has media conditions.\n * @param root - The root selector to substitute for `&`\n * @returns Formatted CSS string\n */\n asCssString(root: string): string {\n const selector = this.selector.substitute(root)\n const mediaQuery = selector.mediaQuery\n\n const mediaIndent = mediaQuery === undefined ? \"\" : \" \"\n\n const props = Object.entries(this.cssProps)\n .toSorted(compareStringKey)\n .map(([k, v]) => `${mediaIndent} ${k}: ${v};\\n`)\n .join(\"\")\n\n const blockCss = `${mediaIndent}${selector.cssSelector} {\\n${props}${mediaIndent}}`\n\n return mediaQuery === undefined ? blockCss : `${mediaQuery} {\\n${blockCss}\\n}`\n }\n\n /**\n * Parses StyleProps into an array of CSS sub-blocks.\n * Recursively processes nested selectors and media queries.\n * Output order is deterministic for consistent hash generation.\n *\n * @param props - The style properties to parse\n * @param selector - The parent selector context (defaults to `&`)\n * @returns Non-empty array of sub-blocks (main block first, then nested)\n */\n static fromProps(props: StyleProps, selector?: MochiSelector): [CssObjectSubBlock, ...CssObjectSubBlock[]] {\n selector ??= new MochiSelector([\"&\"])\n\n const cssProps: Record<string, string> = {}\n const propsToProcess: { key: string; selector: MochiSelector; props: StyleProps }[] = []\n\n for (const [key, value] of Object.entries(props)) {\n // skip undefined value\n if (value === undefined) continue\n\n // transform variable\n if (isCssVariableName(key)) {\n cssProps[key] = asVar(value as StyleProps[typeof key] & {})\n continue\n }\n\n // transform known CSS prop\n if (isKnownPropertyName(key)) {\n cssProps[camelToKebab(key)] = asKnownProp(value, key)\n continue\n }\n\n // transform nested and media selectors\n if (isNestedSelector(key)) {\n propsToProcess.push({\n key,\n props: value as StyleProps,\n selector: selector.extend(key),\n })\n continue\n }\n\n // transform media selector\n if (isMediaSelector(key)) {\n propsToProcess.push({\n key,\n props: value as StyleProps,\n selector: selector.wrap(key),\n })\n continue\n }\n\n if (process.env[\"NODE_ENV\"] !== \"production\") {\n console.warn(`[mochi-css] Unknown style property \"${key}\" will be ignored`)\n }\n }\n\n return [\n new CssObjectSubBlock(cssProps, selector),\n ...propsToProcess\n .toSorted(stringPropComparator(\"key\"))\n .flatMap(({ props, selector }) => CssObjectSubBlock.fromProps(props, selector)),\n ] as const\n }\n}\n\n/**\n * Represents an abstract CSS block definition.\n * Contains one or more sub-blocks for nested selectors and media queries.\n */\nexport class CssObjectBlock {\n /** The generated unique class name for this block */\n public readonly className: string\n /** All sub-blocks (main styles and nested/media rules) */\n public readonly subBlocks: CssObjectSubBlock[] = []\n\n /**\n * Creates a new CSS block from style properties.\n * Generates a unique class name based on the content hash.\n * @param styles - The style properties to compile\n */\n constructor(styles: StyleProps) {\n const blocks = CssObjectSubBlock.fromProps(styles)\n\n this.className = \"c\" + shortHash(blocks.map((b) => b.hash).join(\"+\"))\n this.subBlocks = blocks\n }\n\n /**\n * Gets the CSS class selector for this block.\n */\n get selector(): string {\n return `.${this.className}`\n }\n\n /**\n * Converts style block to a CSS string.\n * @param root - The root selector to scope styles to\n * @returns Complete CSS string for this block\n */\n asCssString(root: string): string {\n return this.subBlocks\n .map((b) => b.asCssString(new MochiSelector([root]).extend(`&.${this.className}`).cssSelector))\n .join(\"\\n\\n\")\n }\n}\n\nexport type AllVariants = Record<string, Record<string, StyleProps>>\nexport type DefaultVariants = Record<never, Record<string, StyleProps>>\n\n/**\n * A compound variant entry that applies styles when multiple variant conditions match.\n * Each entry specifies a set of variant conditions and a `css` property with styles\n * that apply only when all conditions are satisfied simultaneously.\n *\n * @template V - The variant definitions type\n *\n * @example\n * { color: 'red', size: 'large', css: { fontWeight: 'bold' } }\n */\nexport type CompoundVariant<V extends AllVariants> = {\n [K in keyof V]?: keyof V[K]\n} & { css: StyleProps }\n\n/**\n * Refines string literal types to their proper runtime types.\n * Converts \"true\"/\"false\" strings to boolean literals.\n */\ntype RefineVariantType<T extends string> = T extends \"true\"\n ? true\n : T extends \"false\"\n ? false\n : T extends string\n ? T\n : string\n\n/**\n * Props for defining variants in a style object.\n * @template V - The variant definitions type\n */\nexport type VariantProps<V extends AllVariants> = {\n /** Variant definitions mapping names to options to styles */\n variants?: V\n /** Default variant selections for when not explicitly provided */\n defaultVariants?: { [K in keyof V]?: keyof V[K] extends string ? RefineVariantType<keyof V[K] & string> : never }\n /** Compound variant definitions that apply when multiple variant conditions match */\n compoundVariants?: CompoundVariant<V>[]\n}\n\n/** Combined type for style props with optional variants */\nexport type MochiCSSProps<V extends AllVariants> = StyleProps & VariantProps<V>\n\n/** Utility type to override properties of A with properties of B */\ntype Override<A extends object, B extends object> = B & Omit<A, keyof B>\n\n/** Recursively merges variant types from a tuple, with later types overriding earlier */\nexport type MergeCSSVariants<V extends AllVariants[]> = V extends [\n infer V1 extends AllVariants,\n ...infer VRest extends AllVariants[],\n]\n ? Override<V1, MergeCSSVariants<VRest>>\n : DefaultVariants\n\n/** Refines all values in a string record to their proper variant types */\ntype RefineVariantTypes<V extends Record<string, string>> = { [K in keyof V]: RefineVariantType<V[K]> }\n\n/** Extracts and refines variant option types from a DefaultVariants definition */\nexport type RefineVariants<T extends AllVariants> = RefineVariantTypes<{ [K in keyof T]: keyof T[K] & string }>\n\n/**\n * Complete CSS object representation with main and variant styles.\n *\n * @template V - The variant definitions type\n *\n * @example\n * const obj = new CSSObject({\n * color: 'blue',\n * variants: {\n * size: {\n * small: { fontSize: 12 },\n * large: { fontSize: 18 }\n * }\n * },\n * defaultVariants: { size: 'small' }\n * })\n * obj.asCssString() // Returns complete CSS with all variants\n */\nexport class CSSObject<V extends AllVariants = DefaultVariants> {\n /** The main style block (non-variant styles) */\n public readonly mainBlock: CssObjectBlock\n /** Compiled blocks for each variant option */\n public readonly variantBlocks: { [K in keyof V & string]: Record<keyof V[K] & string, CssObjectBlock> }\n /** Default variant selections */\n public readonly variantDefaults: Partial<RefineVariants<V>>\n /** Compound variant conditions and their parsed sub-blocks */\n public readonly compoundVariants: { conditions: Record<string, string>; subBlocks: CssObjectSubBlock[] }[]\n\n /**\n * Creates a new CSSObject from style props.\n * Compiles main styles and all variant options into CSS blocks.\n */\n public constructor({ variants, defaultVariants, compoundVariants, ...props }: MochiCSSProps<V>) {\n this.mainBlock = new CssObjectBlock(props)\n this.variantBlocks = {} as typeof this.variantBlocks\n this.variantDefaults = defaultVariants ?? {}\n this.compoundVariants = []\n\n if (variants) {\n for (const variantGroupName in variants) {\n this.variantBlocks[variantGroupName] =\n {} as (typeof this.variantBlocks)[keyof typeof this.variantBlocks]\n const variantGroup = variants[variantGroupName]\n for (const variantItemName in variantGroup) {\n this.variantBlocks[variantGroupName][variantItemName] = new CssObjectBlock(\n variantGroup[variantItemName] ?? {},\n )\n }\n }\n }\n\n if (compoundVariants) {\n for (const compound of compoundVariants) {\n const { css: styles, ...conditions } = compound\n this.compoundVariants.push({\n conditions: conditions as Record<string, string>,\n subBlocks: CssObjectSubBlock.fromProps(styles),\n })\n }\n }\n }\n\n /**\n * Serializes the entire CSS object to a CSS string.\n * Outputs main block first, then all variant blocks in sorted order.\n * @returns Complete CSS string ready for injection into a stylesheet\n */\n public asCssString(): string {\n return [\n this.mainBlock.asCssString(this.mainBlock.selector),\n ...Object.entries(this.variantBlocks)\n .toSorted(compareStringKey)\n .flatMap(([_, b]) => Object.entries(b).toSorted(compareStringKey))\n .map(([_, b]) => b.asCssString(this.mainBlock.selector)),\n ...this.compoundVariants.map(({ conditions, subBlocks }) => {\n const variantSelectors = Object.entries(conditions)\n .toSorted(compareStringKey)\n .map(([variantName, optionName]) => {\n const block = this.variantBlocks[variantName]?.[optionName]\n return block?.selector ?? \"\"\n })\n .filter(Boolean)\n .join(\"\")\n const combinedSelector = `${this.mainBlock.selector}${variantSelectors}`\n return subBlocks.map((b) => b.asCssString(combinedSelector)).join(\"\\n\\n\")\n }),\n ].join(\"\\n\\n\")\n }\n}\n","/**\n * Core CSS-in-JS runtime for generating and applying styles.\n * Provides the main `css` function and `MochiCSS` class for style management.\n * @module css\n */\n\nimport clsx from \"clsx\"\nimport { CSSObject, AllVariants, DefaultVariants, MergeCSSVariants, MochiCSSProps, RefineVariants } from \"@/cssObject\"\n\n/**\n * Runtime representation of a CSS style definition with variant support.\n * Holds generated class names and provides methods to compute the final\n * className string based on selected variants.\n *\n * @template V - The variant definitions type mapping variant names to their options\n *\n * @example\n * const styles = MochiCSS.from(new CSSObject({\n * color: 'blue',\n * variants: { size: { small: { fontSize: 12 }, large: { fontSize: 18 } } }\n * }))\n * styles.variant({ size: 'large' }) // Returns combined class names\n */\nexport class MochiCSS<V extends AllVariants = DefaultVariants> {\n /**\n * Creates a new MochiCSS instance.\n * @param classNames - Base class names to always include\n * @param variantClassNames - Mapping of variant names to option class names\n * @param defaultVariants - Default variant selections when not specified\n */\n constructor(\n public readonly classNames: string[],\n public readonly variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } },\n public readonly defaultVariants: Partial<RefineVariants<V>>,\n ) {}\n\n /**\n * Computes the final className string based on variant selections.\n * Compound variants are handled purely via CSS combined selectors,\n * so no runtime matching is needed here.\n * @param props - Variant selections\n * @returns Combined className string for use in components\n */\n variant(props: Partial<RefineVariants<V>>): string {\n const keys = new Set<keyof V & string>(\n [...Object.keys(props), ...Object.keys(this.defaultVariants)].filter((k) => k in this.variantClassNames),\n )\n\n return clsx(\n this.classNames,\n ...keys.values().map((k) => {\n const variantGroup = this.variantClassNames[k]\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!variantGroup) return false\n\n const variantKey = ((k in props ? props[k] : undefined) ?? this.defaultVariants[k])?.toString()\n if (variantKey == null) return false\n\n const selectedClassname = variantGroup[variantKey]\n if (selectedClassname !== undefined) return selectedClassname\n\n const defaultKey = this.defaultVariants[k]\n if (defaultKey == null) return false\n\n return variantGroup[defaultKey.toString()]\n }),\n )\n }\n\n /**\n * Creates a MochiCSS instance from a CSSObject.\n * Extracts class names from the compiled CSS blocks.\n * @template V - The variant definitions type\n * @param object - The compiled CSSObject to extract from\n * @returns A new MochiCSS instance with the extracted class names\n */\n static from<V extends AllVariants = DefaultVariants>(object: CSSObject<V>): MochiCSS<V> {\n return new MochiCSS<V>(\n [object.mainBlock.className],\n Object.fromEntries(\n Object.entries(object.variantBlocks).map(([key, variantOptions]) => {\n return [\n key,\n Object.fromEntries(\n Object.entries(variantOptions).map(([optionKey, block]) => {\n return [optionKey, block.className]\n }),\n ),\n ]\n }),\n ) as { [K in keyof V]: { [P in keyof V[K]]: string } },\n object.variantDefaults,\n )\n }\n}\n\n/**\n * Creates a CSS style definition.\n * The primary API for defining styles in Mochi-CSS.\n *\n * @template V - Tuple of variant definition types\n * @param props - One or more style objects or existing MochiCSS instances to merge\n * @returns A MochiCSS instance with all styles and variants combined\n *\n * @example\n * // Simple usage\n * const button = css({ padding: 8, borderRadius: 4 })\n *\n * @example\n * // With variants\n * const button = css({\n * padding: 8,\n * variants: {\n * size: {\n * small: { padding: 4 },\n * large: { padding: 16 }\n * }\n * },\n * defaultVariants: { size: 'small' }\n * })\n * button.variant({ size: 'large' }) // Get class names for large size\n *\n * @example\n * // Merging multiple styles\n * const combined = css(baseStyles, additionalStyles)\n */\nconst emptyMochiCSS = new MochiCSS<AllVariants>([], {}, {})\n\nexport function css<V extends AllVariants[]>(\n ...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS }\n): MochiCSS<MergeCSSVariants<V>> {\n const cssToMerge: MochiCSS<AllVariants>[] = []\n for (const p of props) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (p == null || typeof p !== \"object\") continue\n if (p instanceof MochiCSS) {\n cssToMerge.push(p)\n } else {\n cssToMerge.push(MochiCSS.from(new CSSObject<AllVariants>(p)))\n }\n }\n\n if (cssToMerge.length === 0) return emptyMochiCSS as MochiCSS<MergeCSSVariants<V>>\n\n return new MochiCSS<AllVariants>(\n cssToMerge.flatMap((css) => css.classNames),\n cssToMerge.reduce((a, b) => Object.assign(a, b.variantClassNames), {}),\n cssToMerge.reduce((a, b) => Object.assign(a, b.defaultVariants), {}),\n ) as MochiCSS<MergeCSSVariants<V>>\n}\n","/**\n * React styled component utilities.\n * Creates styled components with CSS-in-JS support and variant props.\n * @module styled\n */\n\nimport { ComponentProps, ComponentType, createElement, FC, HTMLElementType } from \"react\"\nimport { css } from \"@/css\"\nimport clsx from \"clsx\"\nimport { AllVariants, MergeCSSVariants, MochiCSSProps, RefineVariants } from \"@/cssObject\"\n\n/** Props added by MochiCSS to styled components */\ntype MochiProps<V extends AllVariants[]> = {\n className?: string\n} & Partial<RefineVariants<MergeCSSVariants<V>>>\n\n/** Minimal interface for components that accept className */\ntype Cls = { className?: string }\n\n/**\n * Creates a styled React component with CSS-in-JS support and variant props.\n * Similar to styled-components or Stitches, but with zero runtime overhead.\n *\n * @template T - The base element type or component type\n * @template V - The variant definitions tuple type\n * @param target - The HTML element tag name or React component to style\n * @param props - One or more style objects with optional variants\n * @returns A React functional component with merged props and variant support\n *\n * @example\n * const Button = styled('button', {\n * padding: 8,\n * borderRadius: 4,\n * variants: {\n * size: {\n * small: { padding: 4 },\n * large: { padding: 16 }\n * },\n * variant: {\n * primary: { backgroundColor: 'blue' },\n * secondary: { backgroundColor: 'gray' }\n * }\n * }\n * })\n *\n * // Usage: <Button size=\"large\" variant=\"primary\">Click me</Button>\n */\n//TODO: Move to dedicated \"styled\" package\nexport function styled<T extends HTMLElementType | ComponentType<Cls>, V extends AllVariants[]>(\n target: T,\n ...props: { [K in keyof V]: MochiCSSProps<V[K]> }\n): FC<Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>> {\n const styles = css<V>(...props)\n return ({ className, ...p }: Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>) =>\n //TODO: pick only variant props from p\n //TODO: omit variant props in p\n createElement(target, {\n className: clsx(styles.variant(p as unknown as Parameters<typeof styles.variant>[0]), className),\n ...p,\n })\n}\n","import { shortHash } from \"@/hash\"\nimport { cssFromProps, SimpleStyleProps } from \"@/props\"\nimport { compareStringKey } from \"@/compare\"\n\nexport type KeyframeStops = Record<string, SimpleStyleProps>\n\nexport class KeyframesObject {\n public readonly name: string\n private readonly body: string\n\n constructor(stops: KeyframeStops) {\n this.body = KeyframesObject.generateBody(stops)\n this.name = \"kf\" + shortHash(this.body)\n }\n\n asCssString(): string {\n return `@keyframes ${this.name} {\\n${this.body}\\n}`\n }\n\n private static generateBody(stops: KeyframeStops): string {\n return Object.entries(stops)\n .toSorted(compareStringKey)\n .map(([stopKey, props]) => {\n const cssProps = cssFromProps(props)\n const propsStr = Object.entries(cssProps)\n .toSorted(compareStringKey)\n .map(([k, v]) => ` ${k}: ${v};`)\n .join(\"\\n\")\n return ` ${stopKey} {\\n${propsStr}\\n }`\n })\n .join(\"\\n\\n\")\n }\n}\n","import { KeyframesObject, type KeyframeStops } from \"@/keyframesObject\"\nexport type { KeyframeStops } from \"@/keyframesObject\"\n\nexport class MochiKeyframes {\n constructor(public readonly name: string) {}\n\n toString(): string {\n return this.name\n }\n\n get value(): string {\n return this.name\n }\n\n static from(object: KeyframesObject): MochiKeyframes {\n return new MochiKeyframes(object.name)\n }\n}\n\nexport function keyframes(stops: KeyframeStops): MochiKeyframes {\n return MochiKeyframes.from(new KeyframesObject(stops))\n}\n"],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;;;;AC3BzB,IAAa,iBAAb,MAAa,eAAe;CACxB,YAAY,AAAgBC,MAAc;EAAd;;CAE5B,WAAmB;AACf,SAAO,KAAK;;CAGhB,IAAI,QAAgB;AAChB,SAAO,KAAK;;CAGhB,OAAO,KAAK,QAAyC;AACjD,SAAO,IAAI,eAAe,OAAO,KAAK;;;AAI9C,SAAgB,UAAU,OAAsC;AAC5D,QAAO,eAAe,KAAK,IAAI,gBAAgB,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["name: string","cssSelectors: string[]","mediaSelectors: string[]","cssProps: Record<string, string>","selector: MochiSelector","propsToProcess: { key: string; selector: MochiSelector; props: StyleProps }[]","props","selector","classNames: string[]","variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } }","defaultVariants: Partial<RefineVariants<V>>","cssToMerge: MochiCSS<AllVariants>[]","name: string"],"sources":["../src/token.ts","../src/propertyUnits.generated.ts","../src/props.ts","../src/selector.ts","../src/hash.ts","../src/compare.ts","../src/cssObject.ts","../src/css.ts","../src/styled.ts","../src/keyframesObject.ts","../src/keyframes.ts","../src/globalCssObject.ts","../src/globalCss.ts"],"sourcesContent":["/**\n * CSS custom property (design token) utilities.\n * Provides type-safe access to CSS variables with proper `var()` syntax.\n * @module token\n */\n\nimport { CssVar, CssVarVal } from \"@/values\"\n\n/**\n * Represents a CSS custom property (design token) with type information.\n * Provides convenient access to both the variable name and its `var()` reference.\n * @template T - The expected value type of the token (for type checking)\n * @example\n * const primaryColor = new Token<string>('primary-color')\n * primaryColor.variable // '--primary-color'\n * primaryColor.value // 'var(--primary-color)'\n */\nexport class Token {\n /**\n * Creates a new CSS token.\n * @param name - The token name (without the `--` prefix)\n */\n constructor(public readonly name: string) {}\n\n /**\n * Gets the CSS custom property name (with `--` prefix).\n * Use this when defining the variable.\n */\n get variable(): CssVar {\n return `--${this.name}`\n }\n\n /**\n * Gets the CSS `var()` reference to this token.\n * Use this when consuming the variable value.\n */\n get value(): CssVarVal {\n return `var(${this.variable})`\n }\n\n /**\n * Returns the variable name for string coercion.\n */\n toString(): CssVar {\n return this.variable\n }\n}\n\n/**\n * Creates a new CSS design token.\n * @template T - The expected value type of the token\n * @param name - The token name (without the `--` prefix)\n * @returns A new Token instance\n * @example\n * const spacing = createToken<number>('spacing-md')\n * // Use in styles: { gap: spacing.value }\n */\nexport function createToken(name: string): Token {\n return new Token(name)\n}\n","// Auto-generated from @webref/css - do not edit manually\n// Run \"yarn build\" to regenerate\n\nexport const propertyUnits = {\n animation: \"ms\",\n animationDelay: \"ms\",\n animationDuration: \"ms\",\n animationRange: \"px\",\n animationRangeCenter: \"px\",\n animationRangeEnd: \"px\",\n animationRangeStart: \"px\",\n background: \"px\",\n backgroundPosition: \"px\",\n backgroundPositionBlock: \"px\",\n backgroundPositionInline: \"px\",\n backgroundPositionX: \"px\",\n backgroundPositionY: \"px\",\n backgroundSize: \"px\",\n backgroundTbd: \"px\",\n baselineShift: \"px\",\n blockSize: \"px\",\n blockStep: \"px\",\n blockStepSize: \"px\",\n border: \"px\",\n borderBlock: \"px\",\n borderBlockClip: \"px\",\n borderBlockEnd: \"px\",\n borderBlockEndClip: \"px\",\n borderBlockEndRadius: \"px\",\n borderBlockEndWidth: \"px\",\n borderBlockStart: \"px\",\n borderBlockStartClip: \"px\",\n borderBlockStartRadius: \"px\",\n borderBlockStartWidth: \"px\",\n borderBlockWidth: \"px\",\n borderBottom: \"px\",\n borderBottomClip: \"px\",\n borderBottomLeftRadius: \"px\",\n borderBottomRadius: \"px\",\n borderBottomRightRadius: \"px\",\n borderBottomWidth: \"px\",\n borderClip: \"px\",\n borderEndEndRadius: \"px\",\n borderEndStartRadius: \"px\",\n borderImage: \"%\",\n borderImageOutset: \"px\",\n borderImageSlice: \"%\",\n borderImageWidth: \"px\",\n borderInline: \"px\",\n borderInlineClip: \"px\",\n borderInlineEnd: \"px\",\n borderInlineEndClip: \"px\",\n borderInlineEndRadius: \"px\",\n borderInlineEndWidth: \"px\",\n borderInlineStart: \"px\",\n borderInlineStartClip: \"px\",\n borderInlineStartRadius: \"px\",\n borderInlineStartWidth: \"px\",\n borderInlineWidth: \"px\",\n borderLeft: \"px\",\n borderLeftClip: \"px\",\n borderLeftRadius: \"px\",\n borderLeftWidth: \"px\",\n borderLimit: \"px\",\n borderRadius: \"px\",\n borderRight: \"px\",\n borderRightClip: \"px\",\n borderRightRadius: \"px\",\n borderRightWidth: \"px\",\n borderSpacing: \"px\",\n borderStartEndRadius: \"px\",\n borderStartStartRadius: \"px\",\n borderTop: \"px\",\n borderTopClip: \"px\",\n borderTopLeftRadius: \"px\",\n borderTopRadius: \"px\",\n borderTopRightRadius: \"px\",\n borderTopWidth: \"px\",\n borderWidth: \"px\",\n bottom: \"px\",\n boxShadow: \"px\",\n boxShadowBlur: \"px\",\n boxShadowOffset: \"px\",\n boxShadowSpread: \"px\",\n columnGap: \"px\",\n columnHeight: \"px\",\n columnRule: \"px\",\n columnRuleEdgeInset: \"px\",\n columnRuleEdgeInsetEnd: \"px\",\n columnRuleEdgeInsetStart: \"px\",\n columnRuleInset: \"px\",\n columnRuleInsetEnd: \"px\",\n columnRuleInsetStart: \"px\",\n columnRuleInteriorInset: \"px\",\n columnRuleInteriorInsetEnd: \"px\",\n columnRuleInteriorInsetStart: \"px\",\n columnRuleWidth: \"px\",\n columns: \"px\",\n columnWidth: \"px\",\n containIntrinsicBlockSize: \"px\",\n containIntrinsicHeight: \"px\",\n containIntrinsicInlineSize: \"px\",\n containIntrinsicSize: \"px\",\n containIntrinsicWidth: \"px\",\n corner: \"px\",\n cornerBlockEnd: \"px\",\n cornerBlockStart: \"px\",\n cornerBottom: \"px\",\n cornerBottomLeft: \"px\",\n cornerBottomRight: \"px\",\n cornerEndEnd: \"px\",\n cornerEndStart: \"px\",\n cornerInlineEnd: \"px\",\n cornerInlineStart: \"px\",\n cornerLeft: \"px\",\n cornerRight: \"px\",\n cornerStartEnd: \"px\",\n cornerStartStart: \"px\",\n cornerTop: \"px\",\n cornerTopLeft: \"px\",\n cornerTopRight: \"px\",\n cx: \"px\",\n cy: \"px\",\n fillOpacity: \"%\",\n fillPosition: \"px\",\n fillSize: \"px\",\n flex: \"px\",\n flexBasis: \"px\",\n floatOffset: \"px\",\n floodOpacity: \"%\",\n flowTolerance: \"px\",\n font: \"deg\",\n fontSize: \"px\",\n fontStretch: \"%\",\n fontStyle: \"deg\",\n fontWidth: \"%\",\n gap: \"px\",\n grid: \"px\",\n gridAutoColumns: \"px\",\n gridAutoRows: \"px\",\n gridColumnGap: \"px\",\n gridGap: \"px\",\n gridRowGap: \"px\",\n gridTemplate: \"px\",\n gridTemplateColumns: \"px\",\n gridTemplateRows: \"px\",\n height: \"px\",\n hyphenateLimitZone: \"px\",\n imageOrientation: \"deg\",\n imageResolution: \"dppx\",\n initialLetterWrap: \"px\",\n inlineSize: \"px\",\n inset: \"px\",\n insetBlock: \"px\",\n insetBlockEnd: \"px\",\n insetBlockStart: \"px\",\n insetInline: \"px\",\n insetInlineEnd: \"px\",\n insetInlineStart: \"px\",\n interestDelay: \"ms\",\n interestDelayEnd: \"ms\",\n interestDelayStart: \"ms\",\n itemFlow: \"px\",\n left: \"px\",\n letterSpacing: \"px\",\n lineHeight: \"px\",\n lineHeightStep: \"px\",\n linePadding: \"px\",\n margin: \"px\",\n marginBlock: \"px\",\n marginBlockEnd: \"px\",\n marginBlockStart: \"px\",\n marginBottom: \"px\",\n marginInline: \"px\",\n marginInlineEnd: \"px\",\n marginInlineStart: \"px\",\n marginLeft: \"px\",\n marginRight: \"px\",\n marginTop: \"px\",\n mask: \"px\",\n maskBorder: \"%\",\n maskBorderOutset: \"px\",\n maskBorderSlice: \"%\",\n maskBorderWidth: \"px\",\n maskPosition: \"px\",\n maskSize: \"px\",\n maxBlockSize: \"px\",\n maxHeight: \"px\",\n maxInlineSize: \"px\",\n maxWidth: \"px\",\n minBlockSize: \"px\",\n minHeight: \"px\",\n minInlineSize: \"px\",\n minWidth: \"px\",\n objectPosition: \"px\",\n offset: \"px\",\n offsetAnchor: \"px\",\n offsetDistance: \"px\",\n offsetPosition: \"px\",\n offsetRotate: \"deg\",\n opacity: \"%\",\n outline: \"px\",\n outlineOffset: \"px\",\n outlineWidth: \"px\",\n overflowClipMargin: \"px\",\n overflowClipMarginBlock: \"px\",\n overflowClipMarginBlockEnd: \"px\",\n overflowClipMarginBlockStart: \"px\",\n overflowClipMarginBottom: \"px\",\n overflowClipMarginInline: \"px\",\n overflowClipMarginInlineEnd: \"px\",\n overflowClipMarginInlineStart: \"px\",\n overflowClipMarginLeft: \"px\",\n overflowClipMarginRight: \"px\",\n overflowClipMarginTop: \"px\",\n padding: \"px\",\n paddingBlock: \"px\",\n paddingBlockEnd: \"px\",\n paddingBlockStart: \"px\",\n paddingBottom: \"px\",\n paddingInline: \"px\",\n paddingInlineEnd: \"px\",\n paddingInlineStart: \"px\",\n paddingLeft: \"px\",\n paddingRight: \"px\",\n paddingTop: \"px\",\n pause: \"ms\",\n pauseAfter: \"ms\",\n pauseBefore: \"ms\",\n perspective: \"px\",\n perspectiveOrigin: \"px\",\n r: \"px\",\n rest: \"ms\",\n restAfter: \"ms\",\n restBefore: \"ms\",\n right: \"px\",\n rotate: \"deg\",\n rowGap: \"px\",\n rowRule: \"px\",\n rowRuleEdgeInset: \"px\",\n rowRuleEdgeInsetEnd: \"px\",\n rowRuleEdgeInsetStart: \"px\",\n rowRuleInset: \"px\",\n rowRuleInsetEnd: \"px\",\n rowRuleInsetStart: \"px\",\n rowRuleInteriorInset: \"px\",\n rowRuleInteriorInsetEnd: \"px\",\n rowRuleInteriorInsetStart: \"px\",\n rowRuleWidth: \"px\",\n rule: \"px\",\n ruleEdgeInset: \"px\",\n ruleInset: \"px\",\n ruleInsetEnd: \"px\",\n ruleInsetStart: \"px\",\n ruleInteriorInset: \"px\",\n ruleWidth: \"px\",\n rx: \"px\",\n ry: \"px\",\n scale: \"%\",\n scrollMargin: \"px\",\n scrollMarginBlock: \"px\",\n scrollMarginBlockEnd: \"px\",\n scrollMarginBlockStart: \"px\",\n scrollMarginBottom: \"px\",\n scrollMarginInline: \"px\",\n scrollMarginInlineEnd: \"px\",\n scrollMarginInlineStart: \"px\",\n scrollMarginLeft: \"px\",\n scrollMarginRight: \"px\",\n scrollMarginTop: \"px\",\n scrollPadding: \"px\",\n scrollPaddingBlock: \"px\",\n scrollPaddingBlockEnd: \"px\",\n scrollPaddingBlockStart: \"px\",\n scrollPaddingBottom: \"px\",\n scrollPaddingInline: \"px\",\n scrollPaddingInlineEnd: \"px\",\n scrollPaddingInlineStart: \"px\",\n scrollPaddingLeft: \"px\",\n scrollPaddingRight: \"px\",\n scrollPaddingTop: \"px\",\n shapeImageThreshold: \"%\",\n shapeMargin: \"px\",\n shapePadding: \"px\",\n stopOpacity: \"%\",\n strokeDasharray: \"px\",\n strokeDashcorner: \"px\",\n strokeDashCorner: \"px\",\n strokeDashoffset: \"px\",\n strokeOpacity: \"%\",\n strokePosition: \"px\",\n strokeSize: \"px\",\n strokeWidth: \"px\",\n tabSize: \"px\",\n textDecoration: \"px\",\n textDecorationInset: \"px\",\n textDecorationThickness: \"px\",\n textIndent: \"px\",\n textShadow: \"px\",\n textSizeAdjust: \"%\",\n textUnderlineOffset: \"px\",\n timelineTrigger: \"px\",\n timelineTriggerExitRange: \"px\",\n timelineTriggerExitRangeEnd: \"px\",\n timelineTriggerExitRangeStart: \"px\",\n timelineTriggerRange: \"px\",\n timelineTriggerRangeEnd: \"px\",\n timelineTriggerRangeStart: \"px\",\n top: \"px\",\n transformOrigin: \"px\",\n transition: \"ms\",\n transitionDelay: \"ms\",\n transitionDuration: \"ms\",\n translate: \"px\",\n verticalAlign: \"px\",\n viewTimeline: \"px\",\n viewTimelineInset: \"px\",\n voiceDuration: \"ms\",\n voicePitch: \"Hz\",\n voiceRange: \"Hz\",\n voiceRate: \"%\",\n width: \"px\",\n wordSpacing: \"px\",\n x: \"px\",\n y: \"px\",\n zoom: \"%\",\n} as const\n\nexport type PropertyWithUnit = keyof typeof propertyUnits\n","/**\n * CSS property handling and type definitions.\n * Provides type-safe mappings from JavaScript objects to CSS properties,\n * with automatic unit conversion and value formatting.\n * @module props\n */\n\nimport { Properties, ObsoleteProperties } from \"csstype\"\nimport { CssLike, CssVar } from \"@/values\"\nimport properties from \"known-css-properties\"\nimport { propertyUnits, type PropertyWithUnit } from \"./propertyUnits.generated\"\n\n/** All non-obsolete CSS properties from csstype */\ntype Props = Required<Omit<Properties, keyof ObsoleteProperties>>\n\n/** Properties that have default units and are valid CSS properties */\ntype PropsWithUnit = PropertyWithUnit & keyof Props\n\n/**\n * Converts a kebab-case string to camelCase.\n */\nexport function kebabToCamel(str: string): string {\n return str.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())\n}\n\n/**\n * Converts a camelCase string to kebab-case.\n */\nexport function camelToKebab(str: string): string {\n return str.replace(/[A-Z]/g, (m) => \"-\" + m.toLowerCase())\n}\n\nfunction getUnitForProperty(propertyName: string): string | undefined {\n return propertyName in propertyUnits ? propertyUnits[propertyName as PropertyWithUnit] : undefined\n}\n\n/**\n * Converts a CSS-like value to its string representation.\n * For properties with known units, numbers are automatically suffixed.\n */\nfunction formatValue(value: CssLike<string | number>, propertyName: string, maxDepth = 10): string {\n if (maxDepth <= 0) return \"\"\n if (typeof value === \"string\") return value\n if (typeof value === \"number\") {\n const unit = getUnitForProperty(propertyName)\n if (unit === \"%\") return `${value * 100}${unit}`\n if (value === 0) return \"0\"\n return unit ? `${value}${unit}` : value.toString()\n }\n return formatValue(value.value, propertyName, maxDepth - 1)\n}\n\n//TODO: generate this list and drop known-css-properties package\nconst knownPropertySet = new Set<string>(properties.all.map(kebabToCamel))\n\n/**\n * Checks if a property name is a CSS custom property (variable).\n */\nexport function isCssVariableName(key: string): key is CssVar {\n return key.startsWith(\"--\")\n}\n\n/**\n * Converts a CSS-like value to a string for use as a CSS variable value.\n * @param value - The value to convert (string, number, or wrapped value)\n * @param maxDepth - Maximum recursion depth for evaluating the value\n * @returns The string representation\n */\nexport function asVar(value: CssLike<string | number>, maxDepth = 10): string {\n if (maxDepth <= 0) return \"\"\n switch (typeof value) {\n case \"string\":\n return value\n case \"number\":\n return value.toString()\n default:\n return asVar(value.value, maxDepth - 1)\n }\n}\n\n/**\n * Checks if a property name is a known CSS property.\n */\nexport function isKnownPropertyName(key: string): key is keyof Props {\n return knownPropertySet.has(key)\n}\n\n/**\n * Converts a value to a CSS property string.\n * Automatically appends units to numeric values for properties that require them.\n * @param value - The value to convert\n * @param key - The CSS property name\n * @returns The formatted CSS value string\n */\nexport function asKnownProp(value: unknown, key: keyof Props): string {\n return formatValue(value as CssLike<string | number>, key)\n}\n\n/**\n * Checks if a key represents a nested CSS selector.\n */\n//TODO: make better validation, provide human readable errors\nexport function isNestedSelector(key: string): key is NestedCssSelector {\n return key.includes(\"&\")\n}\n\n/**\n * Checks if a key represents a media query.\n */\n//TODO: make better validation, provide human readable errors\nexport function isMediaSelector(key: string): key is MediaSelector {\n return key.startsWith(\"@\")\n}\n\n/** A nested CSS selector pattern containing the parent reference `&` */\nexport type NestedCssSelector = `${string}&${string}`\n\n/** A CSS media query starting with `@` */\nexport type MediaSelector = `@${string}`\n\ntype NestedStyleKeys = MediaSelector | NestedCssSelector\n\n/**\n * Style properties without nesting support.\n * Includes all standard CSS properties with type-safe value converters,\n * plus CSS custom properties (variables).\n *\n * Properties with known units (e.g., width, height, padding) accept numbers\n * that are automatically converted with their default unit (e.g., px, ms).\n */\nexport type SimpleStyleProps = { [K in PropsWithUnit]?: CssLike<number | Props[K]> } & {\n [K in Exclude<keyof Props, PropsWithUnit>]?: CssLike<Props[K]>\n} & Partial<Record<CssVar, CssLike<string | number>>>\n\n/**\n * Full style properties type with support for nested selectors and media queries.\n * Extends SimpleStyleProps to allow recursive style definitions.\n *\n * @example\n * const styles: StyleProps = {\n * color: 'blue',\n * padding: 16,\n * '&:hover': { color: 'red' },\n * '@min-width: 768px': { padding: 24 }\n * }\n */\nexport type StyleProps = SimpleStyleProps & { [K in NestedStyleKeys]?: StyleProps | CssLike<string | number> }\n\n/**\n * Converts a SimpleStyleProps object to a CSS properties record.\n * Transforms camelCase property names to kebab-case and applies value converters.\n * @param props - The style properties object\n * @returns A record of CSS property names (kebab-case) to string values\n * @example\n * cssFromProps({ backgroundColor: 'blue', padding: 16 })\n * // { 'background-color': 'blue', 'padding': '16px' }\n */\nexport function cssFromProps(props: SimpleStyleProps): Record<string, string> {\n return Object.fromEntries(\n Object.entries(props)\n .map(([key, value]): [string, string] | undefined => {\n if (value === undefined) return undefined\n // transform variable\n if (isCssVariableName(key)) return [key, asVar(value as CssLike<string | number>)]\n // transform CSS prop\n if (isKnownPropertyName(key)) return [camelToKebab(key), asKnownProp(value, key)]\n return undefined\n })\n .filter((v) => v !== undefined),\n )\n}\n","/**\n * CSS selector building and manipulation utilities.\n * Handles nested selectors (using `&` placeholder) and media queries.\n * @module selector\n */\n\nimport { isMediaSelector, isNestedSelector } from \"@/props\"\n\n/**\n * Immutable CSS selector builder that handles nested selectors and media queries.\n * Uses the `&` character as a placeholder for parent selector substitution.\n *\n * @example\n * const selector = new MochiSelector(['.button'])\n * selector.extend('&:hover').cssSelector // '.button:hover'\n * selector.wrap('@media (min-width: 768px)').mediaQuery // '@media (min-width: 768px)'\n */\nexport class MochiSelector {\n /**\n * Creates a new MochiSelector instance.\n * @param cssSelectors - Array of CSS selectors (may contain `&` placeholders)\n * @param mediaSelectors - Array of media query conditions (without `@media` prefix)\n */\n constructor(\n private readonly cssSelectors: string[] = [],\n private readonly mediaSelectors: string[] = [],\n ) {}\n\n /**\n * Gets the combined CSS selector string.\n * Multiple selectors are joined with commas.\n * @returns The CSS selector, or \"*\" if no selectors are defined\n */\n get cssSelector(): string {\n if (this.cssSelectors.length === 0) return \"*\"\n return this.cssSelectors.join(\", \")\n }\n\n /**\n * Gets the combined media query string, if any.\n * @returns The full `@media` query string, or undefined if no media conditions\n */\n get mediaQuery(): string | undefined {\n if (this.mediaSelectors.length === 0) return undefined\n return `@media ${this.mediaSelectors.map((s) => `(${s})`).join(\" and \")}`\n }\n\n /**\n * Substitutes all `&` placeholders with the given root selector.\n * @param root - The selector to replace `&` with\n * @returns A new MochiSelector with substituted selectors\n */\n substitute(root: string): MochiSelector {\n return new MochiSelector(\n this.cssSelectors.map((selector) => selector.replace(/&/g, root)),\n this.mediaSelectors,\n )\n }\n\n /**\n * Extends this selector by nesting a child selector.\n * The `&` in the child selector is replaced with each parent selector.\n * @param child - The child selector pattern (must contain `&`)\n * @returns A new MochiSelector with the extended selectors\n * @example\n * new MochiSelector(['.btn']).extend('&:hover') // '.btn:hover'\n * new MochiSelector(['.btn']).extend('& .icon') // '.btn .icon'\n */\n extend(child: string): MochiSelector {\n if (!isNestedSelector(child)) return this\n const children = MochiSelector.split(child)\n const selectors = this.cssSelectors.flatMap((parentSelector) =>\n children.map((childSelector) => {\n return childSelector.replace(/&/g, parentSelector)\n }),\n )\n return new MochiSelector(selectors, this.mediaSelectors)\n }\n\n /**\n * Wraps this selector with a media query condition.\n * @param mediaQuery - The media query string (starting with `@`)\n * @returns A new MochiSelector with the added media condition\n * @example\n * selector.wrap('@min-width: 768px') // Adds media query condition\n */\n wrap(mediaQuery: string): MochiSelector {\n if (!isMediaSelector(mediaQuery)) return this\n const mediaQueryPart = mediaQuery.substring(1)\n return new MochiSelector(this.cssSelectors, [...this.mediaSelectors, mediaQueryPart])\n }\n\n /**\n * Splits a comma-separated selector string into individual selectors.\n * @param selector - The selector string to split\n * @returns Array of individual selector strings\n */\n private static split(selector: string): string[] {\n return [selector]\n }\n}\n","/**\n * Hashing utilities for generating short, deterministic class names.\n * Uses djb2 algorithm for fast string hashing.\n * @module hash\n */\n\n/** Characters used for base-62 encoding (css-name safe variant of base-64) */\nconst hashBase = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_\"\nconst base = hashBase.length\n\n/**\n * Converts a number to a base-62 string representation.\n * @param num - The number to convert\n * @param maxLength - Optional maximum length of the output string\n * @returns Base-62 encoded string representation of the number\n */\nexport function numberToBase62(num: number, maxLength?: number): string {\n let out = \"\"\n while (num > 0 && out.length < (maxLength ?? Infinity)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n out = hashBase[num % base]! + out\n num = Math.floor(num / base)\n }\n return out.length > 0 ? out : \"0\"\n}\n\n/**\n * Generates a short hash string from input using the djb2 algorithm.\n * Used to create unique, deterministic CSS class names from style content.\n * @param input - The string to hash\n * @param length - Maximum length of the hash output (default: 8)\n * @returns A short, css-safe hash string\n * @example\n * shortHash(\"color: red;\") // Returns something like \"A1b2C3d4\"\n */\nexport function shortHash(input: string, length = 8): string {\n // fast 32-bit integer hash (djb2 variant)\n let h = 5381\n for (let i = 0; i < input.length; i++) {\n h = (h * 33) ^ input.charCodeAt(i)\n }\n // force unsigned\n h >>>= 0\n\n return numberToBase62(h, length)\n}\n","/**\n * String comparison utilities for deterministic sorting.\n * Used internally to ensure consistent CSS output order.\n * @module compare\n */\n\n/**\n * Compares two strings lexicographically.\n */\nexport function compareString<T extends string>(a: T, b: T) {\n return a < b ? -1 : a === b ? 0 : 1\n}\n\n/**\n * Compares two tuples by their first element (string key).\n * Useful for sorting Object.entries() results.\n */\nexport function compareStringKey<T extends [string, unknown]>(a: T, b: T) {\n return compareString(a[0], b[0])\n}\n\n/**\n * Creates a comparator function for objects with a specific string property.\n * @param name - The property name to compare by\n * @returns A comparator function that compares objects by the specified property\n * @example\n * const items = [{ key: 'b' }, { key: 'a' }]\n * items.sort(stringPropComparator('key')) // [{ key: 'a' }, { key: 'b' }]\n */\nexport function stringPropComparator<N extends string>(name: N) {\n return <T extends Record<N, string>>(a: T, b: T) => compareString(a[name], b[name])\n}\n","/**\n * CSS object model for representing and serializing styles.\n * Converts JavaScript style objects into CSS blocks with proper\n * selector handling, nesting support, and deterministic output.\n * @module cssObject\n */\n\nimport {\n asKnownProp,\n asVar,\n camelToKebab,\n isCssVariableName,\n isKnownPropertyName,\n isMediaSelector,\n isNestedSelector,\n StyleProps,\n} from \"@/props\"\nimport { shortHash } from \"@/hash\"\nimport { MochiSelector } from \"@/selector\"\nimport { compareStringKey, stringPropComparator } from \"@/compare\"\n\n/**\n * Represents a single CSS rule block with properties and a selector.\n * Handles conversion to CSS string format and hash generation.\n */\nexport class CssObjectSubBlock {\n /**\n * Creates a new CSS sub-block.\n * @param cssProps - Map of CSS property names (kebab-case) to values\n * @param selector - The selector this block applies to\n */\n constructor(\n public readonly cssProps: Record<string, string>,\n public readonly selector: MochiSelector,\n ) {}\n\n /**\n * Computes a deterministic hash of this block's CSS content.\n * Used for generating unique class names.\n */\n get hash(): string {\n const str = this.asCssString(\"&\")\n return shortHash(str)\n }\n\n /**\n * Converts this block to a CSS string.\n * Handles media query wrapping if the selector has media conditions.\n * @param root - The root selector to substitute for `&`\n * @returns Formatted CSS string\n */\n asCssString(root: string): string {\n const selector = this.selector.substitute(root)\n const mediaQuery = selector.mediaQuery\n\n const mediaIndent = mediaQuery === undefined ? \"\" : \" \"\n\n const props = Object.entries(this.cssProps)\n .toSorted(compareStringKey)\n .map(([k, v]) => `${mediaIndent} ${k}: ${v};\\n`)\n .join(\"\")\n\n const blockCss = `${mediaIndent}${selector.cssSelector} {\\n${props}${mediaIndent}}`\n\n return mediaQuery === undefined ? blockCss : `${mediaQuery} {\\n${blockCss}\\n}`\n }\n\n /**\n * Parses StyleProps into an array of CSS sub-blocks.\n * Recursively processes nested selectors and media queries.\n * Output order is deterministic for consistent hash generation.\n *\n * @param props - The style properties to parse\n * @param selector - The parent selector context (defaults to `&`)\n * @returns Non-empty array of sub-blocks (main block first, then nested)\n */\n static fromProps(props: StyleProps, selector?: MochiSelector): [CssObjectSubBlock, ...CssObjectSubBlock[]] {\n selector ??= new MochiSelector([\"&\"])\n\n const cssProps: Record<string, string> = {}\n const propsToProcess: { key: string; selector: MochiSelector; props: StyleProps }[] = []\n\n for (const [key, value] of Object.entries(props)) {\n // skip undefined value\n if (value === undefined) continue\n\n // transform variable\n if (isCssVariableName(key)) {\n cssProps[key] = asVar(value as StyleProps[typeof key] & {})\n continue\n }\n\n // transform known CSS prop\n if (isKnownPropertyName(key)) {\n cssProps[camelToKebab(key)] = asKnownProp(value, key)\n continue\n }\n\n // transform nested and media selectors\n if (isNestedSelector(key)) {\n propsToProcess.push({\n key,\n props: value as StyleProps,\n selector: selector.extend(key),\n })\n continue\n }\n\n // transform media selector\n if (isMediaSelector(key)) {\n propsToProcess.push({\n key,\n props: value as StyleProps,\n selector: selector.wrap(key),\n })\n continue\n }\n\n if (process.env[\"NODE_ENV\"] !== \"production\") {\n console.warn(`[mochi-css] Unknown style property \"${key}\" will be ignored`)\n }\n }\n\n return [\n new CssObjectSubBlock(cssProps, selector),\n ...propsToProcess\n .toSorted(stringPropComparator(\"key\"))\n .flatMap(({ props, selector }) => CssObjectSubBlock.fromProps(props, selector)),\n ] as const\n }\n}\n\n/**\n * Represents an abstract CSS block definition.\n * Contains one or more sub-blocks for nested selectors and media queries.\n */\nexport class CssObjectBlock {\n /** The generated unique class name for this block */\n public readonly className: string\n /** All sub-blocks (main styles and nested/media rules) */\n public readonly subBlocks: CssObjectSubBlock[] = []\n\n /**\n * Creates a new CSS block from style properties.\n * Generates a unique class name based on the content hash.\n * @param styles - The style properties to compile\n */\n constructor(styles: StyleProps) {\n const blocks = CssObjectSubBlock.fromProps(styles)\n\n this.className = \"c\" + shortHash(blocks.map((b) => b.hash).join(\"+\"))\n this.subBlocks = blocks\n }\n\n /**\n * Gets the CSS class selector for this block.\n */\n get selector(): string {\n return `.${this.className}`\n }\n\n /**\n * Converts style block to a CSS string.\n * @param root - The root selector to scope styles to\n * @returns Complete CSS string for this block\n */\n asCssString(root: string): string {\n return this.subBlocks\n .map((b) => b.asCssString(new MochiSelector([root]).extend(`&.${this.className}`).cssSelector))\n .join(\"\\n\\n\")\n }\n}\n\nexport type AllVariants = Record<string, Record<string, StyleProps>>\nexport type DefaultVariants = Record<never, Record<string, StyleProps>>\n\n/**\n * A compound variant entry that applies styles when multiple variant conditions match.\n * Each entry specifies a set of variant conditions and a `css` property with styles\n * that apply only when all conditions are satisfied simultaneously.\n *\n * @template V - The variant definitions type\n *\n * @example\n * { color: 'red', size: 'large', css: { fontWeight: 'bold' } }\n */\nexport type CompoundVariant<V extends AllVariants> = {\n [K in keyof V]?: keyof V[K]\n} & { css: StyleProps }\n\n/**\n * Refines string literal types to their proper runtime types.\n * Converts \"true\"/\"false\" strings to boolean literals.\n */\ntype RefineVariantType<T extends string> = T extends \"true\"\n ? true\n : T extends \"false\"\n ? false\n : T extends string\n ? T\n : string\n\n/**\n * Props for defining variants in a style object.\n * @template V - The variant definitions type\n */\nexport type VariantProps<V extends AllVariants> = {\n /** Variant definitions mapping names to options to styles */\n variants?: V\n /** Default variant selections for when not explicitly provided */\n defaultVariants?: { [K in keyof V]?: keyof V[K] extends string ? RefineVariantType<keyof V[K] & string> : never }\n /** Compound variant definitions that apply when multiple variant conditions match */\n compoundVariants?: CompoundVariant<V>[]\n}\n\n/** Combined type for style props with optional variants */\nexport type MochiCSSProps<V extends AllVariants> = StyleProps & VariantProps<V>\n\n/** Utility type to override properties of A with properties of B */\ntype Override<A extends object, B extends object> = B & Omit<A, keyof B>\n\n/** Recursively merges variant types from a tuple, with later types overriding earlier */\nexport type MergeCSSVariants<V extends AllVariants[]> = V extends [\n infer V1 extends AllVariants,\n ...infer VRest extends AllVariants[],\n]\n ? Override<V1, MergeCSSVariants<VRest>>\n : DefaultVariants\n\n/** Refines all values in a string record to their proper variant types */\ntype RefineVariantTypes<V extends Record<string, string>> = { [K in keyof V]: RefineVariantType<V[K]> }\n\n/** Extracts and refines variant option types from a DefaultVariants definition */\nexport type RefineVariants<T extends AllVariants> = RefineVariantTypes<{ [K in keyof T]: keyof T[K] & string }>\n\n/**\n * Complete CSS object representation with main and variant styles.\n *\n * @template V - The variant definitions type\n *\n * @example\n * const obj = new CSSObject({\n * color: 'blue',\n * variants: {\n * size: {\n * small: { fontSize: 12 },\n * large: { fontSize: 18 }\n * }\n * },\n * defaultVariants: { size: 'small' }\n * })\n * obj.asCssString() // Returns complete CSS with all variants\n */\nexport class CSSObject<V extends AllVariants = DefaultVariants> {\n /** The main style block (non-variant styles) */\n public readonly mainBlock: CssObjectBlock\n /** Compiled blocks for each variant option */\n public readonly variantBlocks: { [K in keyof V & string]: Record<keyof V[K] & string, CssObjectBlock> }\n /** Default variant selections */\n public readonly variantDefaults: Partial<RefineVariants<V>>\n /** Compound variant conditions and their parsed sub-blocks */\n public readonly compoundVariants: { conditions: Record<string, string>; subBlocks: CssObjectSubBlock[] }[]\n\n /**\n * Creates a new CSSObject from style props.\n * Compiles main styles and all variant options into CSS blocks.\n */\n public constructor({ variants, defaultVariants, compoundVariants, ...props }: MochiCSSProps<V>) {\n this.mainBlock = new CssObjectBlock(props)\n this.variantBlocks = {} as typeof this.variantBlocks\n this.variantDefaults = defaultVariants ?? {}\n this.compoundVariants = []\n\n if (variants) {\n for (const variantGroupName in variants) {\n this.variantBlocks[variantGroupName] =\n {} as (typeof this.variantBlocks)[keyof typeof this.variantBlocks]\n const variantGroup = variants[variantGroupName]\n for (const variantItemName in variantGroup) {\n this.variantBlocks[variantGroupName][variantItemName] = new CssObjectBlock(\n variantGroup[variantItemName] ?? {},\n )\n }\n }\n }\n\n if (compoundVariants) {\n for (const compound of compoundVariants) {\n const { css: styles, ...conditions } = compound\n this.compoundVariants.push({\n conditions: conditions as Record<string, string>,\n subBlocks: CssObjectSubBlock.fromProps(styles),\n })\n }\n }\n }\n\n /**\n * Serializes the entire CSS object to a CSS string.\n * Outputs main block first, then all variant blocks in sorted order.\n * @returns Complete CSS string ready for injection into a stylesheet\n */\n public asCssString(): string {\n return [\n this.mainBlock.asCssString(this.mainBlock.selector),\n ...Object.entries(this.variantBlocks)\n .toSorted(compareStringKey)\n .flatMap(([_, b]) => Object.entries(b).toSorted(compareStringKey))\n .map(([_, b]) => b.asCssString(this.mainBlock.selector)),\n ...this.compoundVariants.map(({ conditions, subBlocks }) => {\n const variantSelectors = Object.entries(conditions)\n .toSorted(compareStringKey)\n .map(([variantName, optionName]) => {\n const block = this.variantBlocks[variantName]?.[optionName]\n return block?.selector ?? \"\"\n })\n .filter(Boolean)\n .join(\"\")\n const combinedSelector = `${this.mainBlock.selector}${variantSelectors}`\n return subBlocks.map((b) => b.asCssString(combinedSelector)).join(\"\\n\\n\")\n }),\n ].join(\"\\n\\n\")\n }\n}\n","/**\n * Core CSS-in-JS runtime for generating and applying styles.\n * Provides the main `css` function and `MochiCSS` class for style management.\n * @module css\n */\n\nimport clsx from \"clsx\"\nimport { CSSObject, AllVariants, DefaultVariants, MergeCSSVariants, MochiCSSProps, RefineVariants } from \"@/cssObject\"\n\n/**\n * Runtime representation of a CSS style definition with variant support.\n * Holds generated class names and provides methods to compute the final\n * className string based on selected variants.\n *\n * @template V - The variant definitions type mapping variant names to their options\n *\n * @example\n * const styles = MochiCSS.from(new CSSObject({\n * color: 'blue',\n * variants: { size: { small: { fontSize: 12 }, large: { fontSize: 18 } } }\n * }))\n * styles.variant({ size: 'large' }) // Returns combined class names\n */\nexport class MochiCSS<V extends AllVariants = DefaultVariants> {\n /**\n * Creates a new MochiCSS instance.\n * @param classNames - Base class names to always include\n * @param variantClassNames - Mapping of variant names to option class names\n * @param defaultVariants - Default variant selections when not specified\n */\n constructor(\n public readonly classNames: string[],\n public readonly variantClassNames: { [K in keyof V]: { [P in keyof V[K]]: string } },\n public readonly defaultVariants: Partial<RefineVariants<V>>,\n ) {}\n\n /**\n * Computes the final className string based on variant selections.\n * Compound variants are handled purely via CSS combined selectors,\n * so no runtime matching is needed here.\n * @param props - Variant selections\n * @returns Combined className string for use in components\n */\n variant(props: Partial<RefineVariants<V>>): string {\n const keys = new Set<keyof V & string>(\n [...Object.keys(props), ...Object.keys(this.defaultVariants)].filter((k) => k in this.variantClassNames),\n )\n\n return clsx(\n this.classNames,\n ...keys.values().map((k) => {\n const variantGroup = this.variantClassNames[k]\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!variantGroup) return false\n\n const variantKey = ((k in props ? props[k] : undefined) ?? this.defaultVariants[k])?.toString()\n if (variantKey == null) return false\n\n const selectedClassname = variantGroup[variantKey]\n if (selectedClassname !== undefined) return selectedClassname\n\n const defaultKey = this.defaultVariants[k]\n if (defaultKey == null) return false\n\n return variantGroup[defaultKey.toString()]\n }),\n )\n }\n\n /**\n * Creates a MochiCSS instance from a CSSObject.\n * Extracts class names from the compiled CSS blocks.\n * @template V - The variant definitions type\n * @param object - The compiled CSSObject to extract from\n * @returns A new MochiCSS instance with the extracted class names\n */\n static from<V extends AllVariants = DefaultVariants>(object: CSSObject<V>): MochiCSS<V> {\n return new MochiCSS<V>(\n [object.mainBlock.className],\n Object.fromEntries(\n Object.entries(object.variantBlocks).map(([key, variantOptions]) => {\n return [\n key,\n Object.fromEntries(\n Object.entries(variantOptions).map(([optionKey, block]) => {\n return [optionKey, block.className]\n }),\n ),\n ]\n }),\n ) as { [K in keyof V]: { [P in keyof V[K]]: string } },\n object.variantDefaults,\n )\n }\n}\n\n/**\n * Creates a CSS style definition.\n * The primary API for defining styles in Mochi-CSS.\n *\n * @template V - Tuple of variant definition types\n * @param props - One or more style objects or existing MochiCSS instances to merge\n * @returns A MochiCSS instance with all styles and variants combined\n *\n * @example\n * // Simple usage\n * const button = css({ padding: 8, borderRadius: 4 })\n *\n * @example\n * // With variants\n * const button = css({\n * padding: 8,\n * variants: {\n * size: {\n * small: { padding: 4 },\n * large: { padding: 16 }\n * }\n * },\n * defaultVariants: { size: 'small' }\n * })\n * button.variant({ size: 'large' }) // Get class names for large size\n *\n * @example\n * // Merging multiple styles\n * const combined = css(baseStyles, additionalStyles)\n */\nconst emptyMochiCSS = new MochiCSS<AllVariants>([], {}, {})\n\n/**\n * Merges multiple MochiCSS instances into a single one, combining their\n * class names, variant class names, and default variants.\n * @param instances - The MochiCSS instances to merge\n * @returns A new MochiCSS instance with all styles combined\n */\nexport function mergeMochiCss<V extends AllVariants[]>(\n instances: MochiCSS<AllVariants>[],\n): MochiCSS<MergeCSSVariants<V>> {\n if (instances.length === 0) return emptyMochiCSS as MochiCSS<MergeCSSVariants<V>>\n\n return new MochiCSS<AllVariants>(\n instances.flatMap((c) => c.classNames),\n instances.reduce((a, b) => Object.assign(a, b.variantClassNames), {}),\n instances.reduce((a, b) => Object.assign(a, b.defaultVariants), {}),\n ) as MochiCSS<MergeCSSVariants<V>>\n}\n\nexport function css<V extends AllVariants[]>(\n ...props: { [K in keyof V]: MochiCSSProps<V[K]> | MochiCSS }\n): MochiCSS<MergeCSSVariants<V>> {\n const cssToMerge: MochiCSS<AllVariants>[] = []\n for (const p of props) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (p == null || typeof p !== \"object\") continue\n if (p instanceof MochiCSS) {\n cssToMerge.push(p)\n } else {\n cssToMerge.push(MochiCSS.from(new CSSObject<AllVariants>(p)))\n }\n }\n\n return mergeMochiCss(cssToMerge)\n}\n","/**\n * React styled component utilities.\n * Creates styled components with CSS-in-JS support and variant props.\n * @module styled\n */\n\nimport { ComponentProps, ComponentType, createElement, FC, HTMLElementType } from \"react\"\nimport { css } from \"@/css\"\nimport clsx from \"clsx\"\nimport { AllVariants, MergeCSSVariants, MochiCSSProps, RefineVariants } from \"@/cssObject\"\n\n/** Props added by MochiCSS to styled components */\ntype MochiProps<V extends AllVariants[]> = {\n className?: string\n} & Partial<RefineVariants<MergeCSSVariants<V>>>\n\n/** Minimal interface for components that accept className */\ntype Cls = { className?: string }\n\n/**\n * Creates a styled React component with CSS-in-JS support and variant props.\n * Similar to styled-components or Stitches, but with zero runtime overhead.\n *\n * @template T - The base element type or component type\n * @template V - The variant definitions tuple type\n * @param target - The HTML element tag name or React component to style\n * @param props - One or more style objects with optional variants\n * @returns A React functional component with merged props and variant support\n *\n * @example\n * const Button = styled('button', {\n * padding: 8,\n * borderRadius: 4,\n * variants: {\n * size: {\n * small: { padding: 4 },\n * large: { padding: 16 }\n * },\n * variant: {\n * primary: { backgroundColor: 'blue' },\n * secondary: { backgroundColor: 'gray' }\n * }\n * }\n * })\n *\n * // Usage: <Button size=\"large\" variant=\"primary\">Click me</Button>\n */\n//TODO: Move to dedicated \"styled\" package\nexport function styled<T extends HTMLElementType | ComponentType<Cls>, V extends AllVariants[]>(\n target: T,\n ...props: { [K in keyof V]: MochiCSSProps<V[K]> }\n): FC<Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>> {\n const styles = css<V>(...props)\n return ({ className, ...p }: Omit<ComponentProps<T>, keyof MochiProps<V>> & MochiProps<V>) =>\n //TODO: pick only variant props from p\n //TODO: omit variant props in p\n createElement(target, {\n className: clsx(styles.variant(p as unknown as Parameters<typeof styles.variant>[0]), className),\n ...p,\n })\n}\n","import { shortHash } from \"@/hash\"\nimport { cssFromProps, SimpleStyleProps } from \"@/props\"\nimport { compareStringKey } from \"@/compare\"\n\nexport type KeyframeStops = Record<string, SimpleStyleProps>\n\nexport class KeyframesObject {\n public readonly name: string\n private readonly body: string\n\n constructor(stops: KeyframeStops) {\n this.body = KeyframesObject.generateBody(stops)\n this.name = \"kf\" + shortHash(this.body)\n }\n\n asCssString(): string {\n return `@keyframes ${this.name} {\\n${this.body}\\n}`\n }\n\n private static generateBody(stops: KeyframeStops): string {\n return Object.entries(stops)\n .toSorted(compareStringKey)\n .map(([stopKey, props]) => {\n const cssProps = cssFromProps(props)\n const propsStr = Object.entries(cssProps)\n .toSorted(compareStringKey)\n .map(([k, v]) => ` ${k}: ${v};`)\n .join(\"\\n\")\n return ` ${stopKey} {\\n${propsStr}\\n }`\n })\n .join(\"\\n\\n\")\n }\n}\n","import { KeyframesObject, type KeyframeStops } from \"@/keyframesObject\"\nexport type { KeyframeStops } from \"@/keyframesObject\"\n\nexport class MochiKeyframes {\n constructor(public readonly name: string) {}\n\n toString(): string {\n return this.name\n }\n\n get value(): string {\n return this.name\n }\n\n static from(object: KeyframesObject): MochiKeyframes {\n return new MochiKeyframes(object.name)\n }\n}\n\nexport function keyframes(stops: KeyframeStops): MochiKeyframes {\n return MochiKeyframes.from(new KeyframesObject(stops))\n}\n","import { CssObjectSubBlock } from \"@/cssObject\"\nimport { compareStringKey } from \"@/compare\"\nimport { StyleProps } from \"@/props\"\n\nexport type GlobalCssStyles = Record<string, StyleProps>\n\n/**\n * CSS object model for global (non-scoped) styles.\n * Accepts a map of CSS selectors to style objects and serializes them\n * as plain CSS rules without class name scoping.\n *\n * @example\n * const obj = new GlobalCssObject({\n * body: { margin: 0 },\n * 'h1': { fontSize: 32 },\n * })\n * obj.asCssString() // \"body {\\n margin: 0;\\n}\\n\\nh1 {\\n font-size: 32px;\\n}\"\n */\nexport class GlobalCssObject {\n private readonly rules: { selector: string; subBlocks: CssObjectSubBlock[] }[]\n\n constructor(styles: GlobalCssStyles) {\n this.rules = Object.entries(styles)\n .toSorted(compareStringKey)\n .map(([selector, props]) => ({\n selector,\n subBlocks: [...CssObjectSubBlock.fromProps(props)],\n }))\n }\n\n asCssString(): string {\n return this.rules\n .flatMap(({ selector, subBlocks }) => subBlocks.map((b) => b.asCssString(selector)))\n .join(\"\\n\\n\")\n }\n}\n","import type { GlobalCssStyles } from \"@/globalCssObject\"\nexport type { GlobalCssStyles } from \"@/globalCssObject\"\n\n/**\n * Creates a global CSS definition.\n * Styles are not scoped to any class — they apply to all matching elements.\n *\n * @param styles - Map of CSS selectors to style objects\n *\n * @example\n * globalCss({\n * 'body': { margin: 0, padding: 0 },\n * '*, *::before, *::after': { boxSizing: 'border-box' },\n * })\n */\nexport function globalCss(styles: GlobalCssStyles): void {\n void styles // mark as used\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAa,QAAb,MAAmB;;;;;CAKf,YAAY,AAAgBA,MAAc;EAAd;;;;;;CAM5B,IAAI,WAAmB;AACnB,SAAO,KAAK,KAAK;;;;;;CAOrB,IAAI,QAAmB;AACnB,SAAO,OAAO,KAAK,SAAS;;;;;CAMhC,WAAmB;AACf,SAAO,KAAK;;;;;;;;;;;;AAapB,SAAgB,YAAY,M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K;;;AAI9C,SAAgB,UAAU,OAAsC;AAC5D,QAAO,eAAe,KAAK,IAAI,gBAAgB,MAAM,CAAC;;;;;;;;;;;;;;;;;ACF1D,IAAa,kBAAb,MAA6B;CACzB,AAAiB;CAEjB,YAAY,QAAyB;AACjC,OAAK,QAAQ,OAAO,QAAQ,OAAO,CAC9B,SAAS,iBAAiB,CAC1B,KAAK,CAAC,UAAU,YAAY;GACzB;GACA,WAAW,CAAC,GAAG,kBAAkB,UAAU,MAAM,CAAC;GACrD,EAAE;;CAGX,cAAsB;AAClB,SAAO,KAAK,MACP,SAAS,EAAE,UAAU,gBAAgB,UAAU,KAAK,MAAM,EAAE,YAAY,SAAS,CAAC,CAAC,CACnF,KAAK,OAAO;;;;;;;;;;;;;;;;;;AClBzB,SAAgB,UAAU,QAA+B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mochi-css/vanilla",
|
|
3
3
|
"repository": "git@github.com:Niikelion/mochi-css.git",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"css-in-js",
|
|
@@ -38,9 +38,12 @@
|
|
|
38
38
|
"@eslint/js": "^9.18.0",
|
|
39
39
|
"@gamedev-sensei/ts-config": "^2.0.0",
|
|
40
40
|
"@gamedev-sensei/tsdown-config": "^2.0.0",
|
|
41
|
+
"@testing-library/dom": "^10.4.1",
|
|
42
|
+
"@testing-library/react": "^16.3.2",
|
|
41
43
|
"@types/css-tree": "^2.3.10",
|
|
42
44
|
"@types/node": "^24.8.1",
|
|
43
45
|
"@types/react": "^19.2.2",
|
|
46
|
+
"@types/react-dom": "^19.2.3",
|
|
44
47
|
"@vitest/coverage-v8": "^4.0.15",
|
|
45
48
|
"@webref/css": "^8.2.3",
|
|
46
49
|
"css-tree": "^3.1.0",
|
|
@@ -48,8 +51,10 @@
|
|
|
48
51
|
"eslint": "^9.39.2",
|
|
49
52
|
"eslint-config-prettier": "^10.1.8",
|
|
50
53
|
"eslint-plugin-prettier": "^5.5.5",
|
|
54
|
+
"happy-dom": "^20.6.3",
|
|
51
55
|
"jiti": "^2.6.1",
|
|
52
56
|
"prettier": "^3.8.1",
|
|
57
|
+
"react-dom": "^19.2.4",
|
|
53
58
|
"tsdown": "^0.15.7",
|
|
54
59
|
"typescript": "^5.9.3",
|
|
55
60
|
"typescript-eslint": "^8.21.0",
|
|
@@ -60,6 +65,6 @@
|
|
|
60
65
|
"clsx": "^2.1.1",
|
|
61
66
|
"csstype": "^3.2.3",
|
|
62
67
|
"known-css-properties": "^0.37.0",
|
|
63
|
-
"react": "
|
|
68
|
+
"react": ">= 18 || >= 19"
|
|
64
69
|
}
|
|
65
70
|
}
|