@micromag/viewer 0.3.607 → 0.3.609

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/es/index.js CHANGED
@@ -37,7 +37,7 @@ function useKeyboardShortcuts() {
37
37
  var shortcuts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
38
38
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
39
39
  _ref$disabled = _ref.disabled,
40
- disabled = _ref$disabled === void 0 ? false : _ref$disabled;
40
+ disabled = _ref$disabled === undefined ? false : _ref$disabled;
41
41
  useEffect(function () {
42
42
  var onKey = function onKey(e) {
43
43
  if (['input', 'textarea'].reduce(function (foundMatch, match) {
@@ -67,14 +67,14 @@ function checkClickable(el) {
67
67
  var parentDistance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
68
68
  var _ref = options || {},
69
69
  _ref$maxParentDistanc = _ref.maxParentDistance,
70
- maxParentDistance = _ref$maxParentDistanc === void 0 ? 5 : _ref$maxParentDistanc,
70
+ maxParentDistance = _ref$maxParentDistanc === undefined ? 5 : _ref$maxParentDistanc,
71
71
  _ref$tags = _ref.tags,
72
- tags = _ref$tags === void 0 ? ['BUTTON', 'A', 'INPUT', 'TEXTAREA'] : _ref$tags;
72
+ tags = _ref$tags === undefined ? ['BUTTON', 'A', 'INPUT', 'TEXTAREA'] : _ref$tags;
73
73
  var _ref2 = el || {},
74
74
  _ref2$tagName = _ref2.tagName,
75
- tagName = _ref2$tagName === void 0 ? null : _ref2$tagName,
75
+ tagName = _ref2$tagName === undefined ? null : _ref2$tagName,
76
76
  _ref2$parentNode = _ref2.parentNode,
77
- parentNode = _ref2$parentNode === void 0 ? null : _ref2$parentNode;
77
+ parentNode = _ref2$parentNode === undefined ? null : _ref2$parentNode;
78
78
  _ref2.dataset;
79
79
  if (tagName === 'BODY') {
80
80
  return false;
@@ -106,15 +106,15 @@ function useScreenInteraction() {
106
106
  screenIndex = _ref.screenIndex,
107
107
  screenWidth = _ref.screenWidth,
108
108
  _ref$disableCurrentSc = _ref.disableCurrentScreenNavigation,
109
- disableCurrentScreenNavigation = _ref$disableCurrentSc === void 0 ? false : _ref$disableCurrentSc,
109
+ disableCurrentScreenNavigation = _ref$disableCurrentSc === undefined ? false : _ref$disableCurrentSc,
110
110
  _ref$clickOnSiblings = _ref.clickOnSiblings,
111
- clickOnSiblings = _ref$clickOnSiblings === void 0 ? false : _ref$clickOnSiblings,
111
+ clickOnSiblings = _ref$clickOnSiblings === undefined ? false : _ref$clickOnSiblings,
112
112
  _ref$nextScreenWidthP = _ref.nextScreenWidthPercent,
113
- nextScreenWidthPercent = _ref$nextScreenWidthP === void 0 ? 0.5 : _ref$nextScreenWidthP,
113
+ nextScreenWidthPercent = _ref$nextScreenWidthP === undefined ? 0.5 : _ref$nextScreenWidthP,
114
114
  _ref$onInteract = _ref.onInteract,
115
- onInteract = _ref$onInteract === void 0 ? null : _ref$onInteract,
115
+ onInteract = _ref$onInteract === undefined ? null : _ref$onInteract,
116
116
  _ref$onNavigate = _ref.onNavigate,
117
- onNavigate = _ref$onNavigate === void 0 ? null : _ref$onNavigate;
117
+ onNavigate = _ref$onNavigate === undefined ? null : _ref$onNavigate;
118
118
  var _useState = useState(screens.reduce(function (map, _ref2) {
119
119
  var id = _ref2.id;
120
120
  return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, id, true));
@@ -124,12 +124,12 @@ function useScreenInteraction() {
124
124
  setScreensInteractionEnabled = _useState2[1];
125
125
  var _ref3 = screens[screenIndex] || {},
126
126
  _ref3$id = _ref3.id,
127
- screenId = _ref3$id === void 0 ? screenIndex : _ref3$id;
127
+ screenId = _ref3$id === undefined ? screenIndex : _ref3$id;
128
128
  var _screensInteractionEn = screensInteractionEnabled[screenId],
129
- currentScreenInteractionEnabled = _screensInteractionEn === void 0 ? true : _screensInteractionEn;
129
+ currentScreenInteractionEnabled = _screensInteractionEn === undefined ? true : _screensInteractionEn;
130
130
  var updateInteraction = useCallback(function (newValue) {
131
131
  var _screensInteractionEn2 = screensInteractionEnabled[screenId],
132
- currentValue = _screensInteractionEn2 === void 0 ? true : _screensInteractionEn2;
132
+ currentValue = _screensInteractionEn2 === undefined ? true : _screensInteractionEn2;
133
133
  if (currentValue !== newValue) {
134
134
  setScreensInteractionEnabled(screens.reduce(function (map, _ref4) {
135
135
  var id = _ref4.id;
@@ -200,14 +200,14 @@ function checkDraggable(el) {
200
200
  var parentDistance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
201
201
  var _ref = options || {},
202
202
  _ref$maxParentDistanc = _ref.maxParentDistance,
203
- maxParentDistance = _ref$maxParentDistanc === void 0 ? 5 : _ref$maxParentDistanc;
203
+ maxParentDistance = _ref$maxParentDistanc === undefined ? 5 : _ref$maxParentDistanc;
204
204
  var _ref2 = el || {},
205
205
  _ref2$tagName = _ref2.tagName,
206
- tagName = _ref2$tagName === void 0 ? null : _ref2$tagName,
206
+ tagName = _ref2$tagName === undefined ? null : _ref2$tagName,
207
207
  _ref2$parentNode = _ref2.parentNode,
208
- parentNode = _ref2$parentNode === void 0 ? null : _ref2$parentNode,
208
+ parentNode = _ref2$parentNode === undefined ? null : _ref2$parentNode,
209
209
  _ref2$dataset = _ref2.dataset,
210
- dataset = _ref2$dataset === void 0 ? {} : _ref2$dataset;
210
+ dataset = _ref2$dataset === undefined ? {} : _ref2$dataset;
211
211
  if (tagName === 'BODY') {
212
212
  return false;
213
213
  }
@@ -312,10 +312,10 @@ var Button = function Button(_ref) {
312
312
  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)]);
313
313
  var _ref3 = theme || {},
314
314
  _ref3$colors = _ref3.colors,
315
- colors = _ref3$colors === void 0 ? null : _ref3$colors;
315
+ colors = _ref3$colors === undefined ? null : _ref3$colors;
316
316
  var _ref4 = colors || {},
317
317
  _ref4$primary = _ref4.primary,
318
- brandPrimaryColor = _ref4$primary === void 0 ? null : _ref4$primary;
318
+ brandPrimaryColor = _ref4$primary === undefined ? null : _ref4$primary;
319
319
  var primaryColor = getStyleFromColor(brandPrimaryColor, 'color');
320
320
  var buttonStyles = _objectSpread({}, primaryColor);
321
321
  var content = /*#__PURE__*/React.createElement(React.Fragment, null, hasInlineIcon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
@@ -608,10 +608,10 @@ var ViewerMenuContainer = function ViewerMenuContainer(_ref) {
608
608
  children = _ref.children;
609
609
  var _ref2 = viewerTheme || {},
610
610
  _ref2$background = _ref2.background,
611
- background = _ref2$background === void 0 ? null : _ref2$background;
611
+ background = _ref2$background === undefined ? null : _ref2$background;
612
612
  var _ref3 = background || {},
613
613
  _ref3$color = _ref3.color,
614
- brandBackgroundColor = _ref3$color === void 0 ? null : _ref3$color;
614
+ brandBackgroundColor = _ref3$color === undefined ? null : _ref3$color;
615
615
  var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor');
616
616
  return /*#__PURE__*/React.createElement("div", {
617
617
  className: classNames([styles$e.container, _defineProperty({}, className, className !== null)]),
@@ -680,9 +680,9 @@ var ViewerMenuDot = function ViewerMenuDot(_ref) {
680
680
  className = _ref.className;
681
681
  var _ref2 = colors || {},
682
682
  _ref2$primary = _ref2.primary,
683
- primary = _ref2$primary === void 0 ? 'rgba(255, 255, 255, 1)' : _ref2$primary,
683
+ primary = _ref2$primary === undefined ? 'rgba(255, 255, 255, 1)' : _ref2$primary,
684
684
  _ref2$secondary = _ref2.secondary,
685
- secondary = _ref2$secondary === void 0 ? 'rgba(255, 255, 255, 0.25)' : _ref2$secondary;
685
+ secondary = _ref2$secondary === undefined ? 'rgba(255, 255, 255, 0.25)' : _ref2$secondary;
686
686
  var _useSpring = useSpring(function () {
687
687
  return {
688
688
  scaleX: 0,
@@ -782,11 +782,11 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
782
782
  props = _objectWithoutProperties(_ref, _excluded$5);
783
783
  var _ref2 = colors || {},
784
784
  _ref2$primary = _ref2.primary,
785
- primary = _ref2$primary === void 0 ? 'rgba(255, 255, 255, 1)' : _ref2$primary;
785
+ primary = _ref2$primary === undefined ? 'rgba(255, 255, 255, 1)' : _ref2$primary;
786
786
  var intl = useIntl();
787
787
  var currentIndex = items.findIndex(function (_ref3) {
788
788
  var _ref3$current = _ref3.current,
789
- current = _ref3$current === void 0 ? false : _ref3$current;
789
+ current = _ref3$current === undefined ? false : _ref3$current;
790
790
  return current;
791
791
  });
792
792
  var _ref4 = props || {},
@@ -821,11 +821,11 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
821
821
  }, items.map(function (item, index) {
822
822
  var _ref6 = item || {},
823
823
  _ref6$current = _ref6.current,
824
- current = _ref6$current === void 0 ? false : _ref6$current,
824
+ current = _ref6$current === undefined ? false : _ref6$current,
825
825
  _ref6$count = _ref6.count,
826
- count = _ref6$count === void 0 ? 1 : _ref6$count,
826
+ count = _ref6$count === undefined ? 1 : _ref6$count,
827
827
  _ref6$subIndex = _ref6.subIndex,
828
- subIndex = _ref6$subIndex === void 0 ? 0 : _ref6$subIndex;
828
+ subIndex = _ref6$subIndex === undefined ? 0 : _ref6$subIndex;
829
829
  return /*#__PURE__*/React.createElement(ViewerMenuDot, {
830
830
  key: "item-".concat(index + 1),
831
831
  current: current,
@@ -927,10 +927,10 @@ var ViewerMenuScreen = function ViewerMenuScreen(_ref) {
927
927
  var intl = useIntl();
928
928
  var _ref2 = item || {},
929
929
  _ref2$current = _ref2.current,
930
- current = _ref2$current === void 0 ? false : _ref2$current,
930
+ current = _ref2$current === undefined ? false : _ref2$current,
931
931
  screen = _ref2.screen,
932
932
  _ref2$count = _ref2.count,
933
- count = _ref2$count === void 0 ? 1 : _ref2$count;
933
+ count = _ref2$count === undefined ? 1 : _ref2$count;
934
934
  var _ref3 = screenSize || {},
935
935
  screenWidth = _ref3.width,
936
936
  screenHeight = _ref3.height;
@@ -940,7 +940,7 @@ var ViewerMenuScreen = function ViewerMenuScreen(_ref) {
940
940
  }),
941
941
  refVisible = _useIsVisible.ref,
942
942
  _useIsVisible$visible = _useIsVisible.visible,
943
- visible = _useIsVisible$visible === void 0 ? false : _useIsVisible$visible;
943
+ visible = _useIsVisible$visible === undefined ? false : _useIsVisible$visible;
944
944
  var screenAriaLabel = "".concat(intl.formatMessage({
945
945
  id: "LkVfwW",
946
946
  defaultMessage: [{
@@ -1059,28 +1059,28 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
1059
1059
  var _useDimensionObserver = useDimensionObserver(),
1060
1060
  containerRef = _useDimensionObserver.ref,
1061
1061
  _useDimensionObserver2 = _useDimensionObserver.width,
1062
- contentWidth = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
1062
+ contentWidth = _useDimensionObserver2 === undefined ? 0 : _useDimensionObserver2;
1063
1063
  var thumbsPerLine = Math.max(Math.floor(contentWidth / maxThumbsWidth), 3); // @note cool, should be in recipes
1064
1064
 
1065
1065
  // @todo reimplement the brand logo
1066
1066
  // const { background = null, logo: brandLogo = null } = viewerTheme || {};
1067
1067
  var _ref2 = viewerTheme || {},
1068
1068
  _ref2$background = _ref2.background,
1069
- background = _ref2$background === void 0 ? null : _ref2$background,
1069
+ background = _ref2$background === undefined ? null : _ref2$background,
1070
1070
  _ref2$textStyles = _ref2.textStyles,
1071
- textStyles = _ref2$textStyles === void 0 ? null : _ref2$textStyles;
1071
+ textStyles = _ref2$textStyles === undefined ? null : _ref2$textStyles;
1072
1072
  var _ref3 = background || {},
1073
1073
  _ref3$image = _ref3.image,
1074
- image = _ref3$image === void 0 ? null : _ref3$image;
1074
+ image = _ref3$image === undefined ? null : _ref3$image;
1075
1075
  var _ref4 = image || {},
1076
1076
  _ref4$url = _ref4.url,
1077
- brandImageUrl = _ref4$url === void 0 ? null : _ref4$url;
1077
+ brandImageUrl = _ref4$url === undefined ? null : _ref4$url;
1078
1078
  var brandImageStyle = brandImageUrl !== null ? {
1079
1079
  backgroundImage: "url(".concat(brandImageUrl, ")")
1080
1080
  } : null;
1081
1081
  var _ref5 = textStyles || {},
1082
1082
  _ref5$title = _ref5.title,
1083
- titleStyles = _ref5$title === void 0 ? null : _ref5$title;
1083
+ titleStyles = _ref5$title === undefined ? null : _ref5$title;
1084
1084
  // eslint-disable-next-line no-unused-vars
1085
1085
  var _ref6 = titleStyles || {};
1086
1086
  _ref6.textAlign;
@@ -1247,32 +1247,32 @@ var ViewerMenuShare = function ViewerMenuShare(_ref) {
1247
1247
  // Viewer theme
1248
1248
  var _ref2 = viewerTheme || {},
1249
1249
  _ref2$background = _ref2.background,
1250
- background = _ref2$background === void 0 ? null : _ref2$background;
1250
+ background = _ref2$background === undefined ? null : _ref2$background;
1251
1251
  var _ref3 = background || {},
1252
1252
  _ref3$image = _ref3.image,
1253
- image = _ref3$image === void 0 ? null : _ref3$image;
1253
+ image = _ref3$image === undefined ? null : _ref3$image;
1254
1254
  var _ref4 = image || {},
1255
1255
  _ref4$url = _ref4.url,
1256
- brandImageUrl = _ref4$url === void 0 ? null : _ref4$url;
1256
+ brandImageUrl = _ref4$url === undefined ? null : _ref4$url;
1257
1257
  var brandImageStyle = brandImageUrl !== null ? {
1258
1258
  backgroundImage: "url(".concat(brandImageUrl, ")")
1259
1259
  } : null;
1260
1260
  var coverScreen = useMemo(function () {
1261
1261
  var _ref5 = items[0] || {},
1262
1262
  _ref5$screen = _ref5.screen,
1263
- screen = _ref5$screen === void 0 ? null : _ref5$screen;
1263
+ screen = _ref5$screen === undefined ? null : _ref5$screen;
1264
1264
  return screen;
1265
1265
  }, [items]);
1266
1266
  var currentScreen = useMemo(function () {
1267
1267
  var found = items.find(function (item) {
1268
1268
  var _ref6 = item || {},
1269
1269
  _ref6$current = _ref6.current,
1270
- current = _ref6$current === void 0 ? false : _ref6$current;
1270
+ current = _ref6$current === undefined ? false : _ref6$current;
1271
1271
  return current;
1272
1272
  });
1273
1273
  var _ref7 = found || {},
1274
1274
  _ref7$screen = _ref7.screen,
1275
- screen = _ref7$screen === void 0 ? null : _ref7$screen;
1275
+ screen = _ref7$screen === undefined ? null : _ref7$screen;
1276
1276
  return screen;
1277
1277
  }, [items, currentScreenIndex, focusable]);
1278
1278
  var _useState = useState(false),
@@ -1422,23 +1422,23 @@ var ViewerMenu = function ViewerMenu(_ref) {
1422
1422
  onClickCloseViewer = _ref.onClickCloseViewer,
1423
1423
  refDots = _ref.refDots;
1424
1424
  var _story$components = story.components,
1425
- screens = _story$components === void 0 ? [] : _story$components,
1425
+ screens = _story$components === undefined ? [] : _story$components,
1426
1426
  _story$title = story.title,
1427
- title = _story$title === void 0 ? null : _story$title,
1427
+ title = _story$title === undefined ? null : _story$title,
1428
1428
  _story$metadata = story.metadata,
1429
- metadata = _story$metadata === void 0 ? null : _story$metadata;
1429
+ metadata = _story$metadata === undefined ? null : _story$metadata;
1430
1430
  var _ref2 = metadata || {},
1431
1431
  _ref2$description = _ref2.description,
1432
- description = _ref2$description === void 0 ? null : _ref2$description;
1432
+ description = _ref2$description === undefined ? null : _ref2$description;
1433
1433
  var currentScreen = screens !== null ? screens[currentScreenIndex] || null : null;
1434
1434
  var _ref3 = currentScreen || {},
1435
1435
  _ref3$id = _ref3.id,
1436
- screenId = _ref3$id === void 0 ? null : _ref3$id,
1436
+ screenId = _ref3$id === undefined ? null : _ref3$id,
1437
1437
  _ref3$type = _ref3.type,
1438
- screenType = _ref3$type === void 0 ? null : _ref3$type;
1438
+ screenType = _ref3$type === undefined ? null : _ref3$type;
1439
1439
  var _ref4 = viewerTheme || {},
1440
1440
  _ref4$menuTheme = _ref4.menuTheme,
1441
- menuTheme = _ref4$menuTheme === void 0 ? null : _ref4$menuTheme;
1441
+ menuTheme = _ref4$menuTheme === undefined ? null : _ref4$menuTheme;
1442
1442
  var _useViewerSize = useViewerSize(),
1443
1443
  viewerHeight = _useViewerSize.height;
1444
1444
  var _useState = useState(false),
@@ -1456,7 +1456,7 @@ var ViewerMenu = function ViewerMenu(_ref) {
1456
1456
  var _useDimensionObserver = useDimensionObserver(),
1457
1457
  navContainerRef = _useDimensionObserver.ref,
1458
1458
  _useDimensionObserver2 = _useDimensionObserver.height,
1459
- navContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
1459
+ navContainerHeight = _useDimensionObserver2 === undefined ? 0 : _useDimensionObserver2;
1460
1460
  var items = useMemo(function () {
1461
1461
  return screens.map(function (it) {
1462
1462
  var children = screens.filter(function (s) {
@@ -1472,13 +1472,13 @@ var ViewerMenu = function ViewerMenu(_ref) {
1472
1472
  screen: it,
1473
1473
  screenId: it.id,
1474
1474
  current: screenId === it.id || currentChild !== null,
1475
- visible: ((it === null || it === void 0 ? void 0 : it.parentId) || null) === null,
1475
+ visible: ((it === null || it === undefined ? undefined : it.parentId) || null) === null,
1476
1476
  count: children.length + 1 || 1,
1477
1477
  subIndex: subIndex || 0
1478
1478
  };
1479
1479
  }).filter(function (_ref5) {
1480
1480
  var _ref5$visible = _ref5.visible,
1481
- visible = _ref5$visible === void 0 ? true : _ref5$visible;
1481
+ visible = _ref5$visible === undefined ? true : _ref5$visible;
1482
1482
  return visible;
1483
1483
  });
1484
1484
  }, [screens, screenId]);
@@ -2018,7 +2018,7 @@ function getFormattedTimestamp() {
2018
2018
  var _ref = parts || [],
2019
2019
  _ref2 = _slicedToArray(_ref, 1),
2020
2020
  _ref2$ = _ref2[0],
2021
- fullSeconds = _ref2$ === void 0 ? 0 : _ref2$;
2021
+ fullSeconds = _ref2$ === undefined ? 0 : _ref2$;
2022
2022
  var finalFullSeconds = Math.round(fullSeconds);
2023
2023
  var seconds = finalFullSeconds % 60;
2024
2024
  var diff = finalFullSeconds - seconds;
@@ -2106,9 +2106,9 @@ var SeekBar = function SeekBar(_ref3) {
2106
2106
  }
2107
2107
  var _currentTarget$getBou = currentTarget.getBoundingClientRect(),
2108
2108
  _currentTarget$getBou2 = _currentTarget$getBou.width,
2109
- elWidth = _currentTarget$getBou2 === void 0 ? 0 : _currentTarget$getBou2,
2109
+ elWidth = _currentTarget$getBou2 === undefined ? 0 : _currentTarget$getBou2,
2110
2110
  _currentTarget$getBou3 = _currentTarget$getBou.x,
2111
- xGap = _currentTarget$getBou3 === void 0 ? null : _currentTarget$getBou3;
2111
+ xGap = _currentTarget$getBou3 === undefined ? null : _currentTarget$getBou3;
2112
2112
  var newProgress = null;
2113
2113
  if (tap) {
2114
2114
  newProgress = Math.max(0, Math.min(1, (xOffset - xGap) / elWidth));
@@ -2252,13 +2252,13 @@ function PlaybackControls(_ref) {
2252
2252
  var intl = useIntl();
2253
2253
  var _usePlaybackContext = usePlaybackContext(),
2254
2254
  _usePlaybackContext$m = _usePlaybackContext.media,
2255
- mediaElement = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m,
2255
+ mediaElement = _usePlaybackContext$m === undefined ? null : _usePlaybackContext$m,
2256
2256
  _usePlaybackContext$h = _usePlaybackContext.hasAudio,
2257
- hasAudio = _usePlaybackContext$h === void 0 ? null : _usePlaybackContext$h,
2257
+ hasAudio = _usePlaybackContext$h === undefined ? null : _usePlaybackContext$h,
2258
2258
  _usePlaybackContext$p = _usePlaybackContext.playing,
2259
- wantedPlaying = _usePlaybackContext$p === void 0 ? false : _usePlaybackContext$p,
2259
+ wantedPlaying = _usePlaybackContext$p === undefined ? false : _usePlaybackContext$p,
2260
2260
  _usePlaybackContext$m2 = _usePlaybackContext.muted,
2261
- wantedMuted = _usePlaybackContext$m2 === void 0 ? true : _usePlaybackContext$m2,
2261
+ wantedMuted = _usePlaybackContext$m2 === undefined ? true : _usePlaybackContext$m2,
2262
2262
  setPlaying = _usePlaybackContext.setPlaying,
2263
2263
  setMuted = _usePlaybackContext.setMuted,
2264
2264
  controls = _usePlaybackContext.controls,
@@ -2490,7 +2490,7 @@ function WebViewContainer(_ref) {
2490
2490
  _useViewerWebView.open;
2491
2491
  _useViewerWebView.update;
2492
2492
  var _useViewerWebView$url = _useViewerWebView.url,
2493
- url = _useViewerWebView$url === void 0 ? null : _useViewerWebView$url,
2493
+ url = _useViewerWebView$url === undefined ? null : _useViewerWebView$url,
2494
2494
  webViewProps = _objectWithoutProperties(_useViewerWebView, _excluded$2);
2495
2495
  var _useViewerInteraction = useViewerInteraction(),
2496
2496
  disableInteraction = _useViewerInteraction.disableInteraction,
@@ -2740,13 +2740,13 @@ var Viewer = function Viewer(_ref) {
2740
2740
  disabled: storyIsParsed
2741
2741
  }) || {};
2742
2742
  var _parsedStory$componen = parsedStory.components,
2743
- screens = _parsedStory$componen === void 0 ? [] : _parsedStory$componen,
2743
+ screens = _parsedStory$componen === undefined ? [] : _parsedStory$componen,
2744
2744
  _parsedStory$title = parsedStory.title,
2745
- title = _parsedStory$title === void 0 ? null : _parsedStory$title,
2745
+ title = _parsedStory$title === undefined ? null : _parsedStory$title,
2746
2746
  _parsedStory$metadata = parsedStory.metadata,
2747
- metadata = _parsedStory$metadata === void 0 ? null : _parsedStory$metadata,
2747
+ metadata = _parsedStory$metadata === undefined ? null : _parsedStory$metadata,
2748
2748
  _parsedStory$fonts = parsedStory.fonts,
2749
- fonts = _parsedStory$fonts === void 0 ? null : _parsedStory$fonts;
2749
+ fonts = _parsedStory$fonts === undefined ? null : _parsedStory$fonts;
2750
2750
  var screensCount = screens.length;
2751
2751
  var eventsManager = useMemo(function () {
2752
2752
  return new EventEmitter();
@@ -2763,9 +2763,9 @@ var Viewer = function Viewer(_ref) {
2763
2763
  screenMetadata = _ref3.metadata;
2764
2764
  var _ref4 = screenMetadata || {},
2765
2765
  _ref4$title = _ref4.title,
2766
- screenTitle = _ref4$title === void 0 ? null : _ref4$title,
2766
+ screenTitle = _ref4$title === undefined ? null : _ref4$title,
2767
2767
  _ref4$description = _ref4.description,
2768
- screenDescription = _ref4$description === void 0 ? null : _ref4$description;
2768
+ screenDescription = _ref4$description === undefined ? null : _ref4$description;
2769
2769
  var finalTitle = screenTitle !== null ? screenTitle : title;
2770
2770
  var finalMetadata = useMemo(function () {
2771
2771
  return screenDescription !== null ? _objectSpread(_objectSpread({}, metadata), {}, {
@@ -2788,16 +2788,16 @@ var Viewer = function Viewer(_ref) {
2788
2788
  colors = _ref5.colors;
2789
2789
  var _ref6 = colors || {},
2790
2790
  _ref6$primary = _ref6.primary,
2791
- primaryColor = _ref6$primary === void 0 ? null : _ref6$primary,
2791
+ primaryColor = _ref6$primary === undefined ? null : _ref6$primary,
2792
2792
  _ref6$focus = _ref6.focus,
2793
- focusColor = _ref6$focus === void 0 ? null : _ref6$focus;
2793
+ focusColor = _ref6$focus === undefined ? null : _ref6$focus;
2794
2794
  var finalFocusColor = getColorAsString(focusColor || primaryColor);
2795
2795
  var _ref7 = textStyles || {},
2796
2796
  _ref7$title = _ref7.title,
2797
- themeTextStyle = _ref7$title === void 0 ? null : _ref7$title;
2797
+ themeTextStyle = _ref7$title === undefined ? null : _ref7$title;
2798
2798
  var _ref8 = themeTextStyle || {},
2799
2799
  _ref8$fontFamily = _ref8.fontFamily,
2800
- themeFont = _ref8$fontFamily === void 0 ? null : _ref8$fontFamily;
2800
+ themeFont = _ref8$fontFamily === undefined ? null : _ref8$fontFamily;
2801
2801
 
2802
2802
  // Fonts
2803
2803
  var finalFonts = useMemo(function () {
@@ -2817,15 +2817,15 @@ var Viewer = function Viewer(_ref) {
2817
2817
  playing = _usePlaybackContext.playing;
2818
2818
  _usePlaybackContext.setControls;
2819
2819
  var _usePlaybackContext$c = _usePlaybackContext.controls,
2820
- playbackControls = _usePlaybackContext$c === void 0 ? false : _usePlaybackContext$c,
2820
+ playbackControls = _usePlaybackContext$c === undefined ? false : _usePlaybackContext$c,
2821
2821
  _usePlaybackContext$c2 = _usePlaybackContext.controlsVisible,
2822
- playbackcontrolsVisible = _usePlaybackContext$c2 === void 0 ? false : _usePlaybackContext$c2,
2822
+ playbackcontrolsVisible = _usePlaybackContext$c2 === undefined ? false : _usePlaybackContext$c2,
2823
2823
  _usePlaybackContext$m = _usePlaybackContext.media,
2824
- playbackMedia = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m;
2824
+ playbackMedia = _usePlaybackContext$m === undefined ? null : _usePlaybackContext$m;
2825
2825
  var _useDimensionObserver = useDimensionObserver(),
2826
2826
  playbackControlsContainerRef = _useDimensionObserver.ref,
2827
2827
  _useDimensionObserver2 = _useDimensionObserver.height,
2828
- playbackControlsContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
2828
+ playbackControlsContainerHeight = _useDimensionObserver2 === undefined ? 0 : _useDimensionObserver2;
2829
2829
  var trackScreenView = useTrackScreenView();
2830
2830
  var _useScreenSizeFromEle = useScreenSizeFromElement(_objectSpread({
2831
2831
  width: width,
@@ -2839,13 +2839,13 @@ var Viewer = function Viewer(_ref) {
2839
2839
  screenScale = _useScreenSizeFromEle.scale;
2840
2840
  var _ref9 = screenSize || {},
2841
2841
  _ref9$width = _ref9.width,
2842
- screenWidth = _ref9$width === void 0 ? null : _ref9$width,
2842
+ screenWidth = _ref9$width === undefined ? null : _ref9$width,
2843
2843
  _ref9$height = _ref9.height,
2844
- screenHeight = _ref9$height === void 0 ? null : _ref9$height,
2844
+ screenHeight = _ref9$height === undefined ? null : _ref9$height,
2845
2845
  _ref9$landscape = _ref9.landscape,
2846
- landscape = _ref9$landscape === void 0 ? false : _ref9$landscape,
2846
+ landscape = _ref9$landscape === undefined ? false : _ref9$landscape,
2847
2847
  _ref9$menuOverScreen = _ref9.menuOverScreen,
2848
- menuOverScreen = _ref9$menuOverScreen === void 0 ? false : _ref9$menuOverScreen;
2848
+ menuOverScreen = _ref9$menuOverScreen === undefined ? false : _ref9$menuOverScreen;
2849
2849
  var screenContainerWidth = screenScale !== null ? screenWidth * screenScale : screenWidth;
2850
2850
  var screenContainerHeight = screenScale !== null ? screenHeight * screenScale : screenHeight;
2851
2851
  var hasSize = screenWidth > 0 && screenHeight > 0;
@@ -3088,7 +3088,7 @@ var Viewer = function Viewer(_ref) {
3088
3088
  var _useDimensionObserver3 = useDimensionObserver(),
3089
3089
  menuDotsContainerRef = _useDimensionObserver3.ref,
3090
3090
  _useDimensionObserver4 = _useDimensionObserver3.height,
3091
- menuDotsContainerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
3091
+ menuDotsContainerHeight = _useDimensionObserver4 === undefined ? 0 : _useDimensionObserver4;
3092
3092
  var onClickScreen = useCallback(function (_ref14) {
3093
3093
  var itemScreenId = _ref14.screenId;
3094
3094
  onInteractionPrivate();
@@ -3163,24 +3163,24 @@ var Viewer = function Viewer(_ref) {
3163
3163
  setShareIncentiveVisible = _useState10[1];
3164
3164
  var _ref16 = currentScreen || {},
3165
3165
  _ref16$header = _ref16.header,
3166
- header = _ref16$header === void 0 ? null : _ref16$header;
3166
+ header = _ref16$header === undefined ? null : _ref16$header;
3167
3167
  var _ref17 = header || {},
3168
3168
  _ref17$shareIncentive = _ref17.shareIncentive,
3169
- shareIncentive = _ref17$shareIncentive === void 0 ? null : _ref17$shareIncentive;
3169
+ shareIncentive = _ref17$shareIncentive === undefined ? null : _ref17$shareIncentive;
3170
3170
  var _ref18 = shareIncentive || {},
3171
3171
  _ref18$active = _ref18.active,
3172
- hasShareIncentive = _ref18$active === void 0 ? false : _ref18$active,
3172
+ hasShareIncentive = _ref18$active === undefined ? false : _ref18$active,
3173
3173
  _ref18$label = _ref18.label,
3174
- shareIncentiveLabel = _ref18$label === void 0 ? null : _ref18$label;
3174
+ shareIncentiveLabel = _ref18$label === undefined ? null : _ref18$label;
3175
3175
  var _ref19 = currentShareIncentive || {},
3176
3176
  _ref19$label = _ref19.label,
3177
- currentShareIncentiveLabel = _ref19$label === void 0 ? null : _ref19$label;
3177
+ currentShareIncentiveLabel = _ref19$label === undefined ? null : _ref19$label;
3178
3178
  var _ref20 = shareIncentiveLabel || {},
3179
3179
  _ref20$body = _ref20.body,
3180
- incentiveLabel = _ref20$body === void 0 ? null : _ref20$body;
3180
+ incentiveLabel = _ref20$body === undefined ? null : _ref20$body;
3181
3181
  var _ref21 = currentShareIncentiveLabel || {},
3182
3182
  _ref21$body = _ref21.body,
3183
- currentIncentiveLabel = _ref21$body === void 0 ? null : _ref21$body;
3183
+ currentIncentiveLabel = _ref21$body === undefined ? null : _ref21$body;
3184
3184
  useEffect(function () {
3185
3185
  setShareIncentiveVisible(true);
3186
3186
  if (hasShareIncentive && shareIncentiveLabel !== currentShareIncentiveLabel) {
@@ -3219,11 +3219,13 @@ var Viewer = function Viewer(_ref) {
3219
3219
  bottomHeight = playbackControlsContainerHeight / screenScale;
3220
3220
  }
3221
3221
  var NavigationHint = withNavigationHint === 'hand' ? HandTap : ArrowHint;
3222
- console.log({
3223
- screenIndex: screenIndex,
3224
- transitionDirection: transitionDirection,
3225
- transitioned: transitioned
3226
- });
3222
+
3223
+ // console.log({
3224
+ // screenIndex,
3225
+ // transitionDirection,
3226
+ // transitioned,
3227
+ // });
3228
+
3227
3229
  return /*#__PURE__*/React.createElement(StoryProvider, {
3228
3230
  story: parsedStory
3229
3231
  }, /*#__PURE__*/React.createElement(ScreenSizeProvider, {
@@ -3453,7 +3455,7 @@ var ViewerRoutes = function ViewerRoutes(_ref) {
3453
3455
  navigate = _useLocation2[1];
3454
3456
  var _ref2 = story || {},
3455
3457
  _ref2$components = _ref2.components,
3456
- screens = _ref2$components === void 0 ? [] : _ref2$components;
3458
+ screens = _ref2$components === undefined ? [] : _ref2$components;
3457
3459
  var finalOnScreenChange = useCallback(function (it) {
3458
3460
  var screenIndex = screens.findIndex(function (screen) {
3459
3461
  var screenId = screen.id;
@@ -3470,7 +3472,7 @@ var ViewerRoutes = function ViewerRoutes(_ref) {
3470
3472
  path: routes.screen
3471
3473
  }, function (_ref3) {
3472
3474
  var _ref3$screen = _ref3.screen,
3473
- screenParam = _ref3$screen === void 0 ? null : _ref3$screen;
3475
+ screenParam = _ref3$screen === undefined ? null : _ref3$screen;
3474
3476
  var screenFromIndex = pathWithIndex && screenParam !== null ? screens[parseInt(screenParam, 10) - 1] || null : null;
3475
3477
  var screenId = pathWithIndex ? (screenFromIndex || {}).id || null : screenParam;
3476
3478
  return /*#__PURE__*/React.createElement(Viewer, Object.assign({}, otherProps, {
@@ -3554,13 +3556,13 @@ var ViewerContainer = function ViewerContainer(_ref) {
3554
3556
  return null;
3555
3557
  }
3556
3558
  var _story$id = story.id,
3557
- id = _story$id === void 0 ? null : _story$id,
3559
+ id = _story$id === undefined ? null : _story$id,
3558
3560
  _story$slug = story.slug,
3559
- slug = _story$slug === void 0 ? null : _story$slug,
3561
+ slug = _story$slug === undefined ? null : _story$slug,
3560
3562
  _story$title = story.title,
3561
- title = _story$title === void 0 ? null : _story$title,
3563
+ title = _story$title === undefined ? null : _story$title,
3562
3564
  _story$components = story.components,
3563
- components = _story$components === void 0 ? [] : _story$components;
3565
+ components = _story$components === undefined ? [] : _story$components;
3564
3566
  return _objectSpread({
3565
3567
  storyId: id,
3566
3568
  storySlug: slug,
@@ -3572,7 +3574,7 @@ var ViewerContainer = function ViewerContainer(_ref) {
3572
3574
  metadata = _ref2.metadata;
3573
3575
  var _ref3 = metadata || {},
3574
3576
  _ref3$language = _ref3.language,
3575
- finalLocale = _ref3$language === void 0 ? locale : _ref3$language;
3577
+ finalLocale = _ref3$language === undefined ? locale : _ref3$language;
3576
3578
  var content = /*#__PURE__*/React.createElement(IntlProvider, {
3577
3579
  locale: finalLocale,
3578
3580
  locales: locales,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/viewer",
3
- "version": "0.3.607",
3
+ "version": "0.3.609",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -63,15 +63,15 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@babel/runtime": "^7.13.10",
66
- "@folklore/routes": "^0.2.27",
67
- "@micromag/core": "^0.3.607",
68
- "@micromag/element-badge": "^0.3.607",
69
- "@micromag/element-scroll": "^0.3.607",
70
- "@micromag/element-share-options": "^0.3.607",
71
- "@micromag/element-webview": "^0.3.607",
72
- "@micromag/elements": "^0.3.607",
73
- "@micromag/intl": "^0.3.607",
74
- "@micromag/screens": "^0.3.607",
66
+ "@folklore/routes": "^0.2.32",
67
+ "@micromag/core": "^0.3.608",
68
+ "@micromag/element-badge": "^0.3.608",
69
+ "@micromag/element-scroll": "^0.3.608",
70
+ "@micromag/element-share-options": "^0.3.608",
71
+ "@micromag/element-webview": "^0.3.608",
72
+ "@micromag/elements": "^0.3.608",
73
+ "@micromag/intl": "^0.3.608",
74
+ "@micromag/screens": "^0.3.608",
75
75
  "@react-spring/core": "^9.6.1",
76
76
  "@react-spring/web": "^9.6.1",
77
77
  "@use-gesture/react": "^10.3.0",
@@ -91,5 +91,5 @@
91
91
  "access": "public",
92
92
  "registry": "https://registry.npmjs.org/"
93
93
  },
94
- "gitHead": "635ee4c6bf057273a9c90bde7c80134ad92ebb9c"
94
+ "gitHead": "7e6a7a5e2201fc2e1888200dd21b7bfa493c14c4"
95
95
  }