@micromag/viewer 0.3.155 → 0.3.156

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
@@ -1594,6 +1594,8 @@ function PlaybackControls(_ref) {
1594
1594
  var _usePlaybackContext = usePlaybackContext(),
1595
1595
  _usePlaybackContext$m = _usePlaybackContext.media,
1596
1596
  mediaElement = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m,
1597
+ _usePlaybackContext$h = _usePlaybackContext.hasAudio,
1598
+ hasAudio = _usePlaybackContext$h === void 0 ? null : _usePlaybackContext$h,
1597
1599
  _usePlaybackContext$p = _usePlaybackContext.playing,
1598
1600
  playing = _usePlaybackContext$p === void 0 ? false : _usePlaybackContext$p,
1599
1601
  _usePlaybackContext$m2 = _usePlaybackContext.muted,
@@ -1636,17 +1638,17 @@ function PlaybackControls(_ref) {
1636
1638
  var onPlay = useCallback(function () {
1637
1639
  setPlaying(true);
1638
1640
 
1639
- if (!controlsVisible) {
1641
+ if (!controlsVisible && controls) {
1640
1642
  showControls();
1641
1643
  }
1642
1644
  }, [setPlaying, controlsVisible, showControls]);
1643
1645
  var onPause = useCallback(function () {
1644
1646
  setPlaying(false);
1645
1647
 
1646
- if (!controlsVisible) {
1648
+ if (!controlsVisible && controls) {
1647
1649
  showControls();
1648
1650
  }
1649
- }, [setPlaying, controlsVisible, showControls]);
1651
+ }, [setPlaying, controlsVisible, controls, showControls]);
1650
1652
  var onMute = useCallback(function () {
1651
1653
  setMuted(true);
1652
1654
 
@@ -1666,21 +1668,27 @@ function PlaybackControls(_ref) {
1666
1668
  if (playing) setPlaying(false);
1667
1669
  }, [playing, setWasPlaying]);
1668
1670
  var onSeek = useCallback(function (time) {
1669
- mediaElement.currentTime = time;
1670
- showControls();
1671
- }, [mediaElement, setWasPlaying, playing, setPlaying, showControls]);
1671
+ if (mediaElement !== null) {
1672
+ mediaElement.currentTime = time;
1673
+ }
1674
+
1675
+ if (!controlsVisible && controls) {
1676
+ showControls();
1677
+ }
1678
+ }, [mediaElement, controlsVisible, controls, setWasPlaying, playing, setPlaying, showControls]);
1672
1679
  var onSeekEnd = useCallback(function () {
1673
1680
  if (wasPlaying) setPlaying(true);
1674
1681
  }, [playing, setPlaying, wasPlaying]);
1682
+ var mediaHasAudio = mediaElement !== null && (hasAudio === null || hasAudio === true);
1675
1683
 
1676
1684
  var _ref3 = customControlsTheme || {},
1677
1685
  color = _ref3.color,
1678
1686
  progressColor = _ref3.progressColor,
1679
1687
  seekBarOnly = _ref3.seekBarOnly;
1680
1688
 
1681
- var isCollapsed = controls && !controlsVisible && playing || !controls && mediaElement !== null;
1689
+ var isCollapsed = controls && !controlsVisible && playing || !controls && mediaHasAudio;
1682
1690
  return /*#__PURE__*/React.createElement("div", {
1683
- className: classNames([styles$1.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$1.withPlayPause, controls && !seekBarOnly), _defineProperty(_ref4, styles$1.withMute, mediaElement !== null || controls), _defineProperty(_ref4, styles$1.withSeekBar, controls), _defineProperty(_ref4, styles$1.isCollapsed, isCollapsed), _ref4)])
1691
+ className: classNames([styles$1.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$1.withPlayPause, controls && !seekBarOnly), _defineProperty(_ref4, styles$1.withMute, mediaHasAudio || controls), _defineProperty(_ref4, styles$1.withSeekBar, controls), _defineProperty(_ref4, styles$1.isCollapsed, isCollapsed), _ref4)])
1684
1692
  }, /*#__PURE__*/React.createElement("button", {
1685
1693
  type: "button",
1686
1694
  className: styles$1.playPauseButton,
@@ -1740,7 +1748,7 @@ function PlaybackControls(_ref) {
1740
1748
  "value": "Mute"
1741
1749
  }]
1742
1750
  }),
1743
- tabIndex: controlsVisible ? '0' : '-1'
1751
+ tabIndex: controlsVisible || mediaHasAudio ? '0' : '-1'
1744
1752
  }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
1745
1753
  className: styles$1.icon,
1746
1754
  icon: faVolumeUp
package/lib/index.js CHANGED
@@ -1614,6 +1614,8 @@ function PlaybackControls(_ref) {
1614
1614
  var _usePlaybackContext = contexts.usePlaybackContext(),
1615
1615
  _usePlaybackContext$m = _usePlaybackContext.media,
1616
1616
  mediaElement = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m,
1617
+ _usePlaybackContext$h = _usePlaybackContext.hasAudio,
1618
+ hasAudio = _usePlaybackContext$h === void 0 ? null : _usePlaybackContext$h,
1617
1619
  _usePlaybackContext$p = _usePlaybackContext.playing,
1618
1620
  playing = _usePlaybackContext$p === void 0 ? false : _usePlaybackContext$p,
1619
1621
  _usePlaybackContext$m2 = _usePlaybackContext.muted,
@@ -1656,17 +1658,17 @@ function PlaybackControls(_ref) {
1656
1658
  var onPlay = React.useCallback(function () {
1657
1659
  setPlaying(true);
1658
1660
 
1659
- if (!controlsVisible) {
1661
+ if (!controlsVisible && controls) {
1660
1662
  showControls();
1661
1663
  }
1662
1664
  }, [setPlaying, controlsVisible, showControls]);
1663
1665
  var onPause = React.useCallback(function () {
1664
1666
  setPlaying(false);
1665
1667
 
1666
- if (!controlsVisible) {
1668
+ if (!controlsVisible && controls) {
1667
1669
  showControls();
1668
1670
  }
1669
- }, [setPlaying, controlsVisible, showControls]);
1671
+ }, [setPlaying, controlsVisible, controls, showControls]);
1670
1672
  var onMute = React.useCallback(function () {
1671
1673
  setMuted(true);
1672
1674
 
@@ -1686,21 +1688,27 @@ function PlaybackControls(_ref) {
1686
1688
  if (playing) setPlaying(false);
1687
1689
  }, [playing, setWasPlaying]);
1688
1690
  var onSeek = React.useCallback(function (time) {
1689
- mediaElement.currentTime = time;
1690
- showControls();
1691
- }, [mediaElement, setWasPlaying, playing, setPlaying, showControls]);
1691
+ if (mediaElement !== null) {
1692
+ mediaElement.currentTime = time;
1693
+ }
1694
+
1695
+ if (!controlsVisible && controls) {
1696
+ showControls();
1697
+ }
1698
+ }, [mediaElement, controlsVisible, controls, setWasPlaying, playing, setPlaying, showControls]);
1692
1699
  var onSeekEnd = React.useCallback(function () {
1693
1700
  if (wasPlaying) setPlaying(true);
1694
1701
  }, [playing, setPlaying, wasPlaying]);
1702
+ var mediaHasAudio = mediaElement !== null && (hasAudio === null || hasAudio === true);
1695
1703
 
1696
1704
  var _ref3 = customControlsTheme || {},
1697
1705
  color = _ref3.color,
1698
1706
  progressColor = _ref3.progressColor,
1699
1707
  seekBarOnly = _ref3.seekBarOnly;
1700
1708
 
1701
- var isCollapsed = controls && !controlsVisible && playing || !controls && mediaElement !== null;
1709
+ var isCollapsed = controls && !controlsVisible && playing || !controls && mediaHasAudio;
1702
1710
  return /*#__PURE__*/React__default["default"].createElement("div", {
1703
- className: classNames__default["default"]([styles$1.container, (_ref4 = {}, _defineProperty__default["default"](_ref4, className, className !== null), _defineProperty__default["default"](_ref4, styles$1.withPlayPause, controls && !seekBarOnly), _defineProperty__default["default"](_ref4, styles$1.withMute, mediaElement !== null || controls), _defineProperty__default["default"](_ref4, styles$1.withSeekBar, controls), _defineProperty__default["default"](_ref4, styles$1.isCollapsed, isCollapsed), _ref4)])
1711
+ className: classNames__default["default"]([styles$1.container, (_ref4 = {}, _defineProperty__default["default"](_ref4, className, className !== null), _defineProperty__default["default"](_ref4, styles$1.withPlayPause, controls && !seekBarOnly), _defineProperty__default["default"](_ref4, styles$1.withMute, mediaHasAudio || controls), _defineProperty__default["default"](_ref4, styles$1.withSeekBar, controls), _defineProperty__default["default"](_ref4, styles$1.isCollapsed, isCollapsed), _ref4)])
1704
1712
  }, /*#__PURE__*/React__default["default"].createElement("button", {
1705
1713
  type: "button",
1706
1714
  className: styles$1.playPauseButton,
@@ -1760,7 +1768,7 @@ function PlaybackControls(_ref) {
1760
1768
  "value": "Mute"
1761
1769
  }]
1762
1770
  }),
1763
- tabIndex: controlsVisible ? '0' : '-1'
1771
+ tabIndex: controlsVisible || mediaHasAudio ? '0' : '-1'
1764
1772
  }, /*#__PURE__*/React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, {
1765
1773
  className: styles$1.icon,
1766
1774
  icon: faVolumeUp.faVolumeUp
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/viewer",
3
- "version": "0.3.155",
3
+ "version": "0.3.156",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -59,13 +59,13 @@
59
59
  "@fortawesome/fontawesome-svg-core": "^1.2.32",
60
60
  "@fortawesome/free-solid-svg-icons": "^5.15.1",
61
61
  "@fortawesome/react-fontawesome": "^0.1.13",
62
- "@micromag/core": "^0.3.153",
63
- "@micromag/element-scroll": "^0.3.153",
64
- "@micromag/element-share-options": "^0.3.153",
65
- "@micromag/elements": "^0.3.153",
66
- "@micromag/fields": "^0.3.153",
67
- "@micromag/intl": "^0.3.153",
68
- "@micromag/screens": "^0.3.155",
62
+ "@micromag/core": "^0.3.156",
63
+ "@micromag/element-scroll": "^0.3.156",
64
+ "@micromag/element-share-options": "^0.3.156",
65
+ "@micromag/elements": "^0.3.156",
66
+ "@micromag/fields": "^0.3.156",
67
+ "@micromag/intl": "^0.3.156",
68
+ "@micromag/screens": "^0.3.156",
69
69
  "@react-spring/core": "^9.1.1",
70
70
  "@react-spring/web": "^9.1.1",
71
71
  "@use-gesture/react": "^10.2.4",
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "49b2b619f342ca3c38e22e6784017b91e992664c"
86
+ "gitHead": "026d0eb445367f824d3d07a04a0fa90cc00d49f2"
87
87
  }