@startlibs/utils 1.0.0-alpha-7f → 1.0.0-alpha-7g
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/lib/index.js +46 -16
- package/package.json +2 -2
- package/src/index.js +15 -0
package/lib/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var _unset = require('lodash/fp/unset');
|
|
|
26
26
|
var polished = require('polished');
|
|
27
27
|
var react = require('react');
|
|
28
28
|
var styled = require('styled-components');
|
|
29
|
-
var
|
|
29
|
+
var createEmotion = require('create-emotion');
|
|
30
30
|
var _map = require('lodash/fp/map');
|
|
31
31
|
var _filter = require('lodash/fp/filter');
|
|
32
32
|
var _each = require('lodash/fp/each');
|
|
@@ -64,6 +64,7 @@ var _isFunction__default = /*#__PURE__*/_interopDefaultLegacy(_isFunction);
|
|
|
64
64
|
var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
|
|
65
65
|
var _unset__default = /*#__PURE__*/_interopDefaultLegacy(_unset);
|
|
66
66
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
67
|
+
var createEmotion__default = /*#__PURE__*/_interopDefaultLegacy(createEmotion);
|
|
67
68
|
var _map__default = /*#__PURE__*/_interopDefaultLegacy(_map);
|
|
68
69
|
var _filter__default = /*#__PURE__*/_interopDefaultLegacy(_filter);
|
|
69
70
|
var _each__default = /*#__PURE__*/_interopDefaultLegacy(_each);
|
|
@@ -1305,19 +1306,45 @@ var ifNotProp = function ifNotProp(path) {
|
|
|
1305
1306
|
return !v;
|
|
1306
1307
|
});
|
|
1307
1308
|
};
|
|
1309
|
+
|
|
1310
|
+
var checkCustomScreenWidth = function checkCustomScreenWidth(sizeParis, customWidth) {
|
|
1311
|
+
var currentWidth = callIfFunction(customWidth);
|
|
1312
|
+
return !sizeParis.find(function (_ref4) {
|
|
1313
|
+
var _ref5 = _slicedToArray__default['default'](_ref4, 2),
|
|
1314
|
+
size = _ref5[0],
|
|
1315
|
+
type = _ref5[1];
|
|
1316
|
+
|
|
1317
|
+
if (type === "min-width") {
|
|
1318
|
+
return currentWidth < size;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
if (type === "max-width") {
|
|
1322
|
+
return currentWidth > size;
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1308
1327
|
var media = function media() {
|
|
1309
1328
|
for (var _len3 = arguments.length, sizePairs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1310
1329
|
sizePairs[_key3] = arguments[_key3];
|
|
1311
1330
|
}
|
|
1312
1331
|
|
|
1313
1332
|
return function () {
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
type = _ref5[1];
|
|
1333
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
1334
|
+
args[_key4] = arguments[_key4];
|
|
1335
|
+
}
|
|
1318
1336
|
|
|
1319
|
-
|
|
1320
|
-
|
|
1337
|
+
return styled.css(["", ""], function (props) {
|
|
1338
|
+
var _props$theme, _props$theme2;
|
|
1339
|
+
|
|
1340
|
+
return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.overrideMediaWidth) ? checkCustomScreenWidth(sizePairs, (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.overrideMediaWidth) ? styled.css.apply(void 0, args) : "" : styled.css(["@media ", "{", "}"], sizePairs.map(function (_ref6) {
|
|
1341
|
+
var _ref7 = _slicedToArray__default['default'](_ref6, 2),
|
|
1342
|
+
size = _ref7[0],
|
|
1343
|
+
type = _ref7[1];
|
|
1344
|
+
|
|
1345
|
+
return "(".concat(type, ": ").concat(size + scrollWidth, "px)");
|
|
1346
|
+
}).join(' and '), styled.css.apply(void 0, args));
|
|
1347
|
+
});
|
|
1321
1348
|
};
|
|
1322
1349
|
};
|
|
1323
1350
|
media.mobile = media([600, 'max-width']);
|
|
@@ -1355,9 +1382,12 @@ var getFrameOffset = function getFrameOffset(i, total) {
|
|
|
1355
1382
|
return Math.round(i * 100 / (total - 1));
|
|
1356
1383
|
};
|
|
1357
1384
|
|
|
1385
|
+
var emotion = createEmotion__default['default']({
|
|
1386
|
+
nonce: __webpack_nonce__
|
|
1387
|
+
});
|
|
1358
1388
|
var oneWayAnimation = function oneWayAnimation() {
|
|
1359
|
-
for (var
|
|
1360
|
-
frames[
|
|
1389
|
+
for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
1390
|
+
frames[_key5] = arguments[_key5];
|
|
1361
1391
|
}
|
|
1362
1392
|
|
|
1363
1393
|
return emotion.keyframes(_templateObject(), frames.map(function (frame, i) {
|
|
@@ -1365,8 +1395,8 @@ var oneWayAnimation = function oneWayAnimation() {
|
|
|
1365
1395
|
}));
|
|
1366
1396
|
};
|
|
1367
1397
|
var twoWayAnimation = function twoWayAnimation() {
|
|
1368
|
-
for (var
|
|
1369
|
-
frames[
|
|
1398
|
+
for (var _len6 = arguments.length, frames = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
1399
|
+
frames[_key6] = arguments[_key6];
|
|
1370
1400
|
}
|
|
1371
1401
|
|
|
1372
1402
|
return [frames, _reverse__default['default'](frames)].map(function (frames) {
|
|
@@ -1375,8 +1405,8 @@ var twoWayAnimation = function twoWayAnimation() {
|
|
|
1375
1405
|
};
|
|
1376
1406
|
var animationTiming = function animationTiming(props) {
|
|
1377
1407
|
return function () {
|
|
1378
|
-
for (var
|
|
1379
|
-
animations[
|
|
1408
|
+
for (var _len7 = arguments.length, animations = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
1409
|
+
animations[_key7] = arguments[_key7];
|
|
1380
1410
|
}
|
|
1381
1411
|
|
|
1382
1412
|
return animations.filter(function (_) {
|
|
@@ -1388,9 +1418,9 @@ var animationTiming = function animationTiming(props) {
|
|
|
1388
1418
|
};
|
|
1389
1419
|
var identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
|
|
1390
1420
|
var identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
|
|
1391
|
-
var styledExtend = function styledExtend(
|
|
1392
|
-
var target =
|
|
1393
|
-
componentStyle =
|
|
1421
|
+
var styledExtend = function styledExtend(_ref8) {
|
|
1422
|
+
var target = _ref8.target,
|
|
1423
|
+
componentStyle = _ref8.componentStyle;
|
|
1394
1424
|
return function () {
|
|
1395
1425
|
var v = styled__default['default'](target).apply(void 0, arguments);
|
|
1396
1426
|
v.componentStyle.rules = _toConsumableArray__default['default'](componentStyle.rules).concat(_toConsumableArray__default['default'](v.componentStyle.rules));
|
package/package.json
CHANGED
package/src/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './createPromiseQueue'
|
|
2
|
+
export * from './getClosestOffsetScroll'
|
|
3
|
+
export * from './smoothScroll'
|
|
4
|
+
export * from './fixMediaQuery'
|
|
5
|
+
export * from './FetchUtils'
|
|
6
|
+
export * from './styled'
|
|
7
|
+
export * from './formatDate'
|
|
8
|
+
export {_s} from './lodashUtils'
|
|
9
|
+
export * from './ActionUtils'
|
|
10
|
+
export * from './reduceUtils'
|
|
11
|
+
export * from './hooks/useEventListener'
|
|
12
|
+
export * from './utils'
|
|
13
|
+
export * from './createPressEvent'
|
|
14
|
+
export * from './wrapLazy'
|
|
15
|
+
|