@micromag/core 0.3.478 → 0.3.482

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 CHANGED
@@ -1,7 +1,5 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import PropTypes$1 from 'prop-types';
3
- import { __assign } from 'tslib';
4
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
5
3
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
6
4
  import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
7
5
  import _createClass from '@babel/runtime/helpers/createClass';
@@ -12,104 +10,16 @@ import sortBy from 'lodash/sortBy';
12
10
  import _callSuper from '@babel/runtime/helpers/callSuper';
13
11
  import _inherits from '@babel/runtime/helpers/inherits';
14
12
  import EventEmitter from 'wolfy87-eventemitter';
15
- import 'lodash/isNumber';
16
- import '@babel/runtime/helpers/regeneratorRuntime';
17
- import '@babel/runtime/helpers/asyncToGenerator';
18
- import 'react';
19
- import isString from 'lodash/isString';
20
- import 'tinycolor2';
21
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
22
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
23
- import 'slugify';
13
+ import { snakeCase, pascalCase } from 'change-case';
24
14
  import uniqBy from 'lodash/uniqBy';
25
15
  import _typeof from '@babel/runtime/helpers/typeof';
16
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
17
+ import isString from 'lodash/isString';
18
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
26
19
  import uniq from 'lodash/uniq';
27
20
  import isEmpty from 'lodash/isEmpty';
28
- import { Tracking as Tracking$1 } from '@folklore/tracking';
29
-
30
- /**
31
- * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
32
- */
33
- /**
34
- * Lower case as a function.
35
- */
36
- function lowerCase(str) {
37
- return str.toLowerCase();
38
- }
39
-
40
- // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
41
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
42
- // Remove all non-word characters.
43
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
44
- /**
45
- * Normalize the string into something other libraries can manipulate easier.
46
- */
47
- function noCase(input, options) {
48
- if (options === void 0) {
49
- options = {};
50
- }
51
- var _a = options.splitRegexp,
52
- splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a,
53
- _b = options.stripRegexp,
54
- stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b,
55
- _c = options.transform,
56
- transform = _c === void 0 ? lowerCase : _c,
57
- _d = options.delimiter,
58
- delimiter = _d === void 0 ? " " : _d;
59
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
60
- var start = 0;
61
- var end = result.length;
62
- // Trim the delimiter from around the output string.
63
- while (result.charAt(start) === "\0") start++;
64
- while (result.charAt(end - 1) === "\0") end--;
65
- // Transform each token independently.
66
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
67
- }
68
- /**
69
- * Replace `re` in the input string with the replacement value.
70
- */
71
- function replace(input, re, value) {
72
- if (re instanceof RegExp) return input.replace(re, value);
73
- return re.reduce(function (input, re) {
74
- return input.replace(re, value);
75
- }, input);
76
- }
77
-
78
- function pascalCaseTransform(input, index) {
79
- var firstChar = input.charAt(0);
80
- var lowerChars = input.substr(1).toLowerCase();
81
- if (index > 0 && firstChar >= "0" && firstChar <= "9") {
82
- return "_" + firstChar + lowerChars;
83
- }
84
- return "" + firstChar.toUpperCase() + lowerChars;
85
- }
86
- function pascalCase(input, options) {
87
- if (options === void 0) {
88
- options = {};
89
- }
90
- return noCase(input, __assign({
91
- delimiter: "",
92
- transform: pascalCaseTransform
93
- }, options));
94
- }
95
-
96
- function dotCase(input, options) {
97
- if (options === void 0) {
98
- options = {};
99
- }
100
- return noCase(input, __assign({
101
- delimiter: "."
102
- }, options));
103
- }
104
-
105
- function snakeCase(input, options) {
106
- if (options === void 0) {
107
- options = {};
108
- }
109
- return dotCase(input, __assign({
110
- delimiter: "_"
111
- }, options));
112
- }
21
+ import { Tracking as Tracking$2 } from '@folklore/tracking';
22
+ import PropTypes$1 from 'prop-types';
113
23
 
114
24
  /**
115
25
  * Core
@@ -998,6 +908,7 @@ var ColorsParser = /*#__PURE__*/function () {
998
908
  }]);
999
909
  return ColorsParser;
1000
910
  }();
911
+ var ColorsParser$1 = ColorsParser;
1001
912
 
1002
913
  var getComponentFromName = function getComponentFromName() {
1003
914
  var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
@@ -1082,6 +993,7 @@ var ComponentsManager = /*#__PURE__*/function (_EventEmitter) {
1082
993
  }]);
1083
994
  return ComponentsManager;
1084
995
  }(EventEmitter);
996
+ var ComponentsManager$1 = ComponentsManager;
1085
997
 
1086
998
  var DefinitionsManager = /*#__PURE__*/function (_EventEmitter) {
1087
999
  _inherits(DefinitionsManager, _EventEmitter);
@@ -1161,6 +1073,7 @@ var DefinitionsManager = /*#__PURE__*/function (_EventEmitter) {
1161
1073
  }]);
1162
1074
  return DefinitionsManager;
1163
1075
  }(EventEmitter);
1076
+ var DefinitionsManager$1 = DefinitionsManager;
1164
1077
 
1165
1078
  var EventsManager = /*#__PURE__*/function (_EventEmitter) {
1166
1079
  _inherits(EventsManager, _EventEmitter);
@@ -1222,6 +1135,7 @@ var EventsManager = /*#__PURE__*/function (_EventEmitter) {
1222
1135
  }]);
1223
1136
  return EventsManager;
1224
1137
  }(EventEmitter);
1138
+ var EventsManager$1 = EventsManager;
1225
1139
 
1226
1140
  var FieldsManager = /*#__PURE__*/function (_DefinitionsManager) {
1227
1141
  _inherits(FieldsManager, _DefinitionsManager);
@@ -1238,7 +1152,8 @@ var FieldsManager = /*#__PURE__*/function (_DefinitionsManager) {
1238
1152
  }
1239
1153
  }]);
1240
1154
  return FieldsManager;
1241
- }(DefinitionsManager);
1155
+ }(DefinitionsManager$1);
1156
+ var FieldsManager$1 = FieldsManager;
1242
1157
 
1243
1158
  var _excluded$4 = ["medias"],
1244
1159
  _excluded2$2 = ["medias"];
@@ -1513,6 +1428,7 @@ var MediasParser = /*#__PURE__*/function () {
1513
1428
  }]);
1514
1429
  return MediasParser;
1515
1430
  }();
1431
+ var MediasParser$1 = MediasParser;
1516
1432
 
1517
1433
  var ScreensManager = /*#__PURE__*/function (_DefinitionsManager) {
1518
1434
  _inherits(ScreensManager, _DefinitionsManager);
@@ -1557,9 +1473,19 @@ var ScreensManager = /*#__PURE__*/function (_DefinitionsManager) {
1557
1473
  // this.definitions = this.definitions.filter(filter);
1558
1474
  // return this;
1559
1475
  }
1476
+ }, {
1477
+ key: "merge",
1478
+ value: function merge(manager) {
1479
+ var newFieldsPattern = manager.getFieldsPattern();
1480
+ if (newFieldsPattern !== null && this.fieldsPattern === null) {
1481
+ this.fieldsPattern = newFieldsPattern;
1482
+ }
1483
+ return this.addDefinitions(manager.getDefinitions());
1484
+ }
1560
1485
  }]);
1561
1486
  return ScreensManager;
1562
- }(DefinitionsManager);
1487
+ }(DefinitionsManager$1);
1488
+ var ScreensManager$1 = ScreensManager;
1563
1489
 
1564
1490
  var _excluded$3 = ["fonts"];
1565
1491
  var FontsParser = /*#__PURE__*/function () {
@@ -1688,6 +1614,7 @@ var FontsParser = /*#__PURE__*/function () {
1688
1614
  }]);
1689
1615
  return FontsParser;
1690
1616
  }();
1617
+ var FontsParser$1 = FontsParser;
1691
1618
 
1692
1619
  var _excluded$2 = ["components"],
1693
1620
  _excluded2$1 = ["shareIncentive", "callToAction"];
@@ -2104,6 +2031,7 @@ var ThemeParser = /*#__PURE__*/function () {
2104
2031
  }]);
2105
2032
  return ThemeParser;
2106
2033
  }();
2034
+ var ThemeParser$1 = ThemeParser;
2107
2035
 
2108
2036
  var StoryParser = /*#__PURE__*/function () {
2109
2037
  function StoryParser(_ref) {
@@ -2116,15 +2044,15 @@ var StoryParser = /*#__PURE__*/function () {
2116
2044
  mediasPattern = _ref2$medias === void 0 ? null : _ref2$medias,
2117
2045
  _ref2$fonts = _ref2.fonts,
2118
2046
  fontsPattern = _ref2$fonts === void 0 ? null : _ref2$fonts;
2119
- this.themeParser = new ThemeParser({
2047
+ this.themeParser = new ThemeParser$1({
2120
2048
  screensManager: screensManager
2121
2049
  });
2122
- this.mediasParser = new MediasParser({
2050
+ this.mediasParser = new MediasParser$1({
2123
2051
  screensManager: screensManager,
2124
2052
  fieldsManager: fieldsManager,
2125
2053
  fieldsPattern: mediasPattern
2126
2054
  });
2127
- this.fontsParser = new FontsParser({
2055
+ this.fontsParser = new FontsParser$1({
2128
2056
  screensManager: screensManager,
2129
2057
  fieldsManager: fieldsManager,
2130
2058
  fieldsPattern: fontsPattern
@@ -2168,6 +2096,7 @@ var StoryParser = /*#__PURE__*/function () {
2168
2096
  }]);
2169
2097
  return StoryParser;
2170
2098
  }();
2099
+ var StoryParser$1 = StoryParser;
2171
2100
 
2172
2101
  var _excluded = ["value"],
2173
2102
  _excluded2 = ["value", "currentTime"];
@@ -2284,6 +2213,7 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2284
2213
  }
2285
2214
  }]);
2286
2215
  return Tracking;
2287
- }(Tracking$1);
2216
+ }(Tracking$2);
2217
+ var Tracking$1 = Tracking;
2288
2218
 
2289
- export { ColorsParser, ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, MediasParser, PropTypes, ScreensManager, StoryParser, ThemeParser, Tracking };
2219
+ export { ColorsParser$1 as ColorsParser, ComponentsManager$1 as ComponentsManager, DefinitionsManager$1 as DefinitionsManager, EventsManager$1 as EventsManager, FieldsManager$1 as FieldsManager, FontsParser$1 as FontsParser, MediasParser$1 as MediasParser, PropTypes, ScreensManager$1 as ScreensManager, StoryParser$1 as StoryParser, ThemeParser$1 as ThemeParser, Tracking$1 as Tracking };