@micromag/core 0.3.508 → 0.3.512
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 +12 -12
- package/assets/css/vendor.css +1 -1
- package/es/components.js +11 -6
- package/es/contexts.js +69 -611
- package/es/index.js +3 -2
- package/es/utils.js +3 -3
- package/lib/components.js +590 -11
- package/lib/contexts.js +72 -617
- package/lib/index.js +105 -70
- package/lib/utils.js +127 -89
- package/package.json +13 -23
- package/scss/_theme.scss +45 -30
- package/scss/vendor.scss +14 -0
package/lib/index.js
CHANGED
|
@@ -12,7 +12,6 @@ var sortBy = require('lodash/sortBy');
|
|
|
12
12
|
var _callSuper = require('@babel/runtime/helpers/callSuper');
|
|
13
13
|
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
14
14
|
var EventEmitter = require('wolfy87-eventemitter');
|
|
15
|
-
var tslib = require('tslib');
|
|
16
15
|
var uniqBy = require('lodash/uniqBy');
|
|
17
16
|
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
18
17
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -23,88 +22,123 @@ var isEmpty = require('lodash/isEmpty');
|
|
|
23
22
|
var tracking = require('@folklore/tracking');
|
|
24
23
|
var PropTypes$1 = require('prop-types');
|
|
25
24
|
|
|
25
|
+
// Regexps involved with splitting words in various case formats.
|
|
26
|
+
const SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
27
|
+
const SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
28
|
+
// Used to iterate over the initial split result and separate numbers.
|
|
29
|
+
const SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
30
|
+
// Regexp involved with stripping non-word characters from the result.
|
|
31
|
+
const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
32
|
+
// The replacement value for splits.
|
|
33
|
+
const SPLIT_REPLACE_VALUE = "$1\0$2";
|
|
34
|
+
// The default characters to keep after transforming case.
|
|
35
|
+
const DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
|
|
26
36
|
/**
|
|
27
|
-
*
|
|
37
|
+
* Split any cased input strings into an array of words.
|
|
28
38
|
*/
|
|
39
|
+
function split(value) {
|
|
40
|
+
let result = value.trim();
|
|
41
|
+
result = result
|
|
42
|
+
.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)
|
|
43
|
+
.replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
|
|
44
|
+
result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
|
|
45
|
+
let start = 0;
|
|
46
|
+
let end = result.length;
|
|
47
|
+
// Trim the delimiter from around the output string.
|
|
48
|
+
while (result.charAt(start) === "\0")
|
|
49
|
+
start++;
|
|
50
|
+
if (start === end)
|
|
51
|
+
return [];
|
|
52
|
+
while (result.charAt(end - 1) === "\0")
|
|
53
|
+
end--;
|
|
54
|
+
return result.slice(start, end).split(/\0/g);
|
|
55
|
+
}
|
|
29
56
|
/**
|
|
30
|
-
*
|
|
57
|
+
* Split the input string into an array of words, separating numbers.
|
|
31
58
|
*/
|
|
32
|
-
function
|
|
33
|
-
|
|
59
|
+
function splitSeparateNumbers(value) {
|
|
60
|
+
const words = split(value);
|
|
61
|
+
for (let i = 0; i < words.length; i++) {
|
|
62
|
+
const word = words[i];
|
|
63
|
+
const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
|
|
64
|
+
if (match) {
|
|
65
|
+
const offset = match.index + (match[1] ?? match[2]).length;
|
|
66
|
+
words.splice(i, 1, word.slice(0, offset), word.slice(offset));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return words;
|
|
34
70
|
}
|
|
35
|
-
|
|
36
|
-
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
|
|
37
|
-
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
|
|
38
|
-
// Remove all non-word characters.
|
|
39
|
-
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
|
|
40
71
|
/**
|
|
41
|
-
*
|
|
72
|
+
* Convert a string to space separated lower case (`foo bar`).
|
|
42
73
|
*/
|
|
43
74
|
function noCase(input, options) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a,
|
|
49
|
-
_b = options.stripRegexp,
|
|
50
|
-
stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b,
|
|
51
|
-
_c = options.transform,
|
|
52
|
-
transform = _c === void 0 ? lowerCase : _c,
|
|
53
|
-
_d = options.delimiter,
|
|
54
|
-
delimiter = _d === void 0 ? " " : _d;
|
|
55
|
-
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
|
|
56
|
-
var start = 0;
|
|
57
|
-
var end = result.length;
|
|
58
|
-
// Trim the delimiter from around the output string.
|
|
59
|
-
while (result.charAt(start) === "\0") start++;
|
|
60
|
-
while (result.charAt(end - 1) === "\0") end--;
|
|
61
|
-
// Transform each token independently.
|
|
62
|
-
return result.slice(start, end).split("\0").map(transform).join(delimiter);
|
|
75
|
+
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
76
|
+
return (prefix +
|
|
77
|
+
words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") +
|
|
78
|
+
suffix);
|
|
63
79
|
}
|
|
64
80
|
/**
|
|
65
|
-
*
|
|
81
|
+
* Convert a string to pascal case (`FooBar`).
|
|
66
82
|
*/
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
83
|
+
function pascalCase(input, options) {
|
|
84
|
+
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
85
|
+
const lower = lowerFactory(options?.locale);
|
|
86
|
+
const upper = upperFactory(options?.locale);
|
|
87
|
+
const transform = options?.mergeAmbiguousCharacters
|
|
88
|
+
? capitalCaseTransformFactory(lower, upper)
|
|
89
|
+
: pascalCaseTransformFactory(lower, upper);
|
|
90
|
+
return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
|
|
72
91
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return "_" + firstChar + lowerChars;
|
|
79
|
-
}
|
|
80
|
-
return "" + firstChar.toUpperCase() + lowerChars;
|
|
92
|
+
/**
|
|
93
|
+
* Convert a string to snake case (`foo_bar`).
|
|
94
|
+
*/
|
|
95
|
+
function snakeCase(input, options) {
|
|
96
|
+
return noCase(input, { delimiter: "_", ...options });
|
|
81
97
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return noCase(input, tslib.__assign({
|
|
87
|
-
delimiter: "",
|
|
88
|
-
transform: pascalCaseTransform
|
|
89
|
-
}, options));
|
|
98
|
+
function lowerFactory(locale) {
|
|
99
|
+
return locale === false
|
|
100
|
+
? (input) => input.toLowerCase()
|
|
101
|
+
: (input) => input.toLocaleLowerCase(locale);
|
|
90
102
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
return noCase(input, tslib.__assign({
|
|
97
|
-
delimiter: "."
|
|
98
|
-
}, options));
|
|
103
|
+
function upperFactory(locale) {
|
|
104
|
+
return locale === false
|
|
105
|
+
? (input) => input.toUpperCase()
|
|
106
|
+
: (input) => input.toLocaleUpperCase(locale);
|
|
99
107
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
function capitalCaseTransformFactory(lower, upper) {
|
|
109
|
+
return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
|
|
110
|
+
}
|
|
111
|
+
function pascalCaseTransformFactory(lower, upper) {
|
|
112
|
+
return (word, index) => {
|
|
113
|
+
const char0 = word[0];
|
|
114
|
+
const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
|
|
115
|
+
return initial + lower(word.slice(1));
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function splitPrefixSuffix(input, options = {}) {
|
|
119
|
+
const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
|
|
120
|
+
const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
121
|
+
const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
122
|
+
let prefixIndex = 0;
|
|
123
|
+
let suffixIndex = input.length;
|
|
124
|
+
while (prefixIndex < input.length) {
|
|
125
|
+
const char = input.charAt(prefixIndex);
|
|
126
|
+
if (!prefixCharacters.includes(char))
|
|
127
|
+
break;
|
|
128
|
+
prefixIndex++;
|
|
129
|
+
}
|
|
130
|
+
while (suffixIndex > prefixIndex) {
|
|
131
|
+
const index = suffixIndex - 1;
|
|
132
|
+
const char = input.charAt(index);
|
|
133
|
+
if (!suffixCharacters.includes(char))
|
|
134
|
+
break;
|
|
135
|
+
suffixIndex = index;
|
|
136
|
+
}
|
|
137
|
+
return [
|
|
138
|
+
input.slice(0, prefixIndex),
|
|
139
|
+
splitFn(input.slice(prefixIndex, suffixIndex)),
|
|
140
|
+
input.slice(suffixIndex),
|
|
141
|
+
];
|
|
108
142
|
}
|
|
109
143
|
|
|
110
144
|
/**
|
|
@@ -292,10 +326,11 @@ var customFont = PropTypes$1.shape({
|
|
|
292
326
|
var font = PropTypes$1.oneOfType([PropTypes$1.object, PropTypes$1.string]);
|
|
293
327
|
var fonts = PropTypes$1.arrayOf(font);
|
|
294
328
|
var textAlign = PropTypes$1.oneOf(['left', 'right', 'center']);
|
|
295
|
-
var
|
|
329
|
+
var colorObject = PropTypes$1.shape({
|
|
296
330
|
color: PropTypes$1.string,
|
|
297
331
|
alpha: PropTypes$1.number
|
|
298
332
|
});
|
|
333
|
+
var color = PropTypes$1.oneOfType([colorObject, PropTypes$1.string]);
|
|
299
334
|
var textStyle = PropTypes$1.shape({
|
|
300
335
|
fontFamily: font,
|
|
301
336
|
fontSize: PropTypes$1.number,
|
|
@@ -739,7 +774,7 @@ var PropTypes = /*#__PURE__*/Object.freeze({
|
|
|
739
774
|
closedCaptions: closedCaptions,
|
|
740
775
|
closedCaptionsElement: closedCaptionsElement,
|
|
741
776
|
closedCaptionsMedia: closedCaptionsMedia,
|
|
742
|
-
|
|
777
|
+
colorObject: colorObject,
|
|
743
778
|
component: component,
|
|
744
779
|
componentNames: componentNames,
|
|
745
780
|
components: components,
|
package/lib/utils.js
CHANGED
|
@@ -4,7 +4,6 @@ var _regeneratorRuntime = require('@babel/runtime/helpers/regeneratorRuntime');
|
|
|
4
4
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
5
5
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
6
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
7
|
-
var tslib = require('tslib');
|
|
8
7
|
var isNumber = require('lodash/isNumber');
|
|
9
8
|
var isObject = require('lodash/isObject');
|
|
10
9
|
var react = require('react');
|
|
@@ -16,115 +15,154 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
16
15
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
17
16
|
var slugify = require('slugify');
|
|
18
17
|
|
|
18
|
+
// Regexps involved with splitting words in various case formats.
|
|
19
|
+
const SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
20
|
+
const SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
21
|
+
// Used to iterate over the initial split result and separate numbers.
|
|
22
|
+
const SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
23
|
+
// Regexp involved with stripping non-word characters from the result.
|
|
24
|
+
const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
25
|
+
// The replacement value for splits.
|
|
26
|
+
const SPLIT_REPLACE_VALUE = "$1\0$2";
|
|
27
|
+
// The default characters to keep after transforming case.
|
|
28
|
+
const DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
|
|
19
29
|
/**
|
|
20
|
-
*
|
|
30
|
+
* Split any cased input strings into an array of words.
|
|
21
31
|
*/
|
|
32
|
+
function split(value) {
|
|
33
|
+
let result = value.trim();
|
|
34
|
+
result = result
|
|
35
|
+
.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)
|
|
36
|
+
.replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
|
|
37
|
+
result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
|
|
38
|
+
let start = 0;
|
|
39
|
+
let end = result.length;
|
|
40
|
+
// Trim the delimiter from around the output string.
|
|
41
|
+
while (result.charAt(start) === "\0")
|
|
42
|
+
start++;
|
|
43
|
+
if (start === end)
|
|
44
|
+
return [];
|
|
45
|
+
while (result.charAt(end - 1) === "\0")
|
|
46
|
+
end--;
|
|
47
|
+
return result.slice(start, end).split(/\0/g);
|
|
48
|
+
}
|
|
22
49
|
/**
|
|
23
|
-
*
|
|
50
|
+
* Split the input string into an array of words, separating numbers.
|
|
24
51
|
*/
|
|
25
|
-
function
|
|
26
|
-
|
|
52
|
+
function splitSeparateNumbers(value) {
|
|
53
|
+
const words = split(value);
|
|
54
|
+
for (let i = 0; i < words.length; i++) {
|
|
55
|
+
const word = words[i];
|
|
56
|
+
const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
|
|
57
|
+
if (match) {
|
|
58
|
+
const offset = match.index + (match[1] ?? match[2]).length;
|
|
59
|
+
words.splice(i, 1, word.slice(0, offset), word.slice(offset));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return words;
|
|
27
63
|
}
|
|
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
64
|
/**
|
|
34
|
-
*
|
|
65
|
+
* Convert a string to space separated lower case (`foo bar`).
|
|
35
66
|
*/
|
|
36
67
|
function noCase(input, options) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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);
|
|
68
|
+
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
69
|
+
return (prefix +
|
|
70
|
+
words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") +
|
|
71
|
+
suffix);
|
|
56
72
|
}
|
|
57
73
|
/**
|
|
58
|
-
*
|
|
74
|
+
* Convert a string to camel case (`fooBar`).
|
|
59
75
|
*/
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
function camelCase(input, options) {
|
|
77
|
+
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
78
|
+
const lower = lowerFactory(options?.locale);
|
|
79
|
+
const upper = upperFactory(options?.locale);
|
|
80
|
+
const transform = options?.mergeAmbiguousCharacters
|
|
81
|
+
? capitalCaseTransformFactory(lower, upper)
|
|
82
|
+
: pascalCaseTransformFactory(lower, upper);
|
|
83
|
+
return (prefix +
|
|
84
|
+
words
|
|
85
|
+
.map((word, index) => {
|
|
86
|
+
if (index === 0)
|
|
87
|
+
return lower(word);
|
|
88
|
+
return transform(word, index);
|
|
89
|
+
})
|
|
90
|
+
.join(options?.delimiter ?? "") +
|
|
91
|
+
suffix);
|
|
74
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Convert a string to pascal case (`FooBar`).
|
|
95
|
+
*/
|
|
75
96
|
function pascalCase(input, options) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
97
|
+
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
98
|
+
const lower = lowerFactory(options?.locale);
|
|
99
|
+
const upper = upperFactory(options?.locale);
|
|
100
|
+
const transform = options?.mergeAmbiguousCharacters
|
|
101
|
+
? capitalCaseTransformFactory(lower, upper)
|
|
102
|
+
: pascalCaseTransformFactory(lower, upper);
|
|
103
|
+
return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
|
|
83
104
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Convert a string to kebab case (`foo-bar`).
|
|
107
|
+
*/
|
|
108
|
+
function kebabCase(input, options) {
|
|
109
|
+
return noCase(input, { delimiter: "-", ...options });
|
|
88
110
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
transform: camelCaseTransform
|
|
95
|
-
}, options));
|
|
111
|
+
/**
|
|
112
|
+
* Convert a string to snake case (`foo_bar`).
|
|
113
|
+
*/
|
|
114
|
+
function snakeCase(input, options) {
|
|
115
|
+
return noCase(input, { delimiter: "_", ...options });
|
|
96
116
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
return noCase(input, tslib.__assign({
|
|
103
|
-
delimiter: "."
|
|
104
|
-
}, options));
|
|
117
|
+
function lowerFactory(locale) {
|
|
118
|
+
return locale === false
|
|
119
|
+
? (input) => input.toLowerCase()
|
|
120
|
+
: (input) => input.toLocaleLowerCase(locale);
|
|
105
121
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
return dotCase(input, tslib.__assign({
|
|
112
|
-
delimiter: "-"
|
|
113
|
-
}, options));
|
|
122
|
+
function upperFactory(locale) {
|
|
123
|
+
return locale === false
|
|
124
|
+
? (input) => input.toUpperCase()
|
|
125
|
+
: (input) => input.toLocaleUpperCase(locale);
|
|
114
126
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
function capitalCaseTransformFactory(lower, upper) {
|
|
128
|
+
return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
|
|
129
|
+
}
|
|
130
|
+
function pascalCaseTransformFactory(lower, upper) {
|
|
131
|
+
return (word, index) => {
|
|
132
|
+
const char0 = word[0];
|
|
133
|
+
const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
|
|
134
|
+
return initial + lower(word.slice(1));
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function splitPrefixSuffix(input, options = {}) {
|
|
138
|
+
const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
|
|
139
|
+
const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
140
|
+
const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
141
|
+
let prefixIndex = 0;
|
|
142
|
+
let suffixIndex = input.length;
|
|
143
|
+
while (prefixIndex < input.length) {
|
|
144
|
+
const char = input.charAt(prefixIndex);
|
|
145
|
+
if (!prefixCharacters.includes(char))
|
|
146
|
+
break;
|
|
147
|
+
prefixIndex++;
|
|
148
|
+
}
|
|
149
|
+
while (suffixIndex > prefixIndex) {
|
|
150
|
+
const index = suffixIndex - 1;
|
|
151
|
+
const char = input.charAt(index);
|
|
152
|
+
if (!suffixCharacters.includes(char))
|
|
153
|
+
break;
|
|
154
|
+
suffixIndex = index;
|
|
155
|
+
}
|
|
156
|
+
return [
|
|
157
|
+
input.slice(0, prefixIndex),
|
|
158
|
+
splitFn(input.slice(prefixIndex, suffixIndex)),
|
|
159
|
+
input.slice(suffixIndex),
|
|
160
|
+
];
|
|
123
161
|
}
|
|
124
162
|
|
|
125
163
|
var convertStyleToString = function convertStyleToString(style) {
|
|
126
164
|
return style !== null ? Object.keys(style).map(function (key) {
|
|
127
|
-
return "".concat(
|
|
165
|
+
return "".concat(kebabCase(key), ":").concat(isNumber(style[key]) ? "".concat(style[key], "px") : style[key], ";");
|
|
128
166
|
}).join('\n') : '';
|
|
129
167
|
};
|
|
130
168
|
var convertStyleToString$1 = convertStyleToString;
|
|
@@ -1272,7 +1310,7 @@ var slug = function slug(str) {
|
|
|
1272
1310
|
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1273
1311
|
var toSlug;
|
|
1274
1312
|
if (separator === '-') {
|
|
1275
|
-
toSlug =
|
|
1313
|
+
toSlug = kebabCase(str);
|
|
1276
1314
|
} else {
|
|
1277
1315
|
toSlug = snakeCase(str);
|
|
1278
1316
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.512",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -112,38 +112,28 @@
|
|
|
112
112
|
"@folklore/services": "^0.1.24",
|
|
113
113
|
"@folklore/size": "^0.1.20",
|
|
114
114
|
"@folklore/tracking": "^0.0.9",
|
|
115
|
-
"@fortawesome/fontawesome-svg-core": "^
|
|
116
|
-
"@fortawesome/free-solid-svg-icons": "^5.
|
|
117
|
-
"@fortawesome/react-fontawesome": "^0.
|
|
115
|
+
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
|
116
|
+
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
|
117
|
+
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
118
|
+
"@panneau/uppy": "^3.0.162",
|
|
118
119
|
"@react-spring/core": "^9.6.1",
|
|
119
120
|
"@react-spring/web": "^9.6.1",
|
|
120
|
-
"@
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"@uppy/facebook": "^2.0.5",
|
|
124
|
-
"@uppy/google-drive": "^2.0.5",
|
|
125
|
-
"@uppy/instagram": "^2.0.5",
|
|
126
|
-
"@uppy/locales": "^2.0.5",
|
|
127
|
-
"@uppy/react": "^2.1.2",
|
|
128
|
-
"@uppy/tus": "^2.2.0",
|
|
129
|
-
"@uppy/webcam": "^2.0.5",
|
|
130
|
-
"@uppy/xhr-upload": "^2.0.7",
|
|
131
|
-
"@use-gesture/react": "^10.3.0",
|
|
132
|
-
"bootstrap": "^5.3.0",
|
|
133
|
-
"change-case": "^4.0.0",
|
|
121
|
+
"@use-gesture/react": "^10.3.1",
|
|
122
|
+
"bootstrap": "^5.3.1",
|
|
123
|
+
"change-case": "^5.4.4",
|
|
134
124
|
"classnames": "^2.2.6",
|
|
135
125
|
"css-mediaquery": "^0.1.2",
|
|
136
126
|
"dayjs": "^1.11.10",
|
|
137
127
|
"debug": "^4.3.4",
|
|
138
|
-
"flat": "^
|
|
128
|
+
"flat": "^6.0.1",
|
|
139
129
|
"hoist-non-react-statics": "^3.3.2",
|
|
140
130
|
"lodash": "^4.17.21",
|
|
141
131
|
"prop-types": "^15.7.2",
|
|
142
|
-
"query-string": "^
|
|
132
|
+
"query-string": "^9.0.0",
|
|
143
133
|
"raf": "^3.4.1",
|
|
144
134
|
"react-helmet": "^6.1.0",
|
|
145
|
-
"react-intl": "^6.6.
|
|
146
|
-
"screenfull": "^5.
|
|
135
|
+
"react-intl": "^6.6.4",
|
|
136
|
+
"screenfull": "^5.2.0",
|
|
147
137
|
"slugify": "^1.6.5",
|
|
148
138
|
"tinycolor2": "^1.4.2",
|
|
149
139
|
"uuid": "^9.0.0",
|
|
@@ -155,5 +145,5 @@
|
|
|
155
145
|
"access": "public",
|
|
156
146
|
"registry": "https://registry.npmjs.org/"
|
|
157
147
|
},
|
|
158
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "23de9c46447bade478129227281870191d4fcc94"
|
|
159
149
|
}
|