@micromag/core 0.3.679 → 0.3.706
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 +3 -3
- package/es/contexts.js +238 -21
- package/es/hooks.js +10 -10
- package/es/index.js +41 -41
- package/es/utils.js +35 -39
- package/package.json +4 -3
package/es/contexts.js
CHANGED
|
@@ -2,11 +2,13 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import isString from 'lodash/isString';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React, { useContext, useMemo, useState, useEffect, useCallback, useRef } from 'react';
|
|
5
|
-
import { ComponentsManager,
|
|
5
|
+
import { ComponentsManager, PropTypes as PropTypes$1, FieldsManager, ScreensManager, ColorsParser, Tracking } from '@micromag/core';
|
|
6
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
7
|
+
import JSCookie from 'js-cookie';
|
|
8
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
6
9
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
7
10
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
8
11
|
import uniqBy from 'lodash/uniqBy';
|
|
9
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
10
12
|
import { getJSON } from '@folklore/fetch';
|
|
11
13
|
import isObject from 'lodash/isObject';
|
|
12
14
|
import { loadGoogleApi, loadGoogleMaps } from '@folklore/services';
|
|
@@ -14,7 +16,6 @@ import { getDisplayName, getScreenExtraField } from '@micromag/core/utils';
|
|
|
14
16
|
import { useUrlGenerator } from '@folklore/routes';
|
|
15
17
|
export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
|
|
16
18
|
import { useLocation } from 'wouter';
|
|
17
|
-
import { useIntl } from 'react-intl';
|
|
18
19
|
import { TrackingContext, TrackingContainer } from '@folklore/tracking';
|
|
19
20
|
export { TrackingContext } from '@folklore/tracking';
|
|
20
21
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
@@ -133,13 +134,13 @@ var useElementComponent = function useElementComponent(name) {
|
|
|
133
134
|
/**
|
|
134
135
|
* Provider
|
|
135
136
|
*/
|
|
136
|
-
var propTypes$
|
|
137
|
+
var propTypes$j = {
|
|
137
138
|
children: PropTypes.node.isRequired,
|
|
138
139
|
namespace: PropTypes.string,
|
|
139
140
|
manager: PropTypes.instanceOf(ComponentsManager),
|
|
140
141
|
components: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.object, PropTypes.func]))
|
|
141
142
|
};
|
|
142
|
-
var defaultProps$
|
|
143
|
+
var defaultProps$j = {
|
|
143
144
|
namespace: null,
|
|
144
145
|
components: {},
|
|
145
146
|
manager: null
|
|
@@ -157,8 +158,224 @@ var ComponentsProvider = function ComponentsProvider(_ref) {
|
|
|
157
158
|
value: finalManager
|
|
158
159
|
}, children);
|
|
159
160
|
};
|
|
160
|
-
ComponentsProvider.propTypes = propTypes$
|
|
161
|
-
ComponentsProvider.defaultProps = defaultProps$
|
|
161
|
+
ComponentsProvider.propTypes = propTypes$j;
|
|
162
|
+
ComponentsProvider.defaultProps = defaultProps$j;
|
|
163
|
+
|
|
164
|
+
var messages = defineMessages({
|
|
165
|
+
functionality_title: {
|
|
166
|
+
id: "consent.functionality_title",
|
|
167
|
+
defaultMessage: [{
|
|
168
|
+
"type": 0,
|
|
169
|
+
"value": "Functionnal"
|
|
170
|
+
}]
|
|
171
|
+
},
|
|
172
|
+
functionality_description: {
|
|
173
|
+
id: "consent.functionality_description",
|
|
174
|
+
defaultMessage: [{
|
|
175
|
+
"type": 0,
|
|
176
|
+
"value": "Cookies required for the site to function properly."
|
|
177
|
+
}]
|
|
178
|
+
},
|
|
179
|
+
analytics_title: {
|
|
180
|
+
id: "consent.analytics_title",
|
|
181
|
+
defaultMessage: [{
|
|
182
|
+
"type": 0,
|
|
183
|
+
"value": "Analytics"
|
|
184
|
+
}]
|
|
185
|
+
},
|
|
186
|
+
analytics_description: {
|
|
187
|
+
id: "consent.analytics_description",
|
|
188
|
+
defaultMessage: [{
|
|
189
|
+
"type": 0,
|
|
190
|
+
"value": "Cookies used to measure user behavior."
|
|
191
|
+
}]
|
|
192
|
+
},
|
|
193
|
+
ad_storage_title: {
|
|
194
|
+
id: "consent.ad_storage_title",
|
|
195
|
+
defaultMessage: [{
|
|
196
|
+
"type": 0,
|
|
197
|
+
"value": "Ad Storage"
|
|
198
|
+
}]
|
|
199
|
+
},
|
|
200
|
+
ad_storage_description: {
|
|
201
|
+
id: "consent.ad_storage_description",
|
|
202
|
+
defaultMessage: [{
|
|
203
|
+
"type": 0,
|
|
204
|
+
"value": "Cookies used for advertising purposes."
|
|
205
|
+
}]
|
|
206
|
+
},
|
|
207
|
+
ad_personalization_title: {
|
|
208
|
+
id: "consent.ad_personalization_title",
|
|
209
|
+
defaultMessage: [{
|
|
210
|
+
"type": 0,
|
|
211
|
+
"value": "Ad Personalization"
|
|
212
|
+
}]
|
|
213
|
+
},
|
|
214
|
+
ad_personalization_description: {
|
|
215
|
+
id: "consent.ad_personalization_description",
|
|
216
|
+
defaultMessage: [{
|
|
217
|
+
"type": 0,
|
|
218
|
+
"value": "Cookies used for ad targeting."
|
|
219
|
+
}]
|
|
220
|
+
},
|
|
221
|
+
ad_user_data_title: {
|
|
222
|
+
id: "consent.ad_user_data_title",
|
|
223
|
+
defaultMessage: [{
|
|
224
|
+
"type": 0,
|
|
225
|
+
"value": "User Ad Data"
|
|
226
|
+
}]
|
|
227
|
+
},
|
|
228
|
+
ad_user_data_description: {
|
|
229
|
+
id: "consent.ad_user_data_description",
|
|
230
|
+
defaultMessage: [{
|
|
231
|
+
"type": 0,
|
|
232
|
+
"value": "Cookies used for user-specific ad data."
|
|
233
|
+
}]
|
|
234
|
+
},
|
|
235
|
+
personalization_storage_title: {
|
|
236
|
+
id: "consent.personalization_storage_title",
|
|
237
|
+
defaultMessage: [{
|
|
238
|
+
"type": 0,
|
|
239
|
+
"value": "Personalization Storage"
|
|
240
|
+
}]
|
|
241
|
+
},
|
|
242
|
+
personalization_storage_description: {
|
|
243
|
+
id: "consent.personalization_storage_description",
|
|
244
|
+
defaultMessage: [{
|
|
245
|
+
"type": 0,
|
|
246
|
+
"value": "Cookies used for personalizing user experience."
|
|
247
|
+
}]
|
|
248
|
+
},
|
|
249
|
+
security_storage_title: {
|
|
250
|
+
id: "consent.security_storage_title",
|
|
251
|
+
defaultMessage: [{
|
|
252
|
+
"type": 0,
|
|
253
|
+
"value": "Security Storage"
|
|
254
|
+
}]
|
|
255
|
+
},
|
|
256
|
+
security_storage_description: {
|
|
257
|
+
id: "consent.security_storage_description",
|
|
258
|
+
defaultMessage: [{
|
|
259
|
+
"type": 0,
|
|
260
|
+
"value": "Cookies used for security purposes."
|
|
261
|
+
}]
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
var consentStates = [{
|
|
265
|
+
id: 'functionality_storage',
|
|
266
|
+
label: messages.functionality_title,
|
|
267
|
+
description: messages.functionality_description,
|
|
268
|
+
value: true,
|
|
269
|
+
disabled: true
|
|
270
|
+
}, {
|
|
271
|
+
id: 'security_storage',
|
|
272
|
+
label: messages.security_storage_title,
|
|
273
|
+
description: messages.security_storage_description,
|
|
274
|
+
value: true
|
|
275
|
+
}, {
|
|
276
|
+
id: 'personalization_storage',
|
|
277
|
+
label: messages.personalization_storage_title,
|
|
278
|
+
description: messages.personalization_storage_description,
|
|
279
|
+
value: true
|
|
280
|
+
}, {
|
|
281
|
+
id: 'analytics_storage',
|
|
282
|
+
label: messages.analytics_title,
|
|
283
|
+
description: messages.analytics_description,
|
|
284
|
+
value: true
|
|
285
|
+
}, {
|
|
286
|
+
id: 'ad_storage',
|
|
287
|
+
label: messages.ad_storage_title,
|
|
288
|
+
description: messages.ad_storage_description,
|
|
289
|
+
value: true
|
|
290
|
+
}, {
|
|
291
|
+
id: 'ad_personalization',
|
|
292
|
+
label: messages.ad_personalization_title,
|
|
293
|
+
description: messages.ad_personalization_description,
|
|
294
|
+
value: true
|
|
295
|
+
}, {
|
|
296
|
+
id: 'ad_user_data',
|
|
297
|
+
label: messages.ad_user_data_title,
|
|
298
|
+
description: messages.ad_user_data_description,
|
|
299
|
+
value: true
|
|
300
|
+
}];
|
|
301
|
+
var ConsentContext = /*#__PURE__*/React.createContext({
|
|
302
|
+
consent: null,
|
|
303
|
+
setConsent: function setConsent() {}
|
|
304
|
+
});
|
|
305
|
+
var useConsent = function useConsent() {
|
|
306
|
+
return useContext(ConsentContext);
|
|
307
|
+
};
|
|
308
|
+
var propTypes$i = {
|
|
309
|
+
children: PropTypes.node.isRequired,
|
|
310
|
+
consent: PropTypes$1.consent
|
|
311
|
+
};
|
|
312
|
+
var defaultProps$i = {
|
|
313
|
+
consent: ['functionality_storage', 'analytics_storage', 'ad_storage', 'ad_personalization', 'ad_user_data']
|
|
314
|
+
};
|
|
315
|
+
var ConsentProvider = function ConsentProvider(_ref) {
|
|
316
|
+
var providedConsent = _ref.consent,
|
|
317
|
+
children = _ref.children;
|
|
318
|
+
var baseConsent = useMemo(function () {
|
|
319
|
+
return (providedConsent || consentStates || []).map(function (item) {
|
|
320
|
+
if (isString(item)) {
|
|
321
|
+
return (consentStates || []).find(function (it) {
|
|
322
|
+
return it.id === item;
|
|
323
|
+
}) || null;
|
|
324
|
+
}
|
|
325
|
+
return item || null;
|
|
326
|
+
}).filter(function (it) {
|
|
327
|
+
return it !== null;
|
|
328
|
+
}).map(function (it) {
|
|
329
|
+
return _objectSpread(_objectSpread({}, it), {}, {
|
|
330
|
+
value:
|
|
331
|
+
// eslint-disable-next-line no-nested-ternary
|
|
332
|
+
JSCookie.get(it.id) === 'granted' ? true : JSCookie.get(it.id) === 'denied' ? false : it.value
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
}, [providedConsent]);
|
|
336
|
+
var _useState = useState(baseConsent),
|
|
337
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
338
|
+
consent = _useState2[0],
|
|
339
|
+
setConsentState = _useState2[1];
|
|
340
|
+
useEffect(function () {
|
|
341
|
+
if (baseConsent) {
|
|
342
|
+
setConsentState(baseConsent);
|
|
343
|
+
}
|
|
344
|
+
}, [baseConsent, setConsentState]);
|
|
345
|
+
var setConsent = useCallback(function (values) {
|
|
346
|
+
JSCookie.set('show_consent', values === null || values === undefined, {
|
|
347
|
+
secure: true,
|
|
348
|
+
expires: 182
|
|
349
|
+
});
|
|
350
|
+
(values || []).forEach(function (it) {
|
|
351
|
+
if (it.value === true) {
|
|
352
|
+
JSCookie.set(it.id, 'granted', {
|
|
353
|
+
secure: true,
|
|
354
|
+
expires: 182
|
|
355
|
+
});
|
|
356
|
+
} else if (it.value === false) {
|
|
357
|
+
JSCookie.set(it.id, 'denied', {
|
|
358
|
+
secure: true,
|
|
359
|
+
expires: 182
|
|
360
|
+
});
|
|
361
|
+
} else {
|
|
362
|
+
JSCookie.remove(it.id);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
setConsentState(values);
|
|
366
|
+
}, [setConsentState]);
|
|
367
|
+
var value = useMemo(function () {
|
|
368
|
+
return {
|
|
369
|
+
consent: consent,
|
|
370
|
+
setConsent: setConsent
|
|
371
|
+
};
|
|
372
|
+
}, [consent, setConsent]);
|
|
373
|
+
return /*#__PURE__*/React.createElement(ConsentContext.Provider, {
|
|
374
|
+
value: value
|
|
375
|
+
}, children);
|
|
376
|
+
};
|
|
377
|
+
ConsentProvider.propTypes = propTypes$i;
|
|
378
|
+
ConsentProvider.defaultProps = defaultProps$i;
|
|
162
379
|
|
|
163
380
|
var FieldsContext = /*#__PURE__*/React.createContext(null);
|
|
164
381
|
var useFieldsManager = function useFieldsManager() {
|
|
@@ -905,21 +1122,21 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
905
1122
|
controls = _useState8[0],
|
|
906
1123
|
setControls = _useState8[1];
|
|
907
1124
|
var _useState9 = useState(initialControlsSuggestPlay),
|
|
908
|
-
|
|
909
|
-
controlsSuggestPlay =
|
|
910
|
-
setControlsSuggestPlay =
|
|
911
|
-
var
|
|
1125
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
1126
|
+
controlsSuggestPlay = _useState0[0],
|
|
1127
|
+
setControlsSuggestPlay = _useState0[1];
|
|
1128
|
+
var _useState1 = useState(initialControlsVisible),
|
|
1129
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
1130
|
+
controlsVisible = _useState10[0],
|
|
1131
|
+
setControlsVisible = _useState10[1];
|
|
1132
|
+
var _useState11 = useState(initialControlsTheme),
|
|
912
1133
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
var _useState13 = useState(
|
|
1134
|
+
controlsTheme = _useState12[0],
|
|
1135
|
+
setControlsTheme = _useState12[1];
|
|
1136
|
+
var _useState13 = useState(initialCurrentQualityLevel),
|
|
916
1137
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
var _useState15 = useState(initialCurrentQualityLevel),
|
|
920
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
921
|
-
currentQualityLevel = _useState16[0],
|
|
922
|
-
setCurrentQualityLevel = _useState16[1];
|
|
1138
|
+
currentQualityLevel = _useState14[0],
|
|
1139
|
+
setCurrentQualityLevel = _useState14[1];
|
|
923
1140
|
var finalSetControls = useCallback(function (newControls) {
|
|
924
1141
|
if (newControls) {
|
|
925
1142
|
setControls(true);
|
|
@@ -1421,4 +1638,4 @@ var VisitorProvider = function VisitorProvider(_ref) {
|
|
|
1421
1638
|
VisitorProvider.propTypes = propTypes;
|
|
1422
1639
|
VisitorProvider.defaultProps = defaultProps;
|
|
1423
1640
|
|
|
1424
|
-
export { ComponentsContext, ComponentsProvider, ELEMENTS_NAMESPACE, EditorContext, EditorProvider, FIELDS_NAMESPACE, FORMS_NAMESPACE, FieldContext, FieldContextProvider, FieldsContext, FieldsProvider, FieldsValueContext, FieldsValueContextProvider, FontsContext, FontsProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, MODALS_NAMESPACE, ModalsContext, ModalsProvider, PanelsContext, PanelsProvider, PlaybackContext, PlaybackProvider, SCREENS_NAMESPACE, ScreenContext, ScreenProvider, ScreenSizeContext, ScreenSizeProvider, ScreensContext, ScreensProvider, StoryContext, StoryProvider, TrackingProvider, ViewerContext, ViewerProvider, VisitorContext, VisitorProvider, useComponent, useComponents, useComponentsManager, useEditor, useElementComponent, useElementsComponents, useElementsComponentsManager, useFieldComponent, useFieldContext, useFieldDefinition, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFieldsValue, useFonts, useFormComponent, useFormsComponents, useFormsComponentsManager, useGetColors, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useModalComponent, useModals, useModalsComponents, useModalsComponentsManager, usePanels, usePlaybackContext, usePlaybackMediaRef, useRouteBack, useRoutePush, useScreen, useScreenComponent, useScreenData, useScreenDefinition, useScreenRenderContext, useScreenSize, useScreenState, useScreensComponents, useScreensComponentsManager, useScreensManager, useSetVisitor, useStory, useStoryContext, useTracking, useViewerContainer, useViewerContext, useViewerEvents, useViewerInteraction, useViewerNavigation, useViewerSize, useViewerWebView, useVisitor, useVisitorContext, withGoogleApiClient, withGoogleMapsClient, withModals, withPanels };
|
|
1641
|
+
export { ComponentsContext, ComponentsProvider, ConsentContext, ConsentProvider, ELEMENTS_NAMESPACE, EditorContext, EditorProvider, FIELDS_NAMESPACE, FORMS_NAMESPACE, FieldContext, FieldContextProvider, FieldsContext, FieldsProvider, FieldsValueContext, FieldsValueContextProvider, FontsContext, FontsProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, MODALS_NAMESPACE, ModalsContext, ModalsProvider, PanelsContext, PanelsProvider, PlaybackContext, PlaybackProvider, SCREENS_NAMESPACE, ScreenContext, ScreenProvider, ScreenSizeContext, ScreenSizeProvider, ScreensContext, ScreensProvider, StoryContext, StoryProvider, TrackingProvider, ViewerContext, ViewerProvider, VisitorContext, VisitorProvider, useComponent, useComponents, useComponentsManager, useConsent, useEditor, useElementComponent, useElementsComponents, useElementsComponentsManager, useFieldComponent, useFieldContext, useFieldDefinition, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFieldsValue, useFonts, useFormComponent, useFormsComponents, useFormsComponentsManager, useGetColors, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useModalComponent, useModals, useModalsComponents, useModalsComponentsManager, usePanels, usePlaybackContext, usePlaybackMediaRef, useRouteBack, useRoutePush, useScreen, useScreenComponent, useScreenData, useScreenDefinition, useScreenRenderContext, useScreenSize, useScreenState, useScreensComponents, useScreensComponentsManager, useScreensManager, useSetVisitor, useStory, useStoryContext, useTracking, useViewerContainer, useViewerContext, useViewerEvents, useViewerInteraction, useViewerNavigation, useViewerSize, useViewerWebView, useVisitor, useVisitorContext, withGoogleApiClient, withGoogleMapsClient, withModals, withPanels };
|
package/es/hooks.js
CHANGED
|
@@ -923,17 +923,17 @@ var useMediaApi = function useMediaApi() {
|
|
|
923
923
|
ready = _useState8[0],
|
|
924
924
|
setReady = _useState8[1];
|
|
925
925
|
var _useState9 = useState(false),
|
|
926
|
-
|
|
927
|
-
dataReady =
|
|
928
|
-
setDataReady =
|
|
929
|
-
var
|
|
926
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
927
|
+
dataReady = _useState0[0],
|
|
928
|
+
setDataReady = _useState0[1];
|
|
929
|
+
var _useState1 = useState(true),
|
|
930
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
931
|
+
initialPlay = _useState10[0],
|
|
932
|
+
setInitialPlay = _useState10[1];
|
|
933
|
+
var _useState11 = useState(false),
|
|
930
934
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
var _useState13 = useState(false),
|
|
934
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
935
|
-
suspended = _useState14[0],
|
|
936
|
-
setSuspended = _useState14[1];
|
|
935
|
+
suspended = _useState12[0],
|
|
936
|
+
setSuspended = _useState12[1];
|
|
937
937
|
var progressStepsReached = useRef({});
|
|
938
938
|
var paused = !playing;
|
|
939
939
|
|
package/es/index.js
CHANGED
|
@@ -1902,20 +1902,20 @@ var ButtonPadding = /*#__PURE__*/function () {
|
|
|
1902
1902
|
return _createClass(ButtonPadding, [{
|
|
1903
1903
|
key: "test",
|
|
1904
1904
|
value: function test(screen) {
|
|
1905
|
-
var
|
|
1906
|
-
|
|
1907
|
-
footer =
|
|
1908
|
-
|
|
1909
|
-
header =
|
|
1905
|
+
var _ref0 = screen || {},
|
|
1906
|
+
_ref0$footer = _ref0.footer,
|
|
1907
|
+
footer = _ref0$footer === void 0 ? null : _ref0$footer,
|
|
1908
|
+
_ref0$header = _ref0.header,
|
|
1909
|
+
header = _ref0$header === void 0 ? null : _ref0$header;
|
|
1910
1910
|
if (header === null || footer === null) {
|
|
1911
1911
|
return false;
|
|
1912
1912
|
}
|
|
1913
|
-
var
|
|
1914
|
-
|
|
1915
|
-
badge =
|
|
1916
|
-
var
|
|
1917
|
-
|
|
1918
|
-
callToAction =
|
|
1913
|
+
var _ref1 = header || {},
|
|
1914
|
+
_ref1$badge = _ref1.badge,
|
|
1915
|
+
badge = _ref1$badge === void 0 ? null : _ref1$badge;
|
|
1916
|
+
var _ref10 = footer || {},
|
|
1917
|
+
_ref10$callToAction = _ref10.callToAction,
|
|
1918
|
+
callToAction = _ref10$callToAction === void 0 ? null : _ref10$callToAction;
|
|
1919
1919
|
if (callToAction === null) {
|
|
1920
1920
|
return false;
|
|
1921
1921
|
}
|
|
@@ -1935,20 +1935,20 @@ var ButtonPadding = /*#__PURE__*/function () {
|
|
|
1935
1935
|
}, {
|
|
1936
1936
|
key: "parse",
|
|
1937
1937
|
value: function parse(screen) {
|
|
1938
|
-
var
|
|
1939
|
-
|
|
1940
|
-
footer =
|
|
1941
|
-
|
|
1942
|
-
header =
|
|
1943
|
-
restScreen = _objectWithoutProperties(
|
|
1944
|
-
var
|
|
1945
|
-
|
|
1946
|
-
badge =
|
|
1947
|
-
restHeader = _objectWithoutProperties(
|
|
1948
|
-
var
|
|
1949
|
-
|
|
1950
|
-
callToAction =
|
|
1951
|
-
restFooter = _objectWithoutProperties(
|
|
1938
|
+
var _ref11 = screen || {},
|
|
1939
|
+
_ref11$footer = _ref11.footer,
|
|
1940
|
+
footer = _ref11$footer === void 0 ? null : _ref11$footer,
|
|
1941
|
+
_ref11$header = _ref11.header,
|
|
1942
|
+
header = _ref11$header === void 0 ? null : _ref11$header,
|
|
1943
|
+
restScreen = _objectWithoutProperties(_ref11, _excluded$3);
|
|
1944
|
+
var _ref12 = header || {},
|
|
1945
|
+
_ref12$badge = _ref12.badge,
|
|
1946
|
+
badge = _ref12$badge === void 0 ? null : _ref12$badge,
|
|
1947
|
+
restHeader = _objectWithoutProperties(_ref12, _excluded2$1);
|
|
1948
|
+
var _ref13 = footer || {},
|
|
1949
|
+
_ref13$callToAction = _ref13.callToAction,
|
|
1950
|
+
callToAction = _ref13$callToAction === void 0 ? null : _ref13$callToAction,
|
|
1951
|
+
restFooter = _objectWithoutProperties(_ref13, _excluded3);
|
|
1952
1952
|
return _objectSpread(_objectSpread({}, restScreen), {}, {
|
|
1953
1953
|
header: _objectSpread(_objectSpread({}, restHeader), badge !== null ? {
|
|
1954
1954
|
badge: parsePadding(badge)
|
|
@@ -2285,9 +2285,9 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
2285
2285
|
var innerDefinition = isArray(fieldsOrDefinition) ? fieldsOrDefinition.find(function (it) {
|
|
2286
2286
|
return it.name === innerFieldName;
|
|
2287
2287
|
}) || null : fieldsOrDefinition;
|
|
2288
|
-
var
|
|
2289
|
-
|
|
2290
|
-
idfTheme =
|
|
2288
|
+
var _ref0 = innerDefinition || {},
|
|
2289
|
+
_ref0$theme = _ref0.theme,
|
|
2290
|
+
idfTheme = _ref0$theme === void 0 ? null : _ref0$theme;
|
|
2291
2291
|
var innerValue = value[innerFieldName];
|
|
2292
2292
|
|
|
2293
2293
|
// For items fields
|
|
@@ -2318,14 +2318,14 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
2318
2318
|
var _this5 = this;
|
|
2319
2319
|
if (isObject(initialValue) || isObject(fieldTheme)) {
|
|
2320
2320
|
var value = initialValue || null;
|
|
2321
|
-
var
|
|
2322
|
-
|
|
2323
|
-
fieldTextStyleName =
|
|
2324
|
-
|
|
2325
|
-
fieldColorName =
|
|
2326
|
-
|
|
2327
|
-
fieldBoxStyleName =
|
|
2328
|
-
otherProps = _objectWithoutProperties(
|
|
2321
|
+
var _ref1 = fieldTheme || {},
|
|
2322
|
+
_ref1$textStyle = _ref1.textStyle,
|
|
2323
|
+
fieldTextStyleName = _ref1$textStyle === void 0 ? null : _ref1$textStyle,
|
|
2324
|
+
_ref1$color = _ref1.color,
|
|
2325
|
+
fieldColorName = _ref1$color === void 0 ? null : _ref1$color,
|
|
2326
|
+
_ref1$boxStyle = _ref1.boxStyle,
|
|
2327
|
+
fieldBoxStyleName = _ref1$boxStyle === void 0 ? null : _ref1$boxStyle,
|
|
2328
|
+
otherProps = _objectWithoutProperties(_ref1, _excluded$1);
|
|
2329
2329
|
if (fieldTextStyleName === null && fieldColorName === null && fieldBoxStyleName === null && isEmpty(otherProps) && !isObject(fieldTheme)) {
|
|
2330
2330
|
return value;
|
|
2331
2331
|
}
|
|
@@ -2337,11 +2337,11 @@ var ThemeParser = /*#__PURE__*/function () {
|
|
|
2337
2337
|
return _objectSpread(_objectSpread({}, newObject), newValue !== null ? _defineProperty({}, key, newValue) : null);
|
|
2338
2338
|
}, {});
|
|
2339
2339
|
}
|
|
2340
|
-
var
|
|
2341
|
-
|
|
2342
|
-
valueTextStyle =
|
|
2343
|
-
|
|
2344
|
-
valueBoxStyle =
|
|
2340
|
+
var _ref11 = value || {},
|
|
2341
|
+
_ref11$textStyle = _ref11.textStyle,
|
|
2342
|
+
valueTextStyle = _ref11$textStyle === void 0 ? null : _ref11$textStyle,
|
|
2343
|
+
_ref11$boxStyle = _ref11.boxStyle,
|
|
2344
|
+
valueBoxStyle = _ref11$boxStyle === void 0 ? null : _ref11$boxStyle;
|
|
2345
2345
|
|
|
2346
2346
|
// Color
|
|
2347
2347
|
var fieldColor = fieldColorName !== null && themeColors !== null ? themeColors[fieldColorName] || null : null;
|
package/es/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import isNumber from 'lodash/isNumber';
|
|
2
2
|
import { kebabCase, pascalCase, snakeCase } from 'change-case';
|
|
3
3
|
export { camelCase, pascalCase, snakeCase } from 'change-case';
|
|
4
|
-
import
|
|
4
|
+
import _regenerator from '@babel/runtime/helpers/regenerator';
|
|
5
5
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
6
|
import isObject from 'lodash/isObject';
|
|
7
7
|
import { useEffect, useMemo } from 'react';
|
|
@@ -33,20 +33,17 @@ function copyClipboardApi(_x) {
|
|
|
33
33
|
return _copyClipboardApi.apply(this, arguments);
|
|
34
34
|
}
|
|
35
35
|
function _copyClipboardApi() {
|
|
36
|
-
_copyClipboardApi = _asyncToGenerator(/*#__PURE__*/
|
|
37
|
-
return
|
|
38
|
-
while (1) switch (_context.
|
|
36
|
+
_copyClipboardApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(text) {
|
|
37
|
+
return _regenerator().w(function (_context) {
|
|
38
|
+
while (1) switch (_context.n) {
|
|
39
39
|
case 0:
|
|
40
40
|
if (navigator.clipboard) {
|
|
41
|
-
_context.
|
|
41
|
+
_context.n = 1;
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
throw makeError();
|
|
45
|
-
case
|
|
46
|
-
return _context.
|
|
47
|
-
case 3:
|
|
48
|
-
case "end":
|
|
49
|
-
return _context.stop();
|
|
45
|
+
case 1:
|
|
46
|
+
return _context.a(2, navigator.clipboard.writeText(text));
|
|
50
47
|
}
|
|
51
48
|
}, _callee);
|
|
52
49
|
}));
|
|
@@ -56,10 +53,10 @@ function copyExecCommand(_x2) {
|
|
|
56
53
|
return _copyExecCommand.apply(this, arguments);
|
|
57
54
|
}
|
|
58
55
|
function _copyExecCommand() {
|
|
59
|
-
_copyExecCommand = _asyncToGenerator(/*#__PURE__*/
|
|
56
|
+
_copyExecCommand = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(text) {
|
|
60
57
|
var span, selection, range, success;
|
|
61
|
-
return
|
|
62
|
-
while (1) switch (_context2.
|
|
58
|
+
return _regenerator().w(function (_context2) {
|
|
59
|
+
while (1) switch (_context2.n) {
|
|
63
60
|
case 0:
|
|
64
61
|
// Put the text to copy into a <span>
|
|
65
62
|
span = document.createElement('span');
|
|
@@ -90,13 +87,12 @@ function _copyExecCommand() {
|
|
|
90
87
|
window.document.body.removeChild(span);
|
|
91
88
|
}
|
|
92
89
|
if (success) {
|
|
93
|
-
_context2.
|
|
90
|
+
_context2.n = 1;
|
|
94
91
|
break;
|
|
95
92
|
}
|
|
96
93
|
throw makeError();
|
|
97
|
-
case
|
|
98
|
-
|
|
99
|
-
return _context2.stop();
|
|
94
|
+
case 1:
|
|
95
|
+
return _context2.a(2);
|
|
100
96
|
}
|
|
101
97
|
}, _callee2);
|
|
102
98
|
}));
|
|
@@ -106,34 +102,34 @@ function copyToClipboard(_x3) {
|
|
|
106
102
|
return _copyToClipboard.apply(this, arguments);
|
|
107
103
|
}
|
|
108
104
|
function _copyToClipboard() {
|
|
109
|
-
_copyToClipboard = _asyncToGenerator(/*#__PURE__*/
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
_copyToClipboard = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(text) {
|
|
106
|
+
var _t, _t2;
|
|
107
|
+
return _regenerator().w(function (_context3) {
|
|
108
|
+
while (1) switch (_context3.n) {
|
|
112
109
|
case 0:
|
|
113
|
-
_context3.
|
|
114
|
-
_context3.
|
|
110
|
+
_context3.p = 0;
|
|
111
|
+
_context3.n = 1;
|
|
115
112
|
return copyClipboardApi(text);
|
|
116
|
-
case
|
|
117
|
-
_context3.
|
|
113
|
+
case 1:
|
|
114
|
+
_context3.n = 6;
|
|
118
115
|
break;
|
|
119
|
-
case
|
|
120
|
-
_context3.
|
|
121
|
-
|
|
122
|
-
_context3.
|
|
123
|
-
_context3.
|
|
116
|
+
case 2:
|
|
117
|
+
_context3.p = 2;
|
|
118
|
+
_t = _context3.v;
|
|
119
|
+
_context3.p = 3;
|
|
120
|
+
_context3.n = 4;
|
|
124
121
|
return copyExecCommand(text);
|
|
125
|
-
case
|
|
126
|
-
_context3.
|
|
122
|
+
case 4:
|
|
123
|
+
_context3.n = 6;
|
|
127
124
|
break;
|
|
128
|
-
case
|
|
129
|
-
_context3.
|
|
130
|
-
|
|
131
|
-
throw
|
|
132
|
-
case
|
|
133
|
-
|
|
134
|
-
return _context3.stop();
|
|
125
|
+
case 5:
|
|
126
|
+
_context3.p = 5;
|
|
127
|
+
_t2 = _context3.v;
|
|
128
|
+
throw _t2 || _t || makeError();
|
|
129
|
+
case 6:
|
|
130
|
+
return _context3.a(2);
|
|
135
131
|
}
|
|
136
|
-
}, _callee3, null, [[
|
|
132
|
+
}, _callee3, null, [[3, 5], [0, 2]]);
|
|
137
133
|
}));
|
|
138
134
|
return _copyToClipboard.apply(this, arguments);
|
|
139
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.706",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@react-spring/core": "^9.6.1",
|
|
119
119
|
"@react-spring/web": "^9.6.1",
|
|
120
120
|
"@use-gesture/react": "^10.3.1",
|
|
121
|
-
"bootstrap": "^5.3.
|
|
121
|
+
"bootstrap": "^5.3.7",
|
|
122
122
|
"change-case": "^5.4.4",
|
|
123
123
|
"classnames": "^2.2.6",
|
|
124
124
|
"css-mediaquery": "^0.1.2",
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
"debug": "^4.3.4",
|
|
127
127
|
"flat": "^6.0.1",
|
|
128
128
|
"hoist-non-react-statics": "^3.3.2",
|
|
129
|
+
"js-cookie": "^3.0.5",
|
|
129
130
|
"lodash": "^4.17.21",
|
|
130
131
|
"prop-types": "^15.7.2",
|
|
131
132
|
"query-string": "^9.0.0",
|
|
@@ -144,5 +145,5 @@
|
|
|
144
145
|
"access": "public",
|
|
145
146
|
"registry": "https://registry.npmjs.org/"
|
|
146
147
|
},
|
|
147
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "1797e88940f701824f9b047784d8f5a872b6a790"
|
|
148
149
|
}
|