@micromag/core 0.3.410 → 0.3.418
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/index.js +113 -34
- package/lib/index.js +113 -34
- package/package.json +2 -2
- package/scss/_theme.scss +2 -2
package/es/index.js
CHANGED
|
@@ -1700,8 +1700,36 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1700
1700
|
key: "parseScreen",
|
|
1701
1701
|
value: function parseScreen(definition, value, themeValue, themeBackground, themeColors, themeTextStyles, themeBoxStyles) {
|
|
1702
1702
|
var _this2 = this;
|
|
1703
|
-
var
|
|
1704
|
-
fields =
|
|
1703
|
+
var _ref3 = definition || {},
|
|
1704
|
+
_ref3$fields = _ref3.fields,
|
|
1705
|
+
fields = _ref3$fields === void 0 ? [] : _ref3$fields,
|
|
1706
|
+
_ref3$states = _ref3.states,
|
|
1707
|
+
states = _ref3$states === void 0 ? [] : _ref3$states;
|
|
1708
|
+
|
|
1709
|
+
// TODO: test this
|
|
1710
|
+
var finalFields = fields;
|
|
1711
|
+
var repetableStates = [];
|
|
1712
|
+
if (states !== null && states.length > 0) {
|
|
1713
|
+
var nonRepetableStates = states.filter(function (_ref4) {
|
|
1714
|
+
var _ref4$repeatable = _ref4.repeatable,
|
|
1715
|
+
repeatable = _ref4$repeatable === void 0 ? false : _ref4$repeatable;
|
|
1716
|
+
return repeatable === false;
|
|
1717
|
+
});
|
|
1718
|
+
repetableStates = states.filter(function (_ref5) {
|
|
1719
|
+
var _ref5$repeatable = _ref5.repeatable,
|
|
1720
|
+
repeatable = _ref5$repeatable === void 0 ? false : _ref5$repeatable;
|
|
1721
|
+
return repeatable === true;
|
|
1722
|
+
});
|
|
1723
|
+
finalFields = nonRepetableStates.reduce(function (acc, it) {
|
|
1724
|
+
var _ref6 = it || {},
|
|
1725
|
+
_ref6$fields = _ref6.fields,
|
|
1726
|
+
itemFields = _ref6$fields === void 0 ? [] : _ref6$fields;
|
|
1727
|
+
if (itemFields !== null && itemFields.length > 0) {
|
|
1728
|
+
return acc.concat(itemFields);
|
|
1729
|
+
}
|
|
1730
|
+
return acc;
|
|
1731
|
+
}, finalFields);
|
|
1732
|
+
}
|
|
1705
1733
|
var newThemeValue = themeValue === null && themeBackground !== null ? {} : themeValue;
|
|
1706
1734
|
if (themeBackground !== null && typeof newThemeValue.background !== 'undefined') {
|
|
1707
1735
|
newThemeValue.background = _objectSpread(_objectSpread({}, themeBackground), newThemeValue.background);
|
|
@@ -1709,12 +1737,23 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1709
1737
|
newThemeValue.background = themeBackground;
|
|
1710
1738
|
}
|
|
1711
1739
|
var newScreenValue = Object.keys(value).reduce(function (currentValue, key) {
|
|
1712
|
-
var
|
|
1740
|
+
var repetableState = null;
|
|
1741
|
+
if (repetableStates.length > 0) {
|
|
1742
|
+
repetableState = repetableStates.find(function (_ref7) {
|
|
1743
|
+
var _ref7$id = _ref7.id,
|
|
1744
|
+
stateId = _ref7$id === void 0 ? null : _ref7$id;
|
|
1745
|
+
return stateId !== null && stateId === key;
|
|
1746
|
+
}) || null;
|
|
1747
|
+
}
|
|
1748
|
+
var fieldDefinition = finalFields.find(function (it) {
|
|
1713
1749
|
return it.name === key;
|
|
1714
|
-
}) || {};
|
|
1750
|
+
}) || repetableState || {};
|
|
1715
1751
|
var fieldValue = value[key];
|
|
1716
1752
|
var fieldThemeValue = newThemeValue !== null ? newThemeValue[key] || null : null;
|
|
1717
|
-
|
|
1753
|
+
|
|
1754
|
+
// console.log('start', key, fieldValue);
|
|
1755
|
+
var newFieldValue = _this2.parseField(fieldValue, fieldDefinition, fieldThemeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1756
|
+
// console.log('result', newFieldValue);
|
|
1718
1757
|
|
|
1719
1758
|
// Only switch field if it has changed
|
|
1720
1759
|
return newFieldValue !== fieldValue ? _objectSpread(_objectSpread({}, currentValue), {}, _defineProperty({}, key, newFieldValue)) : currentValue;
|
|
@@ -1725,40 +1764,47 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1725
1764
|
// eslint-disable-next-line class-methods-use-this
|
|
1726
1765
|
}, {
|
|
1727
1766
|
key: "parseField",
|
|
1728
|
-
value: function parseField(
|
|
1767
|
+
value: function parseField(value, definition, themeValue, themeColors, themeTextStyles, themeBoxStyles) {
|
|
1768
|
+
var _this3 = this;
|
|
1729
1769
|
var _definition$theme = definition.theme,
|
|
1730
|
-
fieldTheme = _definition$theme === void 0 ? null : _definition$theme
|
|
1731
|
-
|
|
1770
|
+
fieldTheme = _definition$theme === void 0 ? null : _definition$theme,
|
|
1771
|
+
_definition$fields = definition.fields,
|
|
1772
|
+
definitionFields = _definition$fields === void 0 ? null : _definition$fields;
|
|
1773
|
+
if (definitionFields !== null && value !== null) {
|
|
1774
|
+
return isArray(value) ? value.map(function (innerFieldValue) {
|
|
1775
|
+
if (innerFieldValue === null) {
|
|
1776
|
+
return innerFieldValue;
|
|
1777
|
+
}
|
|
1778
|
+
return _this3.parseInnerFields(innerFieldValue, definitionFields, themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1779
|
+
}) : this.parseInnerFields(value, definitionFields, themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1780
|
+
}
|
|
1732
1781
|
|
|
1733
1782
|
// Early return
|
|
1734
1783
|
if (fieldTheme === null || !isObject(fieldTheme)) {
|
|
1735
1784
|
return value;
|
|
1736
1785
|
}
|
|
1737
1786
|
|
|
1738
|
-
// @TODO very
|
|
1787
|
+
// @TODO very slooow...
|
|
1739
1788
|
if (isArray(value)) {
|
|
1740
1789
|
var newFieldValue = value.map(function (innerField) {
|
|
1741
1790
|
return innerField !== null ? Object.keys(innerField).reduce(function (newInnerField, innerFieldName) {
|
|
1742
|
-
// console.log('innerField', innerField);
|
|
1743
1791
|
// Early return
|
|
1744
1792
|
if (!isObject(innerField[innerFieldName])) {
|
|
1745
1793
|
return newInnerField;
|
|
1746
1794
|
}
|
|
1747
|
-
var
|
|
1748
|
-
|
|
1749
|
-
innerFieldTextStyle =
|
|
1750
|
-
|
|
1751
|
-
innerFieldColor =
|
|
1752
|
-
|
|
1753
|
-
innerFieldBoxStyle =
|
|
1795
|
+
var _ref8 = fieldTheme[innerFieldName] || {},
|
|
1796
|
+
_ref8$textStyle = _ref8.textStyle,
|
|
1797
|
+
innerFieldTextStyle = _ref8$textStyle === void 0 ? null : _ref8$textStyle,
|
|
1798
|
+
_ref8$color = _ref8.color,
|
|
1799
|
+
innerFieldColor = _ref8$color === void 0 ? null : _ref8$color,
|
|
1800
|
+
_ref8$boxStyle = _ref8.boxStyle,
|
|
1801
|
+
innerFieldBoxStyle = _ref8$boxStyle === void 0 ? null : _ref8$boxStyle;
|
|
1754
1802
|
|
|
1755
1803
|
// Early return, no theme
|
|
1756
1804
|
if (innerFieldTextStyle === null && innerFieldColor === null && innerFieldBoxStyle === null) {
|
|
1757
1805
|
return newInnerField;
|
|
1758
1806
|
}
|
|
1759
1807
|
|
|
1760
|
-
// TODO: replace this with the recursive parseValue...
|
|
1761
|
-
|
|
1762
1808
|
// Color
|
|
1763
1809
|
var colorValue = innerFieldColor !== null ? {
|
|
1764
1810
|
color: innerFieldColor !== null && themeColors !== null ? themeColors[innerFieldColor] || null : null
|
|
@@ -1784,22 +1830,55 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1784
1830
|
}
|
|
1785
1831
|
return value;
|
|
1786
1832
|
}
|
|
1833
|
+
}, {
|
|
1834
|
+
key: "parseInnerFields",
|
|
1835
|
+
value: function parseInnerFields(value, fieldsOrDefinition, themeValue, themeColors, themeTextStyles, themeBoxStyles) {
|
|
1836
|
+
var _this4 = this;
|
|
1837
|
+
var newValue = Object.keys(value).reduce(function (finalValue, innerFieldName) {
|
|
1838
|
+
var innerDefinition = isArray(fieldsOrDefinition) ? fieldsOrDefinition.find(function (it) {
|
|
1839
|
+
return it.name === innerFieldName;
|
|
1840
|
+
}) || null : fieldsOrDefinition;
|
|
1841
|
+
var _ref9 = innerDefinition || {},
|
|
1842
|
+
_ref9$theme = _ref9.theme,
|
|
1843
|
+
idfTheme = _ref9$theme === void 0 ? null : _ref9$theme;
|
|
1844
|
+
var innerValue = value[innerFieldName];
|
|
1845
|
+
|
|
1846
|
+
// For items fields
|
|
1847
|
+
if (innerValue !== null && innerDefinition !== null && isArray(innerValue)) {
|
|
1848
|
+
// eslint-disable-next-line no-param-reassign
|
|
1849
|
+
finalValue[innerFieldName] = _this4.parseField(innerValue, innerDefinition, themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1850
|
+
return finalValue;
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
// For fields with fields
|
|
1854
|
+
if (innerValue !== null && idfTheme !== null && isObject(idfTheme) && isObject(innerValue)) {
|
|
1855
|
+
// eslint-disable-next-line no-param-reassign
|
|
1856
|
+
finalValue[innerFieldName] = _this4.parseValue(innerValue, idfTheme, themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1857
|
+
return finalValue;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
// eslint-disable-next-line no-param-reassign
|
|
1861
|
+
finalValue[innerFieldName] = value[innerFieldName];
|
|
1862
|
+
return finalValue;
|
|
1863
|
+
}, {});
|
|
1864
|
+
return newValue;
|
|
1865
|
+
}
|
|
1787
1866
|
|
|
1788
1867
|
// eslint-disable-next-line class-methods-use-this
|
|
1789
1868
|
}, {
|
|
1790
1869
|
key: "parseValue",
|
|
1791
1870
|
value: function parseValue(initialValue, fieldTheme, themeValue, themeColors, themeTextStyles, themeBoxStyles) {
|
|
1792
|
-
var
|
|
1871
|
+
var _this5 = this;
|
|
1793
1872
|
if (isObject(initialValue) || isObject(fieldTheme)) {
|
|
1794
1873
|
var value = initialValue || null;
|
|
1795
|
-
var
|
|
1796
|
-
|
|
1797
|
-
fieldTextStyleName =
|
|
1798
|
-
|
|
1799
|
-
fieldColorName =
|
|
1800
|
-
|
|
1801
|
-
fieldBoxStyleName =
|
|
1802
|
-
otherProps = _objectWithoutProperties(
|
|
1874
|
+
var _ref10 = fieldTheme || {},
|
|
1875
|
+
_ref10$textStyle = _ref10.textStyle,
|
|
1876
|
+
fieldTextStyleName = _ref10$textStyle === void 0 ? null : _ref10$textStyle,
|
|
1877
|
+
_ref10$color = _ref10.color,
|
|
1878
|
+
fieldColorName = _ref10$color === void 0 ? null : _ref10$color,
|
|
1879
|
+
_ref10$boxStyle = _ref10.boxStyle,
|
|
1880
|
+
fieldBoxStyleName = _ref10$boxStyle === void 0 ? null : _ref10$boxStyle,
|
|
1881
|
+
otherProps = _objectWithoutProperties(_ref10, _excluded$1);
|
|
1803
1882
|
if (fieldTextStyleName === null && fieldColorName === null && fieldBoxStyleName === null && isEmpty(otherProps) && !isObject(fieldTheme)) {
|
|
1804
1883
|
return value;
|
|
1805
1884
|
}
|
|
@@ -1807,15 +1886,15 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1807
1886
|
if (!isEmpty(otherProps)) {
|
|
1808
1887
|
complexValue = Object.keys(otherProps).reduce(function (newObject, key) {
|
|
1809
1888
|
var innerValue = value !== null ? value[key] || null : null;
|
|
1810
|
-
var newValue =
|
|
1889
|
+
var newValue = _this5.parseValue(innerValue, otherProps[key], themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1811
1890
|
return _objectSpread(_objectSpread({}, newObject), newValue !== null ? _defineProperty({}, key, newValue) : null);
|
|
1812
1891
|
}, {});
|
|
1813
1892
|
}
|
|
1814
|
-
var
|
|
1815
|
-
|
|
1816
|
-
valueTextStyle =
|
|
1817
|
-
|
|
1818
|
-
valueBoxStyle =
|
|
1893
|
+
var _ref12 = value || {},
|
|
1894
|
+
_ref12$textStyle = _ref12.textStyle,
|
|
1895
|
+
valueTextStyle = _ref12$textStyle === void 0 ? null : _ref12$textStyle,
|
|
1896
|
+
_ref12$boxStyle = _ref12.boxStyle,
|
|
1897
|
+
valueBoxStyle = _ref12$boxStyle === void 0 ? null : _ref12$boxStyle;
|
|
1819
1898
|
|
|
1820
1899
|
// Color
|
|
1821
1900
|
var fieldColor = fieldColorName !== null && themeColors !== null ? themeColors[fieldColorName] || null : null;
|
package/lib/index.js
CHANGED
|
@@ -1727,8 +1727,36 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1727
1727
|
key: "parseScreen",
|
|
1728
1728
|
value: function parseScreen(definition, value, themeValue, themeBackground, themeColors, themeTextStyles, themeBoxStyles) {
|
|
1729
1729
|
var _this2 = this;
|
|
1730
|
-
var
|
|
1731
|
-
fields =
|
|
1730
|
+
var _ref3 = definition || {},
|
|
1731
|
+
_ref3$fields = _ref3.fields,
|
|
1732
|
+
fields = _ref3$fields === void 0 ? [] : _ref3$fields,
|
|
1733
|
+
_ref3$states = _ref3.states,
|
|
1734
|
+
states = _ref3$states === void 0 ? [] : _ref3$states;
|
|
1735
|
+
|
|
1736
|
+
// TODO: test this
|
|
1737
|
+
var finalFields = fields;
|
|
1738
|
+
var repetableStates = [];
|
|
1739
|
+
if (states !== null && states.length > 0) {
|
|
1740
|
+
var nonRepetableStates = states.filter(function (_ref4) {
|
|
1741
|
+
var _ref4$repeatable = _ref4.repeatable,
|
|
1742
|
+
repeatable = _ref4$repeatable === void 0 ? false : _ref4$repeatable;
|
|
1743
|
+
return repeatable === false;
|
|
1744
|
+
});
|
|
1745
|
+
repetableStates = states.filter(function (_ref5) {
|
|
1746
|
+
var _ref5$repeatable = _ref5.repeatable,
|
|
1747
|
+
repeatable = _ref5$repeatable === void 0 ? false : _ref5$repeatable;
|
|
1748
|
+
return repeatable === true;
|
|
1749
|
+
});
|
|
1750
|
+
finalFields = nonRepetableStates.reduce(function (acc, it) {
|
|
1751
|
+
var _ref6 = it || {},
|
|
1752
|
+
_ref6$fields = _ref6.fields,
|
|
1753
|
+
itemFields = _ref6$fields === void 0 ? [] : _ref6$fields;
|
|
1754
|
+
if (itemFields !== null && itemFields.length > 0) {
|
|
1755
|
+
return acc.concat(itemFields);
|
|
1756
|
+
}
|
|
1757
|
+
return acc;
|
|
1758
|
+
}, finalFields);
|
|
1759
|
+
}
|
|
1732
1760
|
var newThemeValue = themeValue === null && themeBackground !== null ? {} : themeValue;
|
|
1733
1761
|
if (themeBackground !== null && typeof newThemeValue.background !== 'undefined') {
|
|
1734
1762
|
newThemeValue.background = _objectSpread__default["default"](_objectSpread__default["default"]({}, themeBackground), newThemeValue.background);
|
|
@@ -1736,12 +1764,23 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1736
1764
|
newThemeValue.background = themeBackground;
|
|
1737
1765
|
}
|
|
1738
1766
|
var newScreenValue = Object.keys(value).reduce(function (currentValue, key) {
|
|
1739
|
-
var
|
|
1767
|
+
var repetableState = null;
|
|
1768
|
+
if (repetableStates.length > 0) {
|
|
1769
|
+
repetableState = repetableStates.find(function (_ref7) {
|
|
1770
|
+
var _ref7$id = _ref7.id,
|
|
1771
|
+
stateId = _ref7$id === void 0 ? null : _ref7$id;
|
|
1772
|
+
return stateId !== null && stateId === key;
|
|
1773
|
+
}) || null;
|
|
1774
|
+
}
|
|
1775
|
+
var fieldDefinition = finalFields.find(function (it) {
|
|
1740
1776
|
return it.name === key;
|
|
1741
|
-
}) || {};
|
|
1777
|
+
}) || repetableState || {};
|
|
1742
1778
|
var fieldValue = value[key];
|
|
1743
1779
|
var fieldThemeValue = newThemeValue !== null ? newThemeValue[key] || null : null;
|
|
1744
|
-
|
|
1780
|
+
|
|
1781
|
+
// console.log('start', key, fieldValue);
|
|
1782
|
+
var newFieldValue = _this2.parseField(fieldValue, fieldDefinition, fieldThemeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1783
|
+
// console.log('result', newFieldValue);
|
|
1745
1784
|
|
|
1746
1785
|
// Only switch field if it has changed
|
|
1747
1786
|
return newFieldValue !== fieldValue ? _objectSpread__default["default"](_objectSpread__default["default"]({}, currentValue), {}, _defineProperty__default["default"]({}, key, newFieldValue)) : currentValue;
|
|
@@ -1752,40 +1791,47 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1752
1791
|
// eslint-disable-next-line class-methods-use-this
|
|
1753
1792
|
}, {
|
|
1754
1793
|
key: "parseField",
|
|
1755
|
-
value: function parseField(
|
|
1794
|
+
value: function parseField(value, definition, themeValue, themeColors, themeTextStyles, themeBoxStyles) {
|
|
1795
|
+
var _this3 = this;
|
|
1756
1796
|
var _definition$theme = definition.theme,
|
|
1757
|
-
fieldTheme = _definition$theme === void 0 ? null : _definition$theme
|
|
1758
|
-
|
|
1797
|
+
fieldTheme = _definition$theme === void 0 ? null : _definition$theme,
|
|
1798
|
+
_definition$fields = definition.fields,
|
|
1799
|
+
definitionFields = _definition$fields === void 0 ? null : _definition$fields;
|
|
1800
|
+
if (definitionFields !== null && value !== null) {
|
|
1801
|
+
return isArray__default["default"](value) ? value.map(function (innerFieldValue) {
|
|
1802
|
+
if (innerFieldValue === null) {
|
|
1803
|
+
return innerFieldValue;
|
|
1804
|
+
}
|
|
1805
|
+
return _this3.parseInnerFields(innerFieldValue, definitionFields, themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1806
|
+
}) : this.parseInnerFields(value, definitionFields, themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1807
|
+
}
|
|
1759
1808
|
|
|
1760
1809
|
// Early return
|
|
1761
1810
|
if (fieldTheme === null || !isObject__default["default"](fieldTheme)) {
|
|
1762
1811
|
return value;
|
|
1763
1812
|
}
|
|
1764
1813
|
|
|
1765
|
-
// @TODO very
|
|
1814
|
+
// @TODO very slooow...
|
|
1766
1815
|
if (isArray__default["default"](value)) {
|
|
1767
1816
|
var newFieldValue = value.map(function (innerField) {
|
|
1768
1817
|
return innerField !== null ? Object.keys(innerField).reduce(function (newInnerField, innerFieldName) {
|
|
1769
|
-
// console.log('innerField', innerField);
|
|
1770
1818
|
// Early return
|
|
1771
1819
|
if (!isObject__default["default"](innerField[innerFieldName])) {
|
|
1772
1820
|
return newInnerField;
|
|
1773
1821
|
}
|
|
1774
|
-
var
|
|
1775
|
-
|
|
1776
|
-
innerFieldTextStyle =
|
|
1777
|
-
|
|
1778
|
-
innerFieldColor =
|
|
1779
|
-
|
|
1780
|
-
innerFieldBoxStyle =
|
|
1822
|
+
var _ref8 = fieldTheme[innerFieldName] || {},
|
|
1823
|
+
_ref8$textStyle = _ref8.textStyle,
|
|
1824
|
+
innerFieldTextStyle = _ref8$textStyle === void 0 ? null : _ref8$textStyle,
|
|
1825
|
+
_ref8$color = _ref8.color,
|
|
1826
|
+
innerFieldColor = _ref8$color === void 0 ? null : _ref8$color,
|
|
1827
|
+
_ref8$boxStyle = _ref8.boxStyle,
|
|
1828
|
+
innerFieldBoxStyle = _ref8$boxStyle === void 0 ? null : _ref8$boxStyle;
|
|
1781
1829
|
|
|
1782
1830
|
// Early return, no theme
|
|
1783
1831
|
if (innerFieldTextStyle === null && innerFieldColor === null && innerFieldBoxStyle === null) {
|
|
1784
1832
|
return newInnerField;
|
|
1785
1833
|
}
|
|
1786
1834
|
|
|
1787
|
-
// TODO: replace this with the recursive parseValue...
|
|
1788
|
-
|
|
1789
1835
|
// Color
|
|
1790
1836
|
var colorValue = innerFieldColor !== null ? {
|
|
1791
1837
|
color: innerFieldColor !== null && themeColors !== null ? themeColors[innerFieldColor] || null : null
|
|
@@ -1811,22 +1857,55 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1811
1857
|
}
|
|
1812
1858
|
return value;
|
|
1813
1859
|
}
|
|
1860
|
+
}, {
|
|
1861
|
+
key: "parseInnerFields",
|
|
1862
|
+
value: function parseInnerFields(value, fieldsOrDefinition, themeValue, themeColors, themeTextStyles, themeBoxStyles) {
|
|
1863
|
+
var _this4 = this;
|
|
1864
|
+
var newValue = Object.keys(value).reduce(function (finalValue, innerFieldName) {
|
|
1865
|
+
var innerDefinition = isArray__default["default"](fieldsOrDefinition) ? fieldsOrDefinition.find(function (it) {
|
|
1866
|
+
return it.name === innerFieldName;
|
|
1867
|
+
}) || null : fieldsOrDefinition;
|
|
1868
|
+
var _ref9 = innerDefinition || {},
|
|
1869
|
+
_ref9$theme = _ref9.theme,
|
|
1870
|
+
idfTheme = _ref9$theme === void 0 ? null : _ref9$theme;
|
|
1871
|
+
var innerValue = value[innerFieldName];
|
|
1872
|
+
|
|
1873
|
+
// For items fields
|
|
1874
|
+
if (innerValue !== null && innerDefinition !== null && isArray__default["default"](innerValue)) {
|
|
1875
|
+
// eslint-disable-next-line no-param-reassign
|
|
1876
|
+
finalValue[innerFieldName] = _this4.parseField(innerValue, innerDefinition, themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1877
|
+
return finalValue;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
// For fields with fields
|
|
1881
|
+
if (innerValue !== null && idfTheme !== null && isObject__default["default"](idfTheme) && isObject__default["default"](innerValue)) {
|
|
1882
|
+
// eslint-disable-next-line no-param-reassign
|
|
1883
|
+
finalValue[innerFieldName] = _this4.parseValue(innerValue, idfTheme, themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1884
|
+
return finalValue;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
// eslint-disable-next-line no-param-reassign
|
|
1888
|
+
finalValue[innerFieldName] = value[innerFieldName];
|
|
1889
|
+
return finalValue;
|
|
1890
|
+
}, {});
|
|
1891
|
+
return newValue;
|
|
1892
|
+
}
|
|
1814
1893
|
|
|
1815
1894
|
// eslint-disable-next-line class-methods-use-this
|
|
1816
1895
|
}, {
|
|
1817
1896
|
key: "parseValue",
|
|
1818
1897
|
value: function parseValue(initialValue, fieldTheme, themeValue, themeColors, themeTextStyles, themeBoxStyles) {
|
|
1819
|
-
var
|
|
1898
|
+
var _this5 = this;
|
|
1820
1899
|
if (isObject__default["default"](initialValue) || isObject__default["default"](fieldTheme)) {
|
|
1821
1900
|
var value = initialValue || null;
|
|
1822
|
-
var
|
|
1823
|
-
|
|
1824
|
-
fieldTextStyleName =
|
|
1825
|
-
|
|
1826
|
-
fieldColorName =
|
|
1827
|
-
|
|
1828
|
-
fieldBoxStyleName =
|
|
1829
|
-
otherProps = _objectWithoutProperties__default["default"](
|
|
1901
|
+
var _ref10 = fieldTheme || {},
|
|
1902
|
+
_ref10$textStyle = _ref10.textStyle,
|
|
1903
|
+
fieldTextStyleName = _ref10$textStyle === void 0 ? null : _ref10$textStyle,
|
|
1904
|
+
_ref10$color = _ref10.color,
|
|
1905
|
+
fieldColorName = _ref10$color === void 0 ? null : _ref10$color,
|
|
1906
|
+
_ref10$boxStyle = _ref10.boxStyle,
|
|
1907
|
+
fieldBoxStyleName = _ref10$boxStyle === void 0 ? null : _ref10$boxStyle,
|
|
1908
|
+
otherProps = _objectWithoutProperties__default["default"](_ref10, _excluded$1);
|
|
1830
1909
|
if (fieldTextStyleName === null && fieldColorName === null && fieldBoxStyleName === null && isEmpty__default["default"](otherProps) && !isObject__default["default"](fieldTheme)) {
|
|
1831
1910
|
return value;
|
|
1832
1911
|
}
|
|
@@ -1834,15 +1913,15 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
1834
1913
|
if (!isEmpty__default["default"](otherProps)) {
|
|
1835
1914
|
complexValue = Object.keys(otherProps).reduce(function (newObject, key) {
|
|
1836
1915
|
var innerValue = value !== null ? value[key] || null : null;
|
|
1837
|
-
var newValue =
|
|
1916
|
+
var newValue = _this5.parseValue(innerValue, otherProps[key], themeValue, themeColors, themeTextStyles, themeBoxStyles);
|
|
1838
1917
|
return _objectSpread__default["default"](_objectSpread__default["default"]({}, newObject), newValue !== null ? _defineProperty__default["default"]({}, key, newValue) : null);
|
|
1839
1918
|
}, {});
|
|
1840
1919
|
}
|
|
1841
|
-
var
|
|
1842
|
-
|
|
1843
|
-
valueTextStyle =
|
|
1844
|
-
|
|
1845
|
-
valueBoxStyle =
|
|
1920
|
+
var _ref12 = value || {},
|
|
1921
|
+
_ref12$textStyle = _ref12.textStyle,
|
|
1922
|
+
valueTextStyle = _ref12$textStyle === void 0 ? null : _ref12$textStyle,
|
|
1923
|
+
_ref12$boxStyle = _ref12.boxStyle,
|
|
1924
|
+
valueBoxStyle = _ref12$boxStyle === void 0 ? null : _ref12$boxStyle;
|
|
1846
1925
|
|
|
1847
1926
|
// Color
|
|
1848
1927
|
var fieldColor = fieldColorName !== null && themeColors !== null ? themeColors[fieldColorName] || null : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.418",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -136,5 +136,5 @@
|
|
|
136
136
|
"access": "public",
|
|
137
137
|
"registry": "https://registry.npmjs.org/"
|
|
138
138
|
},
|
|
139
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "b88d067aa5c016ffdbc031902e1c387160d51f9b"
|
|
140
140
|
}
|
package/scss/_theme.scss
CHANGED
|
@@ -7,7 +7,7 @@ $gray-200: #e9e9e9;
|
|
|
7
7
|
$secondary: $gray-200;
|
|
8
8
|
$green: #0ED88F;
|
|
9
9
|
$gray-100: #f5f5f5;
|
|
10
|
-
$input-bg:
|
|
10
|
+
$input-bg: hsla(0,0%,100%,.07);
|
|
11
11
|
$gray-300: #dedede;
|
|
12
12
|
$gray-400: #B3B3B3;
|
|
13
13
|
$gray-500: #adadad;
|
|
@@ -96,4 +96,4 @@ $ease-in-ramp: cubic-bezier(.6,0,1,.5);
|
|
|
96
96
|
$ease-out-ramp: cubic-bezier(0,.6,.5,1);
|
|
97
97
|
$ease-in-kickback: cubic-bezier(.41,1.69,.04,.67);
|
|
98
98
|
$ease-in-yo: cubic-bezier(.21,2.59,0,.9);
|
|
99
|
-
$ease-in-bump: cubic-bezier(.4,1.69,0,1);
|
|
99
|
+
$ease-in-bump: cubic-bezier(.4,1.69,0,1);
|