@micromag/core 0.3.651 → 0.3.659
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/es/components.js +81 -81
- package/es/contexts.js +29 -29
- package/es/hooks.js +138 -138
- package/es/index.js +179 -118
- package/es/utils.js +121 -113
- package/package.json +2 -2
package/es/utils.js
CHANGED
|
@@ -270,9 +270,9 @@ var getColorAsString = function getColorAsString() {
|
|
|
270
270
|
color: value
|
|
271
271
|
} : value,
|
|
272
272
|
_ref$color = _ref.color,
|
|
273
|
-
color = _ref$color ===
|
|
273
|
+
color = _ref$color === void 0 ? null : _ref$color,
|
|
274
274
|
_ref$alpha = _ref.alpha,
|
|
275
|
-
alpha = _ref$alpha ===
|
|
275
|
+
alpha = _ref$alpha === void 0 ? null : _ref$alpha;
|
|
276
276
|
return alpha !== null || overideAlpha !== null ? tinycolor(color).setAlpha(overideAlpha !== null ? overideAlpha : alpha).toRgbString() : color;
|
|
277
277
|
};
|
|
278
278
|
|
|
@@ -310,9 +310,9 @@ var getDeviceScreens = function getDeviceScreens() {
|
|
|
310
310
|
|
|
311
311
|
var getDisplayName = function getDisplayName(_ref) {
|
|
312
312
|
var _ref$displayName = _ref.displayName,
|
|
313
|
-
displayName = _ref$displayName ===
|
|
313
|
+
displayName = _ref$displayName === void 0 ? null : _ref$displayName,
|
|
314
314
|
_ref$name = _ref.name,
|
|
315
|
-
name = _ref$name ===
|
|
315
|
+
name = _ref$name === void 0 ? null : _ref$name;
|
|
316
316
|
return displayName || name || 'Component';
|
|
317
317
|
};
|
|
318
318
|
|
|
@@ -322,9 +322,9 @@ var _getFieldByName = function getFieldByName(fields, name) {
|
|
|
322
322
|
return foundField;
|
|
323
323
|
}
|
|
324
324
|
var _it$name = it.name,
|
|
325
|
-
fieldName = _it$name ===
|
|
325
|
+
fieldName = _it$name === void 0 ? null : _it$name,
|
|
326
326
|
_it$fields = it.fields,
|
|
327
|
-
subFields = _it$fields ===
|
|
327
|
+
subFields = _it$fields === void 0 ? [] : _it$fields;
|
|
328
328
|
if (name !== null && fieldName === name) {
|
|
329
329
|
return it;
|
|
330
330
|
}
|
|
@@ -338,22 +338,22 @@ var getFieldFromPath = function getFieldFromPath(path, fields, fieldManager) {
|
|
|
338
338
|
return null;
|
|
339
339
|
}
|
|
340
340
|
var _foundField$type = foundField.type,
|
|
341
|
-
type = _foundField$type ===
|
|
341
|
+
type = _foundField$type === void 0 ? null : _foundField$type,
|
|
342
342
|
_foundField$fields = foundField.fields,
|
|
343
|
-
fieldFields = _foundField$fields ===
|
|
343
|
+
fieldFields = _foundField$fields === void 0 ? null : _foundField$fields,
|
|
344
344
|
_foundField$field = foundField.field,
|
|
345
|
-
field = _foundField$field ===
|
|
345
|
+
field = _foundField$field === void 0 ? null : _foundField$field,
|
|
346
346
|
_foundField$itemsFiel = foundField.itemsField,
|
|
347
|
-
itemsField = _foundField$itemsFiel ===
|
|
347
|
+
itemsField = _foundField$itemsFiel === void 0 ? null : _foundField$itemsFiel;
|
|
348
348
|
var finalType = field !== null ? field.type || type : type;
|
|
349
349
|
var definition = fieldManager.getDefinition(finalType);
|
|
350
350
|
var _ref = finalType !== null ? definition : foundField,
|
|
351
351
|
_ref$fields = _ref.fields,
|
|
352
|
-
subFields = _ref$fields ===
|
|
352
|
+
subFields = _ref$fields === void 0 ? null : _ref$fields,
|
|
353
353
|
_ref$settings = _ref.settings,
|
|
354
|
-
settings = _ref$settings ===
|
|
354
|
+
settings = _ref$settings === void 0 ? null : _ref$settings,
|
|
355
355
|
_ref$itemsField = _ref.itemsField,
|
|
356
|
-
defItemsField = _ref$itemsField ===
|
|
356
|
+
defItemsField = _ref$itemsField === void 0 ? null : _ref$itemsField;
|
|
357
357
|
var finalItemsField = itemsField || defItemsField;
|
|
358
358
|
if (finalItemsField !== null && key.match(/^[0-9]+$/)) {
|
|
359
359
|
return _objectSpread(_objectSpread({}, finalItemsField), {}, {
|
|
@@ -384,7 +384,7 @@ var getFontFamily = function getFontFamily(value) {
|
|
|
384
384
|
},
|
|
385
385
|
name = _ref.name,
|
|
386
386
|
_ref$fallback = _ref.fallback,
|
|
387
|
-
fallback = _ref$fallback ===
|
|
387
|
+
fallback = _ref$fallback === void 0 ? null : _ref$fallback;
|
|
388
388
|
return [name, fallback].filter(function (it) {
|
|
389
389
|
return it !== null;
|
|
390
390
|
}).map(function (it) {
|
|
@@ -397,21 +397,21 @@ var getFooterProps = function getFooterProps() {
|
|
|
397
397
|
var footer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
398
398
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
399
399
|
_ref$isPreview = _ref.isPreview,
|
|
400
|
-
isPreview = _ref$isPreview ===
|
|
400
|
+
isPreview = _ref$isPreview === void 0 ? false : _ref$isPreview,
|
|
401
401
|
_ref$isView = _ref.isView,
|
|
402
|
-
isView = _ref$isView ===
|
|
402
|
+
isView = _ref$isView === void 0 ? false : _ref$isView,
|
|
403
403
|
_ref$current = _ref.current,
|
|
404
|
-
current = _ref$current ===
|
|
404
|
+
current = _ref$current === void 0 ? false : _ref$current,
|
|
405
405
|
_ref$openWebView = _ref.openWebView,
|
|
406
|
-
openWebView = _ref$openWebView ===
|
|
406
|
+
openWebView = _ref$openWebView === void 0 ? false : _ref$openWebView,
|
|
407
407
|
_ref$enableInteractio = _ref.enableInteraction,
|
|
408
|
-
enableInteraction = _ref$enableInteractio ===
|
|
408
|
+
enableInteraction = _ref$enableInteractio === void 0 ? true : _ref$enableInteractio,
|
|
409
409
|
_ref$disableInteracti = _ref.disableInteraction,
|
|
410
|
-
disableInteraction = _ref$disableInteracti ===
|
|
410
|
+
disableInteraction = _ref$disableInteracti === void 0 ? false : _ref$disableInteracti,
|
|
411
411
|
otherProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
412
412
|
var _ref2 = footer || {},
|
|
413
413
|
_ref2$callToAction = _ref2.callToAction,
|
|
414
|
-
callToAction = _ref2$callToAction ===
|
|
414
|
+
callToAction = _ref2$callToAction === void 0 ? null : _ref2$callToAction;
|
|
415
415
|
var footerProps = useMemo(function () {
|
|
416
416
|
return {
|
|
417
417
|
callToAction: _objectSpread(_objectSpread({}, callToAction), {}, {
|
|
@@ -471,13 +471,13 @@ var getLayersFromBackground = function getLayersFromBackground() {
|
|
|
471
471
|
}
|
|
472
472
|
return (isArray(background) ? background : [background]).reduce(function (layers, _ref) {
|
|
473
473
|
var _ref$image = _ref.image,
|
|
474
|
-
image = _ref$image ===
|
|
474
|
+
image = _ref$image === void 0 ? null : _ref$image,
|
|
475
475
|
_ref$video = _ref.video,
|
|
476
|
-
video = _ref$video ===
|
|
476
|
+
video = _ref$video === void 0 ? null : _ref$video,
|
|
477
477
|
_ref$media = _ref.media,
|
|
478
|
-
media = _ref$media ===
|
|
478
|
+
media = _ref$media === void 0 ? null : _ref$media,
|
|
479
479
|
_ref$color = _ref.color,
|
|
480
|
-
color = _ref$color ===
|
|
480
|
+
color = _ref$color === void 0 ? null : _ref$color,
|
|
481
481
|
data = _objectWithoutProperties(_ref, _excluded);
|
|
482
482
|
if (image === null && video === null && color === null) {
|
|
483
483
|
return layers;
|
|
@@ -512,16 +512,16 @@ var getOptimalImageUrl = function getOptimalImageUrl() {
|
|
|
512
512
|
var containerHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
513
513
|
var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
|
514
514
|
_ref$resolution = _ref.resolution,
|
|
515
|
-
resolution = _ref$resolution ===
|
|
515
|
+
resolution = _ref$resolution === void 0 ? 1 : _ref$resolution,
|
|
516
516
|
_ref$maxDiff = _ref.maxDiff,
|
|
517
|
-
maxDiff = _ref$maxDiff ===
|
|
517
|
+
maxDiff = _ref$maxDiff === void 0 ? 800 : _ref$maxDiff;
|
|
518
518
|
var _ref2 = media || {},
|
|
519
519
|
_ref2$sizes = _ref2.sizes,
|
|
520
|
-
sizes = _ref2$sizes ===
|
|
520
|
+
sizes = _ref2$sizes === void 0 ? null : _ref2$sizes,
|
|
521
521
|
_ref2$url = _ref2.url,
|
|
522
|
-
defaultUrl = _ref2$url ===
|
|
522
|
+
defaultUrl = _ref2$url === void 0 ? null : _ref2$url,
|
|
523
523
|
_ref2$metadata = _ref2.metadata,
|
|
524
|
-
_ref2$metadata2 = _ref2$metadata ===
|
|
524
|
+
_ref2$metadata2 = _ref2$metadata === void 0 ? {} : _ref2$metadata,
|
|
525
525
|
imgWidth = _ref2$metadata2.width,
|
|
526
526
|
imgHeight = _ref2$metadata2.height;
|
|
527
527
|
if (sizes === null || containerWidth === null && containerHeight === null) {
|
|
@@ -543,9 +543,9 @@ var getOptimalImageUrl = function getOptimalImageUrl() {
|
|
|
543
543
|
var _finalSizes$key = finalSizes[key],
|
|
544
544
|
url = _finalSizes$key.url,
|
|
545
545
|
_finalSizes$key$width = _finalSizes$key.width,
|
|
546
|
-
width = _finalSizes$key$width ===
|
|
546
|
+
width = _finalSizes$key$width === void 0 ? null : _finalSizes$key$width,
|
|
547
547
|
_finalSizes$key$heigh = _finalSizes$key.height,
|
|
548
|
-
height = _finalSizes$key$heigh ===
|
|
548
|
+
height = _finalSizes$key$heigh === void 0 ? null : _finalSizes$key$heigh;
|
|
549
549
|
var diffWidth = width !== null && finalContainerWidth !== null ? width - finalContainerWidth : null;
|
|
550
550
|
var diffHeight = height !== null && finalContainerHeight !== null ? height - finalContainerHeight : null;
|
|
551
551
|
var isLarger = (diffWidth === null || diffWidth >= 0) && (diffHeight === null || diffHeight >= 0);
|
|
@@ -615,9 +615,9 @@ var getScreenExtraField = function getScreenExtraField(intl) {
|
|
|
615
615
|
function getScreenFieldsWithStates(definition) {
|
|
616
616
|
var _ref = definition || {},
|
|
617
617
|
_ref$fields = _ref.fields,
|
|
618
|
-
screenFields = _ref$fields ===
|
|
618
|
+
screenFields = _ref$fields === void 0 ? null : _ref$fields,
|
|
619
619
|
_ref$states = _ref.states,
|
|
620
|
-
states = _ref$states ===
|
|
620
|
+
states = _ref$states === void 0 ? null : _ref$states;
|
|
621
621
|
if (states === null) {
|
|
622
622
|
return screenFields;
|
|
623
623
|
}
|
|
@@ -625,14 +625,14 @@ function getScreenFieldsWithStates(definition) {
|
|
|
625
625
|
var _ref2 = current || {},
|
|
626
626
|
id = _ref2.id,
|
|
627
627
|
_ref2$fields = _ref2.fields,
|
|
628
|
-
fields = _ref2$fields ===
|
|
628
|
+
fields = _ref2$fields === void 0 ? [] : _ref2$fields,
|
|
629
629
|
_ref2$repeatable = _ref2.repeatable,
|
|
630
|
-
repeatable = _ref2$repeatable ===
|
|
630
|
+
repeatable = _ref2$repeatable === void 0 ? false : _ref2$repeatable,
|
|
631
631
|
_ref2$fieldName = _ref2.fieldName,
|
|
632
|
-
fieldName = _ref2$fieldName ===
|
|
632
|
+
fieldName = _ref2$fieldName === void 0 ? null : _ref2$fieldName,
|
|
633
633
|
label = _ref2.label,
|
|
634
634
|
_ref2$defaultValue = _ref2.defaultValue,
|
|
635
|
-
defaultValue = _ref2$defaultValue ===
|
|
635
|
+
defaultValue = _ref2$defaultValue === void 0 ? null : _ref2$defaultValue;
|
|
636
636
|
return [].concat(_toConsumableArray(statesFields), _toConsumableArray(repeatable ? [{
|
|
637
637
|
type: 'items',
|
|
638
638
|
name: fieldName || id,
|
|
@@ -680,18 +680,26 @@ function getAlignItems(vertical) {
|
|
|
680
680
|
return null;
|
|
681
681
|
}
|
|
682
682
|
var getStyleFromAlignment = function getStyleFromAlignment(value) {
|
|
683
|
+
var invertAxis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
684
|
+
var defaultAlignment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
683
685
|
if (value === null) {
|
|
684
686
|
return null;
|
|
685
687
|
}
|
|
686
688
|
var _value$horizontal = value.horizontal,
|
|
687
|
-
horizontal = _value$horizontal ===
|
|
689
|
+
horizontal = _value$horizontal === void 0 ? null : _value$horizontal,
|
|
688
690
|
_value$vertical = value.vertical,
|
|
689
|
-
vertical = _value$vertical ===
|
|
691
|
+
vertical = _value$vertical === void 0 ? null : _value$vertical;
|
|
690
692
|
var justifyContent = getJustifyContent(horizontal);
|
|
691
693
|
var alignItems = getAlignItems(vertical);
|
|
694
|
+
if (invertAxis) {
|
|
695
|
+
return {
|
|
696
|
+
justifyContent: alignItems || defaultAlignment,
|
|
697
|
+
alignItems: justifyContent || defaultAlignment
|
|
698
|
+
};
|
|
699
|
+
}
|
|
692
700
|
return {
|
|
693
|
-
justifyContent: justifyContent,
|
|
694
|
-
alignItems: alignItems
|
|
701
|
+
justifyContent: justifyContent || defaultAlignment,
|
|
702
|
+
alignItems: alignItems || alignItems
|
|
695
703
|
};
|
|
696
704
|
};
|
|
697
705
|
|
|
@@ -708,11 +716,11 @@ var getStyleFromBorder = function getStyleFromBorder(value) {
|
|
|
708
716
|
return null;
|
|
709
717
|
}
|
|
710
718
|
var _value$width = value.width,
|
|
711
|
-
width = _value$width ===
|
|
719
|
+
width = _value$width === void 0 ? null : _value$width,
|
|
712
720
|
_value$style = value.style,
|
|
713
|
-
borderStyle = _value$style ===
|
|
721
|
+
borderStyle = _value$style === void 0 ? null : _value$style,
|
|
714
722
|
_value$color = value.color,
|
|
715
|
-
color = _value$color ===
|
|
723
|
+
color = _value$color === void 0 ? null : _value$color;
|
|
716
724
|
return _objectSpread(_objectSpread(_objectSpread({}, width !== null ? {
|
|
717
725
|
borderWidth: width
|
|
718
726
|
} : null), borderStyle !== null ? {
|
|
@@ -726,13 +734,13 @@ var getStyleFromShadow = function getStyleFromShadow(value) {
|
|
|
726
734
|
}
|
|
727
735
|
var _ref = value || {},
|
|
728
736
|
_ref$shadowAngle = _ref.shadowAngle,
|
|
729
|
-
shadowAngle = _ref$shadowAngle ===
|
|
737
|
+
shadowAngle = _ref$shadowAngle === void 0 ? null : _ref$shadowAngle,
|
|
730
738
|
_ref$shadowDistance = _ref.shadowDistance,
|
|
731
|
-
shadowDistance = _ref$shadowDistance ===
|
|
739
|
+
shadowDistance = _ref$shadowDistance === void 0 ? null : _ref$shadowDistance,
|
|
732
740
|
_ref$shadowBlur = _ref.shadowBlur,
|
|
733
|
-
shadowBlur = _ref$shadowBlur ===
|
|
741
|
+
shadowBlur = _ref$shadowBlur === void 0 ? null : _ref$shadowBlur,
|
|
734
742
|
_ref$shadowColor = _ref.shadowColor,
|
|
735
|
-
shadowColor = _ref$shadowColor ===
|
|
743
|
+
shadowColor = _ref$shadowColor === void 0 ? null : _ref$shadowColor;
|
|
736
744
|
if (!shadowAngle) return null;
|
|
737
745
|
var blur = shadowBlur || '0';
|
|
738
746
|
var color = getColorAsString(shadowColor) || '#000000';
|
|
@@ -751,33 +759,33 @@ var getStyleFromBox = function getStyleFromBox(value) {
|
|
|
751
759
|
return null;
|
|
752
760
|
}
|
|
753
761
|
var _value$backgroundColo = value.backgroundColor,
|
|
754
|
-
backgroundColor = _value$backgroundColo ===
|
|
762
|
+
backgroundColor = _value$backgroundColo === void 0 ? null : _value$backgroundColo,
|
|
755
763
|
_value$borderRadius = value.borderRadius,
|
|
756
|
-
borderRadius = _value$borderRadius ===
|
|
764
|
+
borderRadius = _value$borderRadius === void 0 ? null : _value$borderRadius,
|
|
757
765
|
_value$padding = value.padding,
|
|
758
|
-
padding = _value$padding ===
|
|
766
|
+
padding = _value$padding === void 0 ? null : _value$padding,
|
|
759
767
|
_value$paddingTop = value.paddingTop,
|
|
760
|
-
paddingTop = _value$paddingTop ===
|
|
768
|
+
paddingTop = _value$paddingTop === void 0 ? null : _value$paddingTop,
|
|
761
769
|
_value$paddingRight = value.paddingRight,
|
|
762
|
-
paddingRight = _value$paddingRight ===
|
|
770
|
+
paddingRight = _value$paddingRight === void 0 ? null : _value$paddingRight,
|
|
763
771
|
_value$paddingBottom = value.paddingBottom,
|
|
764
|
-
paddingBottom = _value$paddingBottom ===
|
|
772
|
+
paddingBottom = _value$paddingBottom === void 0 ? null : _value$paddingBottom,
|
|
765
773
|
_value$paddingLeft = value.paddingLeft,
|
|
766
|
-
paddingLeft = _value$paddingLeft ===
|
|
774
|
+
paddingLeft = _value$paddingLeft === void 0 ? null : _value$paddingLeft,
|
|
767
775
|
_value$borderWidth = value.borderWidth,
|
|
768
|
-
borderWidth = _value$borderWidth ===
|
|
776
|
+
borderWidth = _value$borderWidth === void 0 ? null : _value$borderWidth,
|
|
769
777
|
_value$borderStyle = value.borderStyle,
|
|
770
|
-
borderStyle = _value$borderStyle ===
|
|
778
|
+
borderStyle = _value$borderStyle === void 0 ? null : _value$borderStyle,
|
|
771
779
|
_value$borderColor = value.borderColor,
|
|
772
|
-
borderColor = _value$borderColor ===
|
|
780
|
+
borderColor = _value$borderColor === void 0 ? null : _value$borderColor,
|
|
773
781
|
_value$shadowAngle = value.shadowAngle,
|
|
774
|
-
shadowAngle = _value$shadowAngle ===
|
|
782
|
+
shadowAngle = _value$shadowAngle === void 0 ? null : _value$shadowAngle,
|
|
775
783
|
_value$shadowDistance = value.shadowDistance,
|
|
776
|
-
shadowDistance = _value$shadowDistance ===
|
|
784
|
+
shadowDistance = _value$shadowDistance === void 0 ? null : _value$shadowDistance,
|
|
777
785
|
_value$shadowBlur = value.shadowBlur,
|
|
778
|
-
shadowBlur = _value$shadowBlur ===
|
|
786
|
+
shadowBlur = _value$shadowBlur === void 0 ? null : _value$shadowBlur,
|
|
779
787
|
_value$shadowColor = value.shadowColor,
|
|
780
|
-
shadowColor = _value$shadowColor ===
|
|
788
|
+
shadowColor = _value$shadowColor === void 0 ? null : _value$shadowColor;
|
|
781
789
|
var border = {
|
|
782
790
|
width: borderWidth,
|
|
783
791
|
style: borderStyle,
|
|
@@ -793,15 +801,15 @@ var getStyleFromBox = function getStyleFromBox(value) {
|
|
|
793
801
|
padding: padding
|
|
794
802
|
},
|
|
795
803
|
_ref$top = _ref.top,
|
|
796
|
-
paddingValueTop = _ref$top ===
|
|
804
|
+
paddingValueTop = _ref$top === void 0 ? null : _ref$top,
|
|
797
805
|
_ref$right = _ref.right,
|
|
798
|
-
paddingValueRight = _ref$right ===
|
|
806
|
+
paddingValueRight = _ref$right === void 0 ? null : _ref$right,
|
|
799
807
|
_ref$bottom = _ref.bottom,
|
|
800
|
-
paddingValueBottom = _ref$bottom ===
|
|
808
|
+
paddingValueBottom = _ref$bottom === void 0 ? null : _ref$bottom,
|
|
801
809
|
_ref$left = _ref.left,
|
|
802
|
-
paddingValueLeft = _ref$left ===
|
|
810
|
+
paddingValueLeft = _ref$left === void 0 ? null : _ref$left,
|
|
803
811
|
_ref$padding = _ref.padding,
|
|
804
|
-
paddingValue = _ref$padding ===
|
|
812
|
+
paddingValue = _ref$padding === void 0 ? null : _ref$padding;
|
|
805
813
|
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getStyleFromColor(backgroundColor, 'backgroundColor')), borderRadius !== null ? {
|
|
806
814
|
borderRadius: borderRadius
|
|
807
815
|
} : null), getStyleFromBorder(border)), getStyleFromShadow(shadow)), padding !== null || paddingValue !== null ? {
|
|
@@ -822,13 +830,13 @@ var getStyleFromContainer = function getStyleFromContainer(value) {
|
|
|
822
830
|
return null;
|
|
823
831
|
}
|
|
824
832
|
var _value$size = value.size,
|
|
825
|
-
size = _value$size ===
|
|
833
|
+
size = _value$size === void 0 ? {} : _value$size,
|
|
826
834
|
_value$backgroundColo = value.backgroundColor,
|
|
827
|
-
backgroundColor = _value$backgroundColo ===
|
|
835
|
+
backgroundColor = _value$backgroundColo === void 0 ? null : _value$backgroundColo;
|
|
828
836
|
var _size$width = size.width,
|
|
829
|
-
width = _size$width ===
|
|
837
|
+
width = _size$width === void 0 ? null : _size$width,
|
|
830
838
|
_size$height = size.height,
|
|
831
|
-
height = _size$height ===
|
|
839
|
+
height = _size$height === void 0 ? null : _size$height;
|
|
832
840
|
return _objectSpread(_objectSpread(_objectSpread({}, width ? {
|
|
833
841
|
width: "".concat(width, "%")
|
|
834
842
|
} : null), height ? {
|
|
@@ -841,9 +849,9 @@ var getStyleFromHighlight = function getStyleFromHighlight(value) {
|
|
|
841
849
|
return null;
|
|
842
850
|
}
|
|
843
851
|
var _value$textColor = value.textColor,
|
|
844
|
-
textColor = _value$textColor ===
|
|
852
|
+
textColor = _value$textColor === void 0 ? null : _value$textColor,
|
|
845
853
|
_value$color = value.color,
|
|
846
|
-
color = _value$color ===
|
|
854
|
+
color = _value$color === void 0 ? null : _value$color;
|
|
847
855
|
var colorString = color !== null ? getColorAsString(color) : null;
|
|
848
856
|
var boxShadow = colorString !== null ? "0.05em 0px 0px ".concat(colorString, ", -0.05em 0px 0px ").concat(colorString) : null;
|
|
849
857
|
return color !== null || textColor !== null ? _objectSpread(_objectSpread(_objectSpread({}, color !== null ? getStyleFromColor(color, 'backgroundColor') : null), textColor !== null ? getStyleFromColor(textColor, 'color') : null), color !== null ? {
|
|
@@ -859,17 +867,17 @@ var getStyleFromImage = function getStyleFromImage(value) {
|
|
|
859
867
|
return null;
|
|
860
868
|
}
|
|
861
869
|
var _value$fit = value.fit,
|
|
862
|
-
fit = _value$fit ===
|
|
870
|
+
fit = _value$fit === void 0 ? {} : _value$fit,
|
|
863
871
|
_value$backgroundColo = value.backgroundColor,
|
|
864
|
-
backgroundColor = _value$backgroundColo ===
|
|
872
|
+
backgroundColor = _value$backgroundColo === void 0 ? null : _value$backgroundColo;
|
|
865
873
|
var _fit$size = fit.size,
|
|
866
|
-
size = _fit$size ===
|
|
874
|
+
size = _fit$size === void 0 ? null : _fit$size,
|
|
867
875
|
_fit$position = fit.position,
|
|
868
|
-
position = _fit$position ===
|
|
876
|
+
position = _fit$position === void 0 ? {} : _fit$position;
|
|
869
877
|
var _position$axisAlign = position.axisAlign,
|
|
870
|
-
axisAlign = _position$axisAlign ===
|
|
878
|
+
axisAlign = _position$axisAlign === void 0 ? null : _position$axisAlign,
|
|
871
879
|
_position$crossAlign = position.crossAlign,
|
|
872
|
-
crossAlign = _position$crossAlign ===
|
|
880
|
+
crossAlign = _position$crossAlign === void 0 ? null : _position$crossAlign;
|
|
873
881
|
return _objectSpread(_objectSpread(_objectSpread({}, size !== null ? {
|
|
874
882
|
objectFit: size
|
|
875
883
|
} : null), axisAlign !== null && crossAlign !== null ? {
|
|
@@ -882,15 +890,15 @@ var getStyleFromLink = function getStyleFromLink(value) {
|
|
|
882
890
|
return null;
|
|
883
891
|
}
|
|
884
892
|
var _value$color = value.color,
|
|
885
|
-
color = _value$color ===
|
|
893
|
+
color = _value$color === void 0 ? null : _value$color,
|
|
886
894
|
fontStyle = value.fontStyle;
|
|
887
895
|
var _ref = fontStyle || {},
|
|
888
896
|
_ref$italic = _ref.italic,
|
|
889
|
-
italic = _ref$italic ===
|
|
897
|
+
italic = _ref$italic === void 0 ? false : _ref$italic,
|
|
890
898
|
_ref$bold = _ref.bold,
|
|
891
|
-
bold = _ref$bold ===
|
|
899
|
+
bold = _ref$bold === void 0 ? false : _ref$bold,
|
|
892
900
|
_ref$underline = _ref.underline,
|
|
893
|
-
underline = _ref$underline ===
|
|
901
|
+
underline = _ref$underline === void 0 ? false : _ref$underline;
|
|
894
902
|
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, color !== null ? getStyleFromColor(color, 'color') : null), italic ? {
|
|
895
903
|
fontStyle: 'italic'
|
|
896
904
|
} : null), bold ? {
|
|
@@ -905,31 +913,31 @@ var getStyleFromText = function getStyleFromText(value) {
|
|
|
905
913
|
return null;
|
|
906
914
|
}
|
|
907
915
|
var _value$fontFamily = value.fontFamily,
|
|
908
|
-
fontFamily = _value$fontFamily ===
|
|
916
|
+
fontFamily = _value$fontFamily === void 0 ? null : _value$fontFamily,
|
|
909
917
|
_value$fontSize = value.fontSize,
|
|
910
|
-
fontSize = _value$fontSize ===
|
|
918
|
+
fontSize = _value$fontSize === void 0 ? null : _value$fontSize,
|
|
911
919
|
_value$fontStyle = value.fontStyle,
|
|
912
|
-
fontStyle = _value$fontStyle ===
|
|
920
|
+
fontStyle = _value$fontStyle === void 0 ? null : _value$fontStyle,
|
|
913
921
|
_value$fontWeight = value.fontWeight,
|
|
914
|
-
fontWeight = _value$fontWeight ===
|
|
922
|
+
fontWeight = _value$fontWeight === void 0 ? null : _value$fontWeight,
|
|
915
923
|
_value$lineHeight = value.lineHeight,
|
|
916
|
-
lineHeight = _value$lineHeight ===
|
|
924
|
+
lineHeight = _value$lineHeight === void 0 ? null : _value$lineHeight,
|
|
917
925
|
_value$letterSpacing = value.letterSpacing,
|
|
918
|
-
letterSpacing = _value$letterSpacing ===
|
|
926
|
+
letterSpacing = _value$letterSpacing === void 0 ? null : _value$letterSpacing,
|
|
919
927
|
_value$align = value.align,
|
|
920
|
-
textAlign = _value$align ===
|
|
928
|
+
textAlign = _value$align === void 0 ? null : _value$align,
|
|
921
929
|
_value$color = value.color,
|
|
922
|
-
color = _value$color ===
|
|
930
|
+
color = _value$color === void 0 ? null : _value$color;
|
|
923
931
|
var _ref = fontStyle || {},
|
|
924
932
|
_ref$italic = _ref.italic,
|
|
925
|
-
italic = _ref$italic ===
|
|
933
|
+
italic = _ref$italic === void 0 ? false : _ref$italic,
|
|
926
934
|
_ref$bold = _ref.bold,
|
|
927
|
-
bold = _ref$bold ===
|
|
935
|
+
bold = _ref$bold === void 0 ? false : _ref$bold,
|
|
928
936
|
_ref$underline = _ref.underline,
|
|
929
|
-
underline = _ref$underline ===
|
|
937
|
+
underline = _ref$underline === void 0 ? false : _ref$underline,
|
|
930
938
|
textTransform = _ref.transform,
|
|
931
939
|
_ref$outline = _ref.outline,
|
|
932
|
-
outline = _ref$outline ===
|
|
940
|
+
outline = _ref$outline === void 0 ? false : _ref$outline;
|
|
933
941
|
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
934
942
|
fontFamily: getFontFamily(fontFamily)
|
|
935
943
|
}, fontSize !== null ? {
|
|
@@ -961,9 +969,9 @@ var getStyleFromMargin = function getStyleFromMargin(value) {
|
|
|
961
969
|
return null;
|
|
962
970
|
}
|
|
963
971
|
var _value$top = value.top,
|
|
964
|
-
marginTop = _value$top ===
|
|
972
|
+
marginTop = _value$top === void 0 ? null : _value$top,
|
|
965
973
|
_value$bottom = value.bottom,
|
|
966
|
-
marginBottom = _value$bottom ===
|
|
974
|
+
marginBottom = _value$bottom === void 0 ? null : _value$bottom;
|
|
967
975
|
return _objectSpread(_objectSpread({}, marginTop !== null ? {
|
|
968
976
|
marginTop: marginTop
|
|
969
977
|
} : null), marginBottom !== null ? {
|
|
@@ -1002,15 +1010,15 @@ var isHeaderFilled = function isHeaderFilled() {
|
|
|
1002
1010
|
var header = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1003
1011
|
var _ref = header || {},
|
|
1004
1012
|
_ref$badge = _ref.badge,
|
|
1005
|
-
badge = _ref$badge ===
|
|
1013
|
+
badge = _ref$badge === void 0 ? null : _ref$badge;
|
|
1006
1014
|
var _ref2 = badge || {},
|
|
1007
1015
|
_ref2$active = _ref2.active,
|
|
1008
|
-
badgeActive = _ref2$active ===
|
|
1016
|
+
badgeActive = _ref2$active === void 0 ? false : _ref2$active,
|
|
1009
1017
|
_ref2$label = _ref2.label,
|
|
1010
|
-
label = _ref2$label ===
|
|
1018
|
+
label = _ref2$label === void 0 ? null : _ref2$label;
|
|
1011
1019
|
var _ref3 = label || {},
|
|
1012
1020
|
_ref3$body = _ref3.body,
|
|
1013
|
-
body = _ref3$body ===
|
|
1021
|
+
body = _ref3$body === void 0 ? null : _ref3$body;
|
|
1014
1022
|
return badgeActive && body !== null;
|
|
1015
1023
|
};
|
|
1016
1024
|
|
|
@@ -1018,15 +1026,15 @@ var isFooterFilled = function isFooterFilled() {
|
|
|
1018
1026
|
var footer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1019
1027
|
var _ref = footer || {},
|
|
1020
1028
|
_ref$callToAction = _ref.callToAction,
|
|
1021
|
-
callToAction = _ref$callToAction ===
|
|
1029
|
+
callToAction = _ref$callToAction === void 0 ? null : _ref$callToAction;
|
|
1022
1030
|
var _ref2 = callToAction || {},
|
|
1023
1031
|
_ref2$active = _ref2.active,
|
|
1024
|
-
callToActionActive = _ref2$active ===
|
|
1032
|
+
callToActionActive = _ref2$active === void 0 ? false : _ref2$active,
|
|
1025
1033
|
_ref2$label = _ref2.label,
|
|
1026
|
-
label = _ref2$label ===
|
|
1034
|
+
label = _ref2$label === void 0 ? null : _ref2$label;
|
|
1027
1035
|
var _ref3 = label || {},
|
|
1028
1036
|
_ref3$body = _ref3.body,
|
|
1029
|
-
body = _ref3$body ===
|
|
1037
|
+
body = _ref3$body === void 0 ? null : _ref3$body;
|
|
1030
1038
|
return callToActionActive && body !== null;
|
|
1031
1039
|
};
|
|
1032
1040
|
|
|
@@ -1043,29 +1051,29 @@ var isIos = function isIos() {
|
|
|
1043
1051
|
var isImageFilled = function isImageFilled(image) {
|
|
1044
1052
|
var _ref = image || {},
|
|
1045
1053
|
_ref$media = _ref.media,
|
|
1046
|
-
media = _ref$media ===
|
|
1054
|
+
media = _ref$media === void 0 ? null : _ref$media,
|
|
1047
1055
|
_ref$url = _ref.url,
|
|
1048
|
-
url = _ref$url ===
|
|
1056
|
+
url = _ref$url === void 0 ? null : _ref$url;
|
|
1049
1057
|
return media !== null || url !== null;
|
|
1050
1058
|
};
|
|
1051
1059
|
|
|
1052
1060
|
var isTextFilled$1 = function isTextFilled(text) {
|
|
1053
1061
|
var _ref = text || {},
|
|
1054
1062
|
_ref$label = _ref.label,
|
|
1055
|
-
label = _ref$label ===
|
|
1063
|
+
label = _ref$label === void 0 ? null : _ref$label;
|
|
1056
1064
|
var _ref2 = label || {},
|
|
1057
1065
|
_ref2$length = _ref2.length,
|
|
1058
|
-
length = _ref2$length ===
|
|
1066
|
+
length = _ref2$length === void 0 ? 0 : _ref2$length;
|
|
1059
1067
|
return typeof length === 'number' && length > 0;
|
|
1060
1068
|
};
|
|
1061
1069
|
|
|
1062
1070
|
var isTextFilled = function isTextFilled(text) {
|
|
1063
1071
|
var _ref = text || {},
|
|
1064
1072
|
_ref$body = _ref.body,
|
|
1065
|
-
body = _ref$body ===
|
|
1073
|
+
body = _ref$body === void 0 ? null : _ref$body;
|
|
1066
1074
|
var _ref2 = body || {},
|
|
1067
1075
|
_ref2$length = _ref2.length,
|
|
1068
|
-
length = _ref2$length ===
|
|
1076
|
+
length = _ref2$length === void 0 ? 0 : _ref2$length;
|
|
1069
1077
|
return typeof length === 'number' && length > 0;
|
|
1070
1078
|
};
|
|
1071
1079
|
|
|
@@ -1153,7 +1161,7 @@ var _validateFields = function validateFields(fields, value) {
|
|
|
1153
1161
|
var getContrastingColor = function getContrastingColor(backgroundColor) {
|
|
1154
1162
|
var _ref = backgroundColor || {},
|
|
1155
1163
|
_ref$color = _ref.color,
|
|
1156
|
-
color = _ref$color ===
|
|
1164
|
+
color = _ref$color === void 0 ? 'white' : _ref$color;
|
|
1157
1165
|
if (tinycolor.equals(color, tinycolor('white'))) {
|
|
1158
1166
|
return '#A13DFF';
|
|
1159
1167
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.659",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"access": "public",
|
|
145
145
|
"registry": "https://registry.npmjs.org/"
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "7c13dad69a7e377cd2f900d95cb95694a3a8fcbb"
|
|
148
148
|
}
|