@micromag/core 0.3.423 → 0.3.430
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/assets/css/styles.css +13 -13
- package/assets/css/vendor.css +3 -2
- package/es/components.js +32 -48
- package/es/hooks.js +9 -8
- package/es/index.js +202 -120
- package/es/utils.js +109 -5
- package/lib/components.js +1101 -1157
- package/lib/contexts.js +199 -233
- package/lib/hooks.js +89 -124
- package/lib/index.js +660 -603
- package/lib/utils.js +155 -73
- package/package.json +22 -7
- package/scss/styles.scss +1 -1
- package/scss/upload.scss +1 -2
- package/scss/vendor.scss +2 -0
package/lib/utils.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var isNumber = require('lodash/isNumber');
|
|
6
|
-
var
|
|
4
|
+
var tslib = require('tslib');
|
|
7
5
|
var _regeneratorRuntime = require('@babel/runtime/helpers/regeneratorRuntime');
|
|
8
6
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
9
7
|
var isObject = require('lodash/isObject');
|
|
10
8
|
var react = require('react');
|
|
11
9
|
var isString = require('lodash/isString');
|
|
12
10
|
var tinycolor = require('tinycolor2');
|
|
13
|
-
var changeCase = require('change-case');
|
|
14
11
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
15
12
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
16
13
|
var isArray = require('lodash/isArray');
|
|
@@ -19,25 +16,115 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
19
16
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
20
17
|
var slugify = require('slugify');
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Lower case as a function.
|
|
24
|
+
*/
|
|
25
|
+
function lowerCase(str) {
|
|
26
|
+
return str.toLowerCase();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
|
|
30
|
+
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
|
|
31
|
+
// Remove all non-word characters.
|
|
32
|
+
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
|
|
33
|
+
/**
|
|
34
|
+
* Normalize the string into something other libraries can manipulate easier.
|
|
35
|
+
*/
|
|
36
|
+
function noCase(input, options) {
|
|
37
|
+
if (options === void 0) {
|
|
38
|
+
options = {};
|
|
39
|
+
}
|
|
40
|
+
var _a = options.splitRegexp,
|
|
41
|
+
splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a,
|
|
42
|
+
_b = options.stripRegexp,
|
|
43
|
+
stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b,
|
|
44
|
+
_c = options.transform,
|
|
45
|
+
transform = _c === void 0 ? lowerCase : _c,
|
|
46
|
+
_d = options.delimiter,
|
|
47
|
+
delimiter = _d === void 0 ? " " : _d;
|
|
48
|
+
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
|
|
49
|
+
var start = 0;
|
|
50
|
+
var end = result.length;
|
|
51
|
+
// Trim the delimiter from around the output string.
|
|
52
|
+
while (result.charAt(start) === "\0") start++;
|
|
53
|
+
while (result.charAt(end - 1) === "\0") end--;
|
|
54
|
+
// Transform each token independently.
|
|
55
|
+
return result.slice(start, end).split("\0").map(transform).join(delimiter);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Replace `re` in the input string with the replacement value.
|
|
59
|
+
*/
|
|
60
|
+
function replace(input, re, value) {
|
|
61
|
+
if (re instanceof RegExp) return input.replace(re, value);
|
|
62
|
+
return re.reduce(function (input, re) {
|
|
63
|
+
return input.replace(re, value);
|
|
64
|
+
}, input);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function pascalCaseTransform(input, index) {
|
|
68
|
+
var firstChar = input.charAt(0);
|
|
69
|
+
var lowerChars = input.substr(1).toLowerCase();
|
|
70
|
+
if (index > 0 && firstChar >= "0" && firstChar <= "9") {
|
|
71
|
+
return "_" + firstChar + lowerChars;
|
|
72
|
+
}
|
|
73
|
+
return "" + firstChar.toUpperCase() + lowerChars;
|
|
74
|
+
}
|
|
75
|
+
function pascalCase(input, options) {
|
|
76
|
+
if (options === void 0) {
|
|
77
|
+
options = {};
|
|
78
|
+
}
|
|
79
|
+
return noCase(input, tslib.__assign({
|
|
80
|
+
delimiter: "",
|
|
81
|
+
transform: pascalCaseTransform
|
|
82
|
+
}, options));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function camelCaseTransform(input, index) {
|
|
86
|
+
if (index === 0) return input.toLowerCase();
|
|
87
|
+
return pascalCaseTransform(input, index);
|
|
88
|
+
}
|
|
89
|
+
function camelCase(input, options) {
|
|
90
|
+
if (options === void 0) {
|
|
91
|
+
options = {};
|
|
92
|
+
}
|
|
93
|
+
return pascalCase(input, tslib.__assign({
|
|
94
|
+
transform: camelCaseTransform
|
|
95
|
+
}, options));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function dotCase(input, options) {
|
|
99
|
+
if (options === void 0) {
|
|
100
|
+
options = {};
|
|
101
|
+
}
|
|
102
|
+
return noCase(input, tslib.__assign({
|
|
103
|
+
delimiter: "."
|
|
104
|
+
}, options));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function paramCase(input, options) {
|
|
108
|
+
if (options === void 0) {
|
|
109
|
+
options = {};
|
|
110
|
+
}
|
|
111
|
+
return dotCase(input, tslib.__assign({
|
|
112
|
+
delimiter: "-"
|
|
113
|
+
}, options));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function snakeCase(input, options) {
|
|
117
|
+
if (options === void 0) {
|
|
118
|
+
options = {};
|
|
119
|
+
}
|
|
120
|
+
return dotCase(input, tslib.__assign({
|
|
121
|
+
delimiter: "_"
|
|
122
|
+
}, options));
|
|
123
|
+
}
|
|
37
124
|
|
|
38
125
|
var convertStyleToString = function convertStyleToString(style) {
|
|
39
126
|
return style !== null ? Object.keys(style).map(function (key) {
|
|
40
|
-
return "".concat(paramCase
|
|
127
|
+
return "".concat(paramCase(key), ":").concat(isNumber(style[key]) ? "".concat(style[key], "px") : style[key], ";");
|
|
41
128
|
}).join('\n') : '';
|
|
42
129
|
};
|
|
43
130
|
|
|
@@ -53,8 +140,8 @@ function copyClipboardApi(_x) {
|
|
|
53
140
|
return _copyClipboardApi.apply(this, arguments);
|
|
54
141
|
}
|
|
55
142
|
function _copyClipboardApi() {
|
|
56
|
-
_copyClipboardApi =
|
|
57
|
-
return
|
|
143
|
+
_copyClipboardApi = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(text) {
|
|
144
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
58
145
|
while (1) switch (_context.prev = _context.next) {
|
|
59
146
|
case 0:
|
|
60
147
|
if (navigator.clipboard) {
|
|
@@ -76,9 +163,9 @@ function copyExecCommand(_x2) {
|
|
|
76
163
|
return _copyExecCommand.apply(this, arguments);
|
|
77
164
|
}
|
|
78
165
|
function _copyExecCommand() {
|
|
79
|
-
_copyExecCommand =
|
|
166
|
+
_copyExecCommand = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(text) {
|
|
80
167
|
var span, selection, range, success;
|
|
81
|
-
return
|
|
168
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
82
169
|
while (1) switch (_context2.prev = _context2.next) {
|
|
83
170
|
case 0:
|
|
84
171
|
// Put the text to copy into a <span>
|
|
@@ -126,8 +213,8 @@ function copyToClipboard(_x3) {
|
|
|
126
213
|
return _copyToClipboard.apply(this, arguments);
|
|
127
214
|
}
|
|
128
215
|
function _copyToClipboard() {
|
|
129
|
-
_copyToClipboard =
|
|
130
|
-
return
|
|
216
|
+
_copyToClipboard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(text) {
|
|
217
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
131
218
|
while (1) switch (_context3.prev = _context3.next) {
|
|
132
219
|
case 0:
|
|
133
220
|
_context3.prev = 0;
|
|
@@ -162,7 +249,7 @@ var createNullableOnChange = function createNullableOnChange() {
|
|
|
162
249
|
var onChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
163
250
|
return function (newValue) {
|
|
164
251
|
var nullableValue = newValue;
|
|
165
|
-
if (
|
|
252
|
+
if (isObject(newValue)) {
|
|
166
253
|
var allNull = Object.keys(newValue).reduce(function (acc, key) {
|
|
167
254
|
return acc && newValue[key] === null;
|
|
168
255
|
}, true);
|
|
@@ -286,14 +373,14 @@ var getColorAsString = function getColorAsString() {
|
|
|
286
373
|
if (value === null) {
|
|
287
374
|
return null;
|
|
288
375
|
}
|
|
289
|
-
var _ref =
|
|
376
|
+
var _ref = isString(value) ? {
|
|
290
377
|
color: value
|
|
291
378
|
} : value,
|
|
292
379
|
_ref$color = _ref.color,
|
|
293
380
|
color = _ref$color === void 0 ? null : _ref$color,
|
|
294
381
|
_ref$alpha = _ref.alpha,
|
|
295
382
|
alpha = _ref$alpha === void 0 ? null : _ref$alpha;
|
|
296
|
-
return alpha !== null || overideAlpha !== null ?
|
|
383
|
+
return alpha !== null || overideAlpha !== null ? tinycolor(color).setAlpha(overideAlpha !== null ? overideAlpha : alpha).toRgbString() : color;
|
|
297
384
|
};
|
|
298
385
|
|
|
299
386
|
var getComponentFromName = function getComponentFromName() {
|
|
@@ -303,7 +390,7 @@ var getComponentFromName = function getComponentFromName() {
|
|
|
303
390
|
if (components === null || name === null) {
|
|
304
391
|
return defaultComponent;
|
|
305
392
|
}
|
|
306
|
-
var pascalName =
|
|
393
|
+
var pascalName = pascalCase(name);
|
|
307
394
|
return components[pascalName] || components[name] || defaultComponent;
|
|
308
395
|
};
|
|
309
396
|
|
|
@@ -353,7 +440,7 @@ var getFieldByName = function getFieldByName(fields, name) {
|
|
|
353
440
|
};
|
|
354
441
|
|
|
355
442
|
var getFieldFromPath = function getFieldFromPath(path, fields, fieldManager) {
|
|
356
|
-
return (
|
|
443
|
+
return (isArray(path) ? path : [path]).reduce(function (foundField, key) {
|
|
357
444
|
if (foundField === null) {
|
|
358
445
|
return null;
|
|
359
446
|
}
|
|
@@ -376,12 +463,12 @@ var getFieldFromPath = function getFieldFromPath(path, fields, fieldManager) {
|
|
|
376
463
|
defItemsField = _ref$itemsField === void 0 ? null : _ref$itemsField;
|
|
377
464
|
var finalItemsField = itemsField || defItemsField;
|
|
378
465
|
if (finalItemsField !== null && key.match(/^[0-9]+$/)) {
|
|
379
|
-
return
|
|
466
|
+
return _objectSpread(_objectSpread({}, finalItemsField), {}, {
|
|
380
467
|
name: path.join('/'),
|
|
381
468
|
listItems: true
|
|
382
469
|
});
|
|
383
470
|
}
|
|
384
|
-
return getFieldByName([].concat(
|
|
471
|
+
return getFieldByName([].concat(_toConsumableArray(fieldFields || []), _toConsumableArray(subFields || []), _toConsumableArray(settings || [])), key);
|
|
385
472
|
}, {
|
|
386
473
|
fields: fields
|
|
387
474
|
});
|
|
@@ -399,7 +486,7 @@ var getFontFamily = function getFontFamily(value) {
|
|
|
399
486
|
if (value == null) {
|
|
400
487
|
return null;
|
|
401
488
|
}
|
|
402
|
-
var _ref =
|
|
489
|
+
var _ref = isObject(value) ? value : {
|
|
403
490
|
name: value
|
|
404
491
|
},
|
|
405
492
|
name = _ref.name,
|
|
@@ -428,13 +515,13 @@ var getFooterProps = function getFooterProps() {
|
|
|
428
515
|
enableInteraction = _ref$enableInteractio === void 0 ? true : _ref$enableInteractio,
|
|
429
516
|
_ref$disableInteracti = _ref.disableInteraction,
|
|
430
517
|
disableInteraction = _ref$disableInteracti === void 0 ? false : _ref$disableInteracti,
|
|
431
|
-
otherProps =
|
|
518
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
432
519
|
var _ref2 = footer || {},
|
|
433
520
|
_ref2$callToAction = _ref2.callToAction,
|
|
434
521
|
callToAction = _ref2$callToAction === void 0 ? null : _ref2$callToAction;
|
|
435
522
|
var footerProps = react.useMemo(function () {
|
|
436
523
|
return {
|
|
437
|
-
callToAction:
|
|
524
|
+
callToAction: _objectSpread(_objectSpread({}, callToAction), {}, {
|
|
438
525
|
animationDisabled: isPreview,
|
|
439
526
|
focusable: current && isView,
|
|
440
527
|
openWebView: openWebView,
|
|
@@ -457,7 +544,7 @@ var getRemainder = function getRemainder(number) {
|
|
|
457
544
|
return remainder.toFixed(4);
|
|
458
545
|
};
|
|
459
546
|
var largestRemainderRound = function largestRemainderRound(numbers, desiredTotal) {
|
|
460
|
-
if (!
|
|
547
|
+
if (!isArray(numbers) || numbers.length < 1) return numbers;
|
|
461
548
|
var result = numbers.map(function (number, index) {
|
|
462
549
|
return {
|
|
463
550
|
floor: Math.floor(number) || 0,
|
|
@@ -489,30 +576,30 @@ var getLayersFromBackground = function getLayersFromBackground() {
|
|
|
489
576
|
if (background === null) {
|
|
490
577
|
return [];
|
|
491
578
|
}
|
|
492
|
-
return (
|
|
579
|
+
return (isArray(background) ? background : [background]).reduce(function (layers, _ref) {
|
|
493
580
|
var _ref$image = _ref.image,
|
|
494
581
|
image = _ref$image === void 0 ? null : _ref$image,
|
|
495
582
|
_ref$video = _ref.video,
|
|
496
583
|
video = _ref$video === void 0 ? null : _ref$video,
|
|
497
584
|
_ref$media = _ref.media,
|
|
498
585
|
media = _ref$media === void 0 ? null : _ref$media,
|
|
499
|
-
data =
|
|
586
|
+
data = _objectWithoutProperties(_ref, _excluded);
|
|
500
587
|
if (image !== null && video !== null) {
|
|
501
|
-
return [].concat(
|
|
588
|
+
return [].concat(_toConsumableArray(layers), [_objectSpread({
|
|
502
589
|
media: image
|
|
503
|
-
}, data),
|
|
590
|
+
}, data), _objectSpread({
|
|
504
591
|
media: video
|
|
505
592
|
}, data)]);
|
|
506
593
|
}
|
|
507
|
-
return [].concat(
|
|
594
|
+
return [].concat(_toConsumableArray(layers), [_objectSpread({
|
|
508
595
|
media: media || image || video
|
|
509
596
|
}, data)]);
|
|
510
597
|
}, []);
|
|
511
598
|
};
|
|
512
599
|
|
|
513
600
|
var getMediaFilesAsArray = function getMediaFilesAsArray(files) {
|
|
514
|
-
return files !== null &&
|
|
515
|
-
return [].concat(
|
|
601
|
+
return files !== null && isArray(files) ? files : Object.keys(files || {}).reduce(function (newFiles, key) {
|
|
602
|
+
return [].concat(_toConsumableArray(newFiles), [_objectSpread({
|
|
516
603
|
handle: key
|
|
517
604
|
}, files[key])]);
|
|
518
605
|
}, []);
|
|
@@ -540,7 +627,7 @@ var getOptimalImageUrl = function getOptimalImageUrl() {
|
|
|
540
627
|
if (sizes === null || containerWidth === null && containerHeight === null) {
|
|
541
628
|
return defaultUrl;
|
|
542
629
|
}
|
|
543
|
-
var finalSizes =
|
|
630
|
+
var finalSizes = _objectSpread({
|
|
544
631
|
original: {
|
|
545
632
|
url: defaultUrl,
|
|
546
633
|
width: imgWidth,
|
|
@@ -667,7 +754,7 @@ var getStyleFromColor = function getStyleFromColor() {
|
|
|
667
754
|
var property = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'backgroundColor';
|
|
668
755
|
var overideAlpha = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
669
756
|
var color = getColorAsString(value, overideAlpha);
|
|
670
|
-
return color !== null ?
|
|
757
|
+
return color !== null ? _defineProperty({}, property, color) : null;
|
|
671
758
|
};
|
|
672
759
|
|
|
673
760
|
var getStyleFromBorder = function getStyleFromBorder(value) {
|
|
@@ -680,7 +767,7 @@ var getStyleFromBorder = function getStyleFromBorder(value) {
|
|
|
680
767
|
borderStyle = _value$style === void 0 ? null : _value$style,
|
|
681
768
|
_value$color = value.color,
|
|
682
769
|
color = _value$color === void 0 ? null : _value$color;
|
|
683
|
-
return
|
|
770
|
+
return _objectSpread(_objectSpread(_objectSpread({}, width !== null ? {
|
|
684
771
|
borderWidth: width
|
|
685
772
|
} : null), borderStyle !== null ? {
|
|
686
773
|
borderStyle: borderStyle
|
|
@@ -756,7 +843,7 @@ var getStyleFromBox = function getStyleFromBox(value) {
|
|
|
756
843
|
shadowBlur: shadowBlur,
|
|
757
844
|
shadowColor: shadowColor
|
|
758
845
|
};
|
|
759
|
-
var _ref =
|
|
846
|
+
var _ref = isObject(padding) ? padding : {
|
|
760
847
|
padding: padding
|
|
761
848
|
},
|
|
762
849
|
_ref$top = _ref.top,
|
|
@@ -769,7 +856,7 @@ var getStyleFromBox = function getStyleFromBox(value) {
|
|
|
769
856
|
paddingValueLeft = _ref$left === void 0 ? null : _ref$left,
|
|
770
857
|
_ref$padding = _ref.padding,
|
|
771
858
|
paddingValue = _ref$padding === void 0 ? null : _ref$padding;
|
|
772
|
-
return
|
|
859
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getStyleFromColor(backgroundColor, 'backgroundColor')), borderRadius !== null ? {
|
|
773
860
|
borderRadius: borderRadius
|
|
774
861
|
} : null), getStyleFromBorder(border)), getStyleFromShadow(shadow)), padding !== null || paddingValue !== null ? {
|
|
775
862
|
padding: padding || paddingValue
|
|
@@ -796,7 +883,7 @@ var getStyleFromContainer = function getStyleFromContainer(value) {
|
|
|
796
883
|
width = _size$width === void 0 ? null : _size$width,
|
|
797
884
|
_size$height = size.height,
|
|
798
885
|
height = _size$height === void 0 ? null : _size$height;
|
|
799
|
-
return
|
|
886
|
+
return _objectSpread(_objectSpread(_objectSpread({}, width ? {
|
|
800
887
|
width: "".concat(width, "%")
|
|
801
888
|
} : null), height ? {
|
|
802
889
|
height: "".concat(height, "%")
|
|
@@ -813,7 +900,7 @@ var getStyleFromHighlight = function getStyleFromHighlight(value) {
|
|
|
813
900
|
color = _value$color === void 0 ? null : _value$color;
|
|
814
901
|
var colorString = color !== null ? getColorAsString(color) : null;
|
|
815
902
|
var boxShadow = colorString !== null ? "0.05em 0px 0px ".concat(colorString, ", -0.05em 0px 0px ").concat(colorString) : null;
|
|
816
|
-
return color !== null || textColor !== null ?
|
|
903
|
+
return color !== null || textColor !== null ? _objectSpread(_objectSpread(_objectSpread({}, color !== null ? getStyleFromColor(color, 'backgroundColor') : null), textColor !== null ? getStyleFromColor(textColor, 'color') : null), color !== null ? {
|
|
817
904
|
boxShadow: boxShadow,
|
|
818
905
|
mozBoxShadow: boxShadow,
|
|
819
906
|
msBoxShadow: boxShadow,
|
|
@@ -837,7 +924,7 @@ var getStyleFromImage = function getStyleFromImage(value) {
|
|
|
837
924
|
axisAlign = _position$axisAlign === void 0 ? null : _position$axisAlign,
|
|
838
925
|
_position$crossAlign = position.crossAlign,
|
|
839
926
|
crossAlign = _position$crossAlign === void 0 ? null : _position$crossAlign;
|
|
840
|
-
return
|
|
927
|
+
return _objectSpread(_objectSpread(_objectSpread({}, size !== null ? {
|
|
841
928
|
objectFit: size
|
|
842
929
|
} : null), axisAlign !== null && crossAlign !== null ? {
|
|
843
930
|
objectPosition: "".concat(axisAlign, " ").concat(crossAlign)
|
|
@@ -858,7 +945,7 @@ var getStyleFromLink = function getStyleFromLink(value) {
|
|
|
858
945
|
bold = _ref$bold === void 0 ? false : _ref$bold,
|
|
859
946
|
_ref$underline = _ref.underline,
|
|
860
947
|
underline = _ref$underline === void 0 ? false : _ref$underline;
|
|
861
|
-
return
|
|
948
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, color !== null ? getStyleFromColor(color, 'color') : null), italic ? {
|
|
862
949
|
fontStyle: 'italic'
|
|
863
950
|
} : null), bold ? {
|
|
864
951
|
fontWeight: 'bold'
|
|
@@ -897,7 +984,7 @@ var getStyleFromText = function getStyleFromText(value) {
|
|
|
897
984
|
textTransform = _ref.transform,
|
|
898
985
|
_ref$outline = _ref.outline,
|
|
899
986
|
outline = _ref$outline === void 0 ? false : _ref$outline;
|
|
900
|
-
return
|
|
987
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
901
988
|
fontFamily: getFontFamily(fontFamily)
|
|
902
989
|
}, fontSize !== null ? {
|
|
903
990
|
fontSize: fontSize
|
|
@@ -931,7 +1018,7 @@ var getStyleFromMargin = function getStyleFromMargin(value) {
|
|
|
931
1018
|
marginTop = _value$top === void 0 ? null : _value$top,
|
|
932
1019
|
_value$bottom = value.bottom,
|
|
933
1020
|
marginBottom = _value$bottom === void 0 ? null : _value$bottom;
|
|
934
|
-
return
|
|
1021
|
+
return _objectSpread(_objectSpread({}, marginTop !== null ? {
|
|
935
1022
|
marginTop: marginTop
|
|
936
1023
|
} : null), marginBottom !== null ? {
|
|
937
1024
|
marginBottom: marginBottom
|
|
@@ -954,7 +1041,7 @@ function getVideoSupportedMimes() {
|
|
|
954
1041
|
var getLayoutParts = function getLayoutParts() {
|
|
955
1042
|
var layout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
956
1043
|
var _ref = layout !== null && layout.indexOf('-') !== false ? layout.split('-') : [layout, null, null],
|
|
957
|
-
_ref2 =
|
|
1044
|
+
_ref2 = _slicedToArray(_ref, 3),
|
|
958
1045
|
horizontal = _ref2[0],
|
|
959
1046
|
vertical = _ref2[1],
|
|
960
1047
|
suffix = _ref2[2];
|
|
@@ -998,7 +1085,7 @@ var isFooterFilled = function isFooterFilled() {
|
|
|
998
1085
|
};
|
|
999
1086
|
|
|
1000
1087
|
var isMessage = function isMessage(message) {
|
|
1001
|
-
return
|
|
1088
|
+
return isObject(message) && typeof message.defaultMessage !== 'undefined';
|
|
1002
1089
|
};
|
|
1003
1090
|
|
|
1004
1091
|
var isIos = function isIos() {
|
|
@@ -1077,10 +1164,10 @@ var setValue = function setValue(value, keyParts, fieldValue) {
|
|
|
1077
1164
|
// ]
|
|
1078
1165
|
// : [...value.slice(0, index), ...value.slice(index + 1)];
|
|
1079
1166
|
|
|
1080
|
-
var newArrayValue = [].concat(
|
|
1167
|
+
var newArrayValue = [].concat(_toConsumableArray(value.slice(0, index)), [keyParts.length > 0 ? setValue(value !== null ? value[index] || null : null, keyParts, fieldValue) : fieldValue], _toConsumableArray(value.slice(index + 1)));
|
|
1081
1168
|
return newArrayValue.length > 0 ? newArrayValue : null;
|
|
1082
1169
|
}
|
|
1083
|
-
return
|
|
1170
|
+
return _objectSpread(_objectSpread({}, value), {}, _defineProperty({}, key, keyParts.length > 0 ? setValue(value !== null ? value[key] || null : null, keyParts, fieldValue) : fieldValue));
|
|
1084
1171
|
}
|
|
1085
1172
|
return null;
|
|
1086
1173
|
};
|
|
@@ -1089,11 +1176,11 @@ var slug = function slug(str) {
|
|
|
1089
1176
|
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1090
1177
|
var toSlug;
|
|
1091
1178
|
if (separator === '-') {
|
|
1092
|
-
toSlug =
|
|
1179
|
+
toSlug = paramCase(str);
|
|
1093
1180
|
} else {
|
|
1094
|
-
toSlug =
|
|
1181
|
+
toSlug = snakeCase(str);
|
|
1095
1182
|
}
|
|
1096
|
-
return
|
|
1183
|
+
return slugify(toSlug, {
|
|
1097
1184
|
lower: true
|
|
1098
1185
|
});
|
|
1099
1186
|
};
|
|
@@ -1121,23 +1208,16 @@ var getContrastingColor = function getContrastingColor(backgroundColor) {
|
|
|
1121
1208
|
var _ref = backgroundColor || {},
|
|
1122
1209
|
_ref$color = _ref.color,
|
|
1123
1210
|
color = _ref$color === void 0 ? 'white' : _ref$color;
|
|
1124
|
-
if (
|
|
1211
|
+
if (tinycolor.equals(color, tinycolor('white'))) {
|
|
1125
1212
|
return '#A13DFF';
|
|
1126
1213
|
}
|
|
1127
|
-
if (
|
|
1214
|
+
if (tinycolor.equals(color, tinycolor('black'))) {
|
|
1128
1215
|
return 'white';
|
|
1129
1216
|
}
|
|
1130
|
-
return
|
|
1217
|
+
return tinycolor(color).spin(30).toString();
|
|
1131
1218
|
};
|
|
1132
1219
|
|
|
1133
|
-
|
|
1134
|
-
enumerable: true,
|
|
1135
|
-
get: function () { return changeCase.pascalCase; }
|
|
1136
|
-
});
|
|
1137
|
-
Object.defineProperty(exports, 'snakeCase', {
|
|
1138
|
-
enumerable: true,
|
|
1139
|
-
get: function () { return changeCase.snakeCase; }
|
|
1140
|
-
});
|
|
1220
|
+
exports.camelCase = camelCase;
|
|
1141
1221
|
exports.convertStyleToString = convertStyleToString;
|
|
1142
1222
|
exports.copyToClipboard = copyToClipboard;
|
|
1143
1223
|
exports.createNullableOnChange = createNullableOnChange;
|
|
@@ -1181,8 +1261,10 @@ exports.isLabelFilled = isTextFilled$1;
|
|
|
1181
1261
|
exports.isMessage = isMessage;
|
|
1182
1262
|
exports.isTextFilled = isTextFilled;
|
|
1183
1263
|
exports.isValidUrl = isValidUrl;
|
|
1264
|
+
exports.pascalCase = pascalCase;
|
|
1184
1265
|
exports.schemaId = schemaId;
|
|
1185
1266
|
exports.setFieldValue = setValue;
|
|
1186
1267
|
exports.slug = slug;
|
|
1268
|
+
exports.snakeCase = snakeCase;
|
|
1187
1269
|
exports.unique = unique;
|
|
1188
1270
|
exports.validateFields = validateFields;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.430",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -34,11 +34,26 @@
|
|
|
34
34
|
"module": "es/index.js",
|
|
35
35
|
"style": "assets/css/styles.css",
|
|
36
36
|
"exports": {
|
|
37
|
-
".":
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"./
|
|
37
|
+
".": {
|
|
38
|
+
"require": "./lib/index.js",
|
|
39
|
+
"import": "./es/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./components": {
|
|
42
|
+
"require": "./lib/components.js",
|
|
43
|
+
"import": "./es/components.js"
|
|
44
|
+
},
|
|
45
|
+
"./contexts": {
|
|
46
|
+
"require": "./lib/contexts.js",
|
|
47
|
+
"import": "./es/contexts.js"
|
|
48
|
+
},
|
|
49
|
+
"./hooks": {
|
|
50
|
+
"require": "./lib/hooks.js",
|
|
51
|
+
"import": "./es/hooks.js"
|
|
52
|
+
},
|
|
53
|
+
"./utils": {
|
|
54
|
+
"require": "./lib/utils.js",
|
|
55
|
+
"import": "./es/utils.js"
|
|
56
|
+
},
|
|
42
57
|
"./scss/mixins": "./scss/_mixins.scss",
|
|
43
58
|
"./scss/mixins.scss": "./scss/_mixins.scss",
|
|
44
59
|
"./scss/placeholders": "./scss/_placeholders.scss",
|
|
@@ -137,5 +152,5 @@
|
|
|
137
152
|
"access": "public",
|
|
138
153
|
"registry": "https://registry.npmjs.org/"
|
|
139
154
|
},
|
|
140
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "da790d76dba9d8e308d9f9c4e51d93a4a0e012a9"
|
|
141
156
|
}
|
package/scss/styles.scss
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import '~@micromag/core/assets/css/styles
|
|
1
|
+
@import '~@micromag/core/assets/css/styles';
|
package/scss/upload.scss
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
@import '~@uppy/dashboard/dist/style.css';
|
|
1
|
+
|