1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = visited;
|
7 | function visited(_ref) {
|
8 | var addCSS = _ref.addCSS,
|
9 | appendImportantToEachValue = _ref.appendImportantToEachValue,
|
10 | config = _ref.config,
|
11 | cssRuleSetToString = _ref.cssRuleSetToString,
|
12 | hash = _ref.hash,
|
13 | props = _ref.props,
|
14 | style = _ref.style;
|
15 |
|
16 |
|
17 | var className = props.className;
|
18 |
|
19 | var newStyle = Object.keys(style).reduce(function (newStyleInProgress, key) {
|
20 | var value = style[key];
|
21 | if (key === ':visited') {
|
22 | value = appendImportantToEachValue(value);
|
23 | var ruleCSS = cssRuleSetToString('', value, config.userAgent);
|
24 | var visitedClassName = 'rad-' + hash(ruleCSS);
|
25 | var css = '.' + visitedClassName + ':visited' + ruleCSS;
|
26 |
|
27 | addCSS(css);
|
28 | className = (className ? className + ' ' : '') + visitedClassName;
|
29 | } else {
|
30 | newStyleInProgress[key] = value;
|
31 | }
|
32 |
|
33 | return newStyleInProgress;
|
34 | }, {});
|
35 |
|
36 | return {
|
37 | props: className === props.className ? null : { className: className },
|
38 | style: newStyle
|
39 | };
|
40 | }
|
41 |
|
42 | module.exports = exports['default']; |
\ | No newline at end of file |