@micromag/viewer 0.3.654 → 0.3.655
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/styles.css +1 -1
- package/es/index.js +95 -95
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -38,7 +38,7 @@ function useKeyboardShortcuts() {
|
|
|
38
38
|
var shortcuts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
39
39
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
40
40
|
_ref$disabled = _ref.disabled,
|
|
41
|
-
disabled = _ref$disabled ===
|
|
41
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
42
42
|
useEffect(function () {
|
|
43
43
|
var onKey = function onKey(e) {
|
|
44
44
|
if (['input', 'textarea'].reduce(function (foundMatch, match) {
|
|
@@ -68,14 +68,14 @@ function checkClickable(el) {
|
|
|
68
68
|
var parentDistance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
69
69
|
var _ref = options || {},
|
|
70
70
|
_ref$maxParentDistanc = _ref.maxParentDistance,
|
|
71
|
-
maxParentDistance = _ref$maxParentDistanc ===
|
|
71
|
+
maxParentDistance = _ref$maxParentDistanc === void 0 ? 5 : _ref$maxParentDistanc,
|
|
72
72
|
_ref$tags = _ref.tags,
|
|
73
|
-
tags = _ref$tags ===
|
|
73
|
+
tags = _ref$tags === void 0 ? ['BUTTON', 'A', 'INPUT', 'TEXTAREA'] : _ref$tags;
|
|
74
74
|
var _ref2 = el || {},
|
|
75
75
|
_ref2$tagName = _ref2.tagName,
|
|
76
|
-
tagName = _ref2$tagName ===
|
|
76
|
+
tagName = _ref2$tagName === void 0 ? null : _ref2$tagName,
|
|
77
77
|
_ref2$parentNode = _ref2.parentNode,
|
|
78
|
-
parentNode = _ref2$parentNode ===
|
|
78
|
+
parentNode = _ref2$parentNode === void 0 ? null : _ref2$parentNode;
|
|
79
79
|
_ref2.dataset;
|
|
80
80
|
if (tagName === 'BODY') {
|
|
81
81
|
return false;
|
|
@@ -107,15 +107,15 @@ function useScreenInteraction() {
|
|
|
107
107
|
screenIndex = _ref.screenIndex,
|
|
108
108
|
screenWidth = _ref.screenWidth,
|
|
109
109
|
_ref$disableCurrentSc = _ref.disableCurrentScreenNavigation,
|
|
110
|
-
disableCurrentScreenNavigation = _ref$disableCurrentSc ===
|
|
110
|
+
disableCurrentScreenNavigation = _ref$disableCurrentSc === void 0 ? false : _ref$disableCurrentSc,
|
|
111
111
|
_ref$clickOnSiblings = _ref.clickOnSiblings,
|
|
112
|
-
clickOnSiblings = _ref$clickOnSiblings ===
|
|
112
|
+
clickOnSiblings = _ref$clickOnSiblings === void 0 ? false : _ref$clickOnSiblings,
|
|
113
113
|
_ref$nextScreenWidthP = _ref.nextScreenWidthPercent,
|
|
114
|
-
nextScreenWidthPercent = _ref$nextScreenWidthP ===
|
|
114
|
+
nextScreenWidthPercent = _ref$nextScreenWidthP === void 0 ? 0.5 : _ref$nextScreenWidthP,
|
|
115
115
|
_ref$onInteract = _ref.onInteract,
|
|
116
|
-
onInteract = _ref$onInteract ===
|
|
116
|
+
onInteract = _ref$onInteract === void 0 ? null : _ref$onInteract,
|
|
117
117
|
_ref$onNavigate = _ref.onNavigate,
|
|
118
|
-
onNavigate = _ref$onNavigate ===
|
|
118
|
+
onNavigate = _ref$onNavigate === void 0 ? null : _ref$onNavigate;
|
|
119
119
|
var _useState = useState(screens.reduce(function (map, _ref2) {
|
|
120
120
|
var id = _ref2.id;
|
|
121
121
|
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, id, true));
|
|
@@ -125,12 +125,12 @@ function useScreenInteraction() {
|
|
|
125
125
|
setScreensInteractionEnabled = _useState2[1];
|
|
126
126
|
var _ref3 = screens[screenIndex] || {},
|
|
127
127
|
_ref3$id = _ref3.id,
|
|
128
|
-
screenId = _ref3$id ===
|
|
128
|
+
screenId = _ref3$id === void 0 ? screenIndex : _ref3$id;
|
|
129
129
|
var _screensInteractionEn = screensInteractionEnabled[screenId],
|
|
130
|
-
currentScreenInteractionEnabled = _screensInteractionEn ===
|
|
130
|
+
currentScreenInteractionEnabled = _screensInteractionEn === void 0 ? true : _screensInteractionEn;
|
|
131
131
|
var updateInteraction = useCallback(function (newValue) {
|
|
132
132
|
var _screensInteractionEn2 = screensInteractionEnabled[screenId],
|
|
133
|
-
currentValue = _screensInteractionEn2 ===
|
|
133
|
+
currentValue = _screensInteractionEn2 === void 0 ? true : _screensInteractionEn2;
|
|
134
134
|
if (currentValue !== newValue) {
|
|
135
135
|
setScreensInteractionEnabled(screens.reduce(function (map, _ref4) {
|
|
136
136
|
var id = _ref4.id;
|
|
@@ -201,14 +201,14 @@ function checkDraggable(el) {
|
|
|
201
201
|
var parentDistance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
202
202
|
var _ref = options || {},
|
|
203
203
|
_ref$maxParentDistanc = _ref.maxParentDistance,
|
|
204
|
-
maxParentDistance = _ref$maxParentDistanc ===
|
|
204
|
+
maxParentDistance = _ref$maxParentDistanc === void 0 ? 5 : _ref$maxParentDistanc;
|
|
205
205
|
var _ref2 = el || {},
|
|
206
206
|
_ref2$tagName = _ref2.tagName,
|
|
207
|
-
tagName = _ref2$tagName ===
|
|
207
|
+
tagName = _ref2$tagName === void 0 ? null : _ref2$tagName,
|
|
208
208
|
_ref2$parentNode = _ref2.parentNode,
|
|
209
|
-
parentNode = _ref2$parentNode ===
|
|
209
|
+
parentNode = _ref2$parentNode === void 0 ? null : _ref2$parentNode,
|
|
210
210
|
_ref2$dataset = _ref2.dataset,
|
|
211
|
-
dataset = _ref2$dataset ===
|
|
211
|
+
dataset = _ref2$dataset === void 0 ? {} : _ref2$dataset;
|
|
212
212
|
if (tagName === 'BODY') {
|
|
213
213
|
return false;
|
|
214
214
|
}
|
|
@@ -313,10 +313,10 @@ var Button = function Button(_ref) {
|
|
|
313
313
|
var buttonClassNames = classNames([styles$h.container, styles$h["icon-".concat(iconPosition)], _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$h.withIcon, hasIcon), styles$h.withIconColumns, hasIconColumns), styles$h.withText, text !== null), styles$h.isLink, href !== null), styles$h.asLink, asLink), styles$h.isDisabled, disabled), styles$h.isLoading, loading), className, className !== null)]);
|
|
314
314
|
var _ref3 = theme || {},
|
|
315
315
|
_ref3$colors = _ref3.colors,
|
|
316
|
-
colors = _ref3$colors ===
|
|
316
|
+
colors = _ref3$colors === void 0 ? null : _ref3$colors;
|
|
317
317
|
var _ref4 = colors || {},
|
|
318
318
|
_ref4$primary = _ref4.primary,
|
|
319
|
-
brandPrimaryColor = _ref4$primary ===
|
|
319
|
+
brandPrimaryColor = _ref4$primary === void 0 ? null : _ref4$primary;
|
|
320
320
|
var primaryColor = getStyleFromColor(brandPrimaryColor, 'color');
|
|
321
321
|
var buttonStyles = _objectSpread({}, primaryColor);
|
|
322
322
|
var content = /*#__PURE__*/React.createElement(React.Fragment, null, hasInlineIcon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
@@ -609,10 +609,10 @@ var ViewerMenuContainer = function ViewerMenuContainer(_ref) {
|
|
|
609
609
|
children = _ref.children;
|
|
610
610
|
var _ref2 = viewerTheme || {},
|
|
611
611
|
_ref2$background = _ref2.background,
|
|
612
|
-
background = _ref2$background ===
|
|
612
|
+
background = _ref2$background === void 0 ? null : _ref2$background;
|
|
613
613
|
var _ref3 = background || {},
|
|
614
614
|
_ref3$color = _ref3.color,
|
|
615
|
-
brandBackgroundColor = _ref3$color ===
|
|
615
|
+
brandBackgroundColor = _ref3$color === void 0 ? null : _ref3$color;
|
|
616
616
|
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor');
|
|
617
617
|
return /*#__PURE__*/React.createElement("div", {
|
|
618
618
|
className: classNames([styles$e.container, _defineProperty({}, className, className !== null)]),
|
|
@@ -681,9 +681,9 @@ var ViewerMenuDot = function ViewerMenuDot(_ref) {
|
|
|
681
681
|
className = _ref.className;
|
|
682
682
|
var _ref2 = colors || {},
|
|
683
683
|
_ref2$primary = _ref2.primary,
|
|
684
|
-
primary = _ref2$primary ===
|
|
684
|
+
primary = _ref2$primary === void 0 ? 'rgba(255, 255, 255, 1)' : _ref2$primary,
|
|
685
685
|
_ref2$secondary = _ref2.secondary,
|
|
686
|
-
secondary = _ref2$secondary ===
|
|
686
|
+
secondary = _ref2$secondary === void 0 ? 'rgba(255, 255, 255, 0.25)' : _ref2$secondary;
|
|
687
687
|
var _useSpring = useSpring(function () {
|
|
688
688
|
return {
|
|
689
689
|
scaleX: 0,
|
|
@@ -783,11 +783,11 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
783
783
|
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
784
784
|
var _ref2 = colors || {},
|
|
785
785
|
_ref2$primary = _ref2.primary,
|
|
786
|
-
primary = _ref2$primary ===
|
|
786
|
+
primary = _ref2$primary === void 0 ? 'rgba(255, 255, 255, 1)' : _ref2$primary;
|
|
787
787
|
var intl = useIntl();
|
|
788
788
|
var currentIndex = items.findIndex(function (_ref3) {
|
|
789
789
|
var _ref3$current = _ref3.current,
|
|
790
|
-
current = _ref3$current ===
|
|
790
|
+
current = _ref3$current === void 0 ? false : _ref3$current;
|
|
791
791
|
return current;
|
|
792
792
|
});
|
|
793
793
|
var _ref4 = props || {},
|
|
@@ -822,11 +822,11 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
822
822
|
}, items.map(function (item, index) {
|
|
823
823
|
var _ref6 = item || {},
|
|
824
824
|
_ref6$current = _ref6.current,
|
|
825
|
-
current = _ref6$current ===
|
|
825
|
+
current = _ref6$current === void 0 ? false : _ref6$current,
|
|
826
826
|
_ref6$count = _ref6.count,
|
|
827
|
-
count = _ref6$count ===
|
|
827
|
+
count = _ref6$count === void 0 ? 1 : _ref6$count,
|
|
828
828
|
_ref6$subIndex = _ref6.subIndex,
|
|
829
|
-
subIndex = _ref6$subIndex ===
|
|
829
|
+
subIndex = _ref6$subIndex === void 0 ? 0 : _ref6$subIndex;
|
|
830
830
|
return /*#__PURE__*/React.createElement(ViewerMenuDot, {
|
|
831
831
|
key: "item-".concat(index + 1),
|
|
832
832
|
current: current,
|
|
@@ -928,10 +928,10 @@ var ViewerMenuScreen = function ViewerMenuScreen(_ref) {
|
|
|
928
928
|
var intl = useIntl();
|
|
929
929
|
var _ref2 = item || {},
|
|
930
930
|
_ref2$current = _ref2.current,
|
|
931
|
-
current = _ref2$current ===
|
|
931
|
+
current = _ref2$current === void 0 ? false : _ref2$current,
|
|
932
932
|
screen = _ref2.screen,
|
|
933
933
|
_ref2$count = _ref2.count,
|
|
934
|
-
count = _ref2$count ===
|
|
934
|
+
count = _ref2$count === void 0 ? 1 : _ref2$count;
|
|
935
935
|
var _ref3 = screenSize || {},
|
|
936
936
|
screenWidth = _ref3.width,
|
|
937
937
|
screenHeight = _ref3.height;
|
|
@@ -941,7 +941,7 @@ var ViewerMenuScreen = function ViewerMenuScreen(_ref) {
|
|
|
941
941
|
}),
|
|
942
942
|
refVisible = _useIsVisible.ref,
|
|
943
943
|
_useIsVisible$visible = _useIsVisible.visible,
|
|
944
|
-
visible = _useIsVisible$visible ===
|
|
944
|
+
visible = _useIsVisible$visible === void 0 ? false : _useIsVisible$visible;
|
|
945
945
|
var screenAriaLabel = "".concat(intl.formatMessage({
|
|
946
946
|
id: "LkVfwW",
|
|
947
947
|
defaultMessage: [{
|
|
@@ -1060,28 +1060,28 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
1060
1060
|
var _useDimensionObserver = useDimensionObserver(),
|
|
1061
1061
|
containerRef = _useDimensionObserver.ref,
|
|
1062
1062
|
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
1063
|
-
contentWidth = _useDimensionObserver2 ===
|
|
1063
|
+
contentWidth = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
1064
1064
|
var thumbsPerLine = Math.max(Math.floor(contentWidth / maxThumbsWidth), 3); // @note cool, should be in recipes
|
|
1065
1065
|
|
|
1066
1066
|
// @todo reimplement the brand logo
|
|
1067
1067
|
// const { background = null, logo: brandLogo = null } = viewerTheme || {};
|
|
1068
1068
|
var _ref2 = viewerTheme || {},
|
|
1069
1069
|
_ref2$background = _ref2.background,
|
|
1070
|
-
background = _ref2$background ===
|
|
1070
|
+
background = _ref2$background === void 0 ? null : _ref2$background,
|
|
1071
1071
|
_ref2$textStyles = _ref2.textStyles,
|
|
1072
|
-
textStyles = _ref2$textStyles ===
|
|
1072
|
+
textStyles = _ref2$textStyles === void 0 ? null : _ref2$textStyles;
|
|
1073
1073
|
var _ref3 = background || {},
|
|
1074
1074
|
_ref3$image = _ref3.image,
|
|
1075
|
-
image = _ref3$image ===
|
|
1075
|
+
image = _ref3$image === void 0 ? null : _ref3$image;
|
|
1076
1076
|
var _ref4 = image || {},
|
|
1077
1077
|
_ref4$url = _ref4.url,
|
|
1078
|
-
brandImageUrl = _ref4$url ===
|
|
1078
|
+
brandImageUrl = _ref4$url === void 0 ? null : _ref4$url;
|
|
1079
1079
|
var brandImageStyle = brandImageUrl !== null ? {
|
|
1080
1080
|
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
1081
1081
|
} : null;
|
|
1082
1082
|
var _ref5 = textStyles || {},
|
|
1083
1083
|
_ref5$title = _ref5.title,
|
|
1084
|
-
titleStyles = _ref5$title ===
|
|
1084
|
+
titleStyles = _ref5$title === void 0 ? null : _ref5$title;
|
|
1085
1085
|
// eslint-disable-next-line no-unused-vars
|
|
1086
1086
|
var _ref6 = titleStyles || {};
|
|
1087
1087
|
_ref6.textAlign;
|
|
@@ -1248,32 +1248,32 @@ var ViewerMenuShare = function ViewerMenuShare(_ref) {
|
|
|
1248
1248
|
// Viewer theme
|
|
1249
1249
|
var _ref2 = viewerTheme || {},
|
|
1250
1250
|
_ref2$background = _ref2.background,
|
|
1251
|
-
background = _ref2$background ===
|
|
1251
|
+
background = _ref2$background === void 0 ? null : _ref2$background;
|
|
1252
1252
|
var _ref3 = background || {},
|
|
1253
1253
|
_ref3$image = _ref3.image,
|
|
1254
|
-
image = _ref3$image ===
|
|
1254
|
+
image = _ref3$image === void 0 ? null : _ref3$image;
|
|
1255
1255
|
var _ref4 = image || {},
|
|
1256
1256
|
_ref4$url = _ref4.url,
|
|
1257
|
-
brandImageUrl = _ref4$url ===
|
|
1257
|
+
brandImageUrl = _ref4$url === void 0 ? null : _ref4$url;
|
|
1258
1258
|
var brandImageStyle = brandImageUrl !== null ? {
|
|
1259
1259
|
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
1260
1260
|
} : null;
|
|
1261
1261
|
var coverScreen = useMemo(function () {
|
|
1262
1262
|
var _ref5 = items[0] || {},
|
|
1263
1263
|
_ref5$screen = _ref5.screen,
|
|
1264
|
-
screen = _ref5$screen ===
|
|
1264
|
+
screen = _ref5$screen === void 0 ? null : _ref5$screen;
|
|
1265
1265
|
return screen;
|
|
1266
1266
|
}, [items]);
|
|
1267
1267
|
var currentScreen = useMemo(function () {
|
|
1268
1268
|
var found = items.find(function (item) {
|
|
1269
1269
|
var _ref6 = item || {},
|
|
1270
1270
|
_ref6$current = _ref6.current,
|
|
1271
|
-
current = _ref6$current ===
|
|
1271
|
+
current = _ref6$current === void 0 ? false : _ref6$current;
|
|
1272
1272
|
return current;
|
|
1273
1273
|
});
|
|
1274
1274
|
var _ref7 = found || {},
|
|
1275
1275
|
_ref7$screen = _ref7.screen,
|
|
1276
|
-
screen = _ref7$screen ===
|
|
1276
|
+
screen = _ref7$screen === void 0 ? null : _ref7$screen;
|
|
1277
1277
|
return screen;
|
|
1278
1278
|
}, [items, currentScreenIndex, focusable]);
|
|
1279
1279
|
var _useState = useState(false),
|
|
@@ -1423,23 +1423,23 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1423
1423
|
onClickCloseViewer = _ref.onClickCloseViewer,
|
|
1424
1424
|
refDots = _ref.refDots;
|
|
1425
1425
|
var _story$components = story.components,
|
|
1426
|
-
screens = _story$components ===
|
|
1426
|
+
screens = _story$components === void 0 ? [] : _story$components,
|
|
1427
1427
|
_story$title = story.title,
|
|
1428
|
-
title = _story$title ===
|
|
1428
|
+
title = _story$title === void 0 ? null : _story$title,
|
|
1429
1429
|
_story$metadata = story.metadata,
|
|
1430
|
-
metadata = _story$metadata ===
|
|
1430
|
+
metadata = _story$metadata === void 0 ? null : _story$metadata;
|
|
1431
1431
|
var _ref2 = metadata || {},
|
|
1432
1432
|
_ref2$description = _ref2.description,
|
|
1433
|
-
description = _ref2$description ===
|
|
1433
|
+
description = _ref2$description === void 0 ? null : _ref2$description;
|
|
1434
1434
|
var currentScreen = screens !== null ? screens[currentScreenIndex] || null : null;
|
|
1435
1435
|
var _ref3 = currentScreen || {},
|
|
1436
1436
|
_ref3$id = _ref3.id,
|
|
1437
|
-
screenId = _ref3$id ===
|
|
1437
|
+
screenId = _ref3$id === void 0 ? null : _ref3$id,
|
|
1438
1438
|
_ref3$type = _ref3.type,
|
|
1439
|
-
screenType = _ref3$type ===
|
|
1439
|
+
screenType = _ref3$type === void 0 ? null : _ref3$type;
|
|
1440
1440
|
var _ref4 = viewerTheme || {},
|
|
1441
1441
|
_ref4$menuTheme = _ref4.menuTheme,
|
|
1442
|
-
menuTheme = _ref4$menuTheme ===
|
|
1442
|
+
menuTheme = _ref4$menuTheme === void 0 ? null : _ref4$menuTheme;
|
|
1443
1443
|
var _useViewerSize = useViewerSize(),
|
|
1444
1444
|
viewerHeight = _useViewerSize.height;
|
|
1445
1445
|
var _useState = useState(false),
|
|
@@ -1457,7 +1457,7 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1457
1457
|
var _useDimensionObserver = useDimensionObserver(),
|
|
1458
1458
|
navContainerRef = _useDimensionObserver.ref,
|
|
1459
1459
|
_useDimensionObserver2 = _useDimensionObserver.height,
|
|
1460
|
-
navContainerHeight = _useDimensionObserver2 ===
|
|
1460
|
+
navContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
1461
1461
|
var items = useMemo(function () {
|
|
1462
1462
|
return screens.map(function (it) {
|
|
1463
1463
|
var children = screens.filter(function (s) {
|
|
@@ -1473,13 +1473,13 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1473
1473
|
screen: it,
|
|
1474
1474
|
screenId: it.id,
|
|
1475
1475
|
current: screenId === it.id || currentChild !== null,
|
|
1476
|
-
visible: ((it === null || it ===
|
|
1476
|
+
visible: ((it === null || it === void 0 ? void 0 : it.parentId) || null) === null,
|
|
1477
1477
|
count: children.length + 1 || 1,
|
|
1478
1478
|
subIndex: subIndex || 0
|
|
1479
1479
|
};
|
|
1480
1480
|
}).filter(function (_ref5) {
|
|
1481
1481
|
var _ref5$visible = _ref5.visible,
|
|
1482
|
-
visible = _ref5$visible ===
|
|
1482
|
+
visible = _ref5$visible === void 0 ? true : _ref5$visible;
|
|
1483
1483
|
return visible;
|
|
1484
1484
|
});
|
|
1485
1485
|
}, [screens, screenId]);
|
|
@@ -2025,7 +2025,7 @@ function getFormattedTimestamp() {
|
|
|
2025
2025
|
var _ref = parts || [],
|
|
2026
2026
|
_ref2 = _slicedToArray(_ref, 1),
|
|
2027
2027
|
_ref2$ = _ref2[0],
|
|
2028
|
-
fullSeconds = _ref2$ ===
|
|
2028
|
+
fullSeconds = _ref2$ === void 0 ? 0 : _ref2$;
|
|
2029
2029
|
var finalFullSeconds = Math.round(fullSeconds);
|
|
2030
2030
|
var seconds = finalFullSeconds % 60;
|
|
2031
2031
|
var diff = finalFullSeconds - seconds;
|
|
@@ -2113,9 +2113,9 @@ var SeekBar = function SeekBar(_ref3) {
|
|
|
2113
2113
|
}
|
|
2114
2114
|
var _currentTarget$getBou = currentTarget.getBoundingClientRect(),
|
|
2115
2115
|
_currentTarget$getBou2 = _currentTarget$getBou.width,
|
|
2116
|
-
elWidth = _currentTarget$getBou2 ===
|
|
2116
|
+
elWidth = _currentTarget$getBou2 === void 0 ? 0 : _currentTarget$getBou2,
|
|
2117
2117
|
_currentTarget$getBou3 = _currentTarget$getBou.x,
|
|
2118
|
-
xGap = _currentTarget$getBou3 ===
|
|
2118
|
+
xGap = _currentTarget$getBou3 === void 0 ? null : _currentTarget$getBou3;
|
|
2119
2119
|
var newProgress = null;
|
|
2120
2120
|
if (tap) {
|
|
2121
2121
|
newProgress = Math.max(0, Math.min(1, (xOffset - xGap) / elWidth));
|
|
@@ -2262,13 +2262,13 @@ function PlaybackControls(_ref) {
|
|
|
2262
2262
|
var intl = useIntl();
|
|
2263
2263
|
var _usePlaybackContext = usePlaybackContext(),
|
|
2264
2264
|
_usePlaybackContext$m = _usePlaybackContext.media,
|
|
2265
|
-
mediaElement = _usePlaybackContext$m ===
|
|
2265
|
+
mediaElement = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m,
|
|
2266
2266
|
_usePlaybackContext$h = _usePlaybackContext.hasAudio,
|
|
2267
|
-
hasAudio = _usePlaybackContext$h ===
|
|
2267
|
+
hasAudio = _usePlaybackContext$h === void 0 ? null : _usePlaybackContext$h,
|
|
2268
2268
|
_usePlaybackContext$p = _usePlaybackContext.playing,
|
|
2269
|
-
wantedPlaying = _usePlaybackContext$p ===
|
|
2269
|
+
wantedPlaying = _usePlaybackContext$p === void 0 ? false : _usePlaybackContext$p,
|
|
2270
2270
|
_usePlaybackContext$m2 = _usePlaybackContext.muted,
|
|
2271
|
-
wantedMuted = _usePlaybackContext$m2 ===
|
|
2271
|
+
wantedMuted = _usePlaybackContext$m2 === void 0 ? true : _usePlaybackContext$m2,
|
|
2272
2272
|
setPlaying = _usePlaybackContext.setPlaying,
|
|
2273
2273
|
setMuted = _usePlaybackContext.setMuted,
|
|
2274
2274
|
controls = _usePlaybackContext.controls,
|
|
@@ -2500,9 +2500,9 @@ function WebViewContainer(_ref) {
|
|
|
2500
2500
|
_useViewerWebView.open;
|
|
2501
2501
|
_useViewerWebView.update;
|
|
2502
2502
|
var _useViewerWebView$url = _useViewerWebView.url,
|
|
2503
|
-
url = _useViewerWebView$url ===
|
|
2503
|
+
url = _useViewerWebView$url === void 0 ? null : _useViewerWebView$url,
|
|
2504
2504
|
_useViewerWebView$sou = _useViewerWebView.source,
|
|
2505
|
-
source = _useViewerWebView$sou ===
|
|
2505
|
+
source = _useViewerWebView$sou === void 0 ? null : _useViewerWebView$sou,
|
|
2506
2506
|
webViewProps = _objectWithoutProperties(_useViewerWebView, _excluded$2);
|
|
2507
2507
|
var _useViewerInteraction = useViewerInteraction(),
|
|
2508
2508
|
disableInteraction = _useViewerInteraction.disableInteraction,
|
|
@@ -2767,13 +2767,13 @@ var Viewer = function Viewer(_ref) {
|
|
|
2767
2767
|
disabled: storyIsParsed
|
|
2768
2768
|
}) || {};
|
|
2769
2769
|
var _parsedStory$componen = parsedStory.components,
|
|
2770
|
-
screens = _parsedStory$componen ===
|
|
2770
|
+
screens = _parsedStory$componen === void 0 ? [] : _parsedStory$componen,
|
|
2771
2771
|
_parsedStory$title = parsedStory.title,
|
|
2772
|
-
title = _parsedStory$title ===
|
|
2772
|
+
title = _parsedStory$title === void 0 ? null : _parsedStory$title,
|
|
2773
2773
|
_parsedStory$metadata = parsedStory.metadata,
|
|
2774
|
-
metadata = _parsedStory$metadata ===
|
|
2774
|
+
metadata = _parsedStory$metadata === void 0 ? null : _parsedStory$metadata,
|
|
2775
2775
|
_parsedStory$fonts = parsedStory.fonts,
|
|
2776
|
-
fonts = _parsedStory$fonts ===
|
|
2776
|
+
fonts = _parsedStory$fonts === void 0 ? null : _parsedStory$fonts;
|
|
2777
2777
|
var screensCount = screens.length;
|
|
2778
2778
|
var eventsManager = useMemo(function () {
|
|
2779
2779
|
return new EventEmitter();
|
|
@@ -2790,9 +2790,9 @@ var Viewer = function Viewer(_ref) {
|
|
|
2790
2790
|
screenMetadata = _ref3.metadata;
|
|
2791
2791
|
var _ref4 = screenMetadata || {},
|
|
2792
2792
|
_ref4$title = _ref4.title,
|
|
2793
|
-
screenTitle = _ref4$title ===
|
|
2793
|
+
screenTitle = _ref4$title === void 0 ? null : _ref4$title,
|
|
2794
2794
|
_ref4$description = _ref4.description,
|
|
2795
|
-
screenDescription = _ref4$description ===
|
|
2795
|
+
screenDescription = _ref4$description === void 0 ? null : _ref4$description;
|
|
2796
2796
|
var finalTitle = screenTitle !== null ? screenTitle : title;
|
|
2797
2797
|
var finalMetadata = useMemo(function () {
|
|
2798
2798
|
return screenDescription !== null ? _objectSpread(_objectSpread({}, metadata), {}, {
|
|
@@ -2815,16 +2815,16 @@ var Viewer = function Viewer(_ref) {
|
|
|
2815
2815
|
colors = _ref5.colors;
|
|
2816
2816
|
var _ref6 = colors || {},
|
|
2817
2817
|
_ref6$primary = _ref6.primary,
|
|
2818
|
-
primaryColor = _ref6$primary ===
|
|
2818
|
+
primaryColor = _ref6$primary === void 0 ? null : _ref6$primary,
|
|
2819
2819
|
_ref6$focus = _ref6.focus,
|
|
2820
|
-
focusColor = _ref6$focus ===
|
|
2820
|
+
focusColor = _ref6$focus === void 0 ? null : _ref6$focus;
|
|
2821
2821
|
var finalFocusColor = getColorAsString(focusColor || primaryColor);
|
|
2822
2822
|
var _ref7 = textStyles || {},
|
|
2823
2823
|
_ref7$title = _ref7.title,
|
|
2824
|
-
themeTextStyle = _ref7$title ===
|
|
2824
|
+
themeTextStyle = _ref7$title === void 0 ? null : _ref7$title;
|
|
2825
2825
|
var _ref8 = themeTextStyle || {},
|
|
2826
2826
|
_ref8$fontFamily = _ref8.fontFamily,
|
|
2827
|
-
themeFont = _ref8$fontFamily ===
|
|
2827
|
+
themeFont = _ref8$fontFamily === void 0 ? null : _ref8$fontFamily;
|
|
2828
2828
|
|
|
2829
2829
|
// Fonts
|
|
2830
2830
|
var finalFonts = useMemo(function () {
|
|
@@ -2843,15 +2843,15 @@ var Viewer = function Viewer(_ref) {
|
|
|
2843
2843
|
var _usePlaybackContext = usePlaybackContext(),
|
|
2844
2844
|
playing = _usePlaybackContext.playing,
|
|
2845
2845
|
_usePlaybackContext$c = _usePlaybackContext.controls,
|
|
2846
|
-
playbackControls = _usePlaybackContext$c ===
|
|
2846
|
+
playbackControls = _usePlaybackContext$c === void 0 ? false : _usePlaybackContext$c,
|
|
2847
2847
|
_usePlaybackContext$c2 = _usePlaybackContext.controlsVisible,
|
|
2848
|
-
playbackcontrolsVisible = _usePlaybackContext$c2 ===
|
|
2848
|
+
playbackcontrolsVisible = _usePlaybackContext$c2 === void 0 ? false : _usePlaybackContext$c2,
|
|
2849
2849
|
_usePlaybackContext$m = _usePlaybackContext.media,
|
|
2850
|
-
playbackMedia = _usePlaybackContext$m ===
|
|
2850
|
+
playbackMedia = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m;
|
|
2851
2851
|
var _useDimensionObserver = useDimensionObserver(),
|
|
2852
2852
|
playbackControlsContainerRef = _useDimensionObserver.ref,
|
|
2853
2853
|
_useDimensionObserver2 = _useDimensionObserver.height,
|
|
2854
|
-
playbackControlsContainerHeight = _useDimensionObserver2 ===
|
|
2854
|
+
playbackControlsContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
2855
2855
|
var trackScreenView = useTrackScreenView();
|
|
2856
2856
|
var _useScreenSizeFromEle = useScreenSizeFromElement(_objectSpread({
|
|
2857
2857
|
width: width,
|
|
@@ -2865,13 +2865,13 @@ var Viewer = function Viewer(_ref) {
|
|
|
2865
2865
|
screenScale = _useScreenSizeFromEle.scale;
|
|
2866
2866
|
var _ref9 = screenSize || {},
|
|
2867
2867
|
_ref9$width = _ref9.width,
|
|
2868
|
-
screenWidth = _ref9$width ===
|
|
2868
|
+
screenWidth = _ref9$width === void 0 ? null : _ref9$width,
|
|
2869
2869
|
_ref9$height = _ref9.height,
|
|
2870
|
-
screenHeight = _ref9$height ===
|
|
2870
|
+
screenHeight = _ref9$height === void 0 ? null : _ref9$height,
|
|
2871
2871
|
_ref9$landscape = _ref9.landscape,
|
|
2872
|
-
landscape = _ref9$landscape ===
|
|
2872
|
+
landscape = _ref9$landscape === void 0 ? false : _ref9$landscape,
|
|
2873
2873
|
_ref9$menuOverScreen = _ref9.menuOverScreen,
|
|
2874
|
-
menuOverScreen = _ref9$menuOverScreen ===
|
|
2874
|
+
menuOverScreen = _ref9$menuOverScreen === void 0 ? false : _ref9$menuOverScreen;
|
|
2875
2875
|
var screenContainerWidth = screenScale !== null ? screenWidth * screenScale : screenWidth;
|
|
2876
2876
|
var screenContainerHeight = screenScale !== null ? screenHeight * screenScale : screenHeight;
|
|
2877
2877
|
var hasSize = screenWidth > 0 && screenHeight > 0;
|
|
@@ -3124,7 +3124,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
3124
3124
|
var _useDimensionObserver3 = useDimensionObserver(),
|
|
3125
3125
|
menuDotsContainerRef = _useDimensionObserver3.ref,
|
|
3126
3126
|
_useDimensionObserver4 = _useDimensionObserver3.height,
|
|
3127
|
-
menuDotsContainerHeight = _useDimensionObserver4 ===
|
|
3127
|
+
menuDotsContainerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
3128
3128
|
var onClickScreen = useCallback(function (_ref14) {
|
|
3129
3129
|
var itemScreenId = _ref14.screenId;
|
|
3130
3130
|
onInteractionPrivate();
|
|
@@ -3199,24 +3199,24 @@ var Viewer = function Viewer(_ref) {
|
|
|
3199
3199
|
setShareIncentiveVisible = _useState10[1];
|
|
3200
3200
|
var _ref16 = currentScreen || {},
|
|
3201
3201
|
_ref16$header = _ref16.header,
|
|
3202
|
-
header = _ref16$header ===
|
|
3202
|
+
header = _ref16$header === void 0 ? null : _ref16$header;
|
|
3203
3203
|
var _ref17 = header || {},
|
|
3204
3204
|
_ref17$shareIncentive = _ref17.shareIncentive,
|
|
3205
|
-
shareIncentive = _ref17$shareIncentive ===
|
|
3205
|
+
shareIncentive = _ref17$shareIncentive === void 0 ? null : _ref17$shareIncentive;
|
|
3206
3206
|
var _ref18 = shareIncentive || {},
|
|
3207
3207
|
_ref18$active = _ref18.active,
|
|
3208
|
-
hasShareIncentive = _ref18$active ===
|
|
3208
|
+
hasShareIncentive = _ref18$active === void 0 ? false : _ref18$active,
|
|
3209
3209
|
_ref18$label = _ref18.label,
|
|
3210
|
-
shareIncentiveLabel = _ref18$label ===
|
|
3210
|
+
shareIncentiveLabel = _ref18$label === void 0 ? null : _ref18$label;
|
|
3211
3211
|
var _ref19 = currentShareIncentive || {},
|
|
3212
3212
|
_ref19$label = _ref19.label,
|
|
3213
|
-
currentShareIncentiveLabel = _ref19$label ===
|
|
3213
|
+
currentShareIncentiveLabel = _ref19$label === void 0 ? null : _ref19$label;
|
|
3214
3214
|
var _ref20 = shareIncentiveLabel || {},
|
|
3215
3215
|
_ref20$body = _ref20.body,
|
|
3216
|
-
incentiveLabel = _ref20$body ===
|
|
3216
|
+
incentiveLabel = _ref20$body === void 0 ? null : _ref20$body;
|
|
3217
3217
|
var _ref21 = currentShareIncentiveLabel || {},
|
|
3218
3218
|
_ref21$body = _ref21.body,
|
|
3219
|
-
currentIncentiveLabel = _ref21$body ===
|
|
3219
|
+
currentIncentiveLabel = _ref21$body === void 0 ? null : _ref21$body;
|
|
3220
3220
|
useEffect(function () {
|
|
3221
3221
|
setShareIncentiveVisible(true);
|
|
3222
3222
|
if (hasShareIncentive && shareIncentiveLabel !== currentShareIncentiveLabel) {
|
|
@@ -3493,7 +3493,7 @@ var ViewerRoutes = function ViewerRoutes(_ref) {
|
|
|
3493
3493
|
navigate = _useLocation2[1];
|
|
3494
3494
|
var _ref2 = story || {},
|
|
3495
3495
|
_ref2$components = _ref2.components,
|
|
3496
|
-
screens = _ref2$components ===
|
|
3496
|
+
screens = _ref2$components === void 0 ? [] : _ref2$components;
|
|
3497
3497
|
var finalOnScreenChange = useCallback(function (it) {
|
|
3498
3498
|
var screenIndex = screens.findIndex(function (screen) {
|
|
3499
3499
|
var screenId = screen.id;
|
|
@@ -3510,7 +3510,7 @@ var ViewerRoutes = function ViewerRoutes(_ref) {
|
|
|
3510
3510
|
path: routes.screen
|
|
3511
3511
|
}, function (_ref3) {
|
|
3512
3512
|
var _ref3$screen = _ref3.screen,
|
|
3513
|
-
screenParam = _ref3$screen ===
|
|
3513
|
+
screenParam = _ref3$screen === void 0 ? null : _ref3$screen;
|
|
3514
3514
|
var screenFromIndex = pathWithIndex && screenParam !== null ? screens[parseInt(screenParam, 10) - 1] || null : null;
|
|
3515
3515
|
var screenId = pathWithIndex ? (screenFromIndex || {}).id || null : screenParam;
|
|
3516
3516
|
return /*#__PURE__*/React.createElement(Viewer, Object.assign({}, otherProps, {
|
|
@@ -3598,13 +3598,13 @@ var ViewerContainer = function ViewerContainer(_ref) {
|
|
|
3598
3598
|
}
|
|
3599
3599
|
var _ref2 = story || {},
|
|
3600
3600
|
_ref2$id = _ref2.id,
|
|
3601
|
-
id = _ref2$id ===
|
|
3601
|
+
id = _ref2$id === void 0 ? null : _ref2$id,
|
|
3602
3602
|
_ref2$slug = _ref2.slug,
|
|
3603
|
-
slug = _ref2$slug ===
|
|
3603
|
+
slug = _ref2$slug === void 0 ? null : _ref2$slug,
|
|
3604
3604
|
_ref2$title = _ref2.title,
|
|
3605
|
-
title = _ref2$title ===
|
|
3605
|
+
title = _ref2$title === void 0 ? null : _ref2$title,
|
|
3606
3606
|
_ref2$components = _ref2.components,
|
|
3607
|
-
components = _ref2$components ===
|
|
3607
|
+
components = _ref2$components === void 0 ? [] : _ref2$components;
|
|
3608
3608
|
return _objectSpread({
|
|
3609
3609
|
storyId: id,
|
|
3610
3610
|
storySlug: slug,
|
|
@@ -3616,7 +3616,7 @@ var ViewerContainer = function ViewerContainer(_ref) {
|
|
|
3616
3616
|
metadata = _ref3.metadata;
|
|
3617
3617
|
var _ref4 = metadata || {},
|
|
3618
3618
|
_ref4$language = _ref4.language,
|
|
3619
|
-
finalLocale = _ref4$language ===
|
|
3619
|
+
finalLocale = _ref4$language === void 0 ? locale : _ref4$language;
|
|
3620
3620
|
var content = /*#__PURE__*/React.createElement(IntlProvider, {
|
|
3621
3621
|
locale: finalLocale,
|
|
3622
3622
|
locales: locales,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/viewer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.655",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@micromag/element-webview": "^0.3.651",
|
|
72
72
|
"@micromag/elements": "^0.3.651",
|
|
73
73
|
"@micromag/intl": "^0.3.651",
|
|
74
|
-
"@micromag/screens": "^0.3.
|
|
74
|
+
"@micromag/screens": "^0.3.655",
|
|
75
75
|
"@react-spring/core": "^9.6.1",
|
|
76
76
|
"@react-spring/web": "^9.6.1",
|
|
77
77
|
"@use-gesture/react": "^10.3.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"access": "public",
|
|
93
93
|
"registry": "https://registry.npmjs.org/"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "95f1c26afca871334931cda3d49ccc3a2f89ccf9"
|
|
96
96
|
}
|