react-outline 2.1.1 → 2.1.2
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 +5 -53
- package/dist/reactOutline.js +1 -231
- package/dist/reactOutline.js.map +4 -4
- package/package.json +8 -9
- package/dist/Styles.js +0 -45
- package/dist/element.js +0 -141
- package/dist/main.js +0 -64
- package/dist/styleItem.js +0 -168
- package/dist/utils/buildCssString.js +0 -14
- package/dist/utils/genCss.js +0 -27
- package/dist/utils/genStyles.js +0 -23
- package/dist/utils/hasKids.js +0 -12
- package/dist/utils/index.js +0 -83
- package/dist/utils/makeid.js +0 -13
- package/dist/utils/object2css.js +0 -25
- package/dist/utils/pubsub.js +0 -40
- package/dist/utils/replaceColors.js +0 -16
- package/dist/utils/replacedStyleFn.js +0 -35
- package/dist/utils/sanitizeOutlineInput.js +0 -70
- package/dist/utils/separateCssStyle.js +0 -23
- package/dist/wrapStyles.js +0 -38
package/dist/utils/pubsub.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
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; }
|
|
10
|
-
var pubsub = new function () {
|
|
11
|
-
var vals = {};
|
|
12
|
-
var subscribers = [];
|
|
13
|
-
this.publish = function (key, value) {
|
|
14
|
-
vals[key] = value;
|
|
15
|
-
subscribers.forEach(function (subscriber) {
|
|
16
|
-
return subscriber(vals);
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
this.subscribe = function (subscriber) {
|
|
20
|
-
return subscribers.push(subscriber);
|
|
21
|
-
};
|
|
22
|
-
this.get = function () {
|
|
23
|
-
return vals;
|
|
24
|
-
};
|
|
25
|
-
this.clear = function () {
|
|
26
|
-
var _iterator = _createForOfIteratorHelper(Object.getOwnPropertyNames(vals)),
|
|
27
|
-
_step;
|
|
28
|
-
try {
|
|
29
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
30
|
-
var className = _step.value;
|
|
31
|
-
delete vals[className];
|
|
32
|
-
}
|
|
33
|
-
} catch (err) {
|
|
34
|
-
_iterator.e(err);
|
|
35
|
-
} finally {
|
|
36
|
-
_iterator.f();
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}();
|
|
40
|
-
var _default = exports["default"] = pubsub;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = _default;
|
|
7
|
-
function _default(colors, style) {
|
|
8
|
-
if (!colors) return style;
|
|
9
|
-
var result = Object.assign({}, style);
|
|
10
|
-
for (var key in result) {
|
|
11
|
-
if (result[key] in colors) {
|
|
12
|
-
result[key] = colors[result[key]];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
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); }
|
|
8
|
-
function replacedStyleFn(_ref, args) {
|
|
9
|
-
var styleCSS = _ref.styleCSS,
|
|
10
|
-
styleFn = _ref.styleFn;
|
|
11
|
-
var processedStyles = 1 === styleFn.length ? styleFn(args[0]) : styleFn(styleCSS, args[0]);
|
|
12
|
-
|
|
13
|
-
// const styleAsPropObj = 0===styleFn.length && "object" === typeof args[0] ? args[0] : {};
|
|
14
|
-
// const styleBase = Object.assign({},styleCSS && styleCSS.base||styleCSS||{},styleAsPropObj)
|
|
15
|
-
var styleBase = Object.assign({}, styleCSS && styleCSS.base || styleCSS || {});
|
|
16
|
-
/*
|
|
17
|
-
for(const stylePropName in styleBase){
|
|
18
|
-
if(specialCharacters.includes(stylePropName[0]))
|
|
19
|
-
delete styleBase[stylePropName];
|
|
20
|
-
}
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
//const autoAddStyles = [], firstVal = args[1]// || args[0];
|
|
24
|
-
var autoAddStyles = [],
|
|
25
|
-
firstVal = args[1] || args[0];
|
|
26
|
-
//console.log(args)
|
|
27
|
-
if (!!firstVal && "object" === _typeof(firstVal)) {
|
|
28
|
-
Object.keys(firstVal).forEach(function (cssName) {
|
|
29
|
-
if (true === firstVal[cssName] && styleCSS && cssName in styleCSS) autoAddStyles.push(styleCSS[cssName]);
|
|
30
|
-
// else // to bind style value to output obj
|
|
31
|
-
// autoAddStyles.push({cssName:firstVal[cssName]})
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return Object.assign.apply(Object, [{}, styleBase].concat(autoAddStyles, [processedStyles]));
|
|
35
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
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); }
|
|
8
|
-
//+++++++++++++++++++++++++++++ { base:{}, foo: ()=> }
|
|
9
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
10
|
-
function sanitizeOutlineInput(_styles) {
|
|
11
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12
|
-
if ("object" !== _typeof(_styles) || Array.isArray(_styles)) {
|
|
13
|
-
throw new Error("Bad style values: " + JSON.stringify(_styles));
|
|
14
|
-
}
|
|
15
|
-
if (!("base" in _styles)) {
|
|
16
|
-
var base = {},
|
|
17
|
-
fns = {};
|
|
18
|
-
|
|
19
|
-
//++++++++++++++ { table: {}, header:{} }, fn:{ ()=> }
|
|
20
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
21
|
-
|
|
22
|
-
var optionsIsFns = true;
|
|
23
|
-
for (var prop in options) {
|
|
24
|
-
if (options.hasOwnProperty(prop) && "function" !== typeof options[prop]) {
|
|
25
|
-
optionsIsFns = false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (optionsIsFns) {
|
|
29
|
-
Object.assign(fns, options);
|
|
30
|
-
}
|
|
31
|
-
for (var _prop in _styles) {
|
|
32
|
-
//+++++++++++++++++++++++++++ { table: {}, header:{} }
|
|
33
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
34
|
-
if ("object" === _typeof(_styles[_prop])) {
|
|
35
|
-
base[_prop] = _styles[_prop];
|
|
36
|
-
//++++++++++++++++++++++++++++++++++++++ { foo: ()=> }
|
|
37
|
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
38
|
-
} else if ("function" === typeof _styles[_prop]) {
|
|
39
|
-
fns[_prop] = _styles[_prop];
|
|
40
|
-
} else {
|
|
41
|
-
throw new Error("Bad style value: " + JSON.stringify(_styles[_prop]));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
_styles = Object.assign({}, {
|
|
45
|
-
base: base
|
|
46
|
-
}, fns);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// apply sharing
|
|
50
|
-
var _loop = function _loop(_prop2) {
|
|
51
|
-
if (0 < _prop2.indexOf(',')) {
|
|
52
|
-
_prop2.split(',').map(function (x) {
|
|
53
|
-
return x.trim();
|
|
54
|
-
}).forEach(function (x) {
|
|
55
|
-
var root = _styles.base;
|
|
56
|
-
var val = Object.assign({}, root[_prop2],
|
|
57
|
-
// we need to check if x exists in root style.
|
|
58
|
-
// e.g. "foo , bar" (cross cutting style) is in style Object
|
|
59
|
-
// but "foo" & "bar" are functions
|
|
60
|
-
root[x] && root[x].base ? root[x].base : root[x]);
|
|
61
|
-
root[x] && root[x].base ? root[x].base = val : root[x] = val;
|
|
62
|
-
});
|
|
63
|
-
delete _styles.base[_prop2];
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
for (var _prop2 in _styles.base) {
|
|
67
|
-
_loop(_prop2);
|
|
68
|
-
}
|
|
69
|
-
return _styles;
|
|
70
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = separateCssStyle;
|
|
7
|
-
//import { specialCharacters } from './index'
|
|
8
|
-
|
|
9
|
-
function separateCssStyle(styles) {
|
|
10
|
-
var css = {};
|
|
11
|
-
var style = {};
|
|
12
|
-
for (var name in styles) {
|
|
13
|
-
//if(specialCharacters.includes(name[0]) )//|| !!name.match(new RegExp(`[${specialInnerCharacters}]`, "gi")))
|
|
14
|
-
//if (!/^\w+$/.test(name))
|
|
15
|
-
if (!/^[a-zA-Z0-9-]+$/.test(name)) css[name] = styles[name];else style[name] = styles[name];
|
|
16
|
-
}
|
|
17
|
-
if (0 === Object.keys(css).length) css = null;
|
|
18
|
-
if (0 === Object.keys(style).length) style = null;
|
|
19
|
-
return {
|
|
20
|
-
css: css,
|
|
21
|
-
style: style
|
|
22
|
-
};
|
|
23
|
-
}
|
package/dist/wrapStyles.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
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) {
|
|
14
|
-
return function wrapStyles(_styles, options, styleCSS) {
|
|
15
|
-
options = Object.assign({}, userSetOptions, options);
|
|
16
|
-
// const radium = !!options.radium;
|
|
17
|
-
var caching = !!options.caching;
|
|
18
|
-
var colors = options.colors;
|
|
19
|
-
styleCSS = _styles.base || styleCSS;
|
|
20
|
-
var replacedStyle = {};
|
|
21
|
-
if (_styles.base) replacedStyle.base = styleCSS;
|
|
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
|
-
});
|
|
31
|
-
Object.keys(_styles).concat(Object.keys(styleCSS)).filter(function (item, pos, a) {
|
|
32
|
-
return a.indexOf(item) === pos;
|
|
33
|
-
}).filter(function (styleName) {
|
|
34
|
-
return "base" !== styleName;
|
|
35
|
-
}).forEach(styleItemGen);
|
|
36
|
-
return replacedStyle;
|
|
37
|
-
};
|
|
38
|
-
}
|