react-outline 1.7.3 → 2.0.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 +151 -116
- package/dist/Styles.js +34 -35
- package/dist/element.js +69 -88
- package/dist/main.js +22 -35
- package/dist/reactOutline.js +241 -0
- package/dist/reactOutline.js.map +7 -0
- package/dist/styleItem.js +105 -91
- package/dist/utils/buildCssString.js +2 -2
- package/dist/utils/genCss.js +21 -32
- package/dist/utils/genStyles.js +13 -26
- package/dist/utils/hasKids.js +2 -4
- package/dist/utils/index.js +80 -66
- package/dist/utils/makeid.js +3 -6
- package/dist/utils/object2css.js +10 -22
- package/dist/utils/pubsub.js +10 -24
- package/dist/utils/replaceColors.js +3 -4
- package/dist/utils/replacedStyleFn.js +5 -10
- package/dist/utils/sanitizeOutlineInput.js +8 -24
- package/dist/utils/separateCssStyle.js +5 -8
- package/dist/wrapStyles.js +18 -14
- package/package.json +36 -24
- package/.babelrc +0 -6
- package/.travis.yml +0 -7
- package/__snapshots__/cornerCases.test.js.snap +0 -139
- package/__snapshots__/example.test.js.snap +0 -408
- package/cornerCases.test.js +0 -367
- package/dist/utils/sanitizeStyleObj.js +0 -22
- package/empty-module.js +0 -1
- package/example/.babelrc +0 -4
- package/example/.storybook/config.js +0 -7
- package/example/.storybook/webpack.config.js +0 -14
- package/example/README.md +0 -11
- package/example/package.json +0 -55
- package/example/stories/Animate/basic.js +0 -73
- package/example/stories/Basics/CreatingAndApplyingAStyle.js +0 -12
- package/example/stories/Basics/Form.js +0 -24
- package/example/stories/Basics/ImpliedTags.js +0 -40
- package/example/stories/Basics/PassingStyleAndFuntion.js +0 -13
- package/example/stories/Basics/PassingStyleAndFuntionAsArray.js +0 -13
- package/example/stories/Basics/ReusingElements.js +0 -13
- package/example/stories/Basics/Share.js +0 -19
- package/example/stories/Basics/UsingTheTagCreater.js +0 -13
- package/example/stories/Basics/WrappingAnExistingElement.js +0 -19
- package/example/stories/Button.js +0 -27
- package/example/stories/CSSHelpers/CssSelector.js +0 -24
- package/example/stories/CSSHelpers/CssSource.js +0 -18
- package/example/stories/CSSHelpers/DynamicCssSelectors.js +0 -24
- package/example/stories/CSSHelpers/Hover.js +0 -20
- package/example/stories/CSSHelpers/MediaQuery.js +0 -22
- package/example/stories/CSSHelpers/VendorPrefix.js +0 -19
- package/example/stories/CombineStyles/CreatingAndApplyingAStyle.js +0 -16
- package/example/stories/CombineStyles/LogicFnWithGenerateElement.js +0 -16
- package/example/stories/CombineStyles/PassStyleObjToGenerateElement.js +0 -9
- package/example/stories/CombineStyles/UsingAPropFlag.js +0 -16
- package/example/stories/CombineStyles/UsingTheTagCreater.js +0 -16
- package/example/stories/Ref/byFn.js +0 -51
- package/example/stories/Ref/onEvent.js +0 -43
- package/example/stories/RuntimeFunctions/DynamicStyles.js +0 -32
- package/example/stories/RuntimeFunctions/FunctionWithOutStyle.js +0 -31
- package/example/stories/RuntimeFunctions/ModifyingStyles.js +0 -36
- package/example/stories/RuntimeFunctions/WithGeneratedElements.js +0 -38
- package/example/stories/Welcome.js +0 -90
- package/example/stories/index.js +0 -88
- package/example/stories/load.js +0 -229
- package/example.test.js +0 -16
- package/source/Styles.js +0 -23
- package/source/element.js +0 -100
- package/source/main.js +0 -56
- package/source/styleItem.js +0 -105
- package/source/utils/buildCssString.js +0 -6
- package/source/utils/genCss.js +0 -30
- package/source/utils/genStyles.js +0 -19
- package/source/utils/hasKids.js +0 -6
- package/source/utils/index.js +0 -27
- package/source/utils/makeid.js +0 -9
- package/source/utils/object2css.js +0 -20
- package/source/utils/pubsub.js +0 -22
- package/source/utils/replaceColors.js +0 -11
- package/source/utils/replacedStyleFn.js +0 -30
- package/source/utils/sanitizeOutlineInput.js +0 -72
- package/source/utils/sanitizeStyleObj.js +0 -13
- package/source/utils/separateCssStyle.js +0 -25
- package/source/wrapStyles.js +0 -30
package/dist/styleItem.js
CHANGED
|
@@ -1,87 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _styles = _ref3._styles,
|
|
11
|
-
replacedStyle = _ref3.replacedStyle,
|
|
12
|
-
styleCSS = _ref3.styleCSS,
|
|
13
|
-
colors = _ref3.colors,
|
|
14
|
-
options = _ref3.options,
|
|
15
|
-
caching = _ref3.caching,
|
|
16
|
-
wrapStyles = _ref3.wrapStyles;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//+++++++++++++++++++++++++++++++++++++ style function
|
|
20
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
21
|
-
return function (styleName) {
|
|
22
|
-
|
|
23
|
-
var styleFn = _styles[styleName] || function () {};
|
|
24
|
-
|
|
25
|
-
var cached = { key: null, value: null, source: [] };
|
|
26
|
-
replacedStyle[styleName] = function () {
|
|
27
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
-
args[_key] = arguments[_key];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var elemName = args[0];
|
|
32
|
-
|
|
33
|
-
//+++++++++++++++++++++++++++++++++++ build an element
|
|
34
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
35
|
-
|
|
36
|
-
if (Array.isArray(elemName) && elemName.hasOwnProperty("raw")) {
|
|
37
|
-
return buildElem({ elemName: elemName, args: args, styleCSS: styleCSS, styleName: styleName, options: options, replacedStyle: replacedStyle, colors: colors });
|
|
38
|
-
} // elem gen
|
|
39
|
-
|
|
40
|
-
//++++++++++++++++++++++++++++++++++++++ generat style
|
|
41
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
42
|
-
|
|
43
|
-
var styleStuff = { styleCSS: styleCSS[styleName], styleFn: "object" === (typeof args === 'undefined' ? 'undefined' : _typeof(args)) && !_styles[styleName] ? function (x) {
|
|
44
|
-
return (0, _utils.sanitizeStyleObj)(x);
|
|
45
|
-
} : styleFn };
|
|
46
|
-
|
|
47
|
-
return buildStyleObj({ styleStuff: styleStuff, genStyles: _utils.genStyles, args: args, colors: colors, caching: caching, cached: cached });
|
|
48
|
-
}; // END replacedStyle[styleName] = function(...args)
|
|
49
|
-
|
|
50
|
-
//+++++++++++++++++++++++++++++++++ step down the tree
|
|
51
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
52
|
-
|
|
53
|
-
if (0 < Object.keys(styleFn).length || (0, _utils.hasKids)(styleCSS[styleName])) {
|
|
54
|
-
Object.assign(replacedStyle[styleName], wrapStyles(styleFn, options, styleCSS[styleName]));
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
var _utils = require('./utils');
|
|
60
|
-
|
|
61
|
-
var _element2 = require('./element');
|
|
62
|
-
|
|
63
|
-
var _element3 = _interopRequireDefault(_element2);
|
|
64
|
-
|
|
65
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
66
|
-
|
|
67
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
68
|
-
|
|
6
|
+
exports["default"] = _default;
|
|
7
|
+
var _utils = require("./utils");
|
|
8
|
+
var _element = _interopRequireDefault(require("./element"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
69
10
|
//=====================================================
|
|
70
11
|
//========================================== build Elem
|
|
71
12
|
//=====================================================
|
|
72
13
|
|
|
73
14
|
function buildElem(_ref) {
|
|
74
|
-
var _element;
|
|
75
|
-
|
|
76
15
|
var elemName = _ref.elemName,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
16
|
+
args = _ref.args,
|
|
17
|
+
styleCSS = _ref.styleCSS,
|
|
18
|
+
styleName = _ref.styleName,
|
|
19
|
+
options = _ref.options,
|
|
20
|
+
replacedStyle = _ref.replacedStyle,
|
|
21
|
+
colors = _ref.colors;
|
|
85
22
|
elemName = elemName[0] || args[1];
|
|
86
23
|
var inlineStyle = null; //replacedStyle[styleName]();
|
|
87
24
|
|
|
@@ -93,27 +30,41 @@ function buildElem(_ref) {
|
|
|
93
30
|
}
|
|
94
31
|
}
|
|
95
32
|
//splict ":" and "@" from all over styles
|
|
96
|
-
|
|
97
33
|
var _separateCssStyle = (0, _utils.separateCssStyle)(baseStyle),
|
|
98
|
-
|
|
99
|
-
|
|
34
|
+
css = _separateCssStyle.css,
|
|
35
|
+
style = _separateCssStyle.style;
|
|
100
36
|
/*
|
|
101
37
|
const cssPropNames = Object.keys(styleCSS[styleName])
|
|
102
38
|
.filter(stylePropName => stylePropName[0] === "@" || stylePropName[0] === ":");
|
|
103
39
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
40
|
var randomClassName = "";
|
|
107
41
|
|
|
108
42
|
//if(0 < cssPropNames.length){
|
|
109
43
|
if (css) {
|
|
110
44
|
randomClassName = "react-outline-";
|
|
111
45
|
if (!global.__TEST__) randomClassName += (0, _utils.makeid)();
|
|
112
|
-
_utils.pubsub.publish(randomClassName, (0, _utils.genCss)({
|
|
46
|
+
_utils.pubsub.publish(randomClassName, (0, _utils.genCss)({
|
|
47
|
+
randomClassName: randomClassName,
|
|
48
|
+
css: css,
|
|
49
|
+
styleCSS: styleCSS,
|
|
50
|
+
colors: colors,
|
|
51
|
+
style: style,
|
|
52
|
+
styleName: styleName
|
|
53
|
+
}));
|
|
113
54
|
inlineStyle = {};
|
|
114
55
|
}
|
|
115
|
-
|
|
116
|
-
|
|
56
|
+
return (0, _element["default"])({
|
|
57
|
+
elemName: elemName,
|
|
58
|
+
css: css,
|
|
59
|
+
styleCSS: styleCSS,
|
|
60
|
+
inlineStyle: inlineStyle,
|
|
61
|
+
style: style,
|
|
62
|
+
styleName: styleName,
|
|
63
|
+
colors: colors,
|
|
64
|
+
randomClassName: randomClassName,
|
|
65
|
+
options: options,
|
|
66
|
+
replacedStyle: replacedStyle
|
|
67
|
+
});
|
|
117
68
|
}
|
|
118
69
|
|
|
119
70
|
//=====================================================
|
|
@@ -122,13 +73,11 @@ function buildElem(_ref) {
|
|
|
122
73
|
|
|
123
74
|
function buildStyleObj(_ref2) {
|
|
124
75
|
var styleStuff = _ref2.styleStuff,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
76
|
+
genStyles = _ref2.genStyles,
|
|
77
|
+
args = _ref2.args,
|
|
78
|
+
colors = _ref2.colors,
|
|
79
|
+
caching = _ref2.caching,
|
|
80
|
+
cached = _ref2.cached;
|
|
132
81
|
if (!caching) {
|
|
133
82
|
return genStyles(styleStuff, args, colors);
|
|
134
83
|
}
|
|
@@ -141,7 +90,6 @@ function buildStyleObj(_ref2) {
|
|
|
141
90
|
if (key === cached.key) {
|
|
142
91
|
return cached.value;
|
|
143
92
|
}
|
|
144
|
-
|
|
145
93
|
cached.key = key;
|
|
146
94
|
cached.source[0] = args[0];
|
|
147
95
|
cached.source[1] = args[1];
|
|
@@ -151,4 +99,70 @@ function buildStyleObj(_ref2) {
|
|
|
151
99
|
|
|
152
100
|
//=====================================================
|
|
153
101
|
//========================================== style Item
|
|
154
|
-
//=====================================================
|
|
102
|
+
//=====================================================
|
|
103
|
+
|
|
104
|
+
function _default(_ref3) {
|
|
105
|
+
var _styles = _ref3._styles,
|
|
106
|
+
replacedStyle = _ref3.replacedStyle,
|
|
107
|
+
styleCSS = _ref3.styleCSS,
|
|
108
|
+
colors = _ref3.colors,
|
|
109
|
+
options = _ref3.options,
|
|
110
|
+
caching = _ref3.caching,
|
|
111
|
+
wrapStyles = _ref3.wrapStyles;
|
|
112
|
+
//+++++++++++++++++++++++++++++++++++++ style function
|
|
113
|
+
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
114
|
+
return function (styleName) {
|
|
115
|
+
var styleFn = _styles[styleName] || function () {
|
|
116
|
+
return {};
|
|
117
|
+
};
|
|
118
|
+
var cached = {
|
|
119
|
+
key: null,
|
|
120
|
+
value: null,
|
|
121
|
+
source: []
|
|
122
|
+
};
|
|
123
|
+
replacedStyle[styleName] = function () {
|
|
124
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
125
|
+
args[_key] = arguments[_key];
|
|
126
|
+
}
|
|
127
|
+
var elemName = args[0];
|
|
128
|
+
|
|
129
|
+
//+++++++++++++++++++++++++++++++++++ build an element
|
|
130
|
+
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
131
|
+
|
|
132
|
+
if (Array.isArray(elemName) && elemName.hasOwnProperty("raw")) {
|
|
133
|
+
return buildElem({
|
|
134
|
+
elemName: elemName,
|
|
135
|
+
args: args,
|
|
136
|
+
styleCSS: styleCSS,
|
|
137
|
+
styleName: styleName,
|
|
138
|
+
options: options,
|
|
139
|
+
replacedStyle: replacedStyle,
|
|
140
|
+
colors: colors
|
|
141
|
+
});
|
|
142
|
+
} // elem gen
|
|
143
|
+
|
|
144
|
+
//++++++++++++++++++++++++++++++++++++++ generat style
|
|
145
|
+
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
146
|
+
|
|
147
|
+
var styleStuff = {
|
|
148
|
+
styleCSS: styleCSS[styleName],
|
|
149
|
+
styleFn: styleFn
|
|
150
|
+
};
|
|
151
|
+
return buildStyleObj({
|
|
152
|
+
styleStuff: styleStuff,
|
|
153
|
+
genStyles: _utils.genStyles,
|
|
154
|
+
args: args,
|
|
155
|
+
colors: colors,
|
|
156
|
+
caching: caching,
|
|
157
|
+
cached: cached
|
|
158
|
+
});
|
|
159
|
+
}; // END replacedStyle[styleName] = function(...args)
|
|
160
|
+
|
|
161
|
+
//+++++++++++++++++++++++++++++++++ step down the tree
|
|
162
|
+
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
163
|
+
|
|
164
|
+
if (0 < Object.keys(styleFn).length || (0, _utils.hasKids)(styleCSS[styleName])) {
|
|
165
|
+
Object.assign(replacedStyle[styleName], wrapStyles(styleFn, options, styleCSS[styleName]));
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = buildCssString;
|
|
7
7
|
function buildCssString(classesValues, props) {
|
|
8
8
|
var css = Object.keys(classesValues).map(function (className) {
|
|
9
9
|
return classesValues[className];
|
|
10
10
|
}).join(" ");
|
|
11
|
-
css += props.children || "";
|
|
11
|
+
css += (props === null || props === void 0 ? void 0 : props.children) || "";
|
|
12
12
|
css = css.replace(/\n/g, ' ').replace(/\s+/g, ' ');
|
|
13
13
|
return css;
|
|
14
14
|
}
|
package/dist/utils/genCss.js
CHANGED
|
@@ -1,38 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _object2css2 = _interopRequireDefault(_object2css);
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
6
|
+
exports["default"] = genCss;
|
|
7
|
+
var _object2css = _interopRequireDefault(require("./object2css"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
9
|
function genCss(_ref) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (propName[0] === "@") return cssString + (" " + propName + "{ ." + randomClassName + "{ " + styleContent + " } } ");else if (propName[0] === ":") return " ." + randomClassName + propName + "{ " + styleContent + " } " + cssString;else return " ." + randomClassName + " " + propName + "{ " + styleContent + " } " + cssString;
|
|
33
|
-
// else // skip unknown prop
|
|
34
|
-
// return cssString
|
|
35
|
-
}, newStyle);
|
|
36
|
-
|
|
37
|
-
return newStyle;
|
|
10
|
+
var randomClassName = _ref.randomClassName,
|
|
11
|
+
css = _ref.css,
|
|
12
|
+
styleCSS = _ref.styleCSS,
|
|
13
|
+
colors = _ref.colors,
|
|
14
|
+
style = _ref.style,
|
|
15
|
+
styleName = _ref.styleName;
|
|
16
|
+
var newStyle = style ? ".".concat(randomClassName, "{").concat((0, _object2css["default"])(colors, style), "}") : "";
|
|
17
|
+
newStyle = Object.keys(css).reduce(function (cssString, propName) {
|
|
18
|
+
var styleContent = (0, _object2css["default"])(colors, css[propName]
|
|
19
|
+
/* || styleCSS[styleName].base
|
|
20
|
+
&& styleCSS[styleName].base[propName]
|
|
21
|
+
|| styleCSS[styleName][propName]*/);
|
|
22
|
+
if (propName[0] === "@") return cssString + " ".concat(propName, "{ .").concat(randomClassName, "{ ").concat(styleContent, " } } ");else if (propName[0] === ":") return " .".concat(randomClassName).concat(propName, "{ ").concat(styleContent, " } ") + cssString;else return " .".concat(randomClassName, " ").concat(propName, "{ ").concat(styleContent, " } ") + cssString;
|
|
23
|
+
// else // skip unknown prop
|
|
24
|
+
// return cssString
|
|
25
|
+
}, newStyle);
|
|
26
|
+
return newStyle;
|
|
38
27
|
}
|
package/dist/utils/genStyles.js
CHANGED
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _replacedStyleFn2 = _interopRequireDefault(_replacedStyleFn);
|
|
15
|
-
|
|
16
|
-
var _replaceColors = require('./replaceColors');
|
|
17
|
-
|
|
18
|
-
var _replaceColors2 = _interopRequireDefault(_replaceColors);
|
|
19
|
-
|
|
20
|
-
var _index = require('./index');
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
var prefixer = new _inlineStylePrefixer2.default();
|
|
25
|
-
|
|
6
|
+
exports["default"] = genStyles;
|
|
7
|
+
var _inlineStylePrefixer = _interopRequireDefault(require("inline-style-prefixer"));
|
|
8
|
+
var _replacedStyleFn = _interopRequireDefault(require("./replacedStyleFn"));
|
|
9
|
+
var _replaceColors = _interopRequireDefault(require("./replaceColors"));
|
|
10
|
+
var _index = require("./index");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
var prefixer = new _inlineStylePrefixer["default"]();
|
|
26
13
|
function genStyles(styleStuff, args, colors) {
|
|
27
|
-
var userResult = (0,
|
|
28
|
-
|
|
29
|
-
var swapedColor = (0, _replaceColors2.default)(colors, userResult);
|
|
14
|
+
var userResult = (0, _replacedStyleFn["default"])(styleStuff, args);
|
|
15
|
+
var swapedColor = (0, _replaceColors["default"])(colors, userResult);
|
|
30
16
|
for (var name in swapedColor) {
|
|
31
17
|
//if(!specialCharacters.includes(name[0]))
|
|
32
|
-
swapedColor[name] = prefixer.prefix({
|
|
18
|
+
swapedColor[name] = prefixer.prefix({
|
|
19
|
+
a: swapedColor[name]
|
|
20
|
+
}).a;
|
|
33
21
|
}
|
|
34
|
-
|
|
35
22
|
return swapedColor;
|
|
36
23
|
}
|
package/dist/utils/hasKids.js
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.default = hasKids;
|
|
6
|
+
exports["default"] = hasKids;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
8
|
function hasKids(obj) {
|
|
11
9
|
for (var name in obj) {
|
|
12
10
|
if ("base" !== name && "object" === _typeof(obj[name])) return true;
|
package/dist/utils/index.js
CHANGED
|
@@ -1,69 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
exports
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
exports
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
6
|
+
Object.defineProperty(exports, "buildCssString", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _buildCssString["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "genCss", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _genCss["default"];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "genStyles", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _genStyles["default"];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "hasKids", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _hasKids["default"];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "makeid", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _makeid["default"];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "object2css", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _object2css["default"];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "pubsub", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _pubsub["default"];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "replaceColors", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _replaceColors["default"];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "replacedStyleFn", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _replacedStyleFn["default"];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "sanitizeOutlineInput", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _sanitizeOutlineInput["default"];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "separateCssStyle", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _separateCssStyle["default"];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var _buildCssString = _interopRequireDefault(require("./buildCssString"));
|
|
73
|
+
var _genCss = _interopRequireDefault(require("./genCss"));
|
|
74
|
+
var _genStyles = _interopRequireDefault(require("./genStyles"));
|
|
75
|
+
var _hasKids = _interopRequireDefault(require("./hasKids"));
|
|
76
|
+
var _makeid = _interopRequireDefault(require("./makeid"));
|
|
77
|
+
var _object2css = _interopRequireDefault(require("./object2css"));
|
|
78
|
+
var _pubsub = _interopRequireDefault(require("./pubsub"));
|
|
79
|
+
var _replaceColors = _interopRequireDefault(require("./replaceColors"));
|
|
80
|
+
var _replacedStyleFn = _interopRequireDefault(require("./replacedStyleFn"));
|
|
81
|
+
var _sanitizeOutlineInput = _interopRequireDefault(require("./sanitizeOutlineInput"));
|
|
82
|
+
var _separateCssStyle = _interopRequireDefault(require("./separateCssStyle"));
|
|
83
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
package/dist/utils/makeid.js
CHANGED
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = makeid;
|
|
7
7
|
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
8
8
|
function makeid() {
|
|
9
9
|
var side = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
10
|
-
|
|
11
10
|
var text = "";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
text += possible.charAt(~~(Math.random() * possible.length));
|
|
15
|
-
}return text;
|
|
11
|
+
for (var i = 0; i < side; i++) text += possible.charAt(~~(Math.random() * possible.length));
|
|
12
|
+
return text;
|
|
16
13
|
}
|
package/dist/utils/object2css.js
CHANGED
|
@@ -1,37 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _addPxToStyle = require('add-px-to-style');
|
|
13
|
-
|
|
14
|
-
var _addPxToStyle2 = _interopRequireDefault(_addPxToStyle);
|
|
15
|
-
|
|
16
|
-
var _replaceColors = require('./replaceColors');
|
|
17
|
-
|
|
18
|
-
var _replaceColors2 = _interopRequireDefault(_replaceColors);
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
6
|
+
exports["default"] = object2css;
|
|
7
|
+
var _hyphenateStyleName = _interopRequireDefault(require("hyphenate-style-name"));
|
|
8
|
+
var _addPxToStyle = _interopRequireDefault(require("add-px-to-style"));
|
|
9
|
+
var _replaceColors = _interopRequireDefault(require("./replaceColors"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
22
11
|
// Convert a JS object to CSS string. Similar to React's output of CSS, extracted into a module.
|
|
23
12
|
function object2css(colors, obj) {
|
|
24
|
-
obj = (0,
|
|
13
|
+
obj = (0, _replaceColors["default"])(colors, obj);
|
|
25
14
|
var keys = Object.keys(obj);
|
|
26
15
|
//if (!keys.length) return ''
|
|
27
|
-
var i
|
|
28
|
-
|
|
16
|
+
var i,
|
|
17
|
+
len = keys.length;
|
|
29
18
|
var result = '';
|
|
30
|
-
|
|
31
19
|
for (i = 0; i < len; i++) {
|
|
32
20
|
var key = keys[i];
|
|
33
21
|
var val = obj[key];
|
|
34
|
-
result += (0,
|
|
22
|
+
result += (0, _hyphenateStyleName["default"])(key) + ':' + (0, _addPxToStyle["default"])(key, val) + "; ";
|
|
35
23
|
}
|
|
36
24
|
return result;
|
|
37
25
|
}
|