@startlibs/core 1.0.0-alpha-6r → 1.0.0-alpha-6t2
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 +56 -11
- package/package.json +6 -6
- package/src/index.js +0 -25
package/lib/index.js
CHANGED
|
@@ -41,8 +41,10 @@ require('@babel/runtime/helpers/wrapAsyncGenerator');
|
|
|
41
41
|
var _ = require('lodash/fp');
|
|
42
42
|
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
43
43
|
require('polished');
|
|
44
|
-
var
|
|
44
|
+
var createEmotion = require('create-emotion');
|
|
45
45
|
var _isFunction = require('lodash/fp/isFunction');
|
|
46
|
+
var _get = require('lodash/fp/get');
|
|
47
|
+
var _isString = require('lodash/fp/isString');
|
|
46
48
|
|
|
47
49
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
48
50
|
|
|
@@ -79,7 +81,10 @@ var mitt__default = /*#__PURE__*/_interopDefaultLegacy(mitt);
|
|
|
79
81
|
var _isArray__default = /*#__PURE__*/_interopDefaultLegacy(_isArray);
|
|
80
82
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
81
83
|
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
84
|
+
var createEmotion__default = /*#__PURE__*/_interopDefaultLegacy(createEmotion);
|
|
82
85
|
var _isFunction__default = /*#__PURE__*/_interopDefaultLegacy(_isFunction);
|
|
86
|
+
var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
|
|
87
|
+
var _isString__default = /*#__PURE__*/_interopDefaultLegacy(_isString);
|
|
83
88
|
|
|
84
89
|
var callList = function callList(list, firstArg) {
|
|
85
90
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
@@ -1183,19 +1188,45 @@ function _templateObject() {
|
|
|
1183
1188
|
|
|
1184
1189
|
return data;
|
|
1185
1190
|
}
|
|
1191
|
+
|
|
1192
|
+
var checkCustomScreenWidth = function checkCustomScreenWidth(sizeParis, customWidth) {
|
|
1193
|
+
var currentWidth = callIfFunction(customWidth);
|
|
1194
|
+
return !sizeParis.find(function (_ref4) {
|
|
1195
|
+
var _ref5 = _slicedToArray__default['default'](_ref4, 2),
|
|
1196
|
+
size = _ref5[0],
|
|
1197
|
+
type = _ref5[1];
|
|
1198
|
+
|
|
1199
|
+
if (type === "min-width") {
|
|
1200
|
+
return currentWidth < size;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
if (type === "max-width") {
|
|
1204
|
+
return currentWidth > size;
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1186
1209
|
var media = function media() {
|
|
1187
1210
|
for (var _len3 = arguments.length, sizePairs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1188
1211
|
sizePairs[_key3] = arguments[_key3];
|
|
1189
1212
|
}
|
|
1190
1213
|
|
|
1191
1214
|
return function () {
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1215
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
1216
|
+
args[_key4] = arguments[_key4];
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
return styled.css(["", ""], function (props) {
|
|
1220
|
+
var _props$theme, _props$theme2;
|
|
1196
1221
|
|
|
1197
|
-
return
|
|
1198
|
-
|
|
1222
|
+
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) {
|
|
1223
|
+
var _ref7 = _slicedToArray__default['default'](_ref6, 2),
|
|
1224
|
+
size = _ref7[0],
|
|
1225
|
+
type = _ref7[1];
|
|
1226
|
+
|
|
1227
|
+
return "(".concat(type, ": ").concat(size + scrollWidth, "px)");
|
|
1228
|
+
}).join(' and '), styled.css.apply(void 0, args));
|
|
1229
|
+
});
|
|
1199
1230
|
};
|
|
1200
1231
|
};
|
|
1201
1232
|
media.mobile = media([600, 'max-width']);
|
|
@@ -1218,9 +1249,12 @@ var getFrameOffset = function getFrameOffset(i, total) {
|
|
|
1218
1249
|
return Math.round(i * 100 / (total - 1));
|
|
1219
1250
|
};
|
|
1220
1251
|
|
|
1252
|
+
var emotion = createEmotion__default['default']({
|
|
1253
|
+
nonce: __webpack_nonce__
|
|
1254
|
+
});
|
|
1221
1255
|
var oneWayAnimation = function oneWayAnimation() {
|
|
1222
|
-
for (var
|
|
1223
|
-
frames[
|
|
1256
|
+
for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
1257
|
+
frames[_key5] = arguments[_key5];
|
|
1224
1258
|
}
|
|
1225
1259
|
|
|
1226
1260
|
return emotion.keyframes(_templateObject(), frames.map(function (frame, i) {
|
|
@@ -1545,8 +1579,8 @@ var willUseSpreadState = function willUseSpreadState(defaultContextValue) {
|
|
|
1545
1579
|
var prevInitState = EMPTY_GLOBAL;
|
|
1546
1580
|
var globalState = EMPTY_GLOBAL;
|
|
1547
1581
|
|
|
1548
|
-
var getGlobalState = function getGlobalState() {
|
|
1549
|
-
return globalState;
|
|
1582
|
+
var getGlobalState = function getGlobalState(key) {
|
|
1583
|
+
return _isString__default['default'](key) || _isArray__default['default'](key) ? _get__default['default'](key, globalState) : globalState;
|
|
1550
1584
|
};
|
|
1551
1585
|
|
|
1552
1586
|
var useProvideSpreadState = function useProvideSpreadState(initState, setCallback) {
|
|
@@ -1646,6 +1680,16 @@ var willUseSpreadState = function willUseSpreadState(defaultContextValue) {
|
|
|
1646
1680
|
return [useProvideSpreadState, useSpreadState, Context, getGlobalState];
|
|
1647
1681
|
};
|
|
1648
1682
|
|
|
1683
|
+
var useRefMemo = function useRefMemo(value) {
|
|
1684
|
+
var ref = React.useRef(value);
|
|
1685
|
+
|
|
1686
|
+
if (ref.current !== value) {
|
|
1687
|
+
ref.current = utils.callIfFunction(value);
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
return ref;
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1649
1693
|
exports.Fill = Fill;
|
|
1650
1694
|
exports.GroupEventFactory = GroupEventFactory;
|
|
1651
1695
|
exports.PopupContext = PopupContext;
|
|
@@ -1674,6 +1718,7 @@ exports.useLazyConstant = useLazyConstant;
|
|
|
1674
1718
|
exports.usePopupToggle = usePopupToggle;
|
|
1675
1719
|
exports.usePrevious = usePrevious;
|
|
1676
1720
|
exports.usePreviousUnique = usePreviousUnique;
|
|
1721
|
+
exports.useRefMemo = useRefMemo;
|
|
1677
1722
|
exports.useRefState = useRefState;
|
|
1678
1723
|
exports.useRefToggle = useRefToggle;
|
|
1679
1724
|
exports.useTitle = useTitle;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startlibs/core",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-6t2",
|
|
4
4
|
"description": "Startlibs Core",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"source": true,
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"lodash": "^4.17.11",
|
|
10
|
-
"react": "^
|
|
11
|
-
"react-dom": "^
|
|
12
|
-
"
|
|
13
|
-
"
|
|
10
|
+
"react": "^18.0",
|
|
11
|
+
"react-dom": "^18.0",
|
|
12
|
+
"styled-components": "^5.2.0",
|
|
13
|
+
"@startlibs/utils": "^1.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@babel/core": "^7.2.0",
|
package/src/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export * from './StartlibsProvider'
|
|
2
|
-
export * from './SlotFill'
|
|
3
|
-
export * from './hocs/consumes'
|
|
4
|
-
export * from './hocs/withDialogError'
|
|
5
|
-
export * from './hocs/withGroupEvent'
|
|
6
|
-
export * from './hocs/WithRef'
|
|
7
|
-
export * from './hocs/WithLazyResource'
|
|
8
|
-
export * from './hooks/WithEffect'
|
|
9
|
-
export * from './hooks/useToggle'
|
|
10
|
-
export * from './hooks/usePopupToggle'
|
|
11
|
-
export * from './hooks/useRefState'
|
|
12
|
-
export * from './hooks/useConsumerCatalog'
|
|
13
|
-
export * from './hooks/useTitle'
|
|
14
|
-
export * from './hooks/usePrevious'
|
|
15
|
-
export * from './hooks/useIsUnmounted'
|
|
16
|
-
export * from './hooks/useEnsureRef'
|
|
17
|
-
export * from './hooks/useConstant'
|
|
18
|
-
export * from './hooks/useForceUpdate'
|
|
19
|
-
export * from './hooks/useUpdateOnResize'
|
|
20
|
-
export * from './hooks/useAsyncEffect'
|
|
21
|
-
export * from './hooks/useUpdateEffect'
|
|
22
|
-
export * from './hooks/willUseLayers'
|
|
23
|
-
export * from './hooks/willUseSharedCallback'
|
|
24
|
-
export * from './hooks/willUseSharedState'
|
|
25
|
-
export * from './hooks/willUseSpreadState'
|