1 | {"version":3,"file":"buildClassMap.js","sourceRoot":"../src/","sources":["utilities/buildClassMap.ts"],"names":[],"mappings":";;AAAA,8CAA6C;AAE7C;;;;;GAKG;AACH,SAAgB,aAAa,CAAmB,MAAS;IACvD,IAAI,OAAO,GAAkC,EAAE,CAAC;4BAEvC,SAAS;QAChB,IAAI,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;YACpC,IAAI,WAAiB,CAAC;YAEtB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE;gBACxC,GAAG,EAAE;oBACH,IAAI,WAAS,KAAK,SAAS,EAAE;wBAC3B,8DAA8D;wBAC9D,WAAS,GAAG,yBAAW,CAAC,MAAM,CAAC,SAAS,CAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;qBAC9D;oBACD,OAAO,WAAS,CAAC;gBACnB,CAAC;gBACD,UAAU,EAAE,IAAI;gBAChB,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;SACJ;;IAfH,KAAK,IAAI,SAAS,IAAI,MAAM;gBAAnB,SAAS;KAgBjB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAtBD,sCAsBC","sourcesContent":["import { mergeStyles } from '../MergeStyles';\n\n/**\n * Builds a class names object from a given map.\n *\n * @param styles - Map of unprocessed styles.\n * @returns Map of property name to class name.\n */\nexport function buildClassMap<T extends Object>(styles: T): { [key in keyof T]?: string } {\n let classes: { [key in keyof T]?: string } = {};\n\n for (let styleName in styles) {\n if (styles.hasOwnProperty(styleName)) {\n let className: string;\n\n Object.defineProperty(classes, styleName, {\n get: (): string => {\n if (className === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n className = mergeStyles(styles[styleName] as any).toString();\n }\n return className;\n },\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n return classes;\n}\n"]} |