@micromag/viewer 0.3.779 → 0.3.781
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 +18 -13
- package/package.json +10 -10
package/es/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import { Helmet } from 'react-helmet';
|
|
|
19
19
|
import { useIntl, FormattedMessage } from 'react-intl';
|
|
20
20
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
21
21
|
import { Label, CloseIcon, ScreenPreview, Screen, ArrowIcon, Button as Button$1, PlayIcon, Spinner, UnmuteIcon, MuteIcon, PauseIcon, Meta, FontFaces } from '@micromag/core/components';
|
|
22
|
-
import { useIsVisible, useDimensionObserver, useTrackEvent, useDragProgress, useMediaProgress, useMediaCurrentTime, useMediaDuration, useMediaReady, useMediaState, useParsedStory, useLoadedFonts, useTrackScreenView, useScreenSizeFromElement, useFullscreen } from '@micromag/core/hooks';
|
|
22
|
+
import { useIsVisible, useDimensionObserver, useTrackEvent, useDragProgress, useMediaProgress, useMediaCurrentTime, useMediaDuration, useMediaReady, useMediaState, useParsedStory, useLoadedFonts, useTrackScreenView, useScreenSizeFromElement, useFullscreen, useActivityDetector } from '@micromag/core/hooks';
|
|
23
23
|
import { getStyleFromColor, easings, getStyleFromText, getColorAsString, getDeviceScreens } from '@micromag/core/utils';
|
|
24
24
|
import { ShareIncentive } from '@micromag/elements/all';
|
|
25
25
|
import FocusLock from 'react-focus-lock';
|
|
@@ -3004,7 +3004,9 @@ var Viewer = function Viewer(_ref) {
|
|
|
3004
3004
|
_usePlaybackContext$m = _usePlaybackContext.media,
|
|
3005
3005
|
playbackMedia = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m,
|
|
3006
3006
|
_usePlaybackContext$c3 = _usePlaybackContext.completed,
|
|
3007
|
-
mediaCompleted = _usePlaybackContext$c3 === void 0 ? false : _usePlaybackContext$c3
|
|
3007
|
+
mediaCompleted = _usePlaybackContext$c3 === void 0 ? false : _usePlaybackContext$c3,
|
|
3008
|
+
_usePlaybackContext$i = _usePlaybackContext.isBackground,
|
|
3009
|
+
isBackgroundVideo = _usePlaybackContext$i === void 0 ? false : _usePlaybackContext$i;
|
|
3008
3010
|
var playbackHelpVisible = useMemo(function () {
|
|
3009
3011
|
return playbackControls && playbackControlsVisible;
|
|
3010
3012
|
}, [playbackControls, playbackControlsVisible]);
|
|
@@ -3261,13 +3263,6 @@ var Viewer = function Viewer(_ref) {
|
|
|
3261
3263
|
}, [onTransitionStart, onTransitionComplete]);
|
|
3262
3264
|
var menuVisible = screensCount === 0 || currentScreenInteractionEnabled;
|
|
3263
3265
|
var navigationDisabled = currentScreenInteractionEnabled === false;
|
|
3264
|
-
|
|
3265
|
-
// console.log(
|
|
3266
|
-
// 'currentScreenInteractionEnabled',
|
|
3267
|
-
// currentScreenInteractionEnabled,
|
|
3268
|
-
// withoutGestures,
|
|
3269
|
-
// );
|
|
3270
|
-
|
|
3271
3266
|
var _useDragProgress = useDragProgress({
|
|
3272
3267
|
progress: screenIndex,
|
|
3273
3268
|
disabled: !isView || withoutTransitions,
|
|
@@ -3474,10 +3469,17 @@ var Viewer = function Viewer(_ref) {
|
|
|
3474
3469
|
bottomHeight = playbackControlsContainerHeight / screenScale;
|
|
3475
3470
|
}
|
|
3476
3471
|
var NavigationHint = withNavigationHint === 'hand' ? HandTap : ArrowHint;
|
|
3472
|
+
var _useActivityDetector = useActivityDetector({
|
|
3473
|
+
element: containerRef.current,
|
|
3474
|
+
disabled: !isView,
|
|
3475
|
+
timeout: 2000
|
|
3476
|
+
}),
|
|
3477
|
+
activityDetected = _useActivityDetector.detected;
|
|
3477
3478
|
useEffect(function () {
|
|
3478
3479
|
var timeout = null;
|
|
3479
|
-
|
|
3480
|
-
|
|
3480
|
+
// const looping = playbackMedia !== null ? playbackMedia.loop || false : false;
|
|
3481
|
+
var hasMediaCompleted = playbackMedia !== null && !isBackgroundVideo ? mediaCompleted : true;
|
|
3482
|
+
if (backToFirstScreenTimeout !== null && isView && screensCount > 1 && screenIndex !== 0 && hasMediaCompleted && !isDragging && !activityDetected) {
|
|
3481
3483
|
timeout = setTimeout(function () {
|
|
3482
3484
|
changeIndex(0);
|
|
3483
3485
|
}, backToFirstScreenTimeout);
|
|
@@ -3487,8 +3489,11 @@ var Viewer = function Viewer(_ref) {
|
|
|
3487
3489
|
clearTimeout(timeout);
|
|
3488
3490
|
}
|
|
3489
3491
|
};
|
|
3490
|
-
}, [backToFirstScreenTimeout, isView, screenIndex, screensCount, changeIndex, playbackMedia, mediaCompleted, isDragging]);
|
|
3491
|
-
|
|
3492
|
+
}, [backToFirstScreenTimeout, isView, screenIndex, screensCount, changeIndex, playbackMedia, mediaCompleted, isDragging, activityDetected, isBackgroundVideo]);
|
|
3493
|
+
|
|
3494
|
+
// console.log('mediaCompleted', mediaCompleted, playbackMedia);
|
|
3495
|
+
// console.log('activityDetected', activityDetected);
|
|
3496
|
+
|
|
3492
3497
|
return /*#__PURE__*/React.createElement(StoryProvider, {
|
|
3493
3498
|
story: parsedStory
|
|
3494
3499
|
}, /*#__PURE__*/React.createElement(ScreenSizeProvider, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/viewer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.781",
|
|
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.
|
|
68
|
-
"@micromag/element-badge": "^0.3.
|
|
69
|
-
"@micromag/element-scroll": "^0.3.
|
|
70
|
-
"@micromag/element-share-options": "^0.3.
|
|
71
|
-
"@micromag/element-webview": "^0.3.
|
|
72
|
-
"@micromag/elements": "^0.3.
|
|
73
|
-
"@micromag/intl": "^0.3.
|
|
74
|
-
"@micromag/screens": "^0.3.
|
|
67
|
+
"@micromag/core": "^0.3.781",
|
|
68
|
+
"@micromag/element-badge": "^0.3.781",
|
|
69
|
+
"@micromag/element-scroll": "^0.3.781",
|
|
70
|
+
"@micromag/element-share-options": "^0.3.781",
|
|
71
|
+
"@micromag/element-webview": "^0.3.781",
|
|
72
|
+
"@micromag/elements": "^0.3.781",
|
|
73
|
+
"@micromag/intl": "^0.3.781",
|
|
74
|
+
"@micromag/screens": "^0.3.781",
|
|
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": "
|
|
94
|
+
"gitHead": "95e03bd48803c170ef4efbc5bd204a0c83563c11"
|
|
95
95
|
}
|