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/utils/pubsub.js
CHANGED
|
@@ -3,20 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
10
|
var pubsub = new function () {
|
|
8
|
-
|
|
9
11
|
var vals = {};
|
|
10
12
|
var subscribers = [];
|
|
11
|
-
|
|
12
13
|
this.publish = function (key, value) {
|
|
13
|
-
|
|
14
14
|
vals[key] = value;
|
|
15
15
|
subscribers.forEach(function (subscriber) {
|
|
16
16
|
return subscriber(vals);
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
|
-
|
|
20
19
|
this.subscribe = function (subscriber) {
|
|
21
20
|
return subscribers.push(subscriber);
|
|
22
21
|
};
|
|
@@ -24,31 +23,18 @@ var pubsub = new function () {
|
|
|
24
23
|
return vals;
|
|
25
24
|
};
|
|
26
25
|
this.clear = function () {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
var _iteratorError = undefined;
|
|
30
|
-
|
|
26
|
+
var _iterator = _createForOfIteratorHelper(Object.getOwnPropertyNames(vals)),
|
|
27
|
+
_step;
|
|
31
28
|
try {
|
|
32
|
-
for (
|
|
29
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
33
30
|
var className = _step.value;
|
|
34
|
-
|
|
35
31
|
delete vals[className];
|
|
36
32
|
}
|
|
37
33
|
} catch (err) {
|
|
38
|
-
|
|
39
|
-
_iteratorError = err;
|
|
34
|
+
_iterator.e(err);
|
|
40
35
|
} finally {
|
|
41
|
-
|
|
42
|
-
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
43
|
-
_iterator.return();
|
|
44
|
-
}
|
|
45
|
-
} finally {
|
|
46
|
-
if (_didIteratorError) {
|
|
47
|
-
throw _iteratorError;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
36
|
+
_iterator.f();
|
|
50
37
|
}
|
|
51
38
|
};
|
|
52
39
|
}();
|
|
53
|
-
|
|
54
|
-
exports.default = pubsub;
|
|
40
|
+
var _default = exports["default"] = pubsub;
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
exports["default"] = _default;
|
|
7
|
+
function _default(colors, style) {
|
|
9
8
|
if (!colors) return style;
|
|
10
9
|
var result = Object.assign({}, style);
|
|
11
10
|
for (var key in result) {
|
|
@@ -14,4 +13,4 @@ exports.default = function (colors, style) {
|
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
return result;
|
|
17
|
-
}
|
|
16
|
+
}
|
|
@@ -3,15 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.default = replacedStyleFn;
|
|
6
|
+
exports["default"] = replacedStyleFn;
|
|
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 replacedStyleFn(_ref, args) {
|
|
11
9
|
var styleCSS = _ref.styleCSS,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
styleFn = _ref.styleFn;
|
|
15
11
|
var processedStyles = 1 === styleFn.length ? styleFn(args[0]) : styleFn(styleCSS, args[0]);
|
|
16
12
|
|
|
17
13
|
// const styleAsPropObj = 0===styleFn.length && "object" === typeof args[0] ? args[0] : {};
|
|
@@ -26,15 +22,14 @@ function replacedStyleFn(_ref, args) {
|
|
|
26
22
|
|
|
27
23
|
//const autoAddStyles = [], firstVal = args[1]// || args[0];
|
|
28
24
|
var autoAddStyles = [],
|
|
29
|
-
|
|
25
|
+
firstVal = args[1] || args[0];
|
|
30
26
|
//console.log(args)
|
|
31
|
-
if (!!firstVal && "object" ===
|
|
27
|
+
if (!!firstVal && "object" === _typeof(firstVal)) {
|
|
32
28
|
Object.keys(firstVal).forEach(function (cssName) {
|
|
33
29
|
if (true === firstVal[cssName] && styleCSS && cssName in styleCSS) autoAddStyles.push(styleCSS[cssName]);
|
|
34
30
|
// else // to bind style value to output obj
|
|
35
31
|
// autoAddStyles.push({cssName:firstVal[cssName]})
|
|
36
32
|
});
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
return Object.assign.apply(Object, [{}, styleBase].concat(autoAddStyles, [processedStyles]));
|
|
40
35
|
}
|
|
@@ -3,45 +3,31 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.default = sanitizeOutlineInput;
|
|
6
|
+
exports["default"] = sanitizeOutlineInput;
|
|
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
|
//+++++++++++++++++++++++++++++ { base:{}, foo: ()=> }
|
|
11
9
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
12
10
|
function sanitizeOutlineInput(_styles) {
|
|
13
11
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if ("object" !== (typeof _styles === "undefined" ? "undefined" : _typeof(_styles))) {
|
|
12
|
+
if ("object" !== _typeof(_styles) || Array.isArray(_styles)) {
|
|
17
13
|
throw new Error("Bad style values: " + JSON.stringify(_styles));
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
//+++++++++++++++++++++++++++++++++++++++ [ base, fn ]
|
|
21
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
22
|
-
if (Array.isArray(_styles)) {
|
|
23
|
-
|
|
24
|
-
_styles = Object.assign({}, { base: _styles[0] }, _styles[1]);
|
|
25
|
-
} else if (!("base" in _styles)) {
|
|
26
|
-
|
|
15
|
+
if (!("base" in _styles)) {
|
|
27
16
|
var base = {},
|
|
28
|
-
|
|
17
|
+
fns = {};
|
|
29
18
|
|
|
30
19
|
//++++++++++++++ { table: {}, header:{} }, fn:{ ()=> }
|
|
31
20
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
32
21
|
|
|
33
22
|
var optionsIsFns = true;
|
|
34
|
-
|
|
35
23
|
for (var prop in options) {
|
|
36
24
|
if (options.hasOwnProperty(prop) && "function" !== typeof options[prop]) {
|
|
37
25
|
optionsIsFns = false;
|
|
38
26
|
}
|
|
39
27
|
}
|
|
40
|
-
|
|
41
28
|
if (optionsIsFns) {
|
|
42
29
|
Object.assign(fns, options);
|
|
43
30
|
}
|
|
44
|
-
|
|
45
31
|
for (var _prop in _styles) {
|
|
46
32
|
//+++++++++++++++++++++++++++ { table: {}, header:{} }
|
|
47
33
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@@ -55,11 +41,12 @@ function sanitizeOutlineInput(_styles) {
|
|
|
55
41
|
throw new Error("Bad style value: " + JSON.stringify(_styles[_prop]));
|
|
56
42
|
}
|
|
57
43
|
}
|
|
58
|
-
_styles = Object.assign({}, {
|
|
44
|
+
_styles = Object.assign({}, {
|
|
45
|
+
base: base
|
|
46
|
+
}, fns);
|
|
59
47
|
}
|
|
60
48
|
|
|
61
49
|
// apply sharing
|
|
62
|
-
|
|
63
50
|
var _loop = function _loop(_prop2) {
|
|
64
51
|
if (0 < _prop2.indexOf(',')) {
|
|
65
52
|
_prop2.split(',').map(function (x) {
|
|
@@ -71,16 +58,13 @@ function sanitizeOutlineInput(_styles) {
|
|
|
71
58
|
// e.g. "foo , bar" (cross cutting style) is in style Object
|
|
72
59
|
// but "foo" & "bar" are functions
|
|
73
60
|
root[x] && root[x].base ? root[x].base : root[x]);
|
|
74
|
-
|
|
75
61
|
root[x] && root[x].base ? root[x].base = val : root[x] = val;
|
|
76
62
|
});
|
|
77
63
|
delete _styles.base[_prop2];
|
|
78
64
|
}
|
|
79
65
|
};
|
|
80
|
-
|
|
81
66
|
for (var _prop2 in _styles.base) {
|
|
82
67
|
_loop(_prop2);
|
|
83
68
|
}
|
|
84
|
-
|
|
85
69
|
return _styles;
|
|
86
70
|
}
|
|
@@ -3,24 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = separateCssStyle;
|
|
8
7
|
//import { specialCharacters } from './index'
|
|
9
8
|
|
|
10
9
|
function separateCssStyle(styles) {
|
|
11
|
-
|
|
12
10
|
var css = {};
|
|
13
11
|
var style = {};
|
|
14
|
-
|
|
15
12
|
for (var name in styles) {
|
|
16
13
|
//if(specialCharacters.includes(name[0]) )//|| !!name.match(new RegExp(`[${specialInnerCharacters}]`, "gi")))
|
|
17
14
|
//if (!/^\w+$/.test(name))
|
|
18
15
|
if (!/^[a-zA-Z0-9-]+$/.test(name)) css[name] = styles[name];else style[name] = styles[name];
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
if (0 === Object.keys(css).length) css = null;
|
|
22
|
-
|
|
23
18
|
if (0 === Object.keys(style).length) style = null;
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
return {
|
|
20
|
+
css: css,
|
|
21
|
+
style: style
|
|
22
|
+
};
|
|
26
23
|
}
|
package/dist/wrapStyles.js
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
exports["default"] = _default;
|
|
7
|
+
var _styleItem = _interopRequireDefault(require("./styleItem"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
//=====================================================
|
|
10
|
+
//========================================= wrap Styles
|
|
11
|
+
//=====================================================
|
|
12
|
+
|
|
13
|
+
function _default(userSetOptions) {
|
|
8
14
|
return function wrapStyles(_styles, options, styleCSS) {
|
|
9
|
-
|
|
10
15
|
options = Object.assign({}, userSetOptions, options);
|
|
11
16
|
// const radium = !!options.radium;
|
|
12
17
|
var caching = !!options.caching;
|
|
@@ -14,21 +19,20 @@ exports.default = function (userSetOptions) {
|
|
|
14
19
|
styleCSS = _styles.base || styleCSS;
|
|
15
20
|
var replacedStyle = {};
|
|
16
21
|
if (_styles.base) replacedStyle.base = styleCSS;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
var styleItemGen = (0, _styleItem["default"])({
|
|
23
|
+
_styles: _styles,
|
|
24
|
+
replacedStyle: replacedStyle,
|
|
25
|
+
styleCSS: styleCSS,
|
|
26
|
+
colors: colors,
|
|
27
|
+
options: options,
|
|
28
|
+
caching: caching,
|
|
29
|
+
wrapStyles: wrapStyles
|
|
30
|
+
});
|
|
20
31
|
Object.keys(_styles).concat(Object.keys(styleCSS)).filter(function (item, pos, a) {
|
|
21
32
|
return a.indexOf(item) === pos;
|
|
22
33
|
}).filter(function (styleName) {
|
|
23
34
|
return "base" !== styleName;
|
|
24
35
|
}).forEach(styleItemGen);
|
|
25
|
-
|
|
26
36
|
return replacedStyle;
|
|
27
37
|
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var _styleItem = require("./styleItem");
|
|
31
|
-
|
|
32
|
-
var _styleItem2 = _interopRequireDefault(_styleItem);
|
|
33
|
-
|
|
34
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-outline",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "react styling framework to keep your makeup clean",
|
|
5
|
-
"main": "./dist/
|
|
5
|
+
"main": "./dist/reactOutline.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
6
9
|
"scripts": {
|
|
10
|
+
"prepare": "cp .hooks/* .git/hooks/ 2>/dev/null && chmod +x .git/hooks/* || true",
|
|
7
11
|
"build": "babel --copy-files source --out-dir dist",
|
|
8
12
|
"build:watch": "babel --copy-files source --out-dir dist -s --source-maps inline -w",
|
|
9
13
|
"test": "jest --no-cache ",
|
|
10
14
|
"test:go": "npm test -- --watch --coverage",
|
|
11
15
|
"test:update": "npm test -- --updateSnapshot",
|
|
12
16
|
"test:cover": "npm test -- --coverage --no-cache",
|
|
13
|
-
"test:watch": "npm test -- --watch --runInBand"
|
|
17
|
+
"test:watch": "npm test -- --watch --runInBand",
|
|
18
|
+
"release": "bash scripts/_publish.sh"
|
|
14
19
|
},
|
|
15
20
|
"repository": {
|
|
16
21
|
"type": "git",
|
|
@@ -36,28 +41,31 @@
|
|
|
36
41
|
"dependencies": {
|
|
37
42
|
"add-px-to-style": "^1.0.0",
|
|
38
43
|
"hyphenate-style-name": "^1.0.2",
|
|
39
|
-
"inline-style-prefixer": "^3.0.6"
|
|
40
|
-
|
|
44
|
+
"inline-style-prefixer": "^3.0.6"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"react": ">=16.0.0 <20.0.0"
|
|
41
48
|
},
|
|
42
49
|
"devDependencies": {
|
|
43
|
-
"babel": "^
|
|
44
|
-
"babel
|
|
45
|
-
"babel
|
|
46
|
-
"babel-
|
|
47
|
-
"babel
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
50
|
+
"@babel/cli": "^7.23.0",
|
|
51
|
+
"@babel/core": "^7.23.0",
|
|
52
|
+
"@babel/plugin-proposal-decorators": "^7.23.0",
|
|
53
|
+
"@babel/preset-env": "^7.23.0",
|
|
54
|
+
"@babel/preset-react": "^7.23.0",
|
|
55
|
+
"@faker-js/faker": "^8.3.0",
|
|
56
|
+
"@testing-library/jest-dom": "^6.1.0",
|
|
57
|
+
"@testing-library/react": "^14.1.0",
|
|
58
|
+
"coveralls": "^3.1.1",
|
|
59
|
+
"esbuild": "^0.24.2",
|
|
60
|
+
"jest": "^29.7.0",
|
|
61
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
62
|
+
"raw-loader": "^4.0.2",
|
|
63
|
+
"react": "^18.2.0",
|
|
64
|
+
"react-dom": "^18.2.0",
|
|
65
|
+
"react-test-renderer": "^18.2.0"
|
|
56
66
|
},
|
|
57
67
|
"jest": {
|
|
58
|
-
"
|
|
59
|
-
"__TEST__": true
|
|
60
|
-
},
|
|
68
|
+
"testEnvironment": "jsdom",
|
|
61
69
|
"moduleNameMapper": {
|
|
62
70
|
"\\.(css|jpg|png)$": "<rootDir>/empty-module.js",
|
|
63
71
|
"^raw-loader": "<rootDir>/empty-module.js",
|
|
@@ -65,13 +73,17 @@
|
|
|
65
73
|
"^react-addons-css-transition-group$": "<rootDir>/empty-module.js"
|
|
66
74
|
},
|
|
67
75
|
"testPathIgnorePatterns": [
|
|
68
|
-
"/node_modules/"
|
|
76
|
+
"/node_modules/",
|
|
77
|
+
"example.test.js"
|
|
69
78
|
],
|
|
70
79
|
"coverageDirectory": "coverage",
|
|
71
80
|
"collectCoverageFrom": [
|
|
72
81
|
"source/**/*.js",
|
|
73
82
|
"!source/utils/index.js"
|
|
74
83
|
],
|
|
75
|
-
"verbose": true
|
|
84
|
+
"verbose": true,
|
|
85
|
+
"setupFilesAfterEnv": [
|
|
86
|
+
"<rootDir>/jest.setup.js"
|
|
87
|
+
]
|
|
76
88
|
}
|
|
77
|
-
}
|
|
89
|
+
}
|
package/.babelrc
DELETED
package/.travis.yml
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
language: node_js
|
|
2
|
-
node_js:
|
|
3
|
-
- "7.9.0"
|
|
4
|
-
# https://strongloop.com/strongblog/npm-modules-travis-coveralls/
|
|
5
|
-
script: npm run-script test:cover
|
|
6
|
-
# Send coverage data to Coveralls
|
|
7
|
-
after_success: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`CSS selectors should allow for color replacment 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<style>
|
|
6
|
-
.react-outline- .abc{ font-size:20px; } .react-outline-{color:squanchy; }
|
|
7
|
-
</style>
|
|
8
|
-
<div
|
|
9
|
-
className="react-outline-"
|
|
10
|
-
name="div"
|
|
11
|
-
/>
|
|
12
|
-
</div>
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`CSS selectors should allow you to select a nested element 1`] = `
|
|
16
|
-
<div>
|
|
17
|
-
<style>
|
|
18
|
-
.react-outline- .abc{ font-size:20px; } .react-outline-{color:red; }
|
|
19
|
-
</style>
|
|
20
|
-
<div
|
|
21
|
-
className="react-outline-"
|
|
22
|
-
name="div"
|
|
23
|
-
/>
|
|
24
|
-
</div>
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`CSS selectors should work with user defined callNames 1`] = `
|
|
28
|
-
<div>
|
|
29
|
-
<div
|
|
30
|
-
className="a react-outline-"
|
|
31
|
-
name="a"
|
|
32
|
-
/>
|
|
33
|
-
<div
|
|
34
|
-
className="react-outline-"
|
|
35
|
-
name="a"
|
|
36
|
-
/>
|
|
37
|
-
<div
|
|
38
|
-
className="b"
|
|
39
|
-
name="b"
|
|
40
|
-
/>
|
|
41
|
-
<div
|
|
42
|
-
name="b"
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
exports[`In production mode should allow cross cutting style to map to only functions 1`] = `
|
|
48
|
-
<span
|
|
49
|
-
name="foo"
|
|
50
|
-
style={
|
|
51
|
-
Object {
|
|
52
|
-
"background": "gray",
|
|
53
|
-
"fontSize": "20px",
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/>
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
exports[`In production mode should allow cross cutting style to map to only functions 2`] = `
|
|
60
|
-
<span
|
|
61
|
-
name="bar"
|
|
62
|
-
style={
|
|
63
|
-
Object {
|
|
64
|
-
"background": "black",
|
|
65
|
-
"fontSize": "20px",
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/>
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
exports[`In production mode should be able to destructur assignments on generated element 1`] = `
|
|
72
|
-
<div
|
|
73
|
-
name="cats"
|
|
74
|
-
style={
|
|
75
|
-
Object {
|
|
76
|
-
"color": "pink",
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/>
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
exports[`In production mode should be able to destructur assignments on generated element 2`] = `
|
|
83
|
-
<div
|
|
84
|
-
name="cats"
|
|
85
|
-
style={
|
|
86
|
-
Object {
|
|
87
|
-
"color": "blue",
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/>
|
|
91
|
-
`;
|
|
92
|
-
|
|
93
|
-
exports[`In production mode should be able to pass an value to style logic 1`] = `
|
|
94
|
-
<div
|
|
95
|
-
name="dogs"
|
|
96
|
-
style={
|
|
97
|
-
Object {
|
|
98
|
-
"color": "white",
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/>
|
|
102
|
-
`;
|
|
103
|
-
|
|
104
|
-
exports[`In production mode should be able to pass an value to style logic 2`] = `
|
|
105
|
-
<div
|
|
106
|
-
name="dogs"
|
|
107
|
-
style={
|
|
108
|
-
Object {
|
|
109
|
-
"color": "black",
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/>
|
|
113
|
-
`;
|
|
114
|
-
|
|
115
|
-
exports[`In production mode should be able to pass true value 1`] = `
|
|
116
|
-
<input
|
|
117
|
-
disabled={true}
|
|
118
|
-
name="input"
|
|
119
|
-
style={
|
|
120
|
-
Object {
|
|
121
|
-
"background": "gray",
|
|
122
|
-
"color": "red",
|
|
123
|
-
"fontSize": "20px",
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/>
|
|
127
|
-
`;
|
|
128
|
-
|
|
129
|
-
exports[`In production mode should generated an element with a logic fn that can take undefined 1`] = `
|
|
130
|
-
<span
|
|
131
|
-
name="foo"
|
|
132
|
-
style={
|
|
133
|
-
Object {
|
|
134
|
-
"background": "gray",
|
|
135
|
-
"fontSize": "20px",
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/>
|
|
139
|
-
`;
|