@micromag/core 0.3.732 → 0.3.733
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 +17 -172
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -18,7 +18,6 @@ import isString from 'lodash/isString';
|
|
|
18
18
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
19
19
|
import uniq from 'lodash/uniq';
|
|
20
20
|
import { isString as isString$1 } from 'lodash';
|
|
21
|
-
import dayjs from 'dayjs';
|
|
22
21
|
import isEmpty from 'lodash/isEmpty';
|
|
23
22
|
import { Tracking as Tracking$1 } from '@folklore/tracking';
|
|
24
23
|
import PropTypes$1 from 'prop-types';
|
|
@@ -1208,8 +1207,8 @@ var FieldsManager = /*#__PURE__*/function (_DefinitionsManager) {
|
|
|
1208
1207
|
}]);
|
|
1209
1208
|
}(DefinitionsManager);
|
|
1210
1209
|
|
|
1211
|
-
var _excluded$
|
|
1212
|
-
_excluded2$
|
|
1210
|
+
var _excluded$7 = ["medias"],
|
|
1211
|
+
_excluded2$3 = ["medias"];
|
|
1213
1212
|
var MediasParser = /*#__PURE__*/function () {
|
|
1214
1213
|
function MediasParser(_ref) {
|
|
1215
1214
|
var fieldsManager = _ref.fieldsManager,
|
|
@@ -1228,7 +1227,7 @@ var MediasParser = /*#__PURE__*/function () {
|
|
|
1228
1227
|
if (typeof this.parsedThemesCache[storyId] === 'undefined') {
|
|
1229
1228
|
var _this$toPath = this.toPath(theme),
|
|
1230
1229
|
themeMedias = _this$toPath.medias,
|
|
1231
|
-
newTheme = _objectWithoutProperties(_this$toPath, _excluded$
|
|
1230
|
+
newTheme = _objectWithoutProperties(_this$toPath, _excluded$7);
|
|
1232
1231
|
this.parsedThemesCache[storyId] = {
|
|
1233
1232
|
themeMedias: themeMedias,
|
|
1234
1233
|
newTheme: newTheme
|
|
@@ -1282,7 +1281,7 @@ var MediasParser = /*#__PURE__*/function () {
|
|
|
1282
1281
|
if (theme !== null) {
|
|
1283
1282
|
var _this$getParsedStoryT = this.getParsedStoryTheme(storyId, theme),
|
|
1284
1283
|
themeMedias = _this$getParsedStoryT.medias,
|
|
1285
|
-
newTheme = _objectWithoutProperties(_this$getParsedStoryT, _excluded2$
|
|
1284
|
+
newTheme = _objectWithoutProperties(_this$getParsedStoryT, _excluded2$3);
|
|
1286
1285
|
return medias !== null || themeMedias !== null ? _objectSpread(_objectSpread({}, story), {}, {
|
|
1287
1286
|
theme: newTheme,
|
|
1288
1287
|
components: newComponents,
|
|
@@ -1534,7 +1533,7 @@ var ScreensManager = /*#__PURE__*/function (_DefinitionsManager) {
|
|
|
1534
1533
|
}]);
|
|
1535
1534
|
}(DefinitionsManager);
|
|
1536
1535
|
|
|
1537
|
-
var _excluded$
|
|
1536
|
+
var _excluded$6 = ["fonts"];
|
|
1538
1537
|
var FontsParser = /*#__PURE__*/function () {
|
|
1539
1538
|
function FontsParser(_ref) {
|
|
1540
1539
|
var fieldsManager = _ref.fieldsManager,
|
|
@@ -1583,7 +1582,7 @@ var FontsParser = /*#__PURE__*/function () {
|
|
|
1583
1582
|
var _this$parse = this.parse(theme),
|
|
1584
1583
|
_this$parse$fonts = _this$parse.fonts,
|
|
1585
1584
|
themeFonts = _this$parse$fonts === void 0 ? [] : _this$parse$fonts,
|
|
1586
|
-
newTheme = _objectWithoutProperties(_this$parse, _excluded$
|
|
1585
|
+
newTheme = _objectWithoutProperties(_this$parse, _excluded$6);
|
|
1587
1586
|
return fonts.length > 0 || themeFonts.length > 0 ? _objectSpread(_objectSpread({}, story), {}, {
|
|
1588
1587
|
theme: newTheme,
|
|
1589
1588
|
fonts: uniq([].concat(_toConsumableArray(themeFonts), _toConsumableArray(fonts)), 'name')
|
|
@@ -1659,7 +1658,7 @@ var FontsParser = /*#__PURE__*/function () {
|
|
|
1659
1658
|
}]);
|
|
1660
1659
|
}();
|
|
1661
1660
|
|
|
1662
|
-
var _excluded$
|
|
1661
|
+
var _excluded$5 = ["shareIncentive", "callToAction"];
|
|
1663
1662
|
/* eslint-disable class-methods-use-this */
|
|
1664
1663
|
var ShareCall = /*#__PURE__*/function () {
|
|
1665
1664
|
function ShareCall() {
|
|
@@ -1686,7 +1685,7 @@ var ShareCall = /*#__PURE__*/function () {
|
|
|
1686
1685
|
shareIncentive = _ref2$shareIncentive === void 0 ? null : _ref2$shareIncentive,
|
|
1687
1686
|
_ref2$callToAction = _ref2.callToAction,
|
|
1688
1687
|
callToAction = _ref2$callToAction === void 0 ? null : _ref2$callToAction,
|
|
1689
|
-
restScreen = _objectWithoutProperties(_ref2, _excluded$
|
|
1688
|
+
restScreen = _objectWithoutProperties(_ref2, _excluded$5);
|
|
1690
1689
|
var _ref3 = screen || {},
|
|
1691
1690
|
_ref3$header = _ref3.header,
|
|
1692
1691
|
header = _ref3$header === void 0 ? null : _ref3$header,
|
|
@@ -1715,8 +1714,8 @@ var ShareCall = /*#__PURE__*/function () {
|
|
|
1715
1714
|
}();
|
|
1716
1715
|
ShareCall.prototype.priority = 0;
|
|
1717
1716
|
|
|
1718
|
-
var _excluded$
|
|
1719
|
-
_excluded2$
|
|
1717
|
+
var _excluded$4 = ["answers"],
|
|
1718
|
+
_excluded2$2 = ["customAnswerLabel"];
|
|
1720
1719
|
/* eslint-disable class-methods-use-this */
|
|
1721
1720
|
var CustomAnswerLabel = /*#__PURE__*/function () {
|
|
1722
1721
|
function CustomAnswerLabel() {
|
|
@@ -1746,7 +1745,7 @@ var CustomAnswerLabel = /*#__PURE__*/function () {
|
|
|
1746
1745
|
var _ref2 = screen || {},
|
|
1747
1746
|
_ref2$answers = _ref2.answers,
|
|
1748
1747
|
answers = _ref2$answers === void 0 ? null : _ref2$answers,
|
|
1749
|
-
restScreen = _objectWithoutProperties(_ref2, _excluded$
|
|
1748
|
+
restScreen = _objectWithoutProperties(_ref2, _excluded$4);
|
|
1750
1749
|
return _objectSpread(_objectSpread({}, restScreen), {}, {
|
|
1751
1750
|
answers: answers.map(function () {
|
|
1752
1751
|
var answer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
@@ -1755,7 +1754,7 @@ var CustomAnswerLabel = /*#__PURE__*/function () {
|
|
|
1755
1754
|
}
|
|
1756
1755
|
var _ref3 = answer || {},
|
|
1757
1756
|
customAnswerLabel = _ref3.customAnswerLabel,
|
|
1758
|
-
restAnswer = _objectWithoutProperties(_ref3, _excluded2$
|
|
1757
|
+
restAnswer = _objectWithoutProperties(_ref3, _excluded2$2);
|
|
1759
1758
|
return _objectSpread(_objectSpread({}, restAnswer), {}, {
|
|
1760
1759
|
result: customAnswerLabel
|
|
1761
1760
|
});
|
|
@@ -1766,8 +1765,8 @@ var CustomAnswerLabel = /*#__PURE__*/function () {
|
|
|
1766
1765
|
}();
|
|
1767
1766
|
CustomAnswerLabel.prototype.priority = 1;
|
|
1768
1767
|
|
|
1769
|
-
var _excluded$
|
|
1770
|
-
_excluded2$
|
|
1768
|
+
var _excluded$3 = ["items"],
|
|
1769
|
+
_excluded2$1 = ["label", "textStyle"];
|
|
1771
1770
|
|
|
1772
1771
|
/* eslint-disable class-methods-use-this */
|
|
1773
1772
|
var KeypadItemLabel = /*#__PURE__*/function () {
|
|
@@ -1800,7 +1799,7 @@ var KeypadItemLabel = /*#__PURE__*/function () {
|
|
|
1800
1799
|
var _ref2 = screen || {},
|
|
1801
1800
|
_ref2$items = _ref2.items,
|
|
1802
1801
|
items = _ref2$items === void 0 ? null : _ref2$items,
|
|
1803
|
-
restScreen = _objectWithoutProperties(_ref2, _excluded$
|
|
1802
|
+
restScreen = _objectWithoutProperties(_ref2, _excluded$3);
|
|
1804
1803
|
return _objectSpread(_objectSpread({}, restScreen), {}, {
|
|
1805
1804
|
items: items.map(function () {
|
|
1806
1805
|
var item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
@@ -1810,7 +1809,7 @@ var KeypadItemLabel = /*#__PURE__*/function () {
|
|
|
1810
1809
|
var _ref3 = item || {},
|
|
1811
1810
|
label = _ref3.label,
|
|
1812
1811
|
textStyle = _ref3.textStyle,
|
|
1813
|
-
restAnswer = _objectWithoutProperties(_ref3, _excluded2$
|
|
1812
|
+
restAnswer = _objectWithoutProperties(_ref3, _excluded2$1);
|
|
1814
1813
|
return _objectSpread(_objectSpread({}, restAnswer), {}, {
|
|
1815
1814
|
label: {
|
|
1816
1815
|
body: label,
|
|
@@ -1824,164 +1823,10 @@ var KeypadItemLabel = /*#__PURE__*/function () {
|
|
|
1824
1823
|
}();
|
|
1825
1824
|
KeypadItemLabel.prototype.priority = 1;
|
|
1826
1825
|
|
|
1827
|
-
|
|
1828
|
-
_excluded2$1 = ["badge"],
|
|
1829
|
-
_excluded3 = ["callToAction"];
|
|
1830
|
-
|
|
1831
|
-
/* eslint-disable class-methods-use-this */
|
|
1832
|
-
var testPadding = function testPadding(element) {
|
|
1833
|
-
var _ref = element || {},
|
|
1834
|
-
_ref$boxStyle = _ref.boxStyle,
|
|
1835
|
-
boxStyle = _ref$boxStyle === void 0 ? null : _ref$boxStyle,
|
|
1836
|
-
_ref$label = _ref.label,
|
|
1837
|
-
label = _ref$label === void 0 ? null : _ref$label;
|
|
1838
|
-
if (boxStyle === null) {
|
|
1839
|
-
return false;
|
|
1840
|
-
}
|
|
1841
|
-
var _ref2 = label || {},
|
|
1842
|
-
_ref2$textStyle = _ref2.textStyle,
|
|
1843
|
-
textStyle = _ref2$textStyle === void 0 ? null : _ref2$textStyle;
|
|
1844
|
-
var _ref3 = textStyle || {},
|
|
1845
|
-
_ref3$fontFamily = _ref3.fontFamily,
|
|
1846
|
-
fontFamily = _ref3$fontFamily === void 0 ? null : _ref3$fontFamily;
|
|
1847
|
-
var _ref4 = fontFamily || {},
|
|
1848
|
-
_ref4$name = _ref4.name,
|
|
1849
|
-
fontName = _ref4$name === void 0 ? null : _ref4$name;
|
|
1850
|
-
if (fontName !== 'Agrandir Tight' && fontName !== 'Verdana') {
|
|
1851
|
-
return false;
|
|
1852
|
-
}
|
|
1853
|
-
var _ref5 = boxStyle || {},
|
|
1854
|
-
_ref5$padding = _ref5.padding,
|
|
1855
|
-
padding = _ref5$padding === void 0 ? null : _ref5$padding;
|
|
1856
|
-
if (padding === null) {
|
|
1857
|
-
return false;
|
|
1858
|
-
}
|
|
1859
|
-
var _ref6 = padding || {},
|
|
1860
|
-
_ref6$top = _ref6.top,
|
|
1861
|
-
top = _ref6$top === void 0 ? null : _ref6$top,
|
|
1862
|
-
_ref6$bottom = _ref6.bottom,
|
|
1863
|
-
bottom = _ref6$bottom === void 0 ? null : _ref6$bottom;
|
|
1864
|
-
if (top === null || bottom === null) {
|
|
1865
|
-
return false;
|
|
1866
|
-
}
|
|
1867
|
-
if (top <= bottom - 2) {
|
|
1868
|
-
return true;
|
|
1869
|
-
}
|
|
1870
|
-
return true;
|
|
1871
|
-
};
|
|
1872
|
-
var parsePadding = function parsePadding(element) {
|
|
1873
|
-
var _ref7 = element || {},
|
|
1874
|
-
_ref7$boxStyle = _ref7.boxStyle,
|
|
1875
|
-
boxStyle = _ref7$boxStyle === void 0 ? null : _ref7$boxStyle;
|
|
1876
|
-
if (boxStyle === null) {
|
|
1877
|
-
return element;
|
|
1878
|
-
}
|
|
1879
|
-
var _ref8 = boxStyle || {},
|
|
1880
|
-
_ref8$padding = _ref8.padding,
|
|
1881
|
-
padding = _ref8$padding === void 0 ? null : _ref8$padding;
|
|
1882
|
-
if (padding === null) {
|
|
1883
|
-
return element;
|
|
1884
|
-
}
|
|
1885
|
-
var _ref9 = padding || {},
|
|
1886
|
-
_ref9$bottom = _ref9.bottom,
|
|
1887
|
-
bottom = _ref9$bottom === void 0 ? null : _ref9$bottom;
|
|
1888
|
-
if (bottom === null) {
|
|
1889
|
-
return element;
|
|
1890
|
-
}
|
|
1891
|
-
return _objectSpread(_objectSpread({}, element), {}, {
|
|
1892
|
-
boxStyle: _objectSpread(_objectSpread({}, boxStyle), {}, {
|
|
1893
|
-
padding: _objectSpread(_objectSpread({}, padding), {}, {
|
|
1894
|
-
top: bottom,
|
|
1895
|
-
bottom: bottom
|
|
1896
|
-
})
|
|
1897
|
-
})
|
|
1898
|
-
});
|
|
1899
|
-
};
|
|
1900
|
-
var ButtonPadding = /*#__PURE__*/function () {
|
|
1901
|
-
function ButtonPadding() {
|
|
1902
|
-
_classCallCheck(this, ButtonPadding);
|
|
1903
|
-
}
|
|
1904
|
-
return _createClass(ButtonPadding, [{
|
|
1905
|
-
key: "test",
|
|
1906
|
-
value: function test(screen, story) {
|
|
1907
|
-
var _ref0 = story || {},
|
|
1908
|
-
_ref0$created_at = _ref0.created_at,
|
|
1909
|
-
createdAt = _ref0$created_at === void 0 ? null : _ref0$created_at;
|
|
1910
|
-
var _ref1 = screen || {},
|
|
1911
|
-
_ref1$footer = _ref1.footer,
|
|
1912
|
-
footer = _ref1$footer === void 0 ? null : _ref1$footer,
|
|
1913
|
-
_ref1$header = _ref1.header,
|
|
1914
|
-
header = _ref1$header === void 0 ? null : _ref1$header;
|
|
1915
|
-
if (header === null || footer === null) {
|
|
1916
|
-
return false;
|
|
1917
|
-
}
|
|
1918
|
-
var _ref10 = header || {},
|
|
1919
|
-
_ref10$badge = _ref10.badge,
|
|
1920
|
-
badge = _ref10$badge === void 0 ? null : _ref10$badge;
|
|
1921
|
-
var _ref11 = footer || {},
|
|
1922
|
-
_ref11$callToAction = _ref11.callToAction,
|
|
1923
|
-
callToAction = _ref11$callToAction === void 0 ? null : _ref11$callToAction;
|
|
1924
|
-
if (callToAction === null) {
|
|
1925
|
-
return false;
|
|
1926
|
-
}
|
|
1927
|
-
if (badge === null) {
|
|
1928
|
-
return false;
|
|
1929
|
-
}
|
|
1930
|
-
if (createdAt === null) {
|
|
1931
|
-
return false;
|
|
1932
|
-
}
|
|
1933
|
-
var callHasPadding = testPadding(callToAction);
|
|
1934
|
-
if (callHasPadding) {
|
|
1935
|
-
return true;
|
|
1936
|
-
}
|
|
1937
|
-
var badgeHasPadding = testPadding(badge);
|
|
1938
|
-
if (badgeHasPadding) {
|
|
1939
|
-
return true;
|
|
1940
|
-
}
|
|
1941
|
-
var dateToFormat = isString(createdAt) ? dayjs(createdAt) : null;
|
|
1942
|
-
if (dateToFormat === null) {
|
|
1943
|
-
return false;
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
// Only the old micromags
|
|
1947
|
-
if (dateToFormat.isAfter(dayjs('2025-05-20T00:00:00.000Z'))) {
|
|
1948
|
-
return false;
|
|
1949
|
-
}
|
|
1950
|
-
return false;
|
|
1951
|
-
}
|
|
1952
|
-
}, {
|
|
1953
|
-
key: "parse",
|
|
1954
|
-
value: function parse(screen) {
|
|
1955
|
-
var _ref12 = screen || {},
|
|
1956
|
-
_ref12$footer = _ref12.footer,
|
|
1957
|
-
footer = _ref12$footer === void 0 ? null : _ref12$footer,
|
|
1958
|
-
_ref12$header = _ref12.header,
|
|
1959
|
-
header = _ref12$header === void 0 ? null : _ref12$header,
|
|
1960
|
-
restScreen = _objectWithoutProperties(_ref12, _excluded$3);
|
|
1961
|
-
var _ref13 = header || {},
|
|
1962
|
-
_ref13$badge = _ref13.badge,
|
|
1963
|
-
badge = _ref13$badge === void 0 ? null : _ref13$badge,
|
|
1964
|
-
restHeader = _objectWithoutProperties(_ref13, _excluded2$1);
|
|
1965
|
-
var _ref14 = footer || {},
|
|
1966
|
-
_ref14$callToAction = _ref14.callToAction,
|
|
1967
|
-
callToAction = _ref14$callToAction === void 0 ? null : _ref14$callToAction,
|
|
1968
|
-
restFooter = _objectWithoutProperties(_ref14, _excluded3);
|
|
1969
|
-
return _objectSpread(_objectSpread({}, restScreen), {}, {
|
|
1970
|
-
header: _objectSpread(_objectSpread({}, restHeader), badge !== null ? {
|
|
1971
|
-
badge: parsePadding(badge)
|
|
1972
|
-
} : null),
|
|
1973
|
-
footer: _objectSpread(_objectSpread({}, restFooter), callToAction !== null ? {
|
|
1974
|
-
callToAction: parsePadding(callToAction)
|
|
1975
|
-
} : null)
|
|
1976
|
-
});
|
|
1977
|
-
}
|
|
1978
|
-
}]);
|
|
1979
|
-
}();
|
|
1980
|
-
ButtonPadding.prototype.priority = 1;
|
|
1826
|
+
// export { default as ButtonPadding } from './ButtonPadding';
|
|
1981
1827
|
|
|
1982
1828
|
var migrations = /*#__PURE__*/Object.freeze({
|
|
1983
1829
|
__proto__: null,
|
|
1984
|
-
ButtonPadding: ButtonPadding,
|
|
1985
1830
|
CustomAnswerLabel: CustomAnswerLabel,
|
|
1986
1831
|
KeypadItemLabel: KeypadItemLabel,
|
|
1987
1832
|
ShareCall: ShareCall
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.733",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -145,5 +145,5 @@
|
|
|
145
145
|
"access": "public",
|
|
146
146
|
"registry": "https://registry.npmjs.org/"
|
|
147
147
|
},
|
|
148
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "9dae26b19bddd5767d8c65c62aad0e51d5a90680"
|
|
149
149
|
}
|