@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
15 lines (14 loc) • 651 B
JavaScript
"use client";
import { cssObjectToString } from "./css-object-to-string/css-object-to-string.mjs";
//#region packages/@mantine/core/src/core/InlineStyles/hash-styles.ts
function djb2Hash(str) {
let hash = 5381;
for (let i = 0; i < str.length; i++) hash = (hash << 5) + hash + str.charCodeAt(i) & 4294967295;
return (hash >>> 0).toString(36);
}
function hashStyleProps(styles, media) {
return `__mdi__-${djb2Hash(`${styles ? cssObjectToString(styles) : ""}|${Array.isArray(media) ? media.map((m) => `${m.query}:${cssObjectToString(m.styles)}`).join("|") : ""}`)}`;
}
//#endregion
export { hashStyleProps };
//# sourceMappingURL=hash-styles.mjs.map