@micromag/core 0.3.541 → 0.3.547
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/vendor.css +1 -1
- package/es/components.js +27 -30
- package/package.json +3 -4
- package/lib/components.js +0 -5370
- package/lib/contexts.js +0 -1848
- package/lib/hooks.js +0 -2402
- package/lib/index.js +0 -2387
- package/lib/utils.js +0 -1409
package/lib/utils.js
DELETED
|
@@ -1,1409 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _regeneratorRuntime = require('@babel/runtime/helpers/regeneratorRuntime');
|
|
4
|
-
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
5
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
-
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
7
|
-
var isNumber = require('lodash/isNumber');
|
|
8
|
-
var isObject = require('lodash/isObject');
|
|
9
|
-
var react = require('react');
|
|
10
|
-
var isString = require('lodash/isString');
|
|
11
|
-
var tinycolor = require('tinycolor2');
|
|
12
|
-
var isArray = require('lodash/isArray');
|
|
13
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
14
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
15
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
16
|
-
var slugify = require('slugify');
|
|
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 = "";
|
|
29
|
-
/**
|
|
30
|
-
* Split any cased input strings into an array of words.
|
|
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
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Split the input string into an array of words, separating numbers.
|
|
51
|
-
*/
|
|
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;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Convert a string to space separated lower case (`foo bar`).
|
|
66
|
-
*/
|
|
67
|
-
function noCase(input, options) {
|
|
68
|
-
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
69
|
-
return (prefix +
|
|
70
|
-
words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") +
|
|
71
|
-
suffix);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Convert a string to camel case (`fooBar`).
|
|
75
|
-
*/
|
|
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);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Convert a string to pascal case (`FooBar`).
|
|
95
|
-
*/
|
|
96
|
-
function pascalCase(input, options) {
|
|
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;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Convert a string to kebab case (`foo-bar`).
|
|
107
|
-
*/
|
|
108
|
-
function kebabCase(input, options) {
|
|
109
|
-
return noCase(input, { delimiter: "-", ...options });
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Convert a string to snake case (`foo_bar`).
|
|
113
|
-
*/
|
|
114
|
-
function snakeCase(input, options) {
|
|
115
|
-
return noCase(input, { delimiter: "_", ...options });
|
|
116
|
-
}
|
|
117
|
-
function lowerFactory(locale) {
|
|
118
|
-
return locale === false
|
|
119
|
-
? (input) => input.toLowerCase()
|
|
120
|
-
: (input) => input.toLocaleLowerCase(locale);
|
|
121
|
-
}
|
|
122
|
-
function upperFactory(locale) {
|
|
123
|
-
return locale === false
|
|
124
|
-
? (input) => input.toUpperCase()
|
|
125
|
-
: (input) => input.toLocaleUpperCase(locale);
|
|
126
|
-
}
|
|
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
|
-
];
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
var convertStyleToString = function convertStyleToString(style) {
|
|
164
|
-
return style !== null ? Object.keys(style).map(function (key) {
|
|
165
|
-
return "".concat(kebabCase(key), ":").concat(isNumber(style[key]) ? "".concat(style[key], "px") : style[key], ";");
|
|
166
|
-
}).join('\n') : '';
|
|
167
|
-
};
|
|
168
|
-
var convertStyleToString$1 = convertStyleToString;
|
|
169
|
-
|
|
170
|
-
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
171
|
-
|
|
172
|
-
// @note vendoring this: https://github.com/feross/clipboard-copy/blob/master/index.js
|
|
173
|
-
// we might want to add that to the npm deps and just use it
|
|
174
|
-
|
|
175
|
-
function makeError() {
|
|
176
|
-
return new DOMException('The request is not allowed', 'NotAllowedError');
|
|
177
|
-
}
|
|
178
|
-
function copyClipboardApi(_x) {
|
|
179
|
-
return _copyClipboardApi.apply(this, arguments);
|
|
180
|
-
}
|
|
181
|
-
function _copyClipboardApi() {
|
|
182
|
-
_copyClipboardApi = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(text) {
|
|
183
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
184
|
-
while (1) switch (_context.prev = _context.next) {
|
|
185
|
-
case 0:
|
|
186
|
-
if (navigator.clipboard) {
|
|
187
|
-
_context.next = 2;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
throw makeError();
|
|
191
|
-
case 2:
|
|
192
|
-
return _context.abrupt("return", navigator.clipboard.writeText(text));
|
|
193
|
-
case 3:
|
|
194
|
-
case "end":
|
|
195
|
-
return _context.stop();
|
|
196
|
-
}
|
|
197
|
-
}, _callee);
|
|
198
|
-
}));
|
|
199
|
-
return _copyClipboardApi.apply(this, arguments);
|
|
200
|
-
}
|
|
201
|
-
function copyExecCommand(_x2) {
|
|
202
|
-
return _copyExecCommand.apply(this, arguments);
|
|
203
|
-
}
|
|
204
|
-
function _copyExecCommand() {
|
|
205
|
-
_copyExecCommand = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(text) {
|
|
206
|
-
var span, selection, range, success;
|
|
207
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
208
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
209
|
-
case 0:
|
|
210
|
-
// Put the text to copy into a <span>
|
|
211
|
-
span = document.createElement('span');
|
|
212
|
-
span.textContent = text;
|
|
213
|
-
|
|
214
|
-
// Preserve consecutive spaces and newlines
|
|
215
|
-
span.style.whiteSpace = 'pre';
|
|
216
|
-
span.style.webkitUserSelect = 'auto';
|
|
217
|
-
span.style.userSelect = 'all';
|
|
218
|
-
|
|
219
|
-
// Add the <span> to the page
|
|
220
|
-
document.body.appendChild(span);
|
|
221
|
-
|
|
222
|
-
// Make a selection object representing the range of text selected by the user
|
|
223
|
-
selection = window.getSelection();
|
|
224
|
-
range = window.document.createRange();
|
|
225
|
-
selection.removeAllRanges();
|
|
226
|
-
range.selectNode(span);
|
|
227
|
-
selection.addRange(range);
|
|
228
|
-
|
|
229
|
-
// Copy text to the clipboard
|
|
230
|
-
success = false;
|
|
231
|
-
try {
|
|
232
|
-
success = window.document.execCommand('copy');
|
|
233
|
-
} finally {
|
|
234
|
-
// Cleanup
|
|
235
|
-
selection.removeAllRanges();
|
|
236
|
-
window.document.body.removeChild(span);
|
|
237
|
-
}
|
|
238
|
-
if (success) {
|
|
239
|
-
_context2.next = 15;
|
|
240
|
-
break;
|
|
241
|
-
}
|
|
242
|
-
throw makeError();
|
|
243
|
-
case 15:
|
|
244
|
-
case "end":
|
|
245
|
-
return _context2.stop();
|
|
246
|
-
}
|
|
247
|
-
}, _callee2);
|
|
248
|
-
}));
|
|
249
|
-
return _copyExecCommand.apply(this, arguments);
|
|
250
|
-
}
|
|
251
|
-
function copyToClipboard(_x3) {
|
|
252
|
-
return _copyToClipboard.apply(this, arguments);
|
|
253
|
-
}
|
|
254
|
-
function _copyToClipboard() {
|
|
255
|
-
_copyToClipboard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(text) {
|
|
256
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
257
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
258
|
-
case 0:
|
|
259
|
-
_context3.prev = 0;
|
|
260
|
-
_context3.next = 3;
|
|
261
|
-
return copyClipboardApi(text);
|
|
262
|
-
case 3:
|
|
263
|
-
_context3.next = 15;
|
|
264
|
-
break;
|
|
265
|
-
case 5:
|
|
266
|
-
_context3.prev = 5;
|
|
267
|
-
_context3.t0 = _context3["catch"](0);
|
|
268
|
-
_context3.prev = 7;
|
|
269
|
-
_context3.next = 10;
|
|
270
|
-
return copyExecCommand(text);
|
|
271
|
-
case 10:
|
|
272
|
-
_context3.next = 15;
|
|
273
|
-
break;
|
|
274
|
-
case 12:
|
|
275
|
-
_context3.prev = 12;
|
|
276
|
-
_context3.t1 = _context3["catch"](7);
|
|
277
|
-
throw _context3.t1 || _context3.t0 || makeError();
|
|
278
|
-
case 15:
|
|
279
|
-
case "end":
|
|
280
|
-
return _context3.stop();
|
|
281
|
-
}
|
|
282
|
-
}, _callee3, null, [[0, 5], [7, 12]]);
|
|
283
|
-
}));
|
|
284
|
-
return _copyToClipboard.apply(this, arguments);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
var createNullableOnChange = function createNullableOnChange() {
|
|
288
|
-
var onChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
289
|
-
return function (newValue) {
|
|
290
|
-
var nullableValue = newValue;
|
|
291
|
-
if (isObject(newValue)) {
|
|
292
|
-
var allNull = Object.keys(newValue).reduce(function (acc, key) {
|
|
293
|
-
return acc && newValue[key] === null;
|
|
294
|
-
}, true);
|
|
295
|
-
if (allNull) {
|
|
296
|
-
nullableValue = null;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
if (onChange !== null) {
|
|
300
|
-
onChange(nullableValue);
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
var createNullableOnChange$1 = createNullableOnChange;
|
|
305
|
-
|
|
306
|
-
var createUseEvent = function createUseEvent(eventsManager) {
|
|
307
|
-
return function (event, callback) {
|
|
308
|
-
var enabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
309
|
-
react.useEffect(function () {
|
|
310
|
-
if (enabled && eventsManager !== null) {
|
|
311
|
-
eventsManager.subscribe(event, callback);
|
|
312
|
-
}
|
|
313
|
-
return function () {
|
|
314
|
-
if (enabled && eventsManager !== null) {
|
|
315
|
-
eventsManager.unsubscribe(event, callback);
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
}, [eventsManager, event, callback, enabled]);
|
|
319
|
-
};
|
|
320
|
-
};
|
|
321
|
-
var createUseEvent$1 = createUseEvent;
|
|
322
|
-
|
|
323
|
-
/* eslint-disable */
|
|
324
|
-
var easings = {
|
|
325
|
-
linear: function linear(x) {
|
|
326
|
-
return x;
|
|
327
|
-
},
|
|
328
|
-
easeInQuad: function easeInQuad(x) {
|
|
329
|
-
return x * x;
|
|
330
|
-
},
|
|
331
|
-
easeOutQuad: function easeOutQuad(x) {
|
|
332
|
-
return 1 - (1 - x) * (1 - x);
|
|
333
|
-
},
|
|
334
|
-
easeInOutQuad: function easeInOutQuad(x) {
|
|
335
|
-
return x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2;
|
|
336
|
-
},
|
|
337
|
-
easeInCubic: function easeInCubic(x) {
|
|
338
|
-
return x * x * x;
|
|
339
|
-
},
|
|
340
|
-
easeOutCubic: function easeOutCubic(x) {
|
|
341
|
-
return 1 - Math.pow(1 - x, 3);
|
|
342
|
-
},
|
|
343
|
-
easeInOutCubic: function easeInOutCubic(x) {
|
|
344
|
-
return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;
|
|
345
|
-
},
|
|
346
|
-
easeInQuart: function easeInQuart(x) {
|
|
347
|
-
return x * x * x * x;
|
|
348
|
-
},
|
|
349
|
-
easeOutQuart: function easeOutQuart(x) {
|
|
350
|
-
return 1 - Math.pow(1 - x, 4);
|
|
351
|
-
},
|
|
352
|
-
easeInOutQuart: function easeInOutQuart(x) {
|
|
353
|
-
return x < 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2;
|
|
354
|
-
},
|
|
355
|
-
easeInQuint: function easeInQuint(x) {
|
|
356
|
-
return x * x * x * x * x;
|
|
357
|
-
},
|
|
358
|
-
easeOutQuint: function easeOutQuint(x) {
|
|
359
|
-
return 1 - Math.pow(1 - x, 5);
|
|
360
|
-
},
|
|
361
|
-
easeInOutQuint: function easeInOutQuint(x) {
|
|
362
|
-
return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
|
|
363
|
-
},
|
|
364
|
-
easeInSine: function easeInSine(x) {
|
|
365
|
-
return 1 - Math.cos(x * Math.PI / 2);
|
|
366
|
-
},
|
|
367
|
-
easeOutSine: function easeOutSine(x) {
|
|
368
|
-
return Math.sin(x * Math.PI / 2);
|
|
369
|
-
},
|
|
370
|
-
easeInOutSine: function easeInOutSine(x) {
|
|
371
|
-
return -(Math.cos(Math.PI * x) - 1) / 2;
|
|
372
|
-
},
|
|
373
|
-
easeInExpo: function easeInExpo(x) {
|
|
374
|
-
return x === 0 ? 0 : Math.pow(2, 10 * x - 10);
|
|
375
|
-
},
|
|
376
|
-
easeOutExpo: function easeOutExpo(x) {
|
|
377
|
-
return x === 1 ? 1 : 1 - Math.pow(2, -10 * x);
|
|
378
|
-
},
|
|
379
|
-
easeInOutExpo: function easeInOutExpo(x) {
|
|
380
|
-
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? Math.pow(2, 20 * x - 10) / 2 : (2 - Math.pow(2, -20 * x + 10)) / 2;
|
|
381
|
-
},
|
|
382
|
-
easeInCirc: function easeInCirc(x) {
|
|
383
|
-
return 1 - Math.sqrt(1 - Math.pow(x, 2));
|
|
384
|
-
},
|
|
385
|
-
easeOutCirc: function easeOutCirc(x) {
|
|
386
|
-
return Math.sqrt(1 - Math.pow(x - 1, 2));
|
|
387
|
-
},
|
|
388
|
-
easeInOutCirc: function easeInOutCirc(x) {
|
|
389
|
-
return x < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * x, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * x + 2, 2)) + 1) / 2;
|
|
390
|
-
},
|
|
391
|
-
easeInBack: function easeInBack(x) {
|
|
392
|
-
return c3 * x * x * x - c1 * x * x;
|
|
393
|
-
},
|
|
394
|
-
easeOutBack: function easeOutBack(x) {
|
|
395
|
-
return 1 + c3 * Math.pow(x - 1, 3) + c1 * Math.pow(x - 1, 2);
|
|
396
|
-
},
|
|
397
|
-
easeInOutBack: function easeInOutBack(x) {
|
|
398
|
-
return x < 0.5 ? Math.pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (Math.pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
|
|
399
|
-
},
|
|
400
|
-
easeInElastic: function easeInElastic(x) {
|
|
401
|
-
return x === 0 ? 0 : x === 1 ? 1 : -Math.pow(2, 10 * x - 10) * Math.sin((x * 10 - 10.75) * c4);
|
|
402
|
-
},
|
|
403
|
-
easeOutElastic: function easeOutElastic(x) {
|
|
404
|
-
return x === 0 ? 0 : x === 1 ? 1 : Math.pow(2, -10 * x) * Math.sin((x * 10 - 0.75) * c4) + 1;
|
|
405
|
-
},
|
|
406
|
-
easeInOutElastic: function easeInOutElastic(x) {
|
|
407
|
-
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5)) / 2 : Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5) / 2 + 1;
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
/* eslint-enable */
|
|
411
|
-
|
|
412
|
-
var easings$1 = easings;
|
|
413
|
-
|
|
414
|
-
var getColorAsString = function getColorAsString() {
|
|
415
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
416
|
-
var overideAlpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
417
|
-
if (value === null) {
|
|
418
|
-
return null;
|
|
419
|
-
}
|
|
420
|
-
var _ref = isString(value) ? {
|
|
421
|
-
color: value
|
|
422
|
-
} : value,
|
|
423
|
-
_ref$color = _ref.color,
|
|
424
|
-
color = _ref$color === void 0 ? null : _ref$color,
|
|
425
|
-
_ref$alpha = _ref.alpha,
|
|
426
|
-
alpha = _ref$alpha === void 0 ? null : _ref$alpha;
|
|
427
|
-
return alpha !== null || overideAlpha !== null ? tinycolor(color).setAlpha(overideAlpha !== null ? overideAlpha : alpha).toRgbString() : color;
|
|
428
|
-
};
|
|
429
|
-
var getColorAsString$1 = getColorAsString;
|
|
430
|
-
|
|
431
|
-
var getComponentFromName = function getComponentFromName() {
|
|
432
|
-
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
433
|
-
var components = arguments.length > 1 ? arguments[1] : undefined;
|
|
434
|
-
var defaultComponent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
435
|
-
if (components === null || name === null) {
|
|
436
|
-
return defaultComponent;
|
|
437
|
-
}
|
|
438
|
-
var pascalName = pascalCase(name);
|
|
439
|
-
return components[pascalName] || components[name] || defaultComponent;
|
|
440
|
-
};
|
|
441
|
-
var getComponentFromName$1 = getComponentFromName;
|
|
442
|
-
|
|
443
|
-
var deviceScreens = [{
|
|
444
|
-
name: 'mobile'
|
|
445
|
-
}, {
|
|
446
|
-
name: 'small',
|
|
447
|
-
mediaQuery: 'only screen and (min-width: 500px)'
|
|
448
|
-
}, {
|
|
449
|
-
name: 'medium',
|
|
450
|
-
mediaQuery: 'only screen and (min-width: 790px)'
|
|
451
|
-
}, {
|
|
452
|
-
name: 'large',
|
|
453
|
-
mediaQuery: 'only screen and (min-width: 1000px)'
|
|
454
|
-
}, {
|
|
455
|
-
name: 'very-large',
|
|
456
|
-
mediaQuery: 'only screen and (min-width: 1600px)'
|
|
457
|
-
}];
|
|
458
|
-
|
|
459
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
460
|
-
var getDeviceScreens = function getDeviceScreens() {
|
|
461
|
-
return deviceScreens;
|
|
462
|
-
};
|
|
463
|
-
var getDeviceScreens$1 = getDeviceScreens;
|
|
464
|
-
|
|
465
|
-
var getDisplayName = function getDisplayName(_ref) {
|
|
466
|
-
var _ref$displayName = _ref.displayName,
|
|
467
|
-
displayName = _ref$displayName === void 0 ? null : _ref$displayName,
|
|
468
|
-
_ref$name = _ref.name,
|
|
469
|
-
name = _ref$name === void 0 ? null : _ref$name;
|
|
470
|
-
return displayName || name || 'Component';
|
|
471
|
-
};
|
|
472
|
-
var getDisplayName$1 = getDisplayName;
|
|
473
|
-
|
|
474
|
-
var getFieldByName = function getFieldByName(fields, name) {
|
|
475
|
-
return fields.reduce(function (foundField, it) {
|
|
476
|
-
if (foundField !== null) {
|
|
477
|
-
return foundField;
|
|
478
|
-
}
|
|
479
|
-
var _it$name = it.name,
|
|
480
|
-
fieldName = _it$name === void 0 ? null : _it$name,
|
|
481
|
-
_it$fields = it.fields,
|
|
482
|
-
subFields = _it$fields === void 0 ? [] : _it$fields;
|
|
483
|
-
if (name !== null && fieldName === name) {
|
|
484
|
-
return it;
|
|
485
|
-
}
|
|
486
|
-
return getFieldByName(subFields, name);
|
|
487
|
-
}, null);
|
|
488
|
-
};
|
|
489
|
-
var getFieldByName$1 = getFieldByName;
|
|
490
|
-
|
|
491
|
-
var getFieldFromPath = function getFieldFromPath(path, fields, fieldManager) {
|
|
492
|
-
return (isArray(path) ? path : [path]).reduce(function (foundField, key) {
|
|
493
|
-
if (foundField === null) {
|
|
494
|
-
return null;
|
|
495
|
-
}
|
|
496
|
-
var _foundField$type = foundField.type,
|
|
497
|
-
type = _foundField$type === void 0 ? null : _foundField$type,
|
|
498
|
-
_foundField$fields = foundField.fields,
|
|
499
|
-
fieldFields = _foundField$fields === void 0 ? null : _foundField$fields,
|
|
500
|
-
_foundField$field = foundField.field,
|
|
501
|
-
field = _foundField$field === void 0 ? null : _foundField$field,
|
|
502
|
-
_foundField$itemsFiel = foundField.itemsField,
|
|
503
|
-
itemsField = _foundField$itemsFiel === void 0 ? null : _foundField$itemsFiel;
|
|
504
|
-
var finalType = field !== null ? field.type || type : type;
|
|
505
|
-
var definition = fieldManager.getDefinition(finalType);
|
|
506
|
-
var _ref = finalType !== null ? definition : foundField,
|
|
507
|
-
_ref$fields = _ref.fields,
|
|
508
|
-
subFields = _ref$fields === void 0 ? null : _ref$fields,
|
|
509
|
-
_ref$settings = _ref.settings,
|
|
510
|
-
settings = _ref$settings === void 0 ? null : _ref$settings,
|
|
511
|
-
_ref$itemsField = _ref.itemsField,
|
|
512
|
-
defItemsField = _ref$itemsField === void 0 ? null : _ref$itemsField;
|
|
513
|
-
var finalItemsField = itemsField || defItemsField;
|
|
514
|
-
if (finalItemsField !== null && key.match(/^[0-9]+$/)) {
|
|
515
|
-
return _objectSpread(_objectSpread({}, finalItemsField), {}, {
|
|
516
|
-
name: path.join('/'),
|
|
517
|
-
listItems: true
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
return getFieldByName$1([].concat(_toConsumableArray(fieldFields || []), _toConsumableArray(subFields || []), _toConsumableArray(settings || [])), key);
|
|
521
|
-
}, {
|
|
522
|
-
fields: fields
|
|
523
|
-
});
|
|
524
|
-
};
|
|
525
|
-
var getFieldFromPath$1 = getFieldFromPath;
|
|
526
|
-
|
|
527
|
-
var getFileName = function getFileName() {
|
|
528
|
-
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
529
|
-
if (url === null || typeof url.match === 'undefined') {
|
|
530
|
-
return null;
|
|
531
|
-
}
|
|
532
|
-
return url.match(/([^/]+)(\?.*)?$/)[1] || url;
|
|
533
|
-
};
|
|
534
|
-
var getFileName$1 = getFileName;
|
|
535
|
-
|
|
536
|
-
var getFontFamily = function getFontFamily(value) {
|
|
537
|
-
if (value == null) {
|
|
538
|
-
return null;
|
|
539
|
-
}
|
|
540
|
-
var _ref = isObject(value) ? value : {
|
|
541
|
-
name: value
|
|
542
|
-
},
|
|
543
|
-
name = _ref.name,
|
|
544
|
-
_ref$fallback = _ref.fallback,
|
|
545
|
-
fallback = _ref$fallback === void 0 ? null : _ref$fallback;
|
|
546
|
-
return [name, fallback].filter(function (it) {
|
|
547
|
-
return it !== null;
|
|
548
|
-
}).map(function (it) {
|
|
549
|
-
return "\"".concat(it, "\"");
|
|
550
|
-
}).join(', ');
|
|
551
|
-
};
|
|
552
|
-
var getFontFamilyFromFont = getFontFamily;
|
|
553
|
-
|
|
554
|
-
var _excluded$1 = ["isPreview", "isView", "current", "openWebView", "enableInteraction", "disableInteraction"];
|
|
555
|
-
var getFooterProps = function getFooterProps() {
|
|
556
|
-
var footer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
557
|
-
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
558
|
-
_ref$isPreview = _ref.isPreview,
|
|
559
|
-
isPreview = _ref$isPreview === void 0 ? false : _ref$isPreview,
|
|
560
|
-
_ref$isView = _ref.isView,
|
|
561
|
-
isView = _ref$isView === void 0 ? false : _ref$isView,
|
|
562
|
-
_ref$current = _ref.current,
|
|
563
|
-
current = _ref$current === void 0 ? false : _ref$current,
|
|
564
|
-
_ref$openWebView = _ref.openWebView,
|
|
565
|
-
openWebView = _ref$openWebView === void 0 ? false : _ref$openWebView,
|
|
566
|
-
_ref$enableInteractio = _ref.enableInteraction,
|
|
567
|
-
enableInteraction = _ref$enableInteractio === void 0 ? true : _ref$enableInteractio,
|
|
568
|
-
_ref$disableInteracti = _ref.disableInteraction,
|
|
569
|
-
disableInteraction = _ref$disableInteracti === void 0 ? false : _ref$disableInteracti,
|
|
570
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
571
|
-
var _ref2 = footer || {},
|
|
572
|
-
_ref2$callToAction = _ref2.callToAction,
|
|
573
|
-
callToAction = _ref2$callToAction === void 0 ? null : _ref2$callToAction;
|
|
574
|
-
var footerProps = react.useMemo(function () {
|
|
575
|
-
return {
|
|
576
|
-
callToAction: _objectSpread(_objectSpread({}, callToAction), {}, {
|
|
577
|
-
animationDisabled: isPreview,
|
|
578
|
-
focusable: current && isView,
|
|
579
|
-
openWebView: openWebView,
|
|
580
|
-
enableInteraction: enableInteraction,
|
|
581
|
-
disableInteraction: disableInteraction
|
|
582
|
-
}, otherProps)
|
|
583
|
-
};
|
|
584
|
-
}, [callToAction, isPreview, isView, current, enableInteraction, disableInteraction, otherProps]);
|
|
585
|
-
return footerProps;
|
|
586
|
-
};
|
|
587
|
-
var getFooterProps$1 = getFooterProps;
|
|
588
|
-
|
|
589
|
-
var getGridLayoutName = function getGridLayoutName(layout) {
|
|
590
|
-
return layout.map(function (it) {
|
|
591
|
-
return "".concat(it.rows, "_").concat(it.columns.join('_'));
|
|
592
|
-
}).join('|');
|
|
593
|
-
};
|
|
594
|
-
var getGridLayoutName$1 = getGridLayoutName;
|
|
595
|
-
|
|
596
|
-
var getRemainder = function getRemainder(number) {
|
|
597
|
-
var remainder = number - Math.floor(number);
|
|
598
|
-
return remainder.toFixed(4);
|
|
599
|
-
};
|
|
600
|
-
var largestRemainderRound = function largestRemainderRound(numbers, desiredTotal) {
|
|
601
|
-
if (!isArray(numbers) || numbers.length < 1) return numbers;
|
|
602
|
-
var result = numbers.map(function (number, index) {
|
|
603
|
-
return {
|
|
604
|
-
floor: Math.floor(number) || 0,
|
|
605
|
-
remainder: getRemainder(number),
|
|
606
|
-
index: index
|
|
607
|
-
};
|
|
608
|
-
}).sort(function (a, b) {
|
|
609
|
-
return b.remainder - a.remainder;
|
|
610
|
-
});
|
|
611
|
-
var lowerSum = result.reduce(function (sum, current) {
|
|
612
|
-
return sum + current.floor;
|
|
613
|
-
}, 0);
|
|
614
|
-
var delta = desiredTotal - lowerSum;
|
|
615
|
-
for (var i = 0; i < delta; i += 1) {
|
|
616
|
-
if (result[i]) {
|
|
617
|
-
result[i].floor += 1;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
return result.sort(function (a, b) {
|
|
621
|
-
return a.index - b.index;
|
|
622
|
-
}).map(function (res) {
|
|
623
|
-
return res.floor;
|
|
624
|
-
});
|
|
625
|
-
};
|
|
626
|
-
var largestRemainderRound$1 = largestRemainderRound;
|
|
627
|
-
|
|
628
|
-
var _excluded = ["image", "video", "media", "color"];
|
|
629
|
-
var getLayersFromBackground = function getLayersFromBackground() {
|
|
630
|
-
var background = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
631
|
-
if (background === null) {
|
|
632
|
-
return [];
|
|
633
|
-
}
|
|
634
|
-
return (isArray(background) ? background : [background]).reduce(function (layers, _ref) {
|
|
635
|
-
var _ref$image = _ref.image,
|
|
636
|
-
image = _ref$image === void 0 ? null : _ref$image,
|
|
637
|
-
_ref$video = _ref.video,
|
|
638
|
-
video = _ref$video === void 0 ? null : _ref$video,
|
|
639
|
-
_ref$media = _ref.media,
|
|
640
|
-
media = _ref$media === void 0 ? null : _ref$media,
|
|
641
|
-
_ref$color = _ref.color,
|
|
642
|
-
color = _ref$color === void 0 ? null : _ref$color,
|
|
643
|
-
data = _objectWithoutProperties(_ref, _excluded);
|
|
644
|
-
if (image === null && video === null && color === null) {
|
|
645
|
-
return layers;
|
|
646
|
-
}
|
|
647
|
-
if (image !== null && video !== null) {
|
|
648
|
-
return [].concat(_toConsumableArray(layers), [_objectSpread({
|
|
649
|
-
media: image
|
|
650
|
-
}, data), _objectSpread({
|
|
651
|
-
media: video,
|
|
652
|
-
color: color
|
|
653
|
-
}, data)]);
|
|
654
|
-
}
|
|
655
|
-
return [].concat(_toConsumableArray(layers), [_objectSpread({
|
|
656
|
-
media: media || image || video,
|
|
657
|
-
color: color
|
|
658
|
-
}, data)]);
|
|
659
|
-
}, []);
|
|
660
|
-
};
|
|
661
|
-
var getLayersFromBackground$1 = getLayersFromBackground;
|
|
662
|
-
|
|
663
|
-
var getMediaFilesAsArray = function getMediaFilesAsArray(files) {
|
|
664
|
-
return files !== null && isArray(files) ? files : Object.keys(files || {}).reduce(function (newFiles, key) {
|
|
665
|
-
return [].concat(_toConsumableArray(newFiles), [_objectSpread({
|
|
666
|
-
handle: key
|
|
667
|
-
}, files[key])]);
|
|
668
|
-
}, []);
|
|
669
|
-
};
|
|
670
|
-
var getMediaFilesAsArray$1 = getMediaFilesAsArray;
|
|
671
|
-
|
|
672
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
673
|
-
var getOptimalImageUrl = function getOptimalImageUrl() {
|
|
674
|
-
var media = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
675
|
-
var containerWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
676
|
-
var containerHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
677
|
-
var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
|
678
|
-
_ref$resolution = _ref.resolution,
|
|
679
|
-
resolution = _ref$resolution === void 0 ? 1 : _ref$resolution,
|
|
680
|
-
_ref$maxDiff = _ref.maxDiff,
|
|
681
|
-
maxDiff = _ref$maxDiff === void 0 ? 800 : _ref$maxDiff;
|
|
682
|
-
var _ref2 = media || {},
|
|
683
|
-
_ref2$sizes = _ref2.sizes,
|
|
684
|
-
sizes = _ref2$sizes === void 0 ? null : _ref2$sizes,
|
|
685
|
-
_ref2$url = _ref2.url,
|
|
686
|
-
defaultUrl = _ref2$url === void 0 ? null : _ref2$url,
|
|
687
|
-
_ref2$metadata = _ref2.metadata,
|
|
688
|
-
_ref2$metadata2 = _ref2$metadata === void 0 ? {} : _ref2$metadata,
|
|
689
|
-
imgWidth = _ref2$metadata2.width,
|
|
690
|
-
imgHeight = _ref2$metadata2.height;
|
|
691
|
-
if (sizes === null || containerWidth === null && containerHeight === null) {
|
|
692
|
-
return defaultUrl;
|
|
693
|
-
}
|
|
694
|
-
var finalSizes = _objectSpread({
|
|
695
|
-
original: {
|
|
696
|
-
url: defaultUrl,
|
|
697
|
-
width: imgWidth,
|
|
698
|
-
height: imgHeight
|
|
699
|
-
}
|
|
700
|
-
}, sizes);
|
|
701
|
-
var finalContainerWidth = containerWidth !== null && resolution !== null ? containerWidth * resolution : containerWidth;
|
|
702
|
-
var finalContainerHeight = containerHeight !== null && resolution !== null ? containerHeight * resolution : containerHeight;
|
|
703
|
-
var _Object$keys$reduce = Object.keys(finalSizes).reduce(function (acc, key) {
|
|
704
|
-
var currentDiff = acc.diff,
|
|
705
|
-
currentIsLarger = acc.isLarger,
|
|
706
|
-
currentSize = acc.size;
|
|
707
|
-
var _finalSizes$key = finalSizes[key],
|
|
708
|
-
url = _finalSizes$key.url,
|
|
709
|
-
_finalSizes$key$width = _finalSizes$key.width,
|
|
710
|
-
width = _finalSizes$key$width === void 0 ? null : _finalSizes$key$width,
|
|
711
|
-
_finalSizes$key$heigh = _finalSizes$key.height,
|
|
712
|
-
height = _finalSizes$key$heigh === void 0 ? null : _finalSizes$key$heigh;
|
|
713
|
-
var diffWidth = width !== null && finalContainerWidth !== null ? width - finalContainerWidth : null;
|
|
714
|
-
var diffHeight = height !== null && finalContainerHeight !== null ? height - finalContainerHeight : null;
|
|
715
|
-
var isLarger = (diffWidth === null || diffWidth >= 0) && (diffHeight === null || diffHeight >= 0);
|
|
716
|
-
var diff = [diffWidth, diffHeight].reduce(function (total, value) {
|
|
717
|
-
return value !== null ? (total || 0) + Math.abs(value) : total;
|
|
718
|
-
}, null);
|
|
719
|
-
if (diff === null) {
|
|
720
|
-
diff = Infinity;
|
|
721
|
-
}
|
|
722
|
-
var size = (width || 0) + (height || 0);
|
|
723
|
-
var sizeIsLarger = size > currentSize;
|
|
724
|
-
if (
|
|
725
|
-
// Difference is lower and image is larger
|
|
726
|
-
diff < currentDiff && isLarger ||
|
|
727
|
-
// Difference is lower and current is not larger or diff is greater than max
|
|
728
|
-
diff < currentDiff && (!currentIsLarger && sizeIsLarger || currentDiff > maxDiff) ||
|
|
729
|
-
// Image is larger and diff is smaller than max
|
|
730
|
-
diff <= maxDiff && !currentIsLarger && isLarger ||
|
|
731
|
-
// Image is larger than previous
|
|
732
|
-
diff <= maxDiff && !currentIsLarger && !isLarger && sizeIsLarger) {
|
|
733
|
-
return {
|
|
734
|
-
key: key,
|
|
735
|
-
url: url,
|
|
736
|
-
diff: diff,
|
|
737
|
-
isLarger: isLarger
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
return acc;
|
|
741
|
-
}, {
|
|
742
|
-
key: null,
|
|
743
|
-
url: defaultUrl,
|
|
744
|
-
diff: Infinity,
|
|
745
|
-
isLarger: false,
|
|
746
|
-
size: 0
|
|
747
|
-
}),
|
|
748
|
-
finalUrl = _Object$keys$reduce.url;
|
|
749
|
-
return finalUrl;
|
|
750
|
-
};
|
|
751
|
-
var getOptimalImageUrl$1 = getOptimalImageUrl;
|
|
752
|
-
|
|
753
|
-
var getSecondsFromTime = function getSecondsFromTime(time) {
|
|
754
|
-
var t = time.split(':');
|
|
755
|
-
try {
|
|
756
|
-
var s = t[2].split(',');
|
|
757
|
-
if (s.length === 1) {
|
|
758
|
-
s = t[2].split('.');
|
|
759
|
-
}
|
|
760
|
-
return parseFloat(t[0], 10) * 3600 + parseFloat(t[1], 10) * 60 + parseFloat(s[0], 10) + parseFloat(s[1], 10) / 1000;
|
|
761
|
-
} catch (e) {
|
|
762
|
-
return 0;
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
var getSecondsFromTime$1 = getSecondsFromTime;
|
|
766
|
-
|
|
767
|
-
var getScreenExtraField = function getScreenExtraField(intl) {
|
|
768
|
-
return {
|
|
769
|
-
name: 'parameters',
|
|
770
|
-
type: 'parameters',
|
|
771
|
-
label: intl.formatMessage({
|
|
772
|
-
id: "8A8cuq",
|
|
773
|
-
defaultMessage: [{
|
|
774
|
-
"type": 0,
|
|
775
|
-
"value": "Parameters"
|
|
776
|
-
}]
|
|
777
|
-
})
|
|
778
|
-
};
|
|
779
|
-
};
|
|
780
|
-
var getScreenExtraField$1 = getScreenExtraField;
|
|
781
|
-
|
|
782
|
-
function getScreenFieldsWithStates(definition) {
|
|
783
|
-
var _ref = definition || {},
|
|
784
|
-
_ref$fields = _ref.fields,
|
|
785
|
-
screenFields = _ref$fields === void 0 ? null : _ref$fields,
|
|
786
|
-
_ref$states = _ref.states,
|
|
787
|
-
states = _ref$states === void 0 ? null : _ref$states;
|
|
788
|
-
if (states === null) {
|
|
789
|
-
return screenFields;
|
|
790
|
-
}
|
|
791
|
-
var extraFields = states.reduce(function (statesFields, current) {
|
|
792
|
-
var _ref2 = current || {},
|
|
793
|
-
id = _ref2.id,
|
|
794
|
-
_ref2$fields = _ref2.fields,
|
|
795
|
-
fields = _ref2$fields === void 0 ? [] : _ref2$fields,
|
|
796
|
-
_ref2$repeatable = _ref2.repeatable,
|
|
797
|
-
repeatable = _ref2$repeatable === void 0 ? false : _ref2$repeatable,
|
|
798
|
-
_ref2$fieldName = _ref2.fieldName,
|
|
799
|
-
fieldName = _ref2$fieldName === void 0 ? null : _ref2$fieldName,
|
|
800
|
-
label = _ref2.label,
|
|
801
|
-
_ref2$defaultValue = _ref2.defaultValue,
|
|
802
|
-
defaultValue = _ref2$defaultValue === void 0 ? null : _ref2$defaultValue;
|
|
803
|
-
return [].concat(_toConsumableArray(statesFields), _toConsumableArray(repeatable ? [{
|
|
804
|
-
type: 'items',
|
|
805
|
-
name: fieldName || id,
|
|
806
|
-
label: label,
|
|
807
|
-
defaultValue: defaultValue,
|
|
808
|
-
stateId: id,
|
|
809
|
-
itemsField: {
|
|
810
|
-
label: label,
|
|
811
|
-
type: 'fields',
|
|
812
|
-
fields: fields
|
|
813
|
-
}
|
|
814
|
-
}] : []), _toConsumableArray(!repeatable && fieldName !== null ? [{
|
|
815
|
-
type: 'fields',
|
|
816
|
-
name: fieldName,
|
|
817
|
-
stateId: id,
|
|
818
|
-
fields: fields
|
|
819
|
-
}] : []), _toConsumableArray(!repeatable && fieldName === null ? fields.map(function (it) {
|
|
820
|
-
return _objectSpread(_objectSpread({}, it), {}, {
|
|
821
|
-
stateId: id
|
|
822
|
-
});
|
|
823
|
-
}) : []));
|
|
824
|
-
}, []);
|
|
825
|
-
return [].concat(_toConsumableArray(extraFields), _toConsumableArray(screenFields));
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
function getShadowCoords(angle, distance) {
|
|
829
|
-
var x = (Math.cos(angle) * distance).toFixed(3);
|
|
830
|
-
var y = (Math.sin(angle) * distance).toFixed(3);
|
|
831
|
-
return {
|
|
832
|
-
x: x,
|
|
833
|
-
y: y
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
function getJustifyContent(horizontal) {
|
|
838
|
-
if (horizontal === 'left') return 'flex-start';
|
|
839
|
-
if (horizontal === 'middle') return 'center';
|
|
840
|
-
if (horizontal === 'right') return 'flex-end';
|
|
841
|
-
return null;
|
|
842
|
-
}
|
|
843
|
-
function getAlignItems(vertical) {
|
|
844
|
-
if (vertical === 'top') return 'flex-start';
|
|
845
|
-
if (vertical === 'middle') return 'center';
|
|
846
|
-
if (vertical === 'bottom') return 'flex-end';
|
|
847
|
-
return null;
|
|
848
|
-
}
|
|
849
|
-
var getStyleFromAlignment = function getStyleFromAlignment(value) {
|
|
850
|
-
if (value === null) {
|
|
851
|
-
return null;
|
|
852
|
-
}
|
|
853
|
-
var _value$horizontal = value.horizontal,
|
|
854
|
-
horizontal = _value$horizontal === void 0 ? null : _value$horizontal,
|
|
855
|
-
_value$vertical = value.vertical,
|
|
856
|
-
vertical = _value$vertical === void 0 ? null : _value$vertical;
|
|
857
|
-
var justifyContent = getJustifyContent(horizontal);
|
|
858
|
-
var alignItems = getAlignItems(vertical);
|
|
859
|
-
return {
|
|
860
|
-
justifyContent: justifyContent,
|
|
861
|
-
alignItems: alignItems
|
|
862
|
-
};
|
|
863
|
-
};
|
|
864
|
-
var getStyleFromAlignment$1 = getStyleFromAlignment;
|
|
865
|
-
|
|
866
|
-
var getStyleFromColor = function getStyleFromColor() {
|
|
867
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
868
|
-
var property = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'backgroundColor';
|
|
869
|
-
var overideAlpha = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
870
|
-
var color = getColorAsString$1(value, overideAlpha);
|
|
871
|
-
return color !== null ? _defineProperty({}, property, color) : null;
|
|
872
|
-
};
|
|
873
|
-
var getStyleFromColor$1 = getStyleFromColor;
|
|
874
|
-
|
|
875
|
-
var getStyleFromBorder = function getStyleFromBorder(value) {
|
|
876
|
-
if (value == null) {
|
|
877
|
-
return null;
|
|
878
|
-
}
|
|
879
|
-
var _value$width = value.width,
|
|
880
|
-
width = _value$width === void 0 ? null : _value$width,
|
|
881
|
-
_value$style = value.style,
|
|
882
|
-
borderStyle = _value$style === void 0 ? null : _value$style,
|
|
883
|
-
_value$color = value.color,
|
|
884
|
-
color = _value$color === void 0 ? null : _value$color;
|
|
885
|
-
return _objectSpread(_objectSpread(_objectSpread({}, width !== null ? {
|
|
886
|
-
borderWidth: width
|
|
887
|
-
} : null), borderStyle !== null ? {
|
|
888
|
-
borderStyle: borderStyle
|
|
889
|
-
} : null), getStyleFromColor$1(color, 'borderColor'));
|
|
890
|
-
};
|
|
891
|
-
var getStyleFromBorder$1 = getStyleFromBorder;
|
|
892
|
-
|
|
893
|
-
var getStyleFromShadow = function getStyleFromShadow(value) {
|
|
894
|
-
if (value == null) {
|
|
895
|
-
return null;
|
|
896
|
-
}
|
|
897
|
-
var _ref = value || {},
|
|
898
|
-
_ref$shadowAngle = _ref.shadowAngle,
|
|
899
|
-
shadowAngle = _ref$shadowAngle === void 0 ? null : _ref$shadowAngle,
|
|
900
|
-
_ref$shadowDistance = _ref.shadowDistance,
|
|
901
|
-
shadowDistance = _ref$shadowDistance === void 0 ? null : _ref$shadowDistance,
|
|
902
|
-
_ref$shadowBlur = _ref.shadowBlur,
|
|
903
|
-
shadowBlur = _ref$shadowBlur === void 0 ? null : _ref$shadowBlur,
|
|
904
|
-
_ref$shadowColor = _ref.shadowColor,
|
|
905
|
-
shadowColor = _ref$shadowColor === void 0 ? null : _ref$shadowColor;
|
|
906
|
-
if (!shadowAngle) return null;
|
|
907
|
-
var blur = shadowBlur || '0';
|
|
908
|
-
var color = getColorAsString$1(shadowColor) || '#000000';
|
|
909
|
-
var _getShadowCoords = getShadowCoords(shadowAngle, shadowDistance),
|
|
910
|
-
x = _getShadowCoords.x,
|
|
911
|
-
y = _getShadowCoords.y;
|
|
912
|
-
var boxShadow = "".concat(x, "px ").concat(y, "px ").concat(blur, "px 0 ").concat(color);
|
|
913
|
-
return {
|
|
914
|
-
boxShadow: boxShadow
|
|
915
|
-
};
|
|
916
|
-
};
|
|
917
|
-
|
|
918
|
-
// @todo hmm, gotta find a better way to handle this
|
|
919
|
-
var getStyleFromBox = function getStyleFromBox(value) {
|
|
920
|
-
if (value === null) {
|
|
921
|
-
return null;
|
|
922
|
-
}
|
|
923
|
-
var _value$backgroundColo = value.backgroundColor,
|
|
924
|
-
backgroundColor = _value$backgroundColo === void 0 ? null : _value$backgroundColo,
|
|
925
|
-
_value$borderRadius = value.borderRadius,
|
|
926
|
-
borderRadius = _value$borderRadius === void 0 ? null : _value$borderRadius,
|
|
927
|
-
_value$padding = value.padding,
|
|
928
|
-
padding = _value$padding === void 0 ? null : _value$padding,
|
|
929
|
-
_value$paddingTop = value.paddingTop,
|
|
930
|
-
paddingTop = _value$paddingTop === void 0 ? null : _value$paddingTop,
|
|
931
|
-
_value$paddingRight = value.paddingRight,
|
|
932
|
-
paddingRight = _value$paddingRight === void 0 ? null : _value$paddingRight,
|
|
933
|
-
_value$paddingBottom = value.paddingBottom,
|
|
934
|
-
paddingBottom = _value$paddingBottom === void 0 ? null : _value$paddingBottom,
|
|
935
|
-
_value$paddingLeft = value.paddingLeft,
|
|
936
|
-
paddingLeft = _value$paddingLeft === void 0 ? null : _value$paddingLeft,
|
|
937
|
-
_value$borderWidth = value.borderWidth,
|
|
938
|
-
borderWidth = _value$borderWidth === void 0 ? null : _value$borderWidth,
|
|
939
|
-
_value$borderStyle = value.borderStyle,
|
|
940
|
-
borderStyle = _value$borderStyle === void 0 ? null : _value$borderStyle,
|
|
941
|
-
_value$borderColor = value.borderColor,
|
|
942
|
-
borderColor = _value$borderColor === void 0 ? null : _value$borderColor,
|
|
943
|
-
_value$shadowAngle = value.shadowAngle,
|
|
944
|
-
shadowAngle = _value$shadowAngle === void 0 ? null : _value$shadowAngle,
|
|
945
|
-
_value$shadowDistance = value.shadowDistance,
|
|
946
|
-
shadowDistance = _value$shadowDistance === void 0 ? null : _value$shadowDistance,
|
|
947
|
-
_value$shadowBlur = value.shadowBlur,
|
|
948
|
-
shadowBlur = _value$shadowBlur === void 0 ? null : _value$shadowBlur,
|
|
949
|
-
_value$shadowColor = value.shadowColor,
|
|
950
|
-
shadowColor = _value$shadowColor === void 0 ? null : _value$shadowColor;
|
|
951
|
-
var border = {
|
|
952
|
-
width: borderWidth,
|
|
953
|
-
style: borderStyle,
|
|
954
|
-
color: borderColor
|
|
955
|
-
};
|
|
956
|
-
var shadow = {
|
|
957
|
-
shadowAngle: shadowAngle,
|
|
958
|
-
shadowDistance: shadowDistance,
|
|
959
|
-
shadowBlur: shadowBlur,
|
|
960
|
-
shadowColor: shadowColor
|
|
961
|
-
};
|
|
962
|
-
var _ref = isObject(padding) ? padding : {
|
|
963
|
-
padding: padding
|
|
964
|
-
},
|
|
965
|
-
_ref$top = _ref.top,
|
|
966
|
-
paddingValueTop = _ref$top === void 0 ? null : _ref$top,
|
|
967
|
-
_ref$right = _ref.right,
|
|
968
|
-
paddingValueRight = _ref$right === void 0 ? null : _ref$right,
|
|
969
|
-
_ref$bottom = _ref.bottom,
|
|
970
|
-
paddingValueBottom = _ref$bottom === void 0 ? null : _ref$bottom,
|
|
971
|
-
_ref$left = _ref.left,
|
|
972
|
-
paddingValueLeft = _ref$left === void 0 ? null : _ref$left,
|
|
973
|
-
_ref$padding = _ref.padding,
|
|
974
|
-
paddingValue = _ref$padding === void 0 ? null : _ref$padding;
|
|
975
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getStyleFromColor$1(backgroundColor, 'backgroundColor')), borderRadius !== null ? {
|
|
976
|
-
borderRadius: borderRadius
|
|
977
|
-
} : null), getStyleFromBorder$1(border)), getStyleFromShadow(shadow)), padding !== null || paddingValue !== null ? {
|
|
978
|
-
padding: padding || paddingValue
|
|
979
|
-
} : null), paddingTop !== null || paddingValueTop !== null ? {
|
|
980
|
-
paddingTop: paddingTop || paddingValueTop
|
|
981
|
-
} : null), paddingRight !== null || paddingValueRight != null ? {
|
|
982
|
-
paddingRight: paddingRight || paddingValueRight
|
|
983
|
-
} : null), paddingBottom !== null || paddingValueBottom !== null ? {
|
|
984
|
-
paddingBottom: paddingBottom || paddingValueBottom
|
|
985
|
-
} : null), paddingLeft !== null || paddingValueLeft !== null ? {
|
|
986
|
-
paddingLeft: paddingLeft || paddingValueLeft
|
|
987
|
-
} : null);
|
|
988
|
-
};
|
|
989
|
-
var getStyleFromBox$1 = getStyleFromBox;
|
|
990
|
-
|
|
991
|
-
var getStyleFromContainer = function getStyleFromContainer(value) {
|
|
992
|
-
if (value == null) {
|
|
993
|
-
return null;
|
|
994
|
-
}
|
|
995
|
-
var _value$size = value.size,
|
|
996
|
-
size = _value$size === void 0 ? {} : _value$size,
|
|
997
|
-
_value$backgroundColo = value.backgroundColor,
|
|
998
|
-
backgroundColor = _value$backgroundColo === void 0 ? null : _value$backgroundColo;
|
|
999
|
-
var _size$width = size.width,
|
|
1000
|
-
width = _size$width === void 0 ? null : _size$width,
|
|
1001
|
-
_size$height = size.height,
|
|
1002
|
-
height = _size$height === void 0 ? null : _size$height;
|
|
1003
|
-
return _objectSpread(_objectSpread(_objectSpread({}, width ? {
|
|
1004
|
-
width: "".concat(width, "%")
|
|
1005
|
-
} : null), height ? {
|
|
1006
|
-
height: "".concat(height, "%")
|
|
1007
|
-
} : null), getStyleFromColor$1(backgroundColor, 'backgroundColor'));
|
|
1008
|
-
};
|
|
1009
|
-
var getStyleFromContainer$1 = getStyleFromContainer;
|
|
1010
|
-
|
|
1011
|
-
var getStyleFromHighlight = function getStyleFromHighlight(value) {
|
|
1012
|
-
if (value == null) {
|
|
1013
|
-
return null;
|
|
1014
|
-
}
|
|
1015
|
-
var _value$textColor = value.textColor,
|
|
1016
|
-
textColor = _value$textColor === void 0 ? null : _value$textColor,
|
|
1017
|
-
_value$color = value.color,
|
|
1018
|
-
color = _value$color === void 0 ? null : _value$color;
|
|
1019
|
-
var colorString = color !== null ? getColorAsString$1(color) : null;
|
|
1020
|
-
var boxShadow = colorString !== null ? "0.05em 0px 0px ".concat(colorString, ", -0.05em 0px 0px ").concat(colorString) : null;
|
|
1021
|
-
return color !== null || textColor !== null ? _objectSpread(_objectSpread(_objectSpread({}, color !== null ? getStyleFromColor$1(color, 'backgroundColor') : null), textColor !== null ? getStyleFromColor$1(textColor, 'color') : null), color !== null ? {
|
|
1022
|
-
boxShadow: boxShadow,
|
|
1023
|
-
mozBoxShadow: boxShadow,
|
|
1024
|
-
msBoxShadow: boxShadow,
|
|
1025
|
-
webkitBoxShadow: boxShadow
|
|
1026
|
-
} : null) : null;
|
|
1027
|
-
};
|
|
1028
|
-
var getStyleFromHighlight$1 = getStyleFromHighlight;
|
|
1029
|
-
|
|
1030
|
-
var getStyleFromImage = function getStyleFromImage(value) {
|
|
1031
|
-
if (value == null) {
|
|
1032
|
-
return null;
|
|
1033
|
-
}
|
|
1034
|
-
var _value$fit = value.fit,
|
|
1035
|
-
fit = _value$fit === void 0 ? {} : _value$fit,
|
|
1036
|
-
_value$backgroundColo = value.backgroundColor,
|
|
1037
|
-
backgroundColor = _value$backgroundColo === void 0 ? null : _value$backgroundColo;
|
|
1038
|
-
var _fit$size = fit.size,
|
|
1039
|
-
size = _fit$size === void 0 ? null : _fit$size,
|
|
1040
|
-
_fit$position = fit.position,
|
|
1041
|
-
position = _fit$position === void 0 ? {} : _fit$position;
|
|
1042
|
-
var _position$axisAlign = position.axisAlign,
|
|
1043
|
-
axisAlign = _position$axisAlign === void 0 ? null : _position$axisAlign,
|
|
1044
|
-
_position$crossAlign = position.crossAlign,
|
|
1045
|
-
crossAlign = _position$crossAlign === void 0 ? null : _position$crossAlign;
|
|
1046
|
-
return _objectSpread(_objectSpread(_objectSpread({}, size !== null ? {
|
|
1047
|
-
objectFit: size
|
|
1048
|
-
} : null), axisAlign !== null && crossAlign !== null ? {
|
|
1049
|
-
objectPosition: "".concat(axisAlign, " ").concat(crossAlign)
|
|
1050
|
-
} : null), getStyleFromColor$1(backgroundColor, 'backgroundColor'));
|
|
1051
|
-
};
|
|
1052
|
-
var getStyleFromImage$1 = getStyleFromImage;
|
|
1053
|
-
|
|
1054
|
-
var getStyleFromLink = function getStyleFromLink(value) {
|
|
1055
|
-
if (value == null) {
|
|
1056
|
-
return null;
|
|
1057
|
-
}
|
|
1058
|
-
var _value$color = value.color,
|
|
1059
|
-
color = _value$color === void 0 ? null : _value$color,
|
|
1060
|
-
fontStyle = value.fontStyle;
|
|
1061
|
-
var _ref = fontStyle || {},
|
|
1062
|
-
_ref$italic = _ref.italic,
|
|
1063
|
-
italic = _ref$italic === void 0 ? false : _ref$italic,
|
|
1064
|
-
_ref$bold = _ref.bold,
|
|
1065
|
-
bold = _ref$bold === void 0 ? false : _ref$bold,
|
|
1066
|
-
_ref$underline = _ref.underline,
|
|
1067
|
-
underline = _ref$underline === void 0 ? false : _ref$underline;
|
|
1068
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, color !== null ? getStyleFromColor$1(color, 'color') : null), italic ? {
|
|
1069
|
-
fontStyle: 'italic'
|
|
1070
|
-
} : null), bold ? {
|
|
1071
|
-
fontWeight: 'bold'
|
|
1072
|
-
} : null), underline ? {
|
|
1073
|
-
textDecoration: 'underline'
|
|
1074
|
-
} : null);
|
|
1075
|
-
};
|
|
1076
|
-
var getStyleFromLink$1 = getStyleFromLink;
|
|
1077
|
-
|
|
1078
|
-
var getStyleFromText = function getStyleFromText(value) {
|
|
1079
|
-
if (value == null) {
|
|
1080
|
-
return null;
|
|
1081
|
-
}
|
|
1082
|
-
var _value$fontFamily = value.fontFamily,
|
|
1083
|
-
fontFamily = _value$fontFamily === void 0 ? null : _value$fontFamily,
|
|
1084
|
-
_value$fontSize = value.fontSize,
|
|
1085
|
-
fontSize = _value$fontSize === void 0 ? null : _value$fontSize,
|
|
1086
|
-
_value$fontStyle = value.fontStyle,
|
|
1087
|
-
fontStyle = _value$fontStyle === void 0 ? null : _value$fontStyle,
|
|
1088
|
-
_value$fontWeight = value.fontWeight,
|
|
1089
|
-
fontWeight = _value$fontWeight === void 0 ? null : _value$fontWeight,
|
|
1090
|
-
_value$lineHeight = value.lineHeight,
|
|
1091
|
-
lineHeight = _value$lineHeight === void 0 ? null : _value$lineHeight,
|
|
1092
|
-
_value$letterSpacing = value.letterSpacing,
|
|
1093
|
-
letterSpacing = _value$letterSpacing === void 0 ? null : _value$letterSpacing,
|
|
1094
|
-
_value$align = value.align,
|
|
1095
|
-
textAlign = _value$align === void 0 ? null : _value$align,
|
|
1096
|
-
_value$color = value.color,
|
|
1097
|
-
color = _value$color === void 0 ? null : _value$color;
|
|
1098
|
-
var _ref = fontStyle || {},
|
|
1099
|
-
_ref$italic = _ref.italic,
|
|
1100
|
-
italic = _ref$italic === void 0 ? false : _ref$italic,
|
|
1101
|
-
_ref$bold = _ref.bold,
|
|
1102
|
-
bold = _ref$bold === void 0 ? false : _ref$bold,
|
|
1103
|
-
_ref$underline = _ref.underline,
|
|
1104
|
-
underline = _ref$underline === void 0 ? false : _ref$underline,
|
|
1105
|
-
textTransform = _ref.transform,
|
|
1106
|
-
_ref$outline = _ref.outline,
|
|
1107
|
-
outline = _ref$outline === void 0 ? false : _ref$outline;
|
|
1108
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1109
|
-
fontFamily: getFontFamilyFromFont(fontFamily)
|
|
1110
|
-
}, fontSize !== null ? {
|
|
1111
|
-
fontSize: fontSize
|
|
1112
|
-
} : null), italic ? {
|
|
1113
|
-
fontStyle: 'italic'
|
|
1114
|
-
} : null), bold ? {
|
|
1115
|
-
fontWeight: 'bold'
|
|
1116
|
-
} : null), fontWeight !== null ? {
|
|
1117
|
-
fontWeight: fontWeight
|
|
1118
|
-
} : null), underline ? {
|
|
1119
|
-
textDecoration: 'underline'
|
|
1120
|
-
} : null), textTransform !== null ? {
|
|
1121
|
-
textTransform: textTransform
|
|
1122
|
-
} : null), textAlign !== null ? {
|
|
1123
|
-
textAlign: textAlign
|
|
1124
|
-
} : null), lineHeight !== null ? {
|
|
1125
|
-
lineHeight: lineHeight
|
|
1126
|
-
} : null), letterSpacing !== null ? {
|
|
1127
|
-
letterSpacing: letterSpacing
|
|
1128
|
-
} : null), getStyleFromColor$1(color, 'color')), outline ? {
|
|
1129
|
-
WebkitTextStroke: "2px ".concat(getColorAsString$1(color, 'color')),
|
|
1130
|
-
color: 'transparent'
|
|
1131
|
-
} : null);
|
|
1132
|
-
};
|
|
1133
|
-
var getStyleFromText$1 = getStyleFromText;
|
|
1134
|
-
|
|
1135
|
-
var getStyleFromMargin = function getStyleFromMargin(value) {
|
|
1136
|
-
if (value == null) {
|
|
1137
|
-
return null;
|
|
1138
|
-
}
|
|
1139
|
-
var _value$top = value.top,
|
|
1140
|
-
marginTop = _value$top === void 0 ? null : _value$top,
|
|
1141
|
-
_value$bottom = value.bottom,
|
|
1142
|
-
marginBottom = _value$bottom === void 0 ? null : _value$bottom;
|
|
1143
|
-
return _objectSpread(_objectSpread({}, marginTop !== null ? {
|
|
1144
|
-
marginTop: marginTop
|
|
1145
|
-
} : null), marginBottom !== null ? {
|
|
1146
|
-
marginBottom: marginBottom
|
|
1147
|
-
} : null);
|
|
1148
|
-
};
|
|
1149
|
-
var getStyleFromMargin$1 = getStyleFromMargin;
|
|
1150
|
-
|
|
1151
|
-
var possibleMimes = ['video/webm', 'video/mp4', 'video/ogg'];
|
|
1152
|
-
var supportedMimes = null;
|
|
1153
|
-
function getVideoSupportedMimes() {
|
|
1154
|
-
var mimes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : possibleMimes;
|
|
1155
|
-
if (supportedMimes === null) {
|
|
1156
|
-
var video = document.createElement('video');
|
|
1157
|
-
supportedMimes = mimes.filter(function (mime) {
|
|
1158
|
-
return video.canPlayType(mime) !== '';
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
return supportedMimes;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
var getLayoutParts = function getLayoutParts() {
|
|
1165
|
-
var layout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1166
|
-
var _ref = layout !== null && layout.indexOf('-') !== false ? layout.split('-') : [layout, null, null],
|
|
1167
|
-
_ref2 = _slicedToArray(_ref, 3),
|
|
1168
|
-
horizontal = _ref2[0],
|
|
1169
|
-
vertical = _ref2[1],
|
|
1170
|
-
suffix = _ref2[2];
|
|
1171
|
-
return {
|
|
1172
|
-
horizontal: horizontal,
|
|
1173
|
-
vertical: vertical,
|
|
1174
|
-
suffix: suffix
|
|
1175
|
-
};
|
|
1176
|
-
};
|
|
1177
|
-
var getLayoutParts$1 = getLayoutParts;
|
|
1178
|
-
|
|
1179
|
-
var isHeaderFilled = function isHeaderFilled() {
|
|
1180
|
-
var header = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1181
|
-
var _ref = header || {},
|
|
1182
|
-
_ref$badge = _ref.badge,
|
|
1183
|
-
badge = _ref$badge === void 0 ? null : _ref$badge;
|
|
1184
|
-
var _ref2 = badge || {},
|
|
1185
|
-
_ref2$active = _ref2.active,
|
|
1186
|
-
badgeActive = _ref2$active === void 0 ? false : _ref2$active,
|
|
1187
|
-
_ref2$label = _ref2.label,
|
|
1188
|
-
label = _ref2$label === void 0 ? null : _ref2$label;
|
|
1189
|
-
var _ref3 = label || {},
|
|
1190
|
-
_ref3$body = _ref3.body,
|
|
1191
|
-
body = _ref3$body === void 0 ? null : _ref3$body;
|
|
1192
|
-
return badgeActive && body !== null;
|
|
1193
|
-
};
|
|
1194
|
-
var isHeaderFilled$1 = isHeaderFilled;
|
|
1195
|
-
|
|
1196
|
-
var isFooterFilled = function isFooterFilled() {
|
|
1197
|
-
var footer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1198
|
-
var _ref = footer || {},
|
|
1199
|
-
_ref$callToAction = _ref.callToAction,
|
|
1200
|
-
callToAction = _ref$callToAction === void 0 ? null : _ref$callToAction;
|
|
1201
|
-
var _ref2 = callToAction || {},
|
|
1202
|
-
_ref2$active = _ref2.active,
|
|
1203
|
-
callToActionActive = _ref2$active === void 0 ? false : _ref2$active,
|
|
1204
|
-
_ref2$label = _ref2.label,
|
|
1205
|
-
label = _ref2$label === void 0 ? null : _ref2$label;
|
|
1206
|
-
var _ref3 = label || {},
|
|
1207
|
-
_ref3$body = _ref3.body,
|
|
1208
|
-
body = _ref3$body === void 0 ? null : _ref3$body;
|
|
1209
|
-
return callToActionActive && body !== null;
|
|
1210
|
-
};
|
|
1211
|
-
var isFooterFilled$1 = isFooterFilled;
|
|
1212
|
-
|
|
1213
|
-
var isMessage = function isMessage(message) {
|
|
1214
|
-
return isObject(message) && typeof message.defaultMessage !== 'undefined';
|
|
1215
|
-
};
|
|
1216
|
-
var isMessage$1 = isMessage;
|
|
1217
|
-
|
|
1218
|
-
var isIos = function isIos() {
|
|
1219
|
-
return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) ||
|
|
1220
|
-
// iPad on iOS 13 detection
|
|
1221
|
-
navigator.userAgent.includes('Mac') && 'ontouchend' in document;
|
|
1222
|
-
};
|
|
1223
|
-
var isIos$1 = isIos;
|
|
1224
|
-
|
|
1225
|
-
var isImageFilled = function isImageFilled(image) {
|
|
1226
|
-
var _ref = image || {},
|
|
1227
|
-
_ref$media = _ref.media,
|
|
1228
|
-
media = _ref$media === void 0 ? null : _ref$media,
|
|
1229
|
-
_ref$url = _ref.url,
|
|
1230
|
-
url = _ref$url === void 0 ? null : _ref$url;
|
|
1231
|
-
return media !== null || url !== null;
|
|
1232
|
-
};
|
|
1233
|
-
var isImageFilled$1 = isImageFilled;
|
|
1234
|
-
|
|
1235
|
-
var isTextFilled$2 = function isTextFilled(text) {
|
|
1236
|
-
var _ref = text || {},
|
|
1237
|
-
_ref$label = _ref.label,
|
|
1238
|
-
label = _ref$label === void 0 ? null : _ref$label;
|
|
1239
|
-
var _ref2 = label || {},
|
|
1240
|
-
_ref2$length = _ref2.length,
|
|
1241
|
-
length = _ref2$length === void 0 ? 0 : _ref2$length;
|
|
1242
|
-
return typeof length === 'number' && length > 0;
|
|
1243
|
-
};
|
|
1244
|
-
var isTextFilled$3 = isTextFilled$2;
|
|
1245
|
-
|
|
1246
|
-
var isTextFilled = function isTextFilled(text) {
|
|
1247
|
-
var _ref = text || {},
|
|
1248
|
-
_ref$body = _ref.body,
|
|
1249
|
-
body = _ref$body === void 0 ? null : _ref$body;
|
|
1250
|
-
var _ref2 = body || {},
|
|
1251
|
-
_ref2$length = _ref2.length,
|
|
1252
|
-
length = _ref2$length === void 0 ? 0 : _ref2$length;
|
|
1253
|
-
return typeof length === 'number' && length > 0;
|
|
1254
|
-
};
|
|
1255
|
-
var isTextFilled$1 = isTextFilled;
|
|
1256
|
-
|
|
1257
|
-
var isValidUrl = function isValidUrl(string) {
|
|
1258
|
-
var url;
|
|
1259
|
-
try {
|
|
1260
|
-
url = new URL(string);
|
|
1261
|
-
} catch (_) {
|
|
1262
|
-
return false;
|
|
1263
|
-
}
|
|
1264
|
-
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
1265
|
-
};
|
|
1266
|
-
var isValidUrl$1 = isValidUrl;
|
|
1267
|
-
|
|
1268
|
-
var createSchemaId = function createSchemaId(id) {
|
|
1269
|
-
return "https://schemas.micromag.ca/0.1/".concat(id, ".json");
|
|
1270
|
-
};
|
|
1271
|
-
|
|
1272
|
-
var schemaId = function schemaId(str) {
|
|
1273
|
-
return createSchemaId(str.join('/'));
|
|
1274
|
-
};
|
|
1275
|
-
var schemaId$1 = schemaId;
|
|
1276
|
-
|
|
1277
|
-
var setValue = function setValue(value, keyParts, fieldValue) {
|
|
1278
|
-
var key = keyParts.shift();
|
|
1279
|
-
var isArray = key.match(/^[0-9]+$/) !== null;
|
|
1280
|
-
if (value !== null || fieldValue !== null) {
|
|
1281
|
-
if (isArray) {
|
|
1282
|
-
var index = parseInt(key, 10);
|
|
1283
|
-
// TODO: fix this with an explicit delete
|
|
1284
|
-
// instead on splicing out the element on null fieldValue
|
|
1285
|
-
// const newArrayValue =
|
|
1286
|
-
// fieldValue !== null
|
|
1287
|
-
// ? [
|
|
1288
|
-
// ...value.slice(0, index),
|
|
1289
|
-
// keyParts.length > 0
|
|
1290
|
-
// ? setValue(
|
|
1291
|
-
// value !== null ? value[index] || null : null,
|
|
1292
|
-
// keyParts,
|
|
1293
|
-
// fieldValue,
|
|
1294
|
-
// )
|
|
1295
|
-
// : fieldValue,
|
|
1296
|
-
// ...value.slice(index + 1),
|
|
1297
|
-
// ]
|
|
1298
|
-
// : [...value.slice(0, index), ...value.slice(index + 1)];
|
|
1299
|
-
|
|
1300
|
-
var newArrayValue = [].concat(_toConsumableArray(value.slice(0, index)), [keyParts.length > 0 ? setValue(value !== null ? value[index] || null : null, keyParts, fieldValue) : fieldValue], _toConsumableArray(value.slice(index + 1)));
|
|
1301
|
-
return newArrayValue.length > 0 ? newArrayValue : null;
|
|
1302
|
-
}
|
|
1303
|
-
return _objectSpread(_objectSpread({}, value), {}, _defineProperty({}, key, keyParts.length > 0 ? setValue(value !== null ? value[key] || null : null, keyParts, fieldValue) : fieldValue));
|
|
1304
|
-
}
|
|
1305
|
-
return null;
|
|
1306
|
-
};
|
|
1307
|
-
var setValue$1 = setValue;
|
|
1308
|
-
|
|
1309
|
-
var slug = function slug(str) {
|
|
1310
|
-
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1311
|
-
var toSlug;
|
|
1312
|
-
if (separator === '-') {
|
|
1313
|
-
toSlug = kebabCase(str);
|
|
1314
|
-
} else {
|
|
1315
|
-
toSlug = snakeCase(str);
|
|
1316
|
-
}
|
|
1317
|
-
return slugify(toSlug, {
|
|
1318
|
-
lower: true
|
|
1319
|
-
});
|
|
1320
|
-
};
|
|
1321
|
-
var slug$1 = slug;
|
|
1322
|
-
|
|
1323
|
-
var unique = function unique(arrArg) {
|
|
1324
|
-
return arrArg !== null ? arrArg.filter(function (elem, pos, arr) {
|
|
1325
|
-
return arr.indexOf(elem) === pos;
|
|
1326
|
-
}) : [];
|
|
1327
|
-
};
|
|
1328
|
-
var unique$1 = unique;
|
|
1329
|
-
|
|
1330
|
-
var validateFields = function validateFields(fields, value) {
|
|
1331
|
-
return fields.reduce(function (acc, field) {
|
|
1332
|
-
if (acc === true) {
|
|
1333
|
-
if (field.type === 'fields' && field.fields) {
|
|
1334
|
-
return validateFields(field.fields, value);
|
|
1335
|
-
}
|
|
1336
|
-
var val = value && value[field.name] ? value[field.name] : false;
|
|
1337
|
-
return !(field.required && !val);
|
|
1338
|
-
}
|
|
1339
|
-
return acc;
|
|
1340
|
-
}, true);
|
|
1341
|
-
};
|
|
1342
|
-
var validateFields$1 = validateFields;
|
|
1343
|
-
|
|
1344
|
-
var getContrastingColor = function getContrastingColor(backgroundColor) {
|
|
1345
|
-
var _ref = backgroundColor || {},
|
|
1346
|
-
_ref$color = _ref.color,
|
|
1347
|
-
color = _ref$color === void 0 ? 'white' : _ref$color;
|
|
1348
|
-
if (tinycolor.equals(color, tinycolor('white'))) {
|
|
1349
|
-
return '#A13DFF';
|
|
1350
|
-
}
|
|
1351
|
-
if (tinycolor.equals(color, tinycolor('black'))) {
|
|
1352
|
-
return 'white';
|
|
1353
|
-
}
|
|
1354
|
-
return tinycolor(color).spin(30).toString();
|
|
1355
|
-
};
|
|
1356
|
-
var getContrastingColor$1 = getContrastingColor;
|
|
1357
|
-
|
|
1358
|
-
exports.camelCase = camelCase;
|
|
1359
|
-
exports.convertStyleToString = convertStyleToString$1;
|
|
1360
|
-
exports.copyToClipboard = copyToClipboard;
|
|
1361
|
-
exports.createNullableOnChange = createNullableOnChange$1;
|
|
1362
|
-
exports.createUseEvent = createUseEvent$1;
|
|
1363
|
-
exports.easings = easings$1;
|
|
1364
|
-
exports.getColorAsString = getColorAsString$1;
|
|
1365
|
-
exports.getComponentFromName = getComponentFromName$1;
|
|
1366
|
-
exports.getContrastingColor = getContrastingColor$1;
|
|
1367
|
-
exports.getDeviceScreens = getDeviceScreens$1;
|
|
1368
|
-
exports.getDisplayName = getDisplayName$1;
|
|
1369
|
-
exports.getFieldByName = getFieldByName$1;
|
|
1370
|
-
exports.getFieldFromPath = getFieldFromPath$1;
|
|
1371
|
-
exports.getFileName = getFileName$1;
|
|
1372
|
-
exports.getFontFamilyFromFont = getFontFamilyFromFont;
|
|
1373
|
-
exports.getFooterProps = getFooterProps$1;
|
|
1374
|
-
exports.getGridLayoutName = getGridLayoutName$1;
|
|
1375
|
-
exports.getLargestRemainderRound = largestRemainderRound$1;
|
|
1376
|
-
exports.getLayersFromBackground = getLayersFromBackground$1;
|
|
1377
|
-
exports.getLayoutParts = getLayoutParts$1;
|
|
1378
|
-
exports.getMediaFilesAsArray = getMediaFilesAsArray$1;
|
|
1379
|
-
exports.getOptimalImageUrl = getOptimalImageUrl$1;
|
|
1380
|
-
exports.getScreenExtraField = getScreenExtraField$1;
|
|
1381
|
-
exports.getScreenFieldsWithStates = getScreenFieldsWithStates;
|
|
1382
|
-
exports.getSecondsFromTime = getSecondsFromTime$1;
|
|
1383
|
-
exports.getShadowCoords = getShadowCoords;
|
|
1384
|
-
exports.getStyleFromAlignment = getStyleFromAlignment$1;
|
|
1385
|
-
exports.getStyleFromBorder = getStyleFromBorder$1;
|
|
1386
|
-
exports.getStyleFromBox = getStyleFromBox$1;
|
|
1387
|
-
exports.getStyleFromColor = getStyleFromColor$1;
|
|
1388
|
-
exports.getStyleFromContainer = getStyleFromContainer$1;
|
|
1389
|
-
exports.getStyleFromHighlight = getStyleFromHighlight$1;
|
|
1390
|
-
exports.getStyleFromImage = getStyleFromImage$1;
|
|
1391
|
-
exports.getStyleFromLink = getStyleFromLink$1;
|
|
1392
|
-
exports.getStyleFromMargin = getStyleFromMargin$1;
|
|
1393
|
-
exports.getStyleFromText = getStyleFromText$1;
|
|
1394
|
-
exports.getVideoSupportedMimes = getVideoSupportedMimes;
|
|
1395
|
-
exports.isFooterFilled = isFooterFilled$1;
|
|
1396
|
-
exports.isHeaderFilled = isHeaderFilled$1;
|
|
1397
|
-
exports.isImageFilled = isImageFilled$1;
|
|
1398
|
-
exports.isIos = isIos$1;
|
|
1399
|
-
exports.isLabelFilled = isTextFilled$3;
|
|
1400
|
-
exports.isMessage = isMessage$1;
|
|
1401
|
-
exports.isTextFilled = isTextFilled$1;
|
|
1402
|
-
exports.isValidUrl = isValidUrl$1;
|
|
1403
|
-
exports.pascalCase = pascalCase;
|
|
1404
|
-
exports.schemaId = schemaId$1;
|
|
1405
|
-
exports.setFieldValue = setValue$1;
|
|
1406
|
-
exports.slug = slug$1;
|
|
1407
|
-
exports.snakeCase = snakeCase;
|
|
1408
|
-
exports.unique = unique$1;
|
|
1409
|
-
exports.validateFields = validateFields$1;
|