@micromag/viewer 0.3.813 → 0.3.814

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.
Files changed (2) hide show
  1. package/es/index.js +8 -3
  2. package/package.json +10 -10
package/es/index.js CHANGED
@@ -1727,7 +1727,8 @@ var ViewerMenu = function ViewerMenu(_ref) {
1727
1727
  my = _ref9$movement[1],
1728
1728
  _ref9$velocity = _slicedToArray(_ref9.velocity, 2),
1729
1729
  vy = _ref9$velocity[1];
1730
- var progress = Math.max(0, my) / (window.innerHeight * 0.8);
1730
+ var windowHeight = typeof window !== 'undefined' ? window.innerHeight : 0;
1731
+ var progress = windowHeight > 0 ? Math.max(0, my) / (windowHeight * 0.8) : 0;
1731
1732
  var reachedThreshold = (vy > 0.3 || Math.abs(progress) > 0.3) && dy !== -1;
1732
1733
  if (!active) {
1733
1734
  if (reachedThreshold) onOpenMenu();
@@ -1743,7 +1744,8 @@ var ViewerMenu = function ViewerMenu(_ref) {
1743
1744
  my = _ref0$movement[1],
1744
1745
  _ref0$velocity = _slicedToArray(_ref0.velocity, 2),
1745
1746
  vy = _ref0$velocity[1];
1746
- var progress = Math.max(0, my) / (window.innerHeight * 0.8);
1747
+ var windowHeight = typeof window !== 'undefined' ? window.innerHeight : 0;
1748
+ var progress = windowHeight > 0 ? Math.max(0, my) / (windowHeight * 0.8) : 0;
1747
1749
  var reachedThreshold = (vy > 0.3 || Math.abs(progress) > 0.3) && dy !== -1;
1748
1750
  if (!active) {
1749
1751
  if (reachedThreshold) onCloseMenu();
@@ -2779,6 +2781,7 @@ var propTypes$2 = {
2779
2781
  beforeScreensMenuButton: PropTypes.node,
2780
2782
  backToFirstScreenTimeout: PropTypes.number,
2781
2783
  closeable: PropTypes.bool,
2784
+ readyWithoutSize: PropTypes.bool,
2782
2785
  withMetadata: PropTypes.bool,
2783
2786
  withMicromagBranding: PropTypes.bool,
2784
2787
  withoutGestures: PropTypes.bool,
@@ -2842,6 +2845,7 @@ var defaultProps$2 = {
2842
2845
  backToFirstScreenTimeout: null,
2843
2846
  menuDotsButtons: null,
2844
2847
  closeable: false,
2848
+ readyWithoutSize: false,
2845
2849
  withMetadata: false,
2846
2850
  withMicromagBranding: false,
2847
2851
  withNeighborScreens: false,
@@ -2900,6 +2904,7 @@ var Viewer = function Viewer(_ref) {
2900
2904
  backToFirstScreenTimeout = _ref.backToFirstScreenTimeout,
2901
2905
  menuDotsButtons = _ref.menuDotsButtons,
2902
2906
  closeable = _ref.closeable,
2907
+ readyWithoutSize = _ref.readyWithoutSize,
2903
2908
  withMetadata = _ref.withMetadata,
2904
2909
  withMicromagBranding = _ref.withMicromagBranding,
2905
2910
  withoutGestures = _ref.withoutGestures,
@@ -3053,7 +3058,7 @@ var Viewer = function Viewer(_ref) {
3053
3058
  var screenContainerWidth = screenScale !== null ? screenWidth * screenScale : screenWidth;
3054
3059
  var screenContainerHeight = screenScale !== null ? screenHeight * screenScale : screenHeight;
3055
3060
  var hasSize = screenWidth > 0 && screenHeight > 0;
3056
- var ready = hasSize;
3061
+ var ready = hasSize || readyWithoutSize;
3057
3062
  var trackingEnabled = isView;
3058
3063
  useEffect(function () {
3059
3064
  if (trackingEnabled && currentScreen !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/viewer",
3
- "version": "0.3.813",
3
+ "version": "0.3.814",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -64,14 +64,14 @@
64
64
  "dependencies": {
65
65
  "@babel/runtime": "^7.13.10",
66
66
  "@folklore/routes": "^0.2.36",
67
- "@micromag/core": "^0.3.813",
68
- "@micromag/element-badge": "^0.3.813",
69
- "@micromag/element-scroll": "^0.3.813",
70
- "@micromag/element-share-options": "^0.3.813",
71
- "@micromag/element-webview": "^0.3.813",
72
- "@micromag/elements": "^0.3.813",
73
- "@micromag/intl": "^0.3.813",
74
- "@micromag/screens": "^0.3.813",
67
+ "@micromag/core": "^0.3.814",
68
+ "@micromag/element-badge": "^0.3.814",
69
+ "@micromag/element-scroll": "^0.3.814",
70
+ "@micromag/element-share-options": "^0.3.814",
71
+ "@micromag/element-webview": "^0.3.814",
72
+ "@micromag/elements": "^0.3.814",
73
+ "@micromag/intl": "^0.3.814",
74
+ "@micromag/screens": "^0.3.814",
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": "24f52ddea5f0ee918f594af86c3c8fd2e1b6f289"
94
+ "gitHead": "96d19c8ede8dc2e8c051ba118975258e061a8da2"
95
95
  }