@micromag/core 0.3.779 → 0.3.788
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 -2
- package/es/components.js +52 -20
- package/es/contexts.js +36 -25
- package/es/hooks.js +6 -3
- package/es/index.js +2 -2
- package/es/utils.js +1 -1
- package/lib/components.js +52 -20
- package/lib/contexts.js +35 -24
- package/lib/hooks.js +6 -3
- package/lib/index.js +2 -2
- package/lib/utils.js +1 -1
- package/package.json +5 -2
- package/scss/vendor.scss +2 -2
package/es/components.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { useCallback, useState, useEffect, useRef, useMemo } from 'react';
|
|
1
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
5
|
import classNames from 'classnames';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
7
|
+
import { faAngleLeft } from '@fortawesome/free-solid-svg-icons/faAngleLeft';
|
|
6
8
|
import { Link as Link$1 } from 'wouter';
|
|
7
9
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
8
10
|
import { FormattedMessage, defineMessages, FormattedDate, FormattedTime } from 'react-intl';
|
|
9
11
|
import { isMessage, getFieldFromPath, getComponentFromName, setFieldValue, validateFields, getDisplayName, pascalCase, convertStyleToString } from '@micromag/core/utils';
|
|
10
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
11
|
-
import { faAngleLeft } from '@fortawesome/free-solid-svg-icons/faAngleLeft';
|
|
12
12
|
import { faClose } from '@fortawesome/free-solid-svg-icons/faClose';
|
|
13
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
14
13
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
15
|
-
import { useForm, useDocumentEvent, useIntersectionObserver, useDimensionObserver, useDevicePixelRatio } from '@micromag/core/hooks';
|
|
16
|
-
import { useFieldsManager, useFieldComponent, FieldContextProvider, withModals, useModals, withPanels, usePanels, ScreenSizeProvider, useScreenComponent, ScreenProvider, useScreenRenderContext, useScreenSize } from '@micromag/core/contexts';
|
|
17
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
18
|
-
import get from 'lodash/get';
|
|
19
|
-
import queryString from 'query-string';
|
|
20
|
-
import { createPortal } from 'react-dom';
|
|
21
14
|
import { faAngleDown } from '@fortawesome/free-solid-svg-icons/faAngleDown';
|
|
22
15
|
import { faAngleUp } from '@fortawesome/free-solid-svg-icons/faAngleUp';
|
|
23
16
|
import dayjs from 'dayjs';
|
|
24
17
|
import throttle from 'lodash/throttle';
|
|
18
|
+
import { useForm, useDocumentEvent, useIntersectionObserver, useDimensionObserver, useDevicePixelRatio } from '@micromag/core/hooks';
|
|
19
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
20
|
+
import get from 'lodash/get';
|
|
21
|
+
import { useFieldsManager, useFieldComponent, FieldContextProvider, withModals, useModals, withPanels, usePanels, ScreenSizeProvider, useScreenComponent, ScreenProvider, useScreenRenderContext, useScreenSize } from '@micromag/core/contexts';
|
|
22
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
25
23
|
import isObject from 'lodash/isObject';
|
|
26
24
|
import { Helmet } from 'react-helmet';
|
|
27
25
|
import isString from 'lodash/isString';
|
|
28
26
|
import isArray from 'lodash/isArray';
|
|
27
|
+
import { createPortal } from 'react-dom';
|
|
28
|
+
import queryString from 'query-string';
|
|
29
29
|
import { faAd } from '@fortawesome/free-solid-svg-icons/faAd';
|
|
30
30
|
import { faImage } from '@fortawesome/free-solid-svg-icons/faImage';
|
|
31
31
|
import { faMusic } from '@fortawesome/free-solid-svg-icons/faMusic';
|
|
@@ -35,12 +35,12 @@ import { faMapMarkedAlt } from '@fortawesome/free-solid-svg-icons/faMapMarkedAlt
|
|
|
35
35
|
import { faVideo } from '@fortawesome/free-solid-svg-icons/faVideo';
|
|
36
36
|
import { faPlay } from '@fortawesome/free-solid-svg-icons/faPlay';
|
|
37
37
|
import { faRedo } from '@fortawesome/free-solid-svg-icons/faRedo';
|
|
38
|
-
import { getSizeWithinBounds } from '@folklore/size';
|
|
39
38
|
import { faCommentDots } from '@fortawesome/free-solid-svg-icons/faCommentDots';
|
|
40
39
|
import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';
|
|
41
40
|
import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';
|
|
42
41
|
import { faCircle } from '@fortawesome/free-solid-svg-icons/faCircle';
|
|
43
42
|
import { faPercent } from '@fortawesome/free-solid-svg-icons/faPercent';
|
|
43
|
+
import { getSizeWithinBounds } from '@folklore/size';
|
|
44
44
|
import { useSpring } from '@react-spring/core';
|
|
45
45
|
import { config, animated } from '@react-spring/web';
|
|
46
46
|
|
|
@@ -2435,24 +2435,56 @@ var FontFaces = function FontFaces(_ref4) {
|
|
|
2435
2435
|
return fontFontFaces;
|
|
2436
2436
|
}
|
|
2437
2437
|
var urls = media !== null ? getUrlsFromMedia(media, formats) : null;
|
|
2438
|
-
|
|
2438
|
+
var fontKey = name.toLowerCase();
|
|
2439
|
+
return _objectSpread(_objectSpread({}, fontFontFaces), {}, _defineProperty({}, fontKey, urls !== null && urls.length > 0 ? "\n @font-face {\n font-family: \"".concat(name, "\";\n src: ").concat(urls.join(','), ";\n }\n ") : null), variants.reduce(function (variantFontFaces, _ref6) {
|
|
2439
2440
|
var weight = _ref6.weight,
|
|
2440
2441
|
style = _ref6.style,
|
|
2441
2442
|
_ref6$media = _ref6.media,
|
|
2442
2443
|
variantMedia = _ref6$media === void 0 ? null : _ref6$media;
|
|
2443
2444
|
if (variantMedia == null) {
|
|
2444
|
-
return
|
|
2445
|
+
return variantFontFaces;
|
|
2445
2446
|
}
|
|
2446
2447
|
var variantUrls = getUrlsFromMedia(variantMedia, formats);
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2448
|
+
var variantKey = "".concat(fontKey, "-").concat(weight !== null ? weight : 'normal', "-").concat(style !== null ? style : 'normal');
|
|
2449
|
+
return _objectSpread(_objectSpread({}, variantFontFaces), {}, _defineProperty({}, variantKey, variantUrls !== null && variantUrls.length > 0 ? "\n @font-face {\n font-family: \"".concat(name, "\";\n ").concat(weight !== null ? "font-weight: ".concat(weight, ";") : '', "\n ").concat(style !== null ? "font-style: ".concat(style, ";") : '', "\n src: ").concat(variantUrls.join(','), ";\n }\n ") : null));
|
|
2450
|
+
}, {}));
|
|
2451
|
+
|
|
2452
|
+
// return [
|
|
2453
|
+
// ...fontFontFaces,
|
|
2454
|
+
// urls !== null && urls.length > 0
|
|
2455
|
+
// ? `
|
|
2456
|
+
// @font-face {
|
|
2457
|
+
// font-family: "${name}";
|
|
2458
|
+
// src: ${urls.join(',')};
|
|
2459
|
+
// }
|
|
2460
|
+
// `
|
|
2461
|
+
// : null,
|
|
2462
|
+
// ...(variants || []).map(({ weight, style, media: variantMedia = null }) => {
|
|
2463
|
+
// if (variantMedia == null) {
|
|
2464
|
+
// return null;
|
|
2465
|
+
// }
|
|
2466
|
+
// const variantUrls = getUrlsFromMedia(variantMedia, formats);
|
|
2467
|
+
// return variantUrls !== null && variantUrls.length > 0
|
|
2468
|
+
// ? `
|
|
2469
|
+
// @font-face {
|
|
2470
|
+
// font-family: "${name}";
|
|
2471
|
+
// ${weight !== null ? `font-weight: ${weight};` : ''}
|
|
2472
|
+
// ${style !== null ? `font-style: ${style};` : ''}
|
|
2473
|
+
// src: ${variantUrls.join(',')};
|
|
2474
|
+
// }
|
|
2475
|
+
// `
|
|
2476
|
+
// : null;
|
|
2477
|
+
// }),
|
|
2478
|
+
// ];
|
|
2479
|
+
}, {});
|
|
2452
2480
|
return fontFaces.length > 0 ? /*#__PURE__*/React.createElement("style", {
|
|
2453
2481
|
type: "text/css",
|
|
2454
2482
|
dangerouslySetInnerHTML: {
|
|
2455
|
-
__html: fontFaces.
|
|
2483
|
+
__html: Object.keys(fontFaces).map(function (it) {
|
|
2484
|
+
return fontFaces[it];
|
|
2485
|
+
}).filter(function (it) {
|
|
2486
|
+
return it !== null;
|
|
2487
|
+
}).join('\n')
|
|
2456
2488
|
}
|
|
2457
2489
|
}) : null;
|
|
2458
2490
|
};
|
package/es/contexts.js
CHANGED
|
@@ -15,10 +15,10 @@ import { loadGoogleApi, loadGoogleMaps } from '@folklore/services';
|
|
|
15
15
|
import { getDisplayName, getScreenExtraField } from '@micromag/core/utils';
|
|
16
16
|
import { useUrlGenerator } from '@folklore/routes';
|
|
17
17
|
export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
|
|
18
|
-
import {
|
|
19
|
-
import { TrackingContext, TrackingContainer } from '@folklore/tracking';
|
|
18
|
+
import { TrackingContainer, TrackingContext } from '@folklore/tracking';
|
|
20
19
|
export { TrackingContext } from '@folklore/tracking';
|
|
21
20
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
21
|
+
import { useLocation } from 'wouter';
|
|
22
22
|
|
|
23
23
|
var MODALS_NAMESPACE = 'modals';
|
|
24
24
|
var FIELDS_NAMESPACE = 'fields';
|
|
@@ -1101,21 +1101,26 @@ var PlaybackContext = /*#__PURE__*/React.createContext(_objectSpread(_objectSpre
|
|
|
1101
1101
|
var usePlaybackContext = function usePlaybackContext() {
|
|
1102
1102
|
return useContext(PlaybackContext);
|
|
1103
1103
|
};
|
|
1104
|
-
var usePlaybackMediaRef = function usePlaybackMediaRef(
|
|
1104
|
+
var usePlaybackMediaRef = function usePlaybackMediaRef() {
|
|
1105
|
+
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1106
|
+
var background = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1105
1107
|
var _usePlaybackContext = usePlaybackContext(),
|
|
1106
|
-
setMedia = _usePlaybackContext.setMedia
|
|
1108
|
+
setMedia = _usePlaybackContext.setMedia,
|
|
1109
|
+
setIsBackground = _usePlaybackContext.setIsBackground;
|
|
1107
1110
|
var mediaRef = useRef(null);
|
|
1108
1111
|
useEffect(function () {
|
|
1109
1112
|
if (!active) {
|
|
1110
1113
|
return function () {};
|
|
1111
1114
|
}
|
|
1115
|
+
setIsBackground(background);
|
|
1112
1116
|
if (mediaRef.current !== null) {
|
|
1113
1117
|
setMedia(mediaRef.current);
|
|
1114
1118
|
}
|
|
1115
1119
|
return function () {
|
|
1116
1120
|
setMedia(null);
|
|
1121
|
+
setIsBackground(false);
|
|
1117
1122
|
};
|
|
1118
|
-
}, [setMedia, active]);
|
|
1123
|
+
}, [setMedia, setIsBackground, active, background]);
|
|
1119
1124
|
return mediaRef;
|
|
1120
1125
|
};
|
|
1121
1126
|
var propTypes$5 = {
|
|
@@ -1156,26 +1161,30 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
1156
1161
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
1157
1162
|
media = _useState6[0],
|
|
1158
1163
|
setMedia = _useState6[1];
|
|
1159
|
-
var _useState7 = useState(
|
|
1164
|
+
var _useState7 = useState(false),
|
|
1160
1165
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
var _useState9 = useState(
|
|
1166
|
+
isBackground = _useState8[0],
|
|
1167
|
+
setIsBackground = _useState8[1];
|
|
1168
|
+
var _useState9 = useState(initialControls),
|
|
1164
1169
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
var _useState1 = useState(
|
|
1170
|
+
controls = _useState0[0],
|
|
1171
|
+
setControls = _useState0[1];
|
|
1172
|
+
var _useState1 = useState(initialControlsSuggestPlay),
|
|
1168
1173
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
var _useState11 = useState(
|
|
1174
|
+
controlsSuggestPlay = _useState10[0],
|
|
1175
|
+
setControlsSuggestPlay = _useState10[1];
|
|
1176
|
+
var _useState11 = useState(initialControlsVisible),
|
|
1172
1177
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
var _useState13 = useState(
|
|
1178
|
+
controlsVisible = _useState12[0],
|
|
1179
|
+
setControlsVisible = _useState12[1];
|
|
1180
|
+
var _useState13 = useState(initialControlsTheme),
|
|
1176
1181
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
1177
|
-
|
|
1178
|
-
|
|
1182
|
+
controlsTheme = _useState14[0],
|
|
1183
|
+
setControlsTheme = _useState14[1];
|
|
1184
|
+
var _useState15 = useState(initialCurrentQualityLevel),
|
|
1185
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
1186
|
+
currentQualityLevel = _useState16[0],
|
|
1187
|
+
setCurrentQualityLevel = _useState16[1];
|
|
1179
1188
|
var finalSetControls = useCallback(function (newControls) {
|
|
1180
1189
|
if (newControls) {
|
|
1181
1190
|
setControls(true);
|
|
@@ -1203,10 +1212,10 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
1203
1212
|
}, [media, setControlsSuggestPlay]);
|
|
1204
1213
|
|
|
1205
1214
|
// Handle media ended
|
|
1206
|
-
var
|
|
1207
|
-
|
|
1208
|
-
completed =
|
|
1209
|
-
setCompleted =
|
|
1215
|
+
var _useState17 = useState(false),
|
|
1216
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
1217
|
+
completed = _useState18[0],
|
|
1218
|
+
setCompleted = _useState18[1];
|
|
1210
1219
|
var onMediaCompleted = useCallback(function () {
|
|
1211
1220
|
return setCompleted(true);
|
|
1212
1221
|
}, [setCompleted]);
|
|
@@ -1258,6 +1267,8 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
1258
1267
|
controlsTheme: controlsTheme,
|
|
1259
1268
|
currentQualityLevel: currentQualityLevel,
|
|
1260
1269
|
setMuted: setMuted,
|
|
1270
|
+
setIsBackground: setIsBackground,
|
|
1271
|
+
isBackground: isBackground,
|
|
1261
1272
|
setPlaying: finalSetPlaying,
|
|
1262
1273
|
setControls: finalSetControls,
|
|
1263
1274
|
setControlsSuggestPlay: setControlsSuggestPlay,
|
|
@@ -1268,7 +1279,7 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
1268
1279
|
setMedia: setMedia,
|
|
1269
1280
|
setCurrentQualityLevel: finalSetCurrentQualityLevel
|
|
1270
1281
|
};
|
|
1271
|
-
}, [muted, playing, completed, paused, controls, controlsSuggestPlay, controlsVisible, controlsTheme, media, hasAudio, currentQualityLevel, setMuted, finalSetPlaying, finalSetControls, finalSetControlsTheme, setControlsSuggestPlay, setControlsVisible, setControlsTheme, showControls, hideControls, setMedia, setCurrentQualityLevel]);
|
|
1282
|
+
}, [muted, playing, completed, paused, controls, controlsSuggestPlay, controlsVisible, controlsTheme, media, hasAudio, currentQualityLevel, setMuted, setIsBackground, isBackground, finalSetPlaying, finalSetControls, finalSetControlsTheme, setControlsSuggestPlay, setControlsVisible, setControlsTheme, showControls, hideControls, setMedia, setCurrentQualityLevel]);
|
|
1272
1283
|
return /*#__PURE__*/React.createElement(PlaybackContext.Provider, {
|
|
1273
1284
|
value: value
|
|
1274
1285
|
}, children);
|
package/es/hooks.js
CHANGED
|
@@ -13,13 +13,13 @@ import screenfull from 'screenfull';
|
|
|
13
13
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
14
14
|
import isArray from 'lodash/isArray';
|
|
15
15
|
import isObject from 'lodash/isObject';
|
|
16
|
+
import raf from 'raf';
|
|
16
17
|
import createDebug from 'debug';
|
|
17
18
|
import isString from 'lodash/isString';
|
|
18
|
-
import raf from 'raf';
|
|
19
19
|
import { useScreensManager, useFieldsManager, useTracking, useScreen } from '@micromag/core/contexts';
|
|
20
|
+
import { match } from 'css-mediaquery';
|
|
20
21
|
import { useIntl } from 'react-intl';
|
|
21
22
|
import dayjs from 'dayjs';
|
|
22
|
-
import { match } from 'css-mediaquery';
|
|
23
23
|
import clamp from 'lodash/clamp';
|
|
24
24
|
|
|
25
25
|
function useActivityDetector() {
|
|
@@ -203,6 +203,8 @@ function useDragProgress() {
|
|
|
203
203
|
onProgress = _ref$onProgress === void 0 ? null : _ref$onProgress,
|
|
204
204
|
_ref$onPointerDown = _ref.onPointerDown,
|
|
205
205
|
onPointerDown = _ref$onPointerDown === void 0 ? null : _ref$onPointerDown,
|
|
206
|
+
_ref$onScroll = _ref.onScroll,
|
|
207
|
+
onScroll = _ref$onScroll === void 0 ? null : _ref$onScroll,
|
|
206
208
|
_ref$springParams = _ref.springParams,
|
|
207
209
|
springParams = _ref$springParams === void 0 ? undefined : _ref$springParams,
|
|
208
210
|
_ref$dragOptions = _ref.dragOptions,
|
|
@@ -272,7 +274,8 @@ function useDragProgress() {
|
|
|
272
274
|
}, [setDragging, disabled, onTap, computeProgress, dragging, onProgress]);
|
|
273
275
|
var bind = useGesture({
|
|
274
276
|
onDrag: onDrag,
|
|
275
|
-
onPointerDown: onPointerDown !== null ? onPointerDown : function () {}
|
|
277
|
+
onPointerDown: onPointerDown !== null ? onPointerDown : function () {},
|
|
278
|
+
onScroll: onScroll !== null ? onScroll : function () {}
|
|
276
279
|
}, {
|
|
277
280
|
drag: dragOptions
|
|
278
281
|
});
|
package/es/index.js
CHANGED
|
@@ -12,11 +12,11 @@ import _inherits from '@babel/runtime/helpers/inherits';
|
|
|
12
12
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
13
13
|
import { snakeCase, pascalCase } from 'change-case';
|
|
14
14
|
import uniqBy from 'lodash/uniqBy';
|
|
15
|
-
import _typeof from '@babel/runtime/helpers/typeof';
|
|
16
15
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
16
|
+
import uniq from 'lodash/uniq';
|
|
17
|
+
import _typeof from '@babel/runtime/helpers/typeof';
|
|
17
18
|
import isString from 'lodash/isString';
|
|
18
19
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
19
|
-
import uniq from 'lodash/uniq';
|
|
20
20
|
import isEmpty from 'lodash/isEmpty';
|
|
21
21
|
import { Tracking as Tracking$1 } from '@folklore/tracking';
|
|
22
22
|
import PropTypes$1 from 'prop-types';
|
package/es/utils.js
CHANGED
|
@@ -11,8 +11,8 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
11
11
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
12
12
|
import isArray from 'lodash/isArray';
|
|
13
13
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
14
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
15
14
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
15
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
16
16
|
import slugify from 'slugify';
|
|
17
17
|
|
|
18
18
|
function addNonBreakingSpaces(text) {
|
package/lib/components.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var PropTypes = require('prop-types');
|
|
4
|
+
var React = require('react');
|
|
3
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
6
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
7
|
var classNames = require('classnames');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
+
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
9
|
+
var faAngleLeft = require('@fortawesome/free-solid-svg-icons/faAngleLeft');
|
|
8
10
|
var wouter = require('wouter');
|
|
9
11
|
var core = require('@micromag/core');
|
|
10
12
|
var reactIntl = require('react-intl');
|
|
11
13
|
var utils = require('@micromag/core/utils');
|
|
12
|
-
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
13
|
-
var faAngleLeft = require('@fortawesome/free-solid-svg-icons/faAngleLeft');
|
|
14
14
|
var faClose = require('@fortawesome/free-solid-svg-icons/faClose');
|
|
15
|
-
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
16
15
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
17
|
-
var hooks = require('@micromag/core/hooks');
|
|
18
|
-
var contexts = require('@micromag/core/contexts');
|
|
19
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
20
|
-
var get = require('lodash/get');
|
|
21
|
-
var queryString = require('query-string');
|
|
22
|
-
var reactDom = require('react-dom');
|
|
23
16
|
var faAngleDown = require('@fortawesome/free-solid-svg-icons/faAngleDown');
|
|
24
17
|
var faAngleUp = require('@fortawesome/free-solid-svg-icons/faAngleUp');
|
|
25
18
|
var dayjs = require('dayjs');
|
|
26
19
|
var throttle = require('lodash/throttle');
|
|
20
|
+
var hooks = require('@micromag/core/hooks');
|
|
21
|
+
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
22
|
+
var get = require('lodash/get');
|
|
23
|
+
var contexts = require('@micromag/core/contexts');
|
|
24
|
+
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
27
25
|
var isObject = require('lodash/isObject');
|
|
28
26
|
var reactHelmet = require('react-helmet');
|
|
29
27
|
var isString = require('lodash/isString');
|
|
30
28
|
var isArray = require('lodash/isArray');
|
|
29
|
+
var reactDom = require('react-dom');
|
|
30
|
+
var queryString = require('query-string');
|
|
31
31
|
var faAd = require('@fortawesome/free-solid-svg-icons/faAd');
|
|
32
32
|
var faImage = require('@fortawesome/free-solid-svg-icons/faImage');
|
|
33
33
|
var faMusic = require('@fortawesome/free-solid-svg-icons/faMusic');
|
|
@@ -37,12 +37,12 @@ var faMapMarkedAlt = require('@fortawesome/free-solid-svg-icons/faMapMarkedAlt')
|
|
|
37
37
|
var faVideo = require('@fortawesome/free-solid-svg-icons/faVideo');
|
|
38
38
|
var faPlay = require('@fortawesome/free-solid-svg-icons/faPlay');
|
|
39
39
|
var faRedo = require('@fortawesome/free-solid-svg-icons/faRedo');
|
|
40
|
-
var size = require('@folklore/size');
|
|
41
40
|
var faCommentDots = require('@fortawesome/free-solid-svg-icons/faCommentDots');
|
|
42
41
|
var faCheck = require('@fortawesome/free-solid-svg-icons/faCheck');
|
|
43
42
|
var faTimes = require('@fortawesome/free-solid-svg-icons/faTimes');
|
|
44
43
|
var faCircle = require('@fortawesome/free-solid-svg-icons/faCircle');
|
|
45
44
|
var faPercent = require('@fortawesome/free-solid-svg-icons/faPercent');
|
|
45
|
+
var size = require('@folklore/size');
|
|
46
46
|
var core$1 = require('@react-spring/core');
|
|
47
47
|
var web = require('@react-spring/web');
|
|
48
48
|
|
|
@@ -2437,24 +2437,56 @@ var FontFaces = function FontFaces(_ref4) {
|
|
|
2437
2437
|
return fontFontFaces;
|
|
2438
2438
|
}
|
|
2439
2439
|
var urls = media !== null ? getUrlsFromMedia(media, formats) : null;
|
|
2440
|
-
|
|
2440
|
+
var fontKey = name.toLowerCase();
|
|
2441
|
+
return _objectSpread(_objectSpread({}, fontFontFaces), {}, _defineProperty({}, fontKey, urls !== null && urls.length > 0 ? "\n @font-face {\n font-family: \"".concat(name, "\";\n src: ").concat(urls.join(','), ";\n }\n ") : null), variants.reduce(function (variantFontFaces, _ref6) {
|
|
2441
2442
|
var weight = _ref6.weight,
|
|
2442
2443
|
style = _ref6.style,
|
|
2443
2444
|
_ref6$media = _ref6.media,
|
|
2444
2445
|
variantMedia = _ref6$media === void 0 ? null : _ref6$media;
|
|
2445
2446
|
if (variantMedia == null) {
|
|
2446
|
-
return
|
|
2447
|
+
return variantFontFaces;
|
|
2447
2448
|
}
|
|
2448
2449
|
var variantUrls = getUrlsFromMedia(variantMedia, formats);
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2450
|
+
var variantKey = "".concat(fontKey, "-").concat(weight !== null ? weight : 'normal', "-").concat(style !== null ? style : 'normal');
|
|
2451
|
+
return _objectSpread(_objectSpread({}, variantFontFaces), {}, _defineProperty({}, variantKey, variantUrls !== null && variantUrls.length > 0 ? "\n @font-face {\n font-family: \"".concat(name, "\";\n ").concat(weight !== null ? "font-weight: ".concat(weight, ";") : '', "\n ").concat(style !== null ? "font-style: ".concat(style, ";") : '', "\n src: ").concat(variantUrls.join(','), ";\n }\n ") : null));
|
|
2452
|
+
}, {}));
|
|
2453
|
+
|
|
2454
|
+
// return [
|
|
2455
|
+
// ...fontFontFaces,
|
|
2456
|
+
// urls !== null && urls.length > 0
|
|
2457
|
+
// ? `
|
|
2458
|
+
// @font-face {
|
|
2459
|
+
// font-family: "${name}";
|
|
2460
|
+
// src: ${urls.join(',')};
|
|
2461
|
+
// }
|
|
2462
|
+
// `
|
|
2463
|
+
// : null,
|
|
2464
|
+
// ...(variants || []).map(({ weight, style, media: variantMedia = null }) => {
|
|
2465
|
+
// if (variantMedia == null) {
|
|
2466
|
+
// return null;
|
|
2467
|
+
// }
|
|
2468
|
+
// const variantUrls = getUrlsFromMedia(variantMedia, formats);
|
|
2469
|
+
// return variantUrls !== null && variantUrls.length > 0
|
|
2470
|
+
// ? `
|
|
2471
|
+
// @font-face {
|
|
2472
|
+
// font-family: "${name}";
|
|
2473
|
+
// ${weight !== null ? `font-weight: ${weight};` : ''}
|
|
2474
|
+
// ${style !== null ? `font-style: ${style};` : ''}
|
|
2475
|
+
// src: ${variantUrls.join(',')};
|
|
2476
|
+
// }
|
|
2477
|
+
// `
|
|
2478
|
+
// : null;
|
|
2479
|
+
// }),
|
|
2480
|
+
// ];
|
|
2481
|
+
}, {});
|
|
2454
2482
|
return fontFaces.length > 0 ? /*#__PURE__*/React.createElement("style", {
|
|
2455
2483
|
type: "text/css",
|
|
2456
2484
|
dangerouslySetInnerHTML: {
|
|
2457
|
-
__html: fontFaces.
|
|
2485
|
+
__html: Object.keys(fontFaces).map(function (it) {
|
|
2486
|
+
return fontFaces[it];
|
|
2487
|
+
}).filter(function (it) {
|
|
2488
|
+
return it !== null;
|
|
2489
|
+
}).join('\n')
|
|
2458
2490
|
}
|
|
2459
2491
|
}) : null;
|
|
2460
2492
|
};
|
package/lib/contexts.js
CHANGED
|
@@ -16,9 +16,9 @@ var isObject = require('lodash/isObject');
|
|
|
16
16
|
var services = require('@folklore/services');
|
|
17
17
|
var utils = require('@micromag/core/utils');
|
|
18
18
|
var routes = require('@folklore/routes');
|
|
19
|
-
var wouter = require('wouter');
|
|
20
19
|
var tracking = require('@folklore/tracking');
|
|
21
20
|
var EventEmitter = require('wolfy87-eventemitter');
|
|
21
|
+
var wouter = require('wouter');
|
|
22
22
|
|
|
23
23
|
var MODALS_NAMESPACE = 'modals';
|
|
24
24
|
var FIELDS_NAMESPACE = 'fields';
|
|
@@ -1101,21 +1101,26 @@ var PlaybackContext = /*#__PURE__*/React.createContext(_objectSpread(_objectSpre
|
|
|
1101
1101
|
var usePlaybackContext = function usePlaybackContext() {
|
|
1102
1102
|
return React.useContext(PlaybackContext);
|
|
1103
1103
|
};
|
|
1104
|
-
var usePlaybackMediaRef = function usePlaybackMediaRef(
|
|
1104
|
+
var usePlaybackMediaRef = function usePlaybackMediaRef() {
|
|
1105
|
+
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1106
|
+
var background = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1105
1107
|
var _usePlaybackContext = usePlaybackContext(),
|
|
1106
|
-
setMedia = _usePlaybackContext.setMedia
|
|
1108
|
+
setMedia = _usePlaybackContext.setMedia,
|
|
1109
|
+
setIsBackground = _usePlaybackContext.setIsBackground;
|
|
1107
1110
|
var mediaRef = React.useRef(null);
|
|
1108
1111
|
React.useEffect(function () {
|
|
1109
1112
|
if (!active) {
|
|
1110
1113
|
return function () {};
|
|
1111
1114
|
}
|
|
1115
|
+
setIsBackground(background);
|
|
1112
1116
|
if (mediaRef.current !== null) {
|
|
1113
1117
|
setMedia(mediaRef.current);
|
|
1114
1118
|
}
|
|
1115
1119
|
return function () {
|
|
1116
1120
|
setMedia(null);
|
|
1121
|
+
setIsBackground(false);
|
|
1117
1122
|
};
|
|
1118
|
-
}, [setMedia, active]);
|
|
1123
|
+
}, [setMedia, setIsBackground, active, background]);
|
|
1119
1124
|
return mediaRef;
|
|
1120
1125
|
};
|
|
1121
1126
|
var propTypes$5 = {
|
|
@@ -1156,26 +1161,30 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
1156
1161
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
1157
1162
|
media = _useState6[0],
|
|
1158
1163
|
setMedia = _useState6[1];
|
|
1159
|
-
var _useState7 = React.useState(
|
|
1164
|
+
var _useState7 = React.useState(false),
|
|
1160
1165
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
var _useState9 = React.useState(
|
|
1166
|
+
isBackground = _useState8[0],
|
|
1167
|
+
setIsBackground = _useState8[1];
|
|
1168
|
+
var _useState9 = React.useState(initialControls),
|
|
1164
1169
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
var _useState1 = React.useState(
|
|
1170
|
+
controls = _useState0[0],
|
|
1171
|
+
setControls = _useState0[1];
|
|
1172
|
+
var _useState1 = React.useState(initialControlsSuggestPlay),
|
|
1168
1173
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
var _useState11 = React.useState(
|
|
1174
|
+
controlsSuggestPlay = _useState10[0],
|
|
1175
|
+
setControlsSuggestPlay = _useState10[1];
|
|
1176
|
+
var _useState11 = React.useState(initialControlsVisible),
|
|
1172
1177
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
var _useState13 = React.useState(
|
|
1178
|
+
controlsVisible = _useState12[0],
|
|
1179
|
+
setControlsVisible = _useState12[1];
|
|
1180
|
+
var _useState13 = React.useState(initialControlsTheme),
|
|
1176
1181
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
1177
|
-
|
|
1178
|
-
|
|
1182
|
+
controlsTheme = _useState14[0],
|
|
1183
|
+
setControlsTheme = _useState14[1];
|
|
1184
|
+
var _useState15 = React.useState(initialCurrentQualityLevel),
|
|
1185
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
1186
|
+
currentQualityLevel = _useState16[0],
|
|
1187
|
+
setCurrentQualityLevel = _useState16[1];
|
|
1179
1188
|
var finalSetControls = React.useCallback(function (newControls) {
|
|
1180
1189
|
if (newControls) {
|
|
1181
1190
|
setControls(true);
|
|
@@ -1203,10 +1212,10 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
1203
1212
|
}, [media, setControlsSuggestPlay]);
|
|
1204
1213
|
|
|
1205
1214
|
// Handle media ended
|
|
1206
|
-
var
|
|
1207
|
-
|
|
1208
|
-
completed =
|
|
1209
|
-
setCompleted =
|
|
1215
|
+
var _useState17 = React.useState(false),
|
|
1216
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
1217
|
+
completed = _useState18[0],
|
|
1218
|
+
setCompleted = _useState18[1];
|
|
1210
1219
|
var onMediaCompleted = React.useCallback(function () {
|
|
1211
1220
|
return setCompleted(true);
|
|
1212
1221
|
}, [setCompleted]);
|
|
@@ -1258,6 +1267,8 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
1258
1267
|
controlsTheme: controlsTheme,
|
|
1259
1268
|
currentQualityLevel: currentQualityLevel,
|
|
1260
1269
|
setMuted: setMuted,
|
|
1270
|
+
setIsBackground: setIsBackground,
|
|
1271
|
+
isBackground: isBackground,
|
|
1261
1272
|
setPlaying: finalSetPlaying,
|
|
1262
1273
|
setControls: finalSetControls,
|
|
1263
1274
|
setControlsSuggestPlay: setControlsSuggestPlay,
|
|
@@ -1268,7 +1279,7 @@ var PlaybackProvider = function PlaybackProvider(_ref) {
|
|
|
1268
1279
|
setMedia: setMedia,
|
|
1269
1280
|
setCurrentQualityLevel: finalSetCurrentQualityLevel
|
|
1270
1281
|
};
|
|
1271
|
-
}, [muted, playing, completed, paused, controls, controlsSuggestPlay, controlsVisible, controlsTheme, media, hasAudio, currentQualityLevel, setMuted, finalSetPlaying, finalSetControls, finalSetControlsTheme, setControlsSuggestPlay, setControlsVisible, setControlsTheme, showControls, hideControls, setMedia, setCurrentQualityLevel]);
|
|
1282
|
+
}, [muted, playing, completed, paused, controls, controlsSuggestPlay, controlsVisible, controlsTheme, media, hasAudio, currentQualityLevel, setMuted, setIsBackground, isBackground, finalSetPlaying, finalSetControls, finalSetControlsTheme, setControlsSuggestPlay, setControlsVisible, setControlsTheme, showControls, hideControls, setMedia, setCurrentQualityLevel]);
|
|
1272
1283
|
return /*#__PURE__*/React.createElement(PlaybackContext.Provider, {
|
|
1273
1284
|
value: value
|
|
1274
1285
|
}, children);
|
package/lib/hooks.js
CHANGED
|
@@ -15,13 +15,13 @@ var screenfull = require('screenfull');
|
|
|
15
15
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
16
16
|
var isArray = require('lodash/isArray');
|
|
17
17
|
var isObject = require('lodash/isObject');
|
|
18
|
+
var raf = require('raf');
|
|
18
19
|
var createDebug = require('debug');
|
|
19
20
|
var isString = require('lodash/isString');
|
|
20
|
-
var raf = require('raf');
|
|
21
21
|
var contexts = require('@micromag/core/contexts');
|
|
22
|
+
var cssMediaquery = require('css-mediaquery');
|
|
22
23
|
var reactIntl = require('react-intl');
|
|
23
24
|
var dayjs = require('dayjs');
|
|
24
|
-
var cssMediaquery = require('css-mediaquery');
|
|
25
25
|
var clamp = require('lodash/clamp');
|
|
26
26
|
|
|
27
27
|
function useActivityDetector() {
|
|
@@ -205,6 +205,8 @@ function useDragProgress() {
|
|
|
205
205
|
onProgress = _ref$onProgress === void 0 ? null : _ref$onProgress,
|
|
206
206
|
_ref$onPointerDown = _ref.onPointerDown,
|
|
207
207
|
onPointerDown = _ref$onPointerDown === void 0 ? null : _ref$onPointerDown,
|
|
208
|
+
_ref$onScroll = _ref.onScroll,
|
|
209
|
+
onScroll = _ref$onScroll === void 0 ? null : _ref$onScroll,
|
|
208
210
|
_ref$springParams = _ref.springParams,
|
|
209
211
|
springParams = _ref$springParams === void 0 ? undefined : _ref$springParams,
|
|
210
212
|
_ref$dragOptions = _ref.dragOptions,
|
|
@@ -274,7 +276,8 @@ function useDragProgress() {
|
|
|
274
276
|
}, [setDragging, disabled, onTap, computeProgress, dragging, onProgress]);
|
|
275
277
|
var bind = react$1.useGesture({
|
|
276
278
|
onDrag: onDrag,
|
|
277
|
-
onPointerDown: onPointerDown !== null ? onPointerDown : function () {}
|
|
279
|
+
onPointerDown: onPointerDown !== null ? onPointerDown : function () {},
|
|
280
|
+
onScroll: onScroll !== null ? onScroll : function () {}
|
|
278
281
|
}, {
|
|
279
282
|
drag: dragOptions
|
|
280
283
|
});
|
package/lib/index.js
CHANGED
|
@@ -14,11 +14,11 @@ var _inherits = require('@babel/runtime/helpers/inherits');
|
|
|
14
14
|
var EventEmitter = require('wolfy87-eventemitter');
|
|
15
15
|
var changeCase = require('change-case');
|
|
16
16
|
var uniqBy = require('lodash/uniqBy');
|
|
17
|
-
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
18
17
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
18
|
+
var uniq = require('lodash/uniq');
|
|
19
|
+
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
19
20
|
var isString = require('lodash/isString');
|
|
20
21
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
21
|
-
var uniq = require('lodash/uniq');
|
|
22
22
|
var isEmpty = require('lodash/isEmpty');
|
|
23
23
|
var tracking = require('@folklore/tracking');
|
|
24
24
|
var PropTypes$1 = require('prop-types');
|
package/lib/utils.js
CHANGED
|
@@ -12,8 +12,8 @@ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
|
12
12
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
13
13
|
var isArray = require('lodash/isArray');
|
|
14
14
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
15
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
16
15
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
16
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
17
17
|
var slugify = require('slugify');
|
|
18
18
|
|
|
19
19
|
function addNonBreakingSpaces(text) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.788",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -120,6 +120,9 @@
|
|
|
120
120
|
"@panneau/filters": "^3.0.301",
|
|
121
121
|
"@panneau/medias": "^3.0.300",
|
|
122
122
|
"@panneau/uppy": "^3.0.162",
|
|
123
|
+
"@uppy/core": "^5.1.1",
|
|
124
|
+
"@uppy/dashboard": "^5.0.4",
|
|
125
|
+
"@uppy/react": "^5.1.1",
|
|
123
126
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
124
127
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
125
128
|
},
|
|
@@ -164,5 +167,5 @@
|
|
|
164
167
|
"access": "public",
|
|
165
168
|
"registry": "https://registry.npmjs.org/"
|
|
166
169
|
},
|
|
167
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "d7e3871424004d8c65157598cd9b9234e1974cdd"
|
|
168
171
|
}
|