@micromag/core 0.2.379 → 0.2.396

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/contexts.js CHANGED
@@ -1157,9 +1157,8 @@ var _excluded$2 = ["default"];
1157
1157
 
1158
1158
  var packagesCache$1 = {};
1159
1159
  var defaultPackagesMap$1 = {
1160
- transloadit: function transloadit() {
1161
- return import('@uppy/transloadit');
1162
- },
1160
+ transloadit: null,
1161
+ // Disabled for compatibility reasons
1163
1162
  tus: function tus() {
1164
1163
  return import('@uppy/tus');
1165
1164
  },
package/es/hooks.js CHANGED
@@ -599,6 +599,16 @@ var preventDefault = function preventDefault(event) {
599
599
  return false;
600
600
  };
601
601
 
602
+ var preventClickDefault = function preventClickDefault(e) {
603
+ if (e.preventDefault) {
604
+ e.preventDefault();
605
+ }
606
+
607
+ if (e.stopPropagation) {
608
+ e.stopPropagation();
609
+ }
610
+ };
611
+
602
612
  var useLongPress = function useLongPress() {
603
613
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
604
614
  _ref$onLongPress = _ref.onLongPress,
@@ -608,7 +618,7 @@ var useLongPress = function useLongPress() {
608
618
  _ref$shouldPreventDef = _ref.shouldPreventDefault,
609
619
  shouldPreventDefault = _ref$shouldPreventDef === void 0 ? true : _ref$shouldPreventDef,
610
620
  _ref$delay = _ref.delay,
611
- delay = _ref$delay === void 0 ? 300 : _ref$delay;
621
+ delay = _ref$delay === void 0 ? 350 : _ref$delay;
612
622
 
613
623
  var _useState = useState(false),
614
624
  _useState2 = _slicedToArray(_useState, 2),
@@ -627,6 +637,9 @@ var useLongPress = function useLongPress() {
627
637
  target.current.addEventListener('touchend', preventDefault, {
628
638
  passive: false
629
639
  });
640
+ target.current.addEventListener('click', preventClickDefault, {
641
+ passive: false
642
+ });
630
643
  }
631
644
 
632
645
  if (onLongPress !== null) {
@@ -645,6 +658,9 @@ var useLongPress = function useLongPress() {
645
658
  } else if (shouldPreventDefault && target.current !== null) {
646
659
  preventDefault(event);
647
660
  target.current.removeEventListener('touchend', preventDefault);
661
+ setTimeout(function () {
662
+ target.current.removeEventListener('click', preventClickDefault);
663
+ }, 10);
648
664
  }
649
665
 
650
666
  if (shouldTriggerClick && !longPressTriggered && onClick !== null) {
@@ -1109,21 +1125,30 @@ var useScreenSizeFromElement = function useScreenSizeFromElement() {
1109
1125
  var fullWidth = width !== null ? width : calculatedWidth;
1110
1126
  var fullHeight = height !== null ? height : calculatedHeight;
1111
1127
  var landscape = fullHeight > 0 && fullWidth > fullHeight;
1112
- var _opts$withoutMaxSize = opts.withoutMaxSize,
1113
- withoutMaxSize = _opts$withoutMaxSize === void 0 ? false : _opts$withoutMaxSize;
1128
+
1129
+ var _ref6 = opts || {},
1130
+ _ref6$withoutMaxSize = _ref6.withoutMaxSize,
1131
+ withoutMaxSize = _ref6$withoutMaxSize === void 0 ? false : _ref6$withoutMaxSize,
1132
+ _ref6$desktopHeightTh = _ref6.desktopHeightThreshold,
1133
+ desktopHeightThreshold = _ref6$desktopHeightTh === void 0 ? 600 : _ref6$desktopHeightTh,
1134
+ _ref6$desktopHeightRa = _ref6.desktopHeightRatio,
1135
+ desktopHeightRatio = _ref6$desktopHeightRa === void 0 ? 3 / 4 : _ref6$desktopHeightRa,
1136
+ _ref6$screenRatio = _ref6.screenRatio,
1137
+ screenRatio = _ref6$screenRatio === void 0 ? 2 / 3 : _ref6$screenRatio;
1138
+
1114
1139
  var landscapeWithMaxSize = landscape && !withoutMaxSize;
1115
1140
  var finalWidth = fullWidth;
1116
1141
  var finalHeight = fullHeight;
1117
1142
  var menuOverScreen = !landscape;
1118
1143
 
1119
1144
  if (landscapeWithMaxSize) {
1120
- if (fullHeight < 600) {
1145
+ if (fullHeight < desktopHeightThreshold) {
1121
1146
  menuOverScreen = true;
1122
1147
  } else {
1123
- finalHeight = Math.round(fullHeight * 3 / 4);
1148
+ finalHeight = Math.round(fullHeight * desktopHeightRatio);
1124
1149
  }
1125
1150
 
1126
- finalWidth = Math.round(finalHeight * 2 / 3);
1151
+ finalWidth = Math.round(finalHeight * screenRatio);
1127
1152
  }
1128
1153
 
1129
1154
  if (finalWidth % 2 === 1) {
package/es/index.js CHANGED
@@ -1119,7 +1119,7 @@ var FieldsManager = /*#__PURE__*/function (_DefinitionsManager) {
1119
1119
  return _super.apply(this, arguments);
1120
1120
  }
1121
1121
 
1122
- return FieldsManager;
1122
+ return _createClass(FieldsManager);
1123
1123
  }(DefinitionsManager);
1124
1124
 
1125
1125
  var _excluded$2 = ["medias"];
package/lib/contexts.js CHANGED
@@ -1191,9 +1191,8 @@ var _excluded$2 = ["default"];
1191
1191
 
1192
1192
  var packagesCache$1 = {};
1193
1193
  var defaultPackagesMap$1 = {
1194
- transloadit: function transloadit() {
1195
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@uppy/transloadit')); });
1196
- },
1194
+ transloadit: null,
1195
+ // Disabled for compatibility reasons
1197
1196
  tus: function tus() {
1198
1197
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@uppy/tus')); });
1199
1198
  },
package/lib/hooks.js CHANGED
@@ -635,6 +635,16 @@ var preventDefault = function preventDefault(event) {
635
635
  return false;
636
636
  };
637
637
 
638
+ var preventClickDefault = function preventClickDefault(e) {
639
+ if (e.preventDefault) {
640
+ e.preventDefault();
641
+ }
642
+
643
+ if (e.stopPropagation) {
644
+ e.stopPropagation();
645
+ }
646
+ };
647
+
638
648
  var useLongPress = function useLongPress() {
639
649
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
640
650
  _ref$onLongPress = _ref.onLongPress,
@@ -644,7 +654,7 @@ var useLongPress = function useLongPress() {
644
654
  _ref$shouldPreventDef = _ref.shouldPreventDefault,
645
655
  shouldPreventDefault = _ref$shouldPreventDef === void 0 ? true : _ref$shouldPreventDef,
646
656
  _ref$delay = _ref.delay,
647
- delay = _ref$delay === void 0 ? 300 : _ref$delay;
657
+ delay = _ref$delay === void 0 ? 350 : _ref$delay;
648
658
 
649
659
  var _useState = react.useState(false),
650
660
  _useState2 = _slicedToArray__default["default"](_useState, 2),
@@ -663,6 +673,9 @@ var useLongPress = function useLongPress() {
663
673
  target.current.addEventListener('touchend', preventDefault, {
664
674
  passive: false
665
675
  });
676
+ target.current.addEventListener('click', preventClickDefault, {
677
+ passive: false
678
+ });
666
679
  }
667
680
 
668
681
  if (onLongPress !== null) {
@@ -681,6 +694,9 @@ var useLongPress = function useLongPress() {
681
694
  } else if (shouldPreventDefault && target.current !== null) {
682
695
  preventDefault(event);
683
696
  target.current.removeEventListener('touchend', preventDefault);
697
+ setTimeout(function () {
698
+ target.current.removeEventListener('click', preventClickDefault);
699
+ }, 10);
684
700
  }
685
701
 
686
702
  if (shouldTriggerClick && !longPressTriggered && onClick !== null) {
@@ -1145,21 +1161,30 @@ var useScreenSizeFromElement = function useScreenSizeFromElement() {
1145
1161
  var fullWidth = width !== null ? width : calculatedWidth;
1146
1162
  var fullHeight = height !== null ? height : calculatedHeight;
1147
1163
  var landscape = fullHeight > 0 && fullWidth > fullHeight;
1148
- var _opts$withoutMaxSize = opts.withoutMaxSize,
1149
- withoutMaxSize = _opts$withoutMaxSize === void 0 ? false : _opts$withoutMaxSize;
1164
+
1165
+ var _ref6 = opts || {},
1166
+ _ref6$withoutMaxSize = _ref6.withoutMaxSize,
1167
+ withoutMaxSize = _ref6$withoutMaxSize === void 0 ? false : _ref6$withoutMaxSize,
1168
+ _ref6$desktopHeightTh = _ref6.desktopHeightThreshold,
1169
+ desktopHeightThreshold = _ref6$desktopHeightTh === void 0 ? 600 : _ref6$desktopHeightTh,
1170
+ _ref6$desktopHeightRa = _ref6.desktopHeightRatio,
1171
+ desktopHeightRatio = _ref6$desktopHeightRa === void 0 ? 3 / 4 : _ref6$desktopHeightRa,
1172
+ _ref6$screenRatio = _ref6.screenRatio,
1173
+ screenRatio = _ref6$screenRatio === void 0 ? 2 / 3 : _ref6$screenRatio;
1174
+
1150
1175
  var landscapeWithMaxSize = landscape && !withoutMaxSize;
1151
1176
  var finalWidth = fullWidth;
1152
1177
  var finalHeight = fullHeight;
1153
1178
  var menuOverScreen = !landscape;
1154
1179
 
1155
1180
  if (landscapeWithMaxSize) {
1156
- if (fullHeight < 600) {
1181
+ if (fullHeight < desktopHeightThreshold) {
1157
1182
  menuOverScreen = true;
1158
1183
  } else {
1159
- finalHeight = Math.round(fullHeight * 3 / 4);
1184
+ finalHeight = Math.round(fullHeight * desktopHeightRatio);
1160
1185
  }
1161
1186
 
1162
- finalWidth = Math.round(finalHeight * 2 / 3);
1187
+ finalWidth = Math.round(finalHeight * screenRatio);
1163
1188
  }
1164
1189
 
1165
1190
  if (finalWidth % 2 === 1) {
package/lib/index.js CHANGED
@@ -1145,7 +1145,7 @@ var FieldsManager = /*#__PURE__*/function (_DefinitionsManager) {
1145
1145
  return _super.apply(this, arguments);
1146
1146
  }
1147
1147
 
1148
- return FieldsManager;
1148
+ return _createClass__default["default"](FieldsManager);
1149
1149
  }(DefinitionsManager);
1150
1150
 
1151
1151
  var _excluded$2 = ["medias"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.2.379",
3
+ "version": "0.2.396",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -86,18 +86,17 @@
86
86
  "@fortawesome/react-fontawesome": "^0.1.13",
87
87
  "@react-spring/core": "^9.1.1",
88
88
  "@react-spring/web": "^9.1.1",
89
- "@uppy/core": "^2.1.2",
90
- "@uppy/dashboard": "^2.1.1",
91
- "@uppy/dropbox": "^2.0.4",
92
- "@uppy/facebook": "^2.0.4",
93
- "@uppy/google-drive": "^2.0.4",
94
- "@uppy/instagram": "^2.0.4",
95
- "@uppy/locales": "^2.0.3",
96
- "@uppy/react": "^2.1.1",
97
- "@uppy/transloadit": "^2.0.4",
98
- "@uppy/tus": "^2.1.1",
99
- "@uppy/webcam": "^2.0.4",
100
- "@uppy/xhr-upload": "^2.0.5",
89
+ "@uppy/core": "^2.1.4",
90
+ "@uppy/dashboard": "^2.1.3",
91
+ "@uppy/dropbox": "^2.0.5",
92
+ "@uppy/facebook": "^2.0.5",
93
+ "@uppy/google-drive": "^2.0.5",
94
+ "@uppy/instagram": "^2.0.5",
95
+ "@uppy/locales": "^2.0.5",
96
+ "@uppy/react": "^2.1.2",
97
+ "@uppy/tus": "^2.2.0",
98
+ "@uppy/webcam": "^2.0.5",
99
+ "@uppy/xhr-upload": "^2.0.7",
101
100
  "bootstrap": "^4.5.3",
102
101
  "change-case": "^4.1.2",
103
102
  "classnames": "^2.2.6",
@@ -125,5 +124,5 @@
125
124
  "publishConfig": {
126
125
  "access": "public"
127
126
  },
128
- "gitHead": "b3261cde1fac196f335a2f2b3091494919dd62b2"
127
+ "gitHead": "480deb93475c6eefcd4c5997b4ce7c9f32e6ff7d"
129
128
  }