fela-monolithic
Advanced tools
Comparing version 5.0.17 to 5.0.18
@@ -1,2 +0,6 @@ | ||
export default function generateMonolithicClassName(style, prefix) { | ||
import { generateUniqueHash } from 'fela-utils'; | ||
export default function generateMonolithicClassName(style) { | ||
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
if (style.className) { | ||
@@ -8,15 +12,4 @@ var name = prefix + style.className; | ||
var stringified = JSON.stringify(style); | ||
var val = 5381; | ||
var i = stringified.length; | ||
while (i) { | ||
val = val * 33 ^ stringified.charCodeAt(--i); | ||
} | ||
var hashedName = (val >>> 0).toString(36); | ||
if (prefix) { | ||
return prefix + hashedName; | ||
} | ||
return "f" + hashedName; | ||
var hashedName = generateUniqueHash(style); | ||
return '' + prefix + hashedName; | ||
} |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -7,3 +7,8 @@ Object.defineProperty(exports, "__esModule", { | ||
exports.default = generateMonolithicClassName; | ||
function generateMonolithicClassName(style, prefix) { | ||
var _felaUtils = require('fela-utils'); | ||
function generateMonolithicClassName(style) { | ||
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
if (style.className) { | ||
@@ -15,15 +20,4 @@ var name = prefix + style.className; | ||
var stringified = JSON.stringify(style); | ||
var val = 5381; | ||
var i = stringified.length; | ||
while (i) { | ||
val = val * 33 ^ stringified.charCodeAt(--i); | ||
} | ||
var hashedName = (val >>> 0).toString(36); | ||
if (prefix) { | ||
return prefix + hashedName; | ||
} | ||
return "f" + hashedName; | ||
var hashedName = (0, _felaUtils.generateUniqueHash)(style); | ||
return '' + prefix + hashedName; | ||
} |
{ | ||
"name": "fela-monolithic", | ||
"version": "5.0.17", | ||
"version": "5.0.18", | ||
"description": "Fela enhancer for having monolithic classnames", | ||
@@ -28,8 +28,9 @@ "main": "lib/index.js", | ||
"fast-loops": "^1.0.0", | ||
"fela-utils": "^8.0.3" | ||
"fela-utils": "^8.0.4" | ||
}, | ||
"devDependencies": { | ||
"fela": "^6.1.3", | ||
"fela-tools": "^5.1.2" | ||
"fela": "^6.1.4", | ||
"fela-tools": "^5.1.3", | ||
"react-fela": "^7.0.0" | ||
} | ||
} |
@@ -81,3 +81,3 @@ # fela-monolithic | ||
If you use it together with `createComponent` from `react-fela`, `preact-fela` or `inferno-fela`, it will also add the component type or displayName to the rule. e.g. | ||
If you use it together with `createComponent` or `connect` from `react-fela`, `preact-fela` or `inferno-fela`, it will also add the component type or displayName to the rule. e.g. | ||
@@ -84,0 +84,0 @@ ```javascript |
14064
3
184
Updatedfela-utils@^8.0.4