@micromag/viewer 0.3.149 → 0.3.153
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/assets/css/styles.css +8 -5
- package/es/index.js +841 -448
- package/lib/index.js +839 -445
- package/package.json +9 -9
package/es/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import React, { useEffect, useState, useCallback, useRef, useMemo } from 'react'
|
|
|
5
5
|
import { Switch, Route, MemoryRouter } from 'react-router';
|
|
6
6
|
import { BrowserRouter } from 'react-router-dom';
|
|
7
7
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
8
|
-
import {
|
|
8
|
+
import { usePlaybackContext, useViewerWebView, useViewerInteraction, VisitorProvider, ScreenSizeProvider, ViewerProvider, useRoutes, useRoutePush, GoogleKeysProvider, GoogleMapsClientProvider, FieldsProvider, ComponentsProvider, SCREENS_NAMESPACE, UserInteractionProvider, PlaybackProvider, TrackingProvider, RoutesProvider } from '@micromag/core/contexts';
|
|
9
9
|
import fieldsManager from '@micromag/fields/manager';
|
|
10
10
|
import { IntlProvider } from '@micromag/intl';
|
|
11
11
|
import { ScreensProvider } from '@micromag/screens';
|
|
@@ -15,29 +15,26 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
15
15
|
import { faArrowLeft } from '@fortawesome/free-solid-svg-icons/faArrowLeft';
|
|
16
16
|
import { faArrowRight } from '@fortawesome/free-solid-svg-icons/faArrowRight';
|
|
17
17
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
18
|
+
import { useDrag, useGesture } from '@use-gesture/react';
|
|
18
19
|
import classNames from 'classnames';
|
|
19
20
|
import { Helmet } from 'react-helmet';
|
|
20
21
|
import { useIntl, FormattedMessage } from 'react-intl';
|
|
21
22
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
22
23
|
import { Button, Close, ScreenPreview, Screen, Meta, FontFaces } from '@micromag/core/components';
|
|
23
|
-
import { useDocumentEvent,
|
|
24
|
-
import {
|
|
24
|
+
import { useDocumentEvent, useDimensionObserver, useTrackEvent, useMediaDuration, useMediaCurrentTime, useParsedStory, useLoadedFonts, useTrackScreenView, useScreenSizeFromElement, useFullscreen } from '@micromag/core/hooks';
|
|
25
|
+
import { getStyleFromColor, getStyleFromText, getColorAsString, getDeviceScreens } from '@micromag/core/utils';
|
|
25
26
|
import { useSpring, config } from '@react-spring/core';
|
|
26
27
|
import { animated } from '@react-spring/web';
|
|
27
|
-
import { useDrag } from '@use-gesture/react';
|
|
28
28
|
import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';
|
|
29
29
|
import { faCompress } from '@fortawesome/free-solid-svg-icons/faCompress';
|
|
30
30
|
import { faExpand } from '@fortawesome/free-solid-svg-icons/faExpand';
|
|
31
31
|
import { faShare } from '@fortawesome/free-solid-svg-icons/faShare';
|
|
32
32
|
import Scroll from '@micromag/element-scroll';
|
|
33
33
|
import ShareOptions from '@micromag/element-share-options';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
home: home,
|
|
39
|
-
screen: screen
|
|
40
|
-
};
|
|
34
|
+
import { faPause } from '@fortawesome/free-solid-svg-icons/faPause';
|
|
35
|
+
import { faPlay } from '@fortawesome/free-solid-svg-icons/faPlay';
|
|
36
|
+
import { faVolumeUp } from '@fortawesome/free-solid-svg-icons/faVolumeUp';
|
|
37
|
+
import WebView from '@micromag/element-webview';
|
|
41
38
|
|
|
42
39
|
var routes = PropTypes.shape({
|
|
43
40
|
home: PropTypes.string.isRequired,
|
|
@@ -116,21 +113,16 @@ function useScreenInteraction() {
|
|
|
116
113
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
117
114
|
screens = _ref.screens,
|
|
118
115
|
screenIndex = _ref.screenIndex,
|
|
119
|
-
|
|
120
|
-
_ref$
|
|
121
|
-
isView = _ref$isView === void 0 ? false : _ref$isView,
|
|
116
|
+
_ref$disableCurrentSc = _ref.disableCurrentScreenNavigation,
|
|
117
|
+
disableCurrentScreenNavigation = _ref$disableCurrentSc === void 0 ? false : _ref$disableCurrentSc,
|
|
122
118
|
_ref$clickOnSiblings = _ref.clickOnSiblings,
|
|
123
119
|
clickOnSiblings = _ref$clickOnSiblings === void 0 ? false : _ref$clickOnSiblings,
|
|
124
120
|
_ref$nextScreenWidthP = _ref.nextScreenWidthPercent,
|
|
125
121
|
nextScreenWidthPercent = _ref$nextScreenWidthP === void 0 ? 0.5 : _ref$nextScreenWidthP,
|
|
126
|
-
_ref$
|
|
127
|
-
|
|
128
|
-
_ref$
|
|
129
|
-
|
|
130
|
-
_ref$onEnd = _ref.onEnd,
|
|
131
|
-
onEnd = _ref$onEnd === void 0 ? null : _ref$onEnd,
|
|
132
|
-
_ref$onChangeScreen = _ref.onChangeScreen,
|
|
133
|
-
onChangeScreen = _ref$onChangeScreen === void 0 ? null : _ref$onChangeScreen;
|
|
122
|
+
_ref$onInteract = _ref.onInteract,
|
|
123
|
+
onInteract = _ref$onInteract === void 0 ? null : _ref$onInteract,
|
|
124
|
+
_ref$onNavigate = _ref.onNavigate,
|
|
125
|
+
onNavigate = _ref$onNavigate === void 0 ? null : _ref$onNavigate;
|
|
134
126
|
|
|
135
127
|
var _useState = useState(screens.reduce(function (map, _ref2) {
|
|
136
128
|
var id = _ref2.id;
|
|
@@ -163,74 +155,69 @@ function useScreenInteraction() {
|
|
|
163
155
|
var disableInteraction = useCallback(function () {
|
|
164
156
|
return updateInteraction(false);
|
|
165
157
|
}, [updateInteraction]);
|
|
166
|
-
var
|
|
167
|
-
|
|
168
|
-
|
|
158
|
+
var interact = useCallback(function (_ref5) {
|
|
159
|
+
var event = _ref5.event,
|
|
160
|
+
target = _ref5.target,
|
|
161
|
+
currentTarget = _ref5.currentTarget,
|
|
162
|
+
x = _ref5.x,
|
|
163
|
+
y = _ref5.y,
|
|
164
|
+
index = _ref5.index;
|
|
165
|
+
|
|
166
|
+
if (onInteract !== null) {
|
|
167
|
+
onInteract({
|
|
168
|
+
event: event,
|
|
169
|
+
target: target,
|
|
170
|
+
currentTarget: currentTarget,
|
|
171
|
+
index: index,
|
|
172
|
+
x: x,
|
|
173
|
+
y: y
|
|
174
|
+
});
|
|
169
175
|
}
|
|
170
176
|
|
|
171
177
|
var screensCount = screens.length;
|
|
172
178
|
var tappedCurrent = screenIndex === index;
|
|
173
179
|
|
|
174
|
-
if (
|
|
175
|
-
eventsManager.emit('tap', e, index);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (!isView && tappedCurrent || checkClickable(e.target) || tappedCurrent && !currentScreenInteractionEnabled) {
|
|
180
|
+
if (disableCurrentScreenNavigation && tappedCurrent || checkClickable(target) || tappedCurrent && !currentScreenInteractionEnabled) {
|
|
179
181
|
return;
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
_e$currentTarget$getB2 = _e$currentTarget$getB.left,
|
|
186
|
-
contentX = _e$currentTarget$getB2 === void 0 ? 0 : _e$currentTarget$getB2;
|
|
184
|
+
var _currentTarget$getBou = currentTarget.getBoundingClientRect(),
|
|
185
|
+
left = _currentTarget$getBou.left,
|
|
186
|
+
width = _currentTarget$getBou.width;
|
|
187
187
|
|
|
188
|
-
var
|
|
188
|
+
var relativeX = x - left;
|
|
189
|
+
var direction = relativeX < width * (1 - nextScreenWidthPercent) ? 'previous' : 'next';
|
|
190
|
+
var lastIndex = screensCount - 1;
|
|
191
|
+
var nextIndex = index;
|
|
189
192
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (
|
|
193
|
-
nextIndex =
|
|
194
|
-
|
|
195
|
-
if (eventsManager !== null) {
|
|
196
|
-
eventsManager.emit('tap_previous', nextIndex);
|
|
197
|
-
}
|
|
198
|
-
} else {
|
|
199
|
-
nextIndex = clickOnSiblings ? index : Math.min(screensCount - 1, screenIndex + 1);
|
|
200
|
-
var isLastScreen = screenIndex === screensCount - 1;
|
|
201
|
-
|
|
202
|
-
if (isLastScreen && onEnd !== null) {
|
|
203
|
-
onEnd();
|
|
204
|
-
|
|
205
|
-
if (eventsManager !== null) {
|
|
206
|
-
eventsManager.emit('tap_end');
|
|
207
|
-
}
|
|
208
|
-
} else if (eventsManager) {
|
|
209
|
-
eventsManager.emit('tap_next', nextIndex);
|
|
210
|
-
}
|
|
193
|
+
if (direction === 'previous' && !clickOnSiblings) {
|
|
194
|
+
nextIndex = Math.max(0, screenIndex - 1);
|
|
195
|
+
} else if (direction === 'next' && !clickOnSiblings) {
|
|
196
|
+
nextIndex = Math.min(lastIndex, screenIndex + 1);
|
|
211
197
|
}
|
|
212
198
|
|
|
213
|
-
if (
|
|
214
|
-
|
|
199
|
+
if (onNavigate !== null) {
|
|
200
|
+
onNavigate({
|
|
201
|
+
index: index,
|
|
202
|
+
newIndex: nextIndex,
|
|
203
|
+
direction: direction,
|
|
204
|
+
end: index === nextIndex && nextIndex === lastIndex
|
|
205
|
+
});
|
|
215
206
|
}
|
|
216
|
-
|
|
217
|
-
onChangeScreen(nextIndex);
|
|
218
|
-
}, [screenWidth, screens, screenIndex, eventsManager, onClick, onEnd, onChangeScreen, screenIndex, screensInteractionEnabled, currentScreenInteractionEnabled, nextScreenWidthPercent, isView, clickOnSiblings]);
|
|
207
|
+
}, [screens, screenIndex, screenIndex, screensInteractionEnabled, currentScreenInteractionEnabled, nextScreenWidthPercent, disableCurrentScreenNavigation, clickOnSiblings, onInteract, onNavigate]);
|
|
219
208
|
return {
|
|
220
|
-
|
|
209
|
+
interact: interact,
|
|
221
210
|
currentScreenInteractionEnabled: currentScreenInteractionEnabled,
|
|
222
211
|
enableInteraction: enableInteraction,
|
|
223
212
|
disableInteraction: disableInteraction
|
|
224
213
|
};
|
|
225
214
|
}
|
|
226
215
|
|
|
227
|
-
var styles$
|
|
216
|
+
var styles$b = {"container":"micromag-viewer-menus-menu-dots-container","closeButton":"micromag-viewer-menus-menu-dots-closeButton","menuButton":"micromag-viewer-menus-menu-dots-menuButton","item":"micromag-viewer-menus-menu-dots-item","items":"micromag-viewer-menus-menu-dots-items","menu":"micromag-viewer-menus-menu-dots-menu","menuIcon":"micromag-viewer-menus-menu-dots-menuIcon","vertical":"micromag-viewer-menus-menu-dots-vertical","withShadow":"micromag-viewer-menus-menu-dots-withShadow"};
|
|
228
217
|
|
|
229
|
-
var styles$
|
|
218
|
+
var styles$a = {"container":"micromag-viewer-menus-menu-dot-container","button":"micromag-viewer-menus-menu-dot-button","dot":"micromag-viewer-menus-menu-dot-dot","subDot":"micromag-viewer-menus-menu-dot-subDot","dots":"micromag-viewer-menus-menu-dot-dots","vertical":"micromag-viewer-menus-menu-dot-vertical"};
|
|
230
219
|
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
var propTypes$e = {
|
|
220
|
+
var propTypes$g = {
|
|
234
221
|
current: PropTypes.bool,
|
|
235
222
|
active: PropTypes.bool,
|
|
236
223
|
colors: PropTypes.shape({
|
|
@@ -243,7 +230,7 @@ var propTypes$e = {
|
|
|
243
230
|
onClick: PropTypes.func,
|
|
244
231
|
className: PropTypes.string
|
|
245
232
|
};
|
|
246
|
-
var defaultProps$
|
|
233
|
+
var defaultProps$g = {
|
|
247
234
|
current: false,
|
|
248
235
|
active: false,
|
|
249
236
|
colors: null,
|
|
@@ -306,44 +293,44 @@ var ViewerMenuDot = function ViewerMenuDot(_ref) {
|
|
|
306
293
|
});
|
|
307
294
|
}, [playing, duration, currentTime, setSpringProps]);
|
|
308
295
|
var inner = current && count > 1 ? /*#__PURE__*/React.createElement("span", {
|
|
309
|
-
className: styles$
|
|
296
|
+
className: styles$a.dots
|
|
310
297
|
}, _toConsumableArray(Array(count).keys()).map(function (i) {
|
|
311
298
|
return /*#__PURE__*/React.createElement("span", {
|
|
312
|
-
className: classNames([styles$
|
|
299
|
+
className: classNames([styles$a.dot, styles$a.subDot]),
|
|
313
300
|
style: {
|
|
314
301
|
width: "".concat(parseFloat(1 / count * 100).toFixed(2), "%"),
|
|
315
302
|
backgroundColor: active && i <= subIndex ? primary : secondary
|
|
316
303
|
}
|
|
317
304
|
});
|
|
318
305
|
})) : /*#__PURE__*/React.createElement("span", {
|
|
319
|
-
className: styles$
|
|
306
|
+
className: styles$a.dot,
|
|
320
307
|
style: {
|
|
321
308
|
backgroundColor: active ? primary : secondary
|
|
322
309
|
}
|
|
323
310
|
});
|
|
324
311
|
return /*#__PURE__*/React.createElement("li", {
|
|
325
|
-
className: classNames([styles$
|
|
312
|
+
className: classNames([styles$a.container, (_ref3 = {}, _defineProperty(_ref3, styles$a.active, current), _defineProperty(_ref3, styles$a.vertical, vertical), _defineProperty(_ref3, className, className !== null), _ref3)]),
|
|
326
313
|
"aria-hidden": "true"
|
|
327
314
|
}, /*#__PURE__*/React.createElement("button", {
|
|
328
315
|
type: "button",
|
|
329
|
-
className: styles$
|
|
316
|
+
className: styles$a.button,
|
|
330
317
|
onClick: onClick,
|
|
331
318
|
tabIndex: "-1"
|
|
332
319
|
}, inner));
|
|
333
320
|
};
|
|
334
321
|
|
|
335
|
-
ViewerMenuDot.propTypes = propTypes$
|
|
336
|
-
ViewerMenuDot.defaultProps = defaultProps$
|
|
322
|
+
ViewerMenuDot.propTypes = propTypes$g;
|
|
323
|
+
ViewerMenuDot.defaultProps = defaultProps$g;
|
|
337
324
|
|
|
338
|
-
var styles$
|
|
325
|
+
var styles$9 = {};
|
|
339
326
|
|
|
340
|
-
var propTypes$
|
|
327
|
+
var propTypes$f = {
|
|
341
328
|
size: PropTypes.number,
|
|
342
329
|
spacing: PropTypes.number,
|
|
343
330
|
color: PropTypes.string,
|
|
344
331
|
className: PropTypes.string
|
|
345
332
|
};
|
|
346
|
-
var defaultProps$
|
|
333
|
+
var defaultProps$f = {
|
|
347
334
|
size: 100,
|
|
348
335
|
spacing: 8,
|
|
349
336
|
color: 'white',
|
|
@@ -357,7 +344,7 @@ var MenuIcon = function MenuIcon(_ref) {
|
|
|
357
344
|
className = _ref.className;
|
|
358
345
|
var squareSize = (size - 2 * spacing) / 3;
|
|
359
346
|
return /*#__PURE__*/React.createElement("svg", {
|
|
360
|
-
className: classNames([styles$
|
|
347
|
+
className: classNames([styles$9.container, _defineProperty({}, className, className !== null)]),
|
|
361
348
|
xmlns: "http://www.w3.org/2000/svg",
|
|
362
349
|
viewBox: "0 0 ".concat(size, " ").concat(size),
|
|
363
350
|
"aria-hidden": "true"
|
|
@@ -375,10 +362,10 @@ var MenuIcon = function MenuIcon(_ref) {
|
|
|
375
362
|
}));
|
|
376
363
|
};
|
|
377
364
|
|
|
378
|
-
MenuIcon.propTypes = propTypes$
|
|
379
|
-
MenuIcon.defaultProps = defaultProps$
|
|
365
|
+
MenuIcon.propTypes = propTypes$f;
|
|
366
|
+
MenuIcon.defaultProps = defaultProps$f;
|
|
380
367
|
|
|
381
|
-
var propTypes$
|
|
368
|
+
var propTypes$e = {
|
|
382
369
|
direction: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
383
370
|
withShadow: PropTypes.bool,
|
|
384
371
|
items: PropTypes$1.menuItems,
|
|
@@ -394,7 +381,7 @@ var propTypes$c = {
|
|
|
394
381
|
onClose: PropTypes.func,
|
|
395
382
|
className: PropTypes.string
|
|
396
383
|
};
|
|
397
|
-
var defaultProps$
|
|
384
|
+
var defaultProps$e = {
|
|
398
385
|
direction: 'horizontal',
|
|
399
386
|
withShadow: false,
|
|
400
387
|
items: [],
|
|
@@ -434,7 +421,7 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
434
421
|
return current;
|
|
435
422
|
});
|
|
436
423
|
return /*#__PURE__*/React.createElement("nav", {
|
|
437
|
-
className: classNames([styles$
|
|
424
|
+
className: classNames([styles$b.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$b.vertical, direction === 'vertical'), _defineProperty(_ref4, styles$b.withShadow, withShadow), _ref4)]),
|
|
438
425
|
"aria-label": intl.formatMessage({
|
|
439
426
|
id: "bLYuuN",
|
|
440
427
|
defaultMessage: [{
|
|
@@ -458,7 +445,7 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
458
445
|
total: items.length
|
|
459
446
|
})
|
|
460
447
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
461
|
-
className: styles$
|
|
448
|
+
className: styles$b.items
|
|
462
449
|
}, items.map(function (item, index) {
|
|
463
450
|
var _ref5 = item || {},
|
|
464
451
|
_ref5$current = _ref5.current,
|
|
@@ -485,9 +472,9 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
485
472
|
vertical: direction === 'vertical'
|
|
486
473
|
});
|
|
487
474
|
}), !withoutScreensMenu ? /*#__PURE__*/React.createElement("li", {
|
|
488
|
-
className: styles$
|
|
475
|
+
className: styles$b.menu
|
|
489
476
|
}, /*#__PURE__*/React.createElement(MenuIcon, {
|
|
490
|
-
className: styles$
|
|
477
|
+
className: styles$b.menuIcon,
|
|
491
478
|
color: primary
|
|
492
479
|
}), /*#__PURE__*/React.createElement("button", {
|
|
493
480
|
type: "button",
|
|
@@ -505,16 +492,16 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
505
492
|
"value": "Menu"
|
|
506
493
|
}]
|
|
507
494
|
}),
|
|
508
|
-
className: styles$
|
|
495
|
+
className: styles$b.menuButton,
|
|
509
496
|
onClick: onClickMenu
|
|
510
497
|
})) : null, closeable ? /*#__PURE__*/React.createElement("li", {
|
|
511
|
-
className: styles$
|
|
498
|
+
className: styles$b.closeButton,
|
|
512
499
|
style: {
|
|
513
500
|
color: primary
|
|
514
501
|
}
|
|
515
502
|
}, /*#__PURE__*/React.createElement("button", {
|
|
516
503
|
type: "button",
|
|
517
|
-
className: styles$
|
|
504
|
+
className: styles$b.closeButton,
|
|
518
505
|
onClick: onClose,
|
|
519
506
|
title: intl.formatMessage({
|
|
520
507
|
id: "dj/p/q",
|
|
@@ -535,15 +522,13 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
535
522
|
}))) : null));
|
|
536
523
|
};
|
|
537
524
|
|
|
538
|
-
ViewerMenuDots.propTypes = propTypes$
|
|
539
|
-
ViewerMenuDots.defaultProps = defaultProps$
|
|
525
|
+
ViewerMenuDots.propTypes = propTypes$e;
|
|
526
|
+
ViewerMenuDots.defaultProps = defaultProps$e;
|
|
540
527
|
|
|
541
|
-
var
|
|
542
|
-
|
|
543
|
-
var propTypes$b = {
|
|
528
|
+
var propTypes$d = {
|
|
544
529
|
className: PropTypes.string
|
|
545
530
|
};
|
|
546
|
-
var defaultProps$
|
|
531
|
+
var defaultProps$d = {
|
|
547
532
|
className: null
|
|
548
533
|
};
|
|
549
534
|
|
|
@@ -560,47 +545,12 @@ var StackIcon = function StackIcon(_ref) {
|
|
|
560
545
|
}));
|
|
561
546
|
};
|
|
562
547
|
|
|
563
|
-
StackIcon.propTypes = propTypes$
|
|
564
|
-
StackIcon.defaultProps = defaultProps$
|
|
548
|
+
StackIcon.propTypes = propTypes$d;
|
|
549
|
+
StackIcon.defaultProps = defaultProps$d;
|
|
565
550
|
|
|
566
|
-
var
|
|
567
|
-
className: PropTypes.string
|
|
568
|
-
};
|
|
569
|
-
var defaultProps$a = {
|
|
570
|
-
className: null
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
var LinkIcon = function LinkIcon(_ref) {
|
|
574
|
-
var className = _ref.className;
|
|
575
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
576
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
577
|
-
width: "32",
|
|
578
|
-
height: "32",
|
|
579
|
-
viewBox: "0 0 32 32",
|
|
580
|
-
className: classNames([_defineProperty({}, className, className !== null)])
|
|
581
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
582
|
-
d: "M13.13,17.44a7.18,7.18,0,0,0,10,1.45,6.34,6.34,0,0,0,.78-.68l4.31-4.31A7.18,7.18,0,0,0,18.2,3.65l-.09.09L15.65,6.2",
|
|
583
|
-
fill: "none",
|
|
584
|
-
stroke: "currentColor",
|
|
585
|
-
strokeLinecap: "round",
|
|
586
|
-
strokeLinejoin: "round",
|
|
587
|
-
strokeWidth: "3"
|
|
588
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
589
|
-
d: "M18.87,14.56a7.19,7.19,0,0,0-10-1.45,6.34,6.34,0,0,0-.78.68L3.73,18.1A7.18,7.18,0,1,0,13.8,28.35l.09-.09,2.45-2.46",
|
|
590
|
-
fill: "none",
|
|
591
|
-
stroke: "currentColor",
|
|
592
|
-
strokeLinecap: "round",
|
|
593
|
-
strokeLinejoin: "round",
|
|
594
|
-
strokeWidth: "3"
|
|
595
|
-
}));
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
LinkIcon.propTypes = propTypes$a;
|
|
599
|
-
LinkIcon.defaultProps = defaultProps$a;
|
|
551
|
+
var styles$8 = {"close":"micromag-viewer-partials-share-modal-close","container":"micromag-viewer-partials-share-modal-container","opened":"micromag-viewer-partials-share-modal-opened","modal":"micromag-viewer-partials-share-modal-modal","header":"micromag-viewer-partials-share-modal-header","heading":"micromag-viewer-partials-share-modal-heading","closeIcon":"micromag-viewer-partials-share-modal-closeIcon","shareOptions":"micromag-viewer-partials-share-modal-shareOptions"};
|
|
600
552
|
|
|
601
|
-
var
|
|
602
|
-
|
|
603
|
-
var propTypes$9 = {
|
|
553
|
+
var propTypes$c = {
|
|
604
554
|
url: PropTypes.string,
|
|
605
555
|
title: PropTypes.string,
|
|
606
556
|
opened: PropTypes.bool,
|
|
@@ -608,7 +558,7 @@ var propTypes$9 = {
|
|
|
608
558
|
onShare: PropTypes.func,
|
|
609
559
|
onCancel: PropTypes.func
|
|
610
560
|
};
|
|
611
|
-
var defaultProps$
|
|
561
|
+
var defaultProps$c = {
|
|
612
562
|
url: null,
|
|
613
563
|
title: null,
|
|
614
564
|
opened: false,
|
|
@@ -627,24 +577,6 @@ var ShareModal = function ShareModal(_ref) {
|
|
|
627
577
|
onShare = _ref.onShare,
|
|
628
578
|
onCancel = _ref.onCancel;
|
|
629
579
|
var modalRef = useRef();
|
|
630
|
-
|
|
631
|
-
var _useState = useState(false),
|
|
632
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
633
|
-
linkCopied = _useState2[0],
|
|
634
|
-
setLinkCopied = _useState2[1];
|
|
635
|
-
|
|
636
|
-
var onClickCopy = useCallback(function () {
|
|
637
|
-
copyToClipboard(url).then(function () {
|
|
638
|
-
setLinkCopied(true);
|
|
639
|
-
setTimeout(function () {
|
|
640
|
-
setLinkCopied(false);
|
|
641
|
-
}, 2000);
|
|
642
|
-
});
|
|
643
|
-
}, [setLinkCopied]);
|
|
644
|
-
var onClickLinkInput = useCallback(function (e) {
|
|
645
|
-
var target = e.target;
|
|
646
|
-
target.setSelectionRange(0, target.value.length);
|
|
647
|
-
}, []);
|
|
648
580
|
var onDocumentClick = useCallback(function (e) {
|
|
649
581
|
var _ref2 = e || {},
|
|
650
582
|
target = _ref2.target;
|
|
@@ -657,15 +589,15 @@ var ShareModal = function ShareModal(_ref) {
|
|
|
657
589
|
}, [opened, onCancel]);
|
|
658
590
|
useDocumentEvent('click', onDocumentClick, opened);
|
|
659
591
|
return /*#__PURE__*/React.createElement("div", {
|
|
660
|
-
className: classNames([styles$
|
|
592
|
+
className: classNames([styles$8.container, (_ref3 = {}, _defineProperty(_ref3, className, className), _defineProperty(_ref3, styles$8.opened, opened), _ref3)]),
|
|
661
593
|
"aria-hidden": opened ? null : '-1'
|
|
662
594
|
}, /*#__PURE__*/React.createElement("div", {
|
|
663
|
-
className: styles$
|
|
595
|
+
className: styles$8.modal,
|
|
664
596
|
ref: modalRef
|
|
665
597
|
}, /*#__PURE__*/React.createElement("div", {
|
|
666
|
-
className: styles$
|
|
598
|
+
className: styles$8.header
|
|
667
599
|
}, /*#__PURE__*/React.createElement("h2", {
|
|
668
|
-
className: styles$
|
|
600
|
+
className: styles$8.heading
|
|
669
601
|
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
670
602
|
id: "oL4ueH",
|
|
671
603
|
defaultMessage: [{
|
|
@@ -673,54 +605,30 @@ var ShareModal = function ShareModal(_ref) {
|
|
|
673
605
|
"value": "Share"
|
|
674
606
|
}]
|
|
675
607
|
})), /*#__PURE__*/React.createElement(Button, {
|
|
676
|
-
className: styles$
|
|
608
|
+
className: styles$8.close,
|
|
677
609
|
onClick: onCancel,
|
|
678
610
|
focusable: opened
|
|
679
611
|
}, /*#__PURE__*/React.createElement(Close, {
|
|
680
|
-
className: styles$
|
|
612
|
+
className: styles$8.closeIcon,
|
|
681
613
|
border: "none"
|
|
682
614
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
683
|
-
className: styles$
|
|
615
|
+
className: styles$8.content
|
|
684
616
|
}, /*#__PURE__*/React.createElement(ShareOptions, {
|
|
685
|
-
className: styles$
|
|
617
|
+
className: styles$8.shareOptions,
|
|
686
618
|
title: title,
|
|
687
619
|
url: url,
|
|
688
620
|
focusable: opened,
|
|
689
621
|
onShare: onShare,
|
|
690
622
|
onClose: onCancel
|
|
691
|
-
})
|
|
692
|
-
className: styles$3.otherOptions
|
|
693
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
694
|
-
className: classNames([styles$3.copyLink, _defineProperty({}, styles$3.isLinkCopied, linkCopied)])
|
|
695
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
696
|
-
className: styles$3.screenUrlInput,
|
|
697
|
-
type: "text",
|
|
698
|
-
value: url,
|
|
699
|
-
onClick: onClickLinkInput,
|
|
700
|
-
readOnly: true
|
|
701
|
-
}), /*#__PURE__*/React.createElement(Button, {
|
|
702
|
-
className: styles$3.copyUrlButton,
|
|
703
|
-
onClick: onClickCopy,
|
|
704
|
-
focusable: opened
|
|
705
|
-
}, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
706
|
-
className: styles$3.linkIcon
|
|
707
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
708
|
-
className: styles$3.successfulCopyMessage
|
|
709
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
710
|
-
id: "XRmkEh",
|
|
711
|
-
defaultMessage: [{
|
|
712
|
-
"type": 0,
|
|
713
|
-
"value": "Link copied to clipboard!"
|
|
714
|
-
}]
|
|
715
|
-
})))))));
|
|
623
|
+
}))));
|
|
716
624
|
};
|
|
717
625
|
|
|
718
|
-
ShareModal.propTypes = propTypes$
|
|
719
|
-
ShareModal.defaultProps = defaultProps$
|
|
626
|
+
ShareModal.propTypes = propTypes$c;
|
|
627
|
+
ShareModal.defaultProps = defaultProps$c;
|
|
720
628
|
|
|
721
|
-
var styles$
|
|
629
|
+
var styles$7 = {"container":"micromag-viewer-partials-share-button-container"};
|
|
722
630
|
|
|
723
|
-
var propTypes$
|
|
631
|
+
var propTypes$b = {
|
|
724
632
|
title: PropTypes.string,
|
|
725
633
|
url: PropTypes.string,
|
|
726
634
|
className: PropTypes.string,
|
|
@@ -729,7 +637,7 @@ var propTypes$8 = {
|
|
|
729
637
|
children: PropTypes.node,
|
|
730
638
|
focusable: PropTypes.bool
|
|
731
639
|
};
|
|
732
|
-
var defaultProps$
|
|
640
|
+
var defaultProps$b = {
|
|
733
641
|
title: null,
|
|
734
642
|
url: null,
|
|
735
643
|
className: null,
|
|
@@ -758,7 +666,7 @@ var ShareButton = function ShareButton(_ref) {
|
|
|
758
666
|
setStoryShareModalOpened(function (opened) {
|
|
759
667
|
return !opened;
|
|
760
668
|
});
|
|
761
|
-
}, [setStoryShareModalOpened]);
|
|
669
|
+
}, [setStoryShareModalOpened, storyShareModalOpened]);
|
|
762
670
|
var onStoryShared = useCallback(function (type) {
|
|
763
671
|
setStoryShareModalOpened(false);
|
|
764
672
|
|
|
@@ -770,7 +678,7 @@ var ShareButton = function ShareButton(_ref) {
|
|
|
770
678
|
setStoryShareModalOpened(false);
|
|
771
679
|
}, [setStoryShareModalOpened]);
|
|
772
680
|
return /*#__PURE__*/React.createElement("div", {
|
|
773
|
-
className: classNames([styles$
|
|
681
|
+
className: classNames([styles$7.container, _defineProperty({}, className, className !== null)])
|
|
774
682
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
775
683
|
className: classNames([_defineProperty({}, buttonClassName, buttonClassName !== null)]),
|
|
776
684
|
onClick: onShareIconClick,
|
|
@@ -790,7 +698,7 @@ var ShareButton = function ShareButton(_ref) {
|
|
|
790
698
|
}),
|
|
791
699
|
focusable: focusable
|
|
792
700
|
}, children), /*#__PURE__*/React.createElement(ShareModal, {
|
|
793
|
-
className: styles$
|
|
701
|
+
className: styles$7.shareModal,
|
|
794
702
|
opened: storyShareModalOpened,
|
|
795
703
|
title: title,
|
|
796
704
|
url: url,
|
|
@@ -799,10 +707,12 @@ var ShareButton = function ShareButton(_ref) {
|
|
|
799
707
|
}));
|
|
800
708
|
};
|
|
801
709
|
|
|
802
|
-
ShareButton.propTypes = propTypes$
|
|
803
|
-
ShareButton.defaultProps = defaultProps$
|
|
710
|
+
ShareButton.propTypes = propTypes$b;
|
|
711
|
+
ShareButton.defaultProps = defaultProps$b;
|
|
804
712
|
|
|
805
|
-
var
|
|
713
|
+
var styles$6 = {"container":"micromag-viewer-menus-menu-preview-container","screenButton":"micromag-viewer-menus-menu-preview-screenButton","activeScreenBorder":"micromag-viewer-menus-menu-preview-activeScreenBorder","scroll":"micromag-viewer-menus-menu-preview-scroll","header":"micromag-viewer-menus-menu-preview-header","button":"micromag-viewer-menus-menu-preview-button","shareButton":"micromag-viewer-menus-menu-preview-shareButton","disabled":"micromag-viewer-menus-menu-preview-disabled","icon":"micromag-viewer-menus-menu-preview-icon","buttons":"micromag-viewer-menus-menu-preview-buttons","organisation":"micromag-viewer-menus-menu-preview-organisation","title":"micromag-viewer-menus-menu-preview-title","content":"micromag-viewer-menus-menu-preview-content","nav":"micromag-viewer-menus-menu-preview-nav","item":"micromag-viewer-menus-menu-preview-item","items":"micromag-viewer-menus-menu-preview-items","active":"micromag-viewer-menus-menu-preview-active","itemContent":"micromag-viewer-menus-menu-preview-itemContent","screenContainer":"micromag-viewer-menus-menu-preview-screenContainer","subScreenBadge":"micromag-viewer-menus-menu-preview-subScreenBadge","subScreenCount":"micromag-viewer-menus-menu-preview-subScreenCount","subScreenIcon":"micromag-viewer-menus-menu-preview-subScreenIcon","screenContent":"micromag-viewer-menus-menu-preview-screenContent"};
|
|
714
|
+
|
|
715
|
+
var propTypes$a = {
|
|
806
716
|
viewerTheme: PropTypes$1.viewerTheme,
|
|
807
717
|
screenSize: PropTypes$1.screenSize,
|
|
808
718
|
menuWidth: PropTypes.number,
|
|
@@ -820,7 +730,7 @@ var propTypes$7 = {
|
|
|
820
730
|
fullscreenEnabled: PropTypes.bool,
|
|
821
731
|
className: PropTypes.string
|
|
822
732
|
};
|
|
823
|
-
var defaultProps$
|
|
733
|
+
var defaultProps$a = {
|
|
824
734
|
viewerTheme: null,
|
|
825
735
|
screenSize: null,
|
|
826
736
|
menuWidth: null,
|
|
@@ -861,61 +771,55 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
861
771
|
screenWidth = _ref2.width,
|
|
862
772
|
screenHeight = _ref2.height;
|
|
863
773
|
|
|
864
|
-
var
|
|
865
|
-
firstScreenContainerRef =
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
var _useResizeObserver2 = useResizeObserver(),
|
|
869
|
-
containerRef = _useResizeObserver2.ref,
|
|
870
|
-
containerRect = _useResizeObserver2.entry.contentRect;
|
|
774
|
+
var _useDimensionObserver = useDimensionObserver(),
|
|
775
|
+
firstScreenContainerRef = _useDimensionObserver.ref,
|
|
776
|
+
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
777
|
+
thumbWidth = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
871
778
|
|
|
872
|
-
var
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
var _ref4 = containerRect || {},
|
|
877
|
-
_ref4$width = _ref4.width,
|
|
878
|
-
contentWidth = _ref4$width === void 0 ? 0 : _ref4$width;
|
|
779
|
+
var _useDimensionObserver3 = useDimensionObserver(),
|
|
780
|
+
containerRef = _useDimensionObserver3.ref,
|
|
781
|
+
_useDimensionObserver4 = _useDimensionObserver3.width,
|
|
782
|
+
contentWidth = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
879
783
|
|
|
880
784
|
var thumbsPerLine = Math.max(Math.floor(contentWidth / maxThumbsWidth), 3); // Viewer theme
|
|
881
785
|
|
|
882
|
-
var
|
|
883
|
-
|
|
884
|
-
colors =
|
|
885
|
-
|
|
886
|
-
background =
|
|
887
|
-
|
|
888
|
-
textStyles =
|
|
889
|
-
|
|
890
|
-
brandLogo =
|
|
891
|
-
|
|
892
|
-
var
|
|
893
|
-
|
|
894
|
-
brandTextStyle =
|
|
895
|
-
|
|
896
|
-
var
|
|
897
|
-
|
|
898
|
-
brandPrimaryColor =
|
|
899
|
-
|
|
900
|
-
brandSecondaryColor =
|
|
901
|
-
|
|
902
|
-
var
|
|
903
|
-
|
|
904
|
-
brandBackgroundColor =
|
|
905
|
-
|
|
906
|
-
image =
|
|
907
|
-
|
|
908
|
-
var
|
|
909
|
-
|
|
910
|
-
brandImageUrl =
|
|
786
|
+
var _ref3 = viewerTheme || {},
|
|
787
|
+
_ref3$colors = _ref3.colors,
|
|
788
|
+
colors = _ref3$colors === void 0 ? null : _ref3$colors,
|
|
789
|
+
_ref3$background = _ref3.background,
|
|
790
|
+
background = _ref3$background === void 0 ? null : _ref3$background,
|
|
791
|
+
_ref3$textStyles = _ref3.textStyles,
|
|
792
|
+
textStyles = _ref3$textStyles === void 0 ? null : _ref3$textStyles,
|
|
793
|
+
_ref3$logo = _ref3.logo,
|
|
794
|
+
brandLogo = _ref3$logo === void 0 ? null : _ref3$logo;
|
|
795
|
+
|
|
796
|
+
var _ref4 = textStyles || {},
|
|
797
|
+
_ref4$title = _ref4.title,
|
|
798
|
+
brandTextStyle = _ref4$title === void 0 ? null : _ref4$title;
|
|
799
|
+
|
|
800
|
+
var _ref5 = colors || {},
|
|
801
|
+
_ref5$primary = _ref5.primary,
|
|
802
|
+
brandPrimaryColor = _ref5$primary === void 0 ? null : _ref5$primary,
|
|
803
|
+
_ref5$secondary = _ref5.secondary,
|
|
804
|
+
brandSecondaryColor = _ref5$secondary === void 0 ? null : _ref5$secondary;
|
|
805
|
+
|
|
806
|
+
var _ref6 = background || {},
|
|
807
|
+
_ref6$color = _ref6.color,
|
|
808
|
+
brandBackgroundColor = _ref6$color === void 0 ? null : _ref6$color,
|
|
809
|
+
_ref6$image = _ref6.image,
|
|
810
|
+
image = _ref6$image === void 0 ? null : _ref6$image;
|
|
811
|
+
|
|
812
|
+
var _ref7 = image || {},
|
|
813
|
+
_ref7$url = _ref7.url,
|
|
814
|
+
brandImageUrl = _ref7$url === void 0 ? null : _ref7$url;
|
|
911
815
|
|
|
912
816
|
var borderPrimaryColorStyle = getStyleFromColor(brandPrimaryColor, 'borderColor');
|
|
913
817
|
var colorSecondaryColorStyle = getStyleFromColor(brandSecondaryColor, 'color');
|
|
914
818
|
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor');
|
|
915
819
|
|
|
916
|
-
var
|
|
917
|
-
|
|
918
|
-
brandLogoUrl =
|
|
820
|
+
var _ref8 = brandLogo || {},
|
|
821
|
+
_ref8$url = _ref8.url,
|
|
822
|
+
brandLogoUrl = _ref8$url === void 0 ? null : _ref8$url;
|
|
919
823
|
|
|
920
824
|
var brandImageStyle = brandImageUrl !== null ? {
|
|
921
825
|
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
@@ -927,11 +831,11 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
927
831
|
scrolledBottom = _useState2[0],
|
|
928
832
|
setScrolledBottom = _useState2[1];
|
|
929
833
|
|
|
930
|
-
var dragBind = useDrag(function (
|
|
931
|
-
var
|
|
932
|
-
dy =
|
|
933
|
-
last =
|
|
934
|
-
tap =
|
|
834
|
+
var dragBind = useDrag(function (_ref9) {
|
|
835
|
+
var _ref9$direction = _slicedToArray(_ref9.direction, 2),
|
|
836
|
+
dy = _ref9$direction[1],
|
|
837
|
+
last = _ref9.last,
|
|
838
|
+
tap = _ref9.tap;
|
|
935
839
|
|
|
936
840
|
if (!tap && last && scrolledBottom && dy < 0 && onClose !== null) {
|
|
937
841
|
onClose();
|
|
@@ -952,36 +856,36 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
952
856
|
return !focusable ? items.slice(0, 3) : items;
|
|
953
857
|
}, [items, focusable]);
|
|
954
858
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
955
|
-
className: classNames([styles$
|
|
859
|
+
className: classNames([styles$6.container, _defineProperty({}, className, className !== null)]),
|
|
956
860
|
style: _objectSpread(_objectSpread(_objectSpread({}, backgroundColorStyle), brandImageStyle), {}, {
|
|
957
861
|
width: menuWidth
|
|
958
862
|
}),
|
|
959
863
|
"aria-hidden": focusable ? null : 'true'
|
|
960
864
|
}, dragBind()), /*#__PURE__*/React.createElement("div", {
|
|
961
|
-
className: styles$
|
|
865
|
+
className: styles$6.header
|
|
962
866
|
}, brandLogoUrl !== null ? /*#__PURE__*/React.createElement("div", {
|
|
963
|
-
className: styles$
|
|
867
|
+
className: styles$6.organisation,
|
|
964
868
|
style: {
|
|
965
869
|
backgroundImage: "url(".concat(brandLogoUrl, ")")
|
|
966
870
|
}
|
|
967
871
|
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
968
|
-
className: styles$
|
|
872
|
+
className: styles$6.title,
|
|
969
873
|
style: titleStyle
|
|
970
874
|
}, title), /*#__PURE__*/React.createElement("div", {
|
|
971
|
-
className: styles$
|
|
875
|
+
className: styles$6.buttons,
|
|
972
876
|
style: colorSecondaryColorStyle
|
|
973
877
|
}, /*#__PURE__*/React.createElement(ShareButton, {
|
|
974
|
-
className: styles$
|
|
975
|
-
buttonClassName: styles$
|
|
878
|
+
className: styles$6.shareButton,
|
|
879
|
+
buttonClassName: styles$6.button,
|
|
976
880
|
onShare: onShare,
|
|
977
881
|
url: shareUrl,
|
|
978
882
|
title: title,
|
|
979
883
|
focusable: focusable
|
|
980
884
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
981
|
-
className: styles$
|
|
885
|
+
className: styles$6.icon,
|
|
982
886
|
icon: faShare
|
|
983
887
|
})), fullscreenEnabled ? /*#__PURE__*/React.createElement(Button, {
|
|
984
|
-
className: styles$
|
|
888
|
+
className: styles$6.button,
|
|
985
889
|
onClick: toggleFullscreen,
|
|
986
890
|
title: intl.formatMessage({
|
|
987
891
|
id: "AuxqcG",
|
|
@@ -999,10 +903,10 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
999
903
|
}),
|
|
1000
904
|
focusable: focusable
|
|
1001
905
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1002
|
-
className: styles$
|
|
906
|
+
className: styles$6.icon,
|
|
1003
907
|
icon: fullscreenActive ? faCompress : faExpand
|
|
1004
908
|
})) : null, /*#__PURE__*/React.createElement(Button, {
|
|
1005
|
-
className: styles$
|
|
909
|
+
className: styles$6.button,
|
|
1006
910
|
onClick: onClose,
|
|
1007
911
|
title: intl.formatMessage({
|
|
1008
912
|
id: "dj/p/q",
|
|
@@ -1020,19 +924,19 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
1020
924
|
}),
|
|
1021
925
|
focusable: focusable
|
|
1022
926
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1023
|
-
className: styles$
|
|
927
|
+
className: styles$6.icon,
|
|
1024
928
|
icon: faTimes
|
|
1025
929
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
1026
|
-
className: styles$
|
|
930
|
+
className: styles$6.content,
|
|
1027
931
|
ref: containerRef
|
|
1028
932
|
}, /*#__PURE__*/React.createElement(Scroll, {
|
|
1029
|
-
className: styles$
|
|
933
|
+
className: styles$6.scroll,
|
|
1030
934
|
onScrolledBottom: onScrolledBottom,
|
|
1031
935
|
onScrolledNotBottom: onScrolledNotBottom
|
|
1032
936
|
}, /*#__PURE__*/React.createElement("nav", {
|
|
1033
|
-
className: styles$
|
|
937
|
+
className: styles$6.nav
|
|
1034
938
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
1035
|
-
className: styles$
|
|
939
|
+
className: styles$6.items
|
|
1036
940
|
}, finalItems.map(function (item, index) {
|
|
1037
941
|
var screenId = item.screenId,
|
|
1038
942
|
_item$current = item.current,
|
|
@@ -1059,22 +963,22 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
1059
963
|
}]
|
|
1060
964
|
})) : '');
|
|
1061
965
|
return /*#__PURE__*/React.createElement("li", {
|
|
1062
|
-
className: classNames([styles$
|
|
966
|
+
className: classNames([styles$6.item, _defineProperty({}, styles$6.active, current)]),
|
|
1063
967
|
key: "item-".concat(screenId),
|
|
1064
968
|
style: {
|
|
1065
969
|
width: "".concat(100 / thumbsPerLine, "%")
|
|
1066
970
|
}
|
|
1067
971
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1068
|
-
className: styles$
|
|
972
|
+
className: styles$6.itemContent
|
|
1069
973
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1070
|
-
className: styles$
|
|
974
|
+
className: styles$6.screenContainer,
|
|
1071
975
|
ref: index === 0 ? firstScreenContainerRef : null
|
|
1072
976
|
}, count > 1 ? /*#__PURE__*/React.createElement("div", {
|
|
1073
|
-
className: styles$
|
|
977
|
+
className: styles$6.subScreenBadge
|
|
1074
978
|
}, /*#__PURE__*/React.createElement("span", {
|
|
1075
|
-
className: styles$
|
|
979
|
+
className: styles$6.subScreenCount
|
|
1076
980
|
}, count), /*#__PURE__*/React.createElement(StackIcon, {
|
|
1077
|
-
className: styles$
|
|
981
|
+
className: styles$6.subScreenIcon
|
|
1078
982
|
})) : null, screenWidth > 0 && screenHeight > 0 ? /*#__PURE__*/React.createElement(ScreenPreview, {
|
|
1079
983
|
screenWidth: screenWidth,
|
|
1080
984
|
screenHeight: screenHeight,
|
|
@@ -1084,11 +988,11 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
1084
988
|
active: focusable,
|
|
1085
989
|
withSize: true
|
|
1086
990
|
}) : null, current ? /*#__PURE__*/React.createElement("div", {
|
|
1087
|
-
className: styles$
|
|
991
|
+
className: styles$6.activeScreenBorder,
|
|
1088
992
|
style: borderPrimaryColorStyle
|
|
1089
993
|
}) : null)), /*#__PURE__*/React.createElement("button", {
|
|
1090
994
|
type: "button",
|
|
1091
|
-
className: styles$
|
|
995
|
+
className: styles$6.screenButton,
|
|
1092
996
|
onClick: function onClick() {
|
|
1093
997
|
if (onClickItem !== null) {
|
|
1094
998
|
onClickItem(item);
|
|
@@ -1105,10 +1009,12 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
1105
1009
|
}))))));
|
|
1106
1010
|
};
|
|
1107
1011
|
|
|
1108
|
-
ViewerMenuPreview.propTypes = propTypes$
|
|
1109
|
-
ViewerMenuPreview.defaultProps = defaultProps$
|
|
1012
|
+
ViewerMenuPreview.propTypes = propTypes$a;
|
|
1013
|
+
ViewerMenuPreview.defaultProps = defaultProps$a;
|
|
1110
1014
|
|
|
1111
|
-
var
|
|
1015
|
+
var styles$5 = {"container":"micromag-viewer-container","navButton":"micromag-viewer-navButton","menuPreview":"micromag-viewer-menuPreview","menuPreviewContainer":"micromag-viewer-menuPreviewContainer","screen":"micromag-viewer-screen","screenInner":"micromag-viewer-screenInner","content":"micromag-viewer-content","previous":"micromag-viewer-previous","next":"micromag-viewer-next","menuDotsContainer":"micromag-viewer-menuDotsContainer","menuDots":"micromag-viewer-menuDots","current":"micromag-viewer-current","handTap":"micromag-viewer-handTap","landscape":"micromag-viewer-landscape","visible":"micromag-viewer-visible","withSiblings":"micromag-viewer-withSiblings","playbackControlsContainer":"micromag-viewer-playbackControlsContainer","playbackControls":"micromag-viewer-playbackControls","isCollapsed":"micromag-viewer-isCollapsed","webView":"micromag-viewer-webView","hideMenu":"micromag-viewer-hideMenu","ready":"micromag-viewer-ready","hasInteracted":"micromag-viewer-hasInteracted"};
|
|
1016
|
+
|
|
1017
|
+
var propTypes$9 = {
|
|
1112
1018
|
story: PropTypes$1.story.isRequired,
|
|
1113
1019
|
currentScreenIndex: PropTypes.number,
|
|
1114
1020
|
opened: PropTypes.bool,
|
|
@@ -1134,7 +1040,7 @@ var propTypes$6 = {
|
|
|
1134
1040
|
|
|
1135
1041
|
})
|
|
1136
1042
|
};
|
|
1137
|
-
var defaultProps$
|
|
1043
|
+
var defaultProps$9 = {
|
|
1138
1044
|
currentScreenIndex: 0,
|
|
1139
1045
|
opened: false,
|
|
1140
1046
|
toggleFullscreen: null,
|
|
@@ -1256,29 +1162,26 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1256
1162
|
});
|
|
1257
1163
|
}, [opened]);
|
|
1258
1164
|
|
|
1259
|
-
var
|
|
1260
|
-
menuPreviewContainerRef =
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
var _ref4 = menuPreviewContainerRect || {},
|
|
1264
|
-
_ref4$height = _ref4.height,
|
|
1265
|
-
menuPreviewContainerHeight = _ref4$height === void 0 ? 0 : _ref4$height;
|
|
1165
|
+
var _useDimensionObserver = useDimensionObserver(),
|
|
1166
|
+
menuPreviewContainerRef = _useDimensionObserver.ref,
|
|
1167
|
+
_useDimensionObserver2 = _useDimensionObserver.height,
|
|
1168
|
+
menuPreviewContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
1266
1169
|
|
|
1267
1170
|
var menuPreviewStyle = {
|
|
1268
1171
|
transform: menuY.to(function (y) {
|
|
1269
1172
|
return "translateY(".concat(y * menuPreviewContainerHeight, "px)");
|
|
1270
1173
|
})
|
|
1271
1174
|
};
|
|
1272
|
-
var menuDragBind = useDrag(function (
|
|
1273
|
-
var
|
|
1274
|
-
my =
|
|
1275
|
-
first =
|
|
1276
|
-
last =
|
|
1277
|
-
|
|
1278
|
-
dy =
|
|
1279
|
-
cancel =
|
|
1280
|
-
canceled =
|
|
1281
|
-
tap =
|
|
1175
|
+
var menuDragBind = useDrag(function (_ref4) {
|
|
1176
|
+
var _ref4$movement = _slicedToArray(_ref4.movement, 2),
|
|
1177
|
+
my = _ref4$movement[1],
|
|
1178
|
+
first = _ref4.first,
|
|
1179
|
+
last = _ref4.last,
|
|
1180
|
+
_ref4$direction = _slicedToArray(_ref4.direction, 2),
|
|
1181
|
+
dy = _ref4$direction[1],
|
|
1182
|
+
cancel = _ref4.cancel,
|
|
1183
|
+
canceled = _ref4.canceled,
|
|
1184
|
+
tap = _ref4.tap;
|
|
1282
1185
|
|
|
1283
1186
|
if (canceled || tap) {
|
|
1284
1187
|
return;
|
|
@@ -1329,8 +1232,8 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1329
1232
|
customOnClickItem(item);
|
|
1330
1233
|
}
|
|
1331
1234
|
|
|
1332
|
-
var index = items.findIndex(function (
|
|
1333
|
-
var id =
|
|
1235
|
+
var index = items.findIndex(function (_ref5) {
|
|
1236
|
+
var id = _ref5.id;
|
|
1334
1237
|
return id === screenId;
|
|
1335
1238
|
});
|
|
1336
1239
|
trackScreenEvent('viewer_menu', 'click_screen_change', "Screen ".concat(index + 1));
|
|
@@ -1347,12 +1250,12 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1347
1250
|
return trackScreenEvent('viewer_menu', 'click_share', type);
|
|
1348
1251
|
}, [trackScreenEvent]);
|
|
1349
1252
|
|
|
1350
|
-
var
|
|
1351
|
-
|
|
1352
|
-
menuTheme =
|
|
1253
|
+
var _ref6 = viewerTheme || {},
|
|
1254
|
+
_ref6$menuTheme = _ref6.menuTheme,
|
|
1255
|
+
menuTheme = _ref6$menuTheme === void 0 ? null : _ref6$menuTheme;
|
|
1353
1256
|
|
|
1354
1257
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", Object.assign({
|
|
1355
|
-
className: styles$
|
|
1258
|
+
className: styles$5.menuDotsContainer,
|
|
1356
1259
|
ref: refDots,
|
|
1357
1260
|
style: {
|
|
1358
1261
|
width: menuWidth
|
|
@@ -1367,16 +1270,16 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1367
1270
|
withItemClick: withDotItemClick,
|
|
1368
1271
|
withoutScreensMenu: withoutScreensMenu,
|
|
1369
1272
|
onClose: onClickCloseViewer,
|
|
1370
|
-
className: styles$
|
|
1273
|
+
className: styles$5.menuDots
|
|
1371
1274
|
}))), /*#__PURE__*/React.createElement(animated.div, {
|
|
1372
|
-
className: styles$
|
|
1275
|
+
className: styles$5.menuPreviewContainer,
|
|
1373
1276
|
style: menuPreviewStyle,
|
|
1374
1277
|
ref: menuPreviewContainerRef
|
|
1375
1278
|
}, /*#__PURE__*/React.createElement(ViewerMenuPreview, {
|
|
1376
1279
|
viewerTheme: viewerTheme,
|
|
1377
1280
|
title: title,
|
|
1378
1281
|
shareUrl: shareUrl,
|
|
1379
|
-
className: styles$
|
|
1282
|
+
className: styles$5.menuPreview,
|
|
1380
1283
|
screenSize: screenSize,
|
|
1381
1284
|
menuWidth: menuWidth,
|
|
1382
1285
|
focusable: opened,
|
|
@@ -1390,34 +1293,26 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1390
1293
|
})));
|
|
1391
1294
|
};
|
|
1392
1295
|
|
|
1393
|
-
ViewerMenu.propTypes = propTypes$
|
|
1394
|
-
ViewerMenu.defaultProps = defaultProps$
|
|
1296
|
+
ViewerMenu.propTypes = propTypes$9;
|
|
1297
|
+
ViewerMenu.defaultProps = defaultProps$9;
|
|
1395
1298
|
|
|
1396
|
-
var styles$
|
|
1299
|
+
var styles$4 = {"container":"micromag-viewer-screen-container","current":"micromag-viewer-screen-current"};
|
|
1397
1300
|
|
|
1398
|
-
var propTypes$
|
|
1301
|
+
var propTypes$8 = {
|
|
1399
1302
|
screen: PropTypes$1.screenComponent,
|
|
1400
1303
|
renderContext: PropTypes$1.renderContext,
|
|
1401
1304
|
screenState: PropTypes.string,
|
|
1402
1305
|
current: PropTypes.bool,
|
|
1403
1306
|
active: PropTypes.bool,
|
|
1404
|
-
|
|
1405
|
-
onNext: PropTypes.func,
|
|
1406
|
-
enableInteraction: PropTypes.func,
|
|
1407
|
-
disableInteraction: PropTypes.func,
|
|
1408
|
-
getMediaRef: PropTypes.func
|
|
1307
|
+
mediaRef: PropTypes.func
|
|
1409
1308
|
};
|
|
1410
|
-
var defaultProps$
|
|
1309
|
+
var defaultProps$8 = {
|
|
1411
1310
|
screen: null,
|
|
1412
1311
|
renderContext: null,
|
|
1413
1312
|
screenState: null,
|
|
1414
1313
|
current: false,
|
|
1415
1314
|
active: true,
|
|
1416
|
-
|
|
1417
|
-
onNext: null,
|
|
1418
|
-
enableInteraction: null,
|
|
1419
|
-
disableInteraction: null,
|
|
1420
|
-
getMediaRef: null
|
|
1315
|
+
mediaRef: null
|
|
1421
1316
|
};
|
|
1422
1317
|
|
|
1423
1318
|
var ViewerScreen = function ViewerScreen(_ref) {
|
|
@@ -1428,13 +1323,9 @@ var ViewerScreen = function ViewerScreen(_ref) {
|
|
|
1428
1323
|
screenState = _ref.screenState,
|
|
1429
1324
|
active = _ref.active,
|
|
1430
1325
|
current = _ref.current,
|
|
1431
|
-
|
|
1432
|
-
onNext = _ref.onNext,
|
|
1433
|
-
enableInteraction = _ref.enableInteraction,
|
|
1434
|
-
disableInteraction = _ref.disableInteraction,
|
|
1435
|
-
getMediaRef = _ref.getMediaRef;
|
|
1326
|
+
mediaRef = _ref.mediaRef;
|
|
1436
1327
|
return screen !== null ? /*#__PURE__*/React.createElement("div", {
|
|
1437
|
-
className: classNames([styles$
|
|
1328
|
+
className: classNames([styles$4.container, (_ref2 = {}, _defineProperty(_ref2, styles$4.active, active), _defineProperty(_ref2, styles$4.current, current), _ref2)]),
|
|
1438
1329
|
"aria-hidden": current ? null : 'true'
|
|
1439
1330
|
}, /*#__PURE__*/React.createElement(Screen, {
|
|
1440
1331
|
screen: screen,
|
|
@@ -1442,24 +1333,20 @@ var ViewerScreen = function ViewerScreen(_ref) {
|
|
|
1442
1333
|
screenState: screenState,
|
|
1443
1334
|
active: active,
|
|
1444
1335
|
current: current,
|
|
1445
|
-
|
|
1446
|
-
onNext: onNext,
|
|
1447
|
-
enableInteraction: enableInteraction,
|
|
1448
|
-
disableInteraction: disableInteraction,
|
|
1449
|
-
getMediaRef: getMediaRef
|
|
1336
|
+
mediaRef: mediaRef
|
|
1450
1337
|
})) : null;
|
|
1451
1338
|
};
|
|
1452
1339
|
|
|
1453
|
-
ViewerScreen.propTypes = propTypes$
|
|
1454
|
-
ViewerScreen.defaultProps = defaultProps$
|
|
1340
|
+
ViewerScreen.propTypes = propTypes$8;
|
|
1341
|
+
ViewerScreen.defaultProps = defaultProps$8;
|
|
1455
1342
|
|
|
1456
|
-
var styles = {"container":"micromag-viewer-partials-hand-tap-container","circle":"micromag-viewer-partials-hand-tap-circle","pulse":"micromag-viewer-partials-hand-tap-pulse","hand":"micromag-viewer-partials-hand-tap-hand","panY":"micromag-viewer-partials-hand-tap-panY","inner":"micromag-viewer-partials-hand-tap-inner","shadowFade":"micromag-viewer-partials-hand-tap-shadowFade"};
|
|
1343
|
+
var styles$3 = {"container":"micromag-viewer-partials-hand-tap-container","circle":"micromag-viewer-partials-hand-tap-circle","pulse":"micromag-viewer-partials-hand-tap-pulse","hand":"micromag-viewer-partials-hand-tap-hand","panY":"micromag-viewer-partials-hand-tap-panY","inner":"micromag-viewer-partials-hand-tap-inner","shadowFade":"micromag-viewer-partials-hand-tap-shadowFade"};
|
|
1457
1344
|
|
|
1458
|
-
var propTypes$
|
|
1345
|
+
var propTypes$7 = {
|
|
1459
1346
|
color: PropTypes.string,
|
|
1460
1347
|
className: PropTypes.string
|
|
1461
1348
|
};
|
|
1462
|
-
var defaultProps$
|
|
1349
|
+
var defaultProps$7 = {
|
|
1463
1350
|
color: 'currentColor',
|
|
1464
1351
|
className: null
|
|
1465
1352
|
};
|
|
@@ -1479,31 +1366,462 @@ var HandIcon = function HandIcon(_ref) {
|
|
|
1479
1366
|
}));
|
|
1480
1367
|
};
|
|
1481
1368
|
|
|
1482
|
-
HandIcon.propTypes = propTypes$
|
|
1483
|
-
HandIcon.defaultProps = defaultProps$
|
|
1369
|
+
HandIcon.propTypes = propTypes$7;
|
|
1370
|
+
HandIcon.defaultProps = defaultProps$7;
|
|
1484
1371
|
|
|
1485
|
-
var propTypes$
|
|
1372
|
+
var propTypes$6 = {
|
|
1486
1373
|
className: PropTypes.string
|
|
1487
1374
|
};
|
|
1488
|
-
var defaultProps$
|
|
1375
|
+
var defaultProps$6 = {
|
|
1489
1376
|
className: null
|
|
1490
1377
|
};
|
|
1491
1378
|
|
|
1492
1379
|
var HandTap = function HandTap(_ref) {
|
|
1493
1380
|
var className = _ref.className;
|
|
1494
1381
|
return /*#__PURE__*/React.createElement("div", {
|
|
1495
|
-
className: classNames([styles.container, _defineProperty({}, className, className !== null)])
|
|
1382
|
+
className: classNames([styles$3.container, _defineProperty({}, className, className !== null)])
|
|
1496
1383
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1497
|
-
className: styles.inner
|
|
1384
|
+
className: styles$3.inner
|
|
1498
1385
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1499
|
-
className: styles.circle
|
|
1386
|
+
className: styles$3.circle
|
|
1500
1387
|
}), /*#__PURE__*/React.createElement(HandIcon, {
|
|
1501
|
-
className: styles.hand
|
|
1388
|
+
className: styles$3.hand
|
|
1389
|
+
})));
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
HandTap.propTypes = propTypes$6;
|
|
1393
|
+
HandTap.defaultProps = defaultProps$6;
|
|
1394
|
+
|
|
1395
|
+
var styles$2 = {"track":"micromag-viewer-partials-seek-bar-track","progress":"micromag-viewer-partials-seek-bar-progress","inner":"micromag-viewer-partials-seek-bar-inner","progressBar":"micromag-viewer-partials-seek-bar-progressBar","playHead":"micromag-viewer-partials-seek-bar-playHead","withSeekHead":"micromag-viewer-partials-seek-bar-withSeekHead","time":"micromag-viewer-partials-seek-bar-time"};
|
|
1396
|
+
|
|
1397
|
+
var propTypes$5 = {
|
|
1398
|
+
media: PropTypes.node,
|
|
1399
|
+
currentTime: PropTypes.number,
|
|
1400
|
+
duration: PropTypes.number,
|
|
1401
|
+
playing: PropTypes.bool,
|
|
1402
|
+
backgroundColor: PropTypes$1.color,
|
|
1403
|
+
progressColor: PropTypes$1.color,
|
|
1404
|
+
onSeek: PropTypes.func,
|
|
1405
|
+
onSeekStart: PropTypes.func,
|
|
1406
|
+
onSeekEnd: PropTypes.func,
|
|
1407
|
+
focusable: PropTypes.bool,
|
|
1408
|
+
className: PropTypes.string,
|
|
1409
|
+
withSeekHead: PropTypes.bool
|
|
1410
|
+
};
|
|
1411
|
+
var defaultProps$5 = {
|
|
1412
|
+
media: null,
|
|
1413
|
+
currentTime: null,
|
|
1414
|
+
duration: null,
|
|
1415
|
+
playing: false,
|
|
1416
|
+
backgroundColor: null,
|
|
1417
|
+
progressColor: null,
|
|
1418
|
+
onSeek: null,
|
|
1419
|
+
onSeekStart: null,
|
|
1420
|
+
onSeekEnd: null,
|
|
1421
|
+
focusable: true,
|
|
1422
|
+
className: null,
|
|
1423
|
+
withSeekHead: true
|
|
1424
|
+
};
|
|
1425
|
+
|
|
1426
|
+
var SeekBar = function SeekBar(_ref) {
|
|
1427
|
+
var _ref3;
|
|
1428
|
+
|
|
1429
|
+
var media = _ref.media,
|
|
1430
|
+
currentTime = _ref.currentTime,
|
|
1431
|
+
duration = _ref.duration,
|
|
1432
|
+
playing = _ref.playing,
|
|
1433
|
+
backgroundColor = _ref.backgroundColor,
|
|
1434
|
+
progressColor = _ref.progressColor,
|
|
1435
|
+
onSeek = _ref.onSeek,
|
|
1436
|
+
onSeekStart = _ref.onSeekStart,
|
|
1437
|
+
onSeekEnd = _ref.onSeekEnd,
|
|
1438
|
+
focusable = _ref.focusable,
|
|
1439
|
+
className = _ref.className,
|
|
1440
|
+
withSeekHead = _ref.withSeekHead;
|
|
1441
|
+
var intl = useIntl();
|
|
1442
|
+
|
|
1443
|
+
var _useSpring = useSpring(function () {
|
|
1444
|
+
return {
|
|
1445
|
+
x: currentTime !== null && duration !== null ? currentTime / duration : 0,
|
|
1446
|
+
config: {
|
|
1447
|
+
duration: 0
|
|
1448
|
+
}
|
|
1449
|
+
};
|
|
1450
|
+
}),
|
|
1451
|
+
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
1452
|
+
springProps = _useSpring2[0],
|
|
1453
|
+
setSpringProps = _useSpring2[1];
|
|
1454
|
+
|
|
1455
|
+
var lastMediaRef = useRef(media);
|
|
1456
|
+
var mediaChanged = lastMediaRef.current !== media;
|
|
1457
|
+
lastMediaRef.current = media;
|
|
1458
|
+
|
|
1459
|
+
var _useDimensionObserver = useDimensionObserver(),
|
|
1460
|
+
elRef = _useDimensionObserver.ref,
|
|
1461
|
+
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
1462
|
+
elWidth = _useDimensionObserver2 === void 0 ? null : _useDimensionObserver2;
|
|
1463
|
+
|
|
1464
|
+
useEffect(function () {
|
|
1465
|
+
if (currentTime === null || duration === null) {
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
var progress = duration > 0 ? currentTime / duration : 0;
|
|
1470
|
+
setSpringProps.start({
|
|
1471
|
+
reset: true,
|
|
1472
|
+
immediate: !playing || mediaChanged,
|
|
1473
|
+
from: {
|
|
1474
|
+
x: progress
|
|
1475
|
+
},
|
|
1476
|
+
to: {
|
|
1477
|
+
x: playing ? 1 : progress
|
|
1478
|
+
},
|
|
1479
|
+
config: {
|
|
1480
|
+
duration: (duration - currentTime) * 1000
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
}, [playing, duration, currentTime, mediaChanged, setSpringProps]); // User events
|
|
1484
|
+
|
|
1485
|
+
var seekFromX = useCallback(function (x) {
|
|
1486
|
+
var elX = elRef.current.getBoundingClientRect().left;
|
|
1487
|
+
var progress = Math.max(0, Math.min(1, (x - elX) / elWidth));
|
|
1488
|
+
setSpringProps.start({
|
|
1489
|
+
immediate: true,
|
|
1490
|
+
to: {
|
|
1491
|
+
x: progress
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
|
|
1495
|
+
if (onSeek !== null && duration !== null) {
|
|
1496
|
+
onSeek(progress * duration);
|
|
1497
|
+
}
|
|
1498
|
+
}, [duration, playing, onSeek]);
|
|
1499
|
+
var bind = useGesture({
|
|
1500
|
+
onDrag: function onDrag(_ref2) {
|
|
1501
|
+
var _ref2$xy = _slicedToArray(_ref2.xy, 1),
|
|
1502
|
+
x = _ref2$xy[0],
|
|
1503
|
+
elapsedTime = _ref2.elapsedTime,
|
|
1504
|
+
active = _ref2.active;
|
|
1505
|
+
|
|
1506
|
+
if (!active && elapsedTime > 300) {
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
seekFromX(x);
|
|
1511
|
+
},
|
|
1512
|
+
onPointerDown: function onPointerDown() {
|
|
1513
|
+
if (onSeekStart !== null) {
|
|
1514
|
+
onSeekStart();
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
onPointerUp: function onPointerUp() {
|
|
1518
|
+
if (onSeekEnd !== null) {
|
|
1519
|
+
onSeekEnd();
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}, {
|
|
1523
|
+
drag: {
|
|
1524
|
+
axis: 'x',
|
|
1525
|
+
filterTaps: true
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1529
|
+
className: classNames([styles$2.container, (_ref3 = {}, _defineProperty(_ref3, className, className !== null), _defineProperty(_ref3, styles$2.withSeekHead, withSeekHead), _ref3)])
|
|
1530
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1531
|
+
className: styles$2.inner
|
|
1532
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1533
|
+
className: styles$2.progressBar,
|
|
1534
|
+
style: {
|
|
1535
|
+
backgroundColor: backgroundColor
|
|
1536
|
+
}
|
|
1537
|
+
}, /*#__PURE__*/React.createElement(animated.div, {
|
|
1538
|
+
className: styles$2.playHead,
|
|
1539
|
+
style: {
|
|
1540
|
+
left: springProps.x.to(function (x) {
|
|
1541
|
+
return "".concat(x * 100, "%");
|
|
1542
|
+
}),
|
|
1543
|
+
backgroundColor: progressColor
|
|
1544
|
+
}
|
|
1545
|
+
}), /*#__PURE__*/React.createElement(animated.div, {
|
|
1546
|
+
className: styles$2.progress,
|
|
1547
|
+
style: {
|
|
1548
|
+
transform: springProps.x.to(function (x) {
|
|
1549
|
+
return "scaleX(".concat(x, ")");
|
|
1550
|
+
}),
|
|
1551
|
+
backgroundColor: progressColor
|
|
1552
|
+
}
|
|
1553
|
+
})), /*#__PURE__*/React.createElement("button", Object.assign({
|
|
1554
|
+
ref: elRef
|
|
1555
|
+
}, bind(), {
|
|
1556
|
+
type: "button",
|
|
1557
|
+
className: styles$2.track,
|
|
1558
|
+
title: intl.formatMessage({
|
|
1559
|
+
id: "G1Gyjn",
|
|
1560
|
+
defaultMessage: [{
|
|
1561
|
+
"type": 0,
|
|
1562
|
+
"value": "Seek"
|
|
1563
|
+
}]
|
|
1564
|
+
}),
|
|
1565
|
+
"aria-label": intl.formatMessage({
|
|
1566
|
+
id: "G1Gyjn",
|
|
1567
|
+
defaultMessage: [{
|
|
1568
|
+
"type": 0,
|
|
1569
|
+
"value": "Seek"
|
|
1570
|
+
}]
|
|
1571
|
+
}),
|
|
1572
|
+
tabIndex: focusable ? '0' : '-1'
|
|
1573
|
+
}))));
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
SeekBar.propTypes = propTypes$5;
|
|
1577
|
+
SeekBar.defaultProps = defaultProps$5;
|
|
1578
|
+
|
|
1579
|
+
var styles$1 = {"muteButton":"micromag-viewer-partials-playback-controls-muteButton","playPauseButton":"micromag-viewer-partials-playback-controls-playPauseButton","container":"micromag-viewer-partials-playback-controls-container","isCollapsed":"micromag-viewer-partials-playback-controls-isCollapsed","icon":"micromag-viewer-partials-playback-controls-icon","withPlayPause":"micromag-viewer-partials-playback-controls-withPlayPause","isMuted":"micromag-viewer-partials-playback-controls-isMuted","withMute":"micromag-viewer-partials-playback-controls-withMute","seekBar":"micromag-viewer-partials-playback-controls-seekBar","withSeekBar":"micromag-viewer-partials-playback-controls-withSeekBar"};
|
|
1580
|
+
|
|
1581
|
+
var propTypes$4 = {
|
|
1582
|
+
className: PropTypes.string
|
|
1583
|
+
};
|
|
1584
|
+
var defaultProps$4 = {
|
|
1585
|
+
className: null
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
function PlaybackControls(_ref) {
|
|
1589
|
+
var _ref4;
|
|
1590
|
+
|
|
1591
|
+
var className = _ref.className;
|
|
1592
|
+
var intl = useIntl();
|
|
1593
|
+
|
|
1594
|
+
var _usePlaybackContext = usePlaybackContext(),
|
|
1595
|
+
_usePlaybackContext$m = _usePlaybackContext.media,
|
|
1596
|
+
mediaElement = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m,
|
|
1597
|
+
_usePlaybackContext$p = _usePlaybackContext.playing,
|
|
1598
|
+
playing = _usePlaybackContext$p === void 0 ? false : _usePlaybackContext$p,
|
|
1599
|
+
_usePlaybackContext$m2 = _usePlaybackContext.muted,
|
|
1600
|
+
muted = _usePlaybackContext$m2 === void 0 ? true : _usePlaybackContext$m2,
|
|
1601
|
+
setPlaying = _usePlaybackContext.setPlaying,
|
|
1602
|
+
setMuted = _usePlaybackContext.setMuted,
|
|
1603
|
+
controls = _usePlaybackContext.controls,
|
|
1604
|
+
controlsVisible = _usePlaybackContext.controlsVisible,
|
|
1605
|
+
controlsTheme = _usePlaybackContext.controlsTheme,
|
|
1606
|
+
showControls = _usePlaybackContext.showControls;
|
|
1607
|
+
|
|
1608
|
+
var duration = useMediaDuration(mediaElement);
|
|
1609
|
+
var currentTime = useMediaCurrentTime(mediaElement, {
|
|
1610
|
+
disabled: !playing,
|
|
1611
|
+
updateInterval: 100
|
|
1612
|
+
});
|
|
1613
|
+
|
|
1614
|
+
var _useState = useState(null),
|
|
1615
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1616
|
+
customControlsTheme = _useState2[0],
|
|
1617
|
+
setCustomControlsTheme = _useState2[1];
|
|
1618
|
+
|
|
1619
|
+
var _useState3 = useState(false),
|
|
1620
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1621
|
+
wasPlaying = _useState4[0],
|
|
1622
|
+
setWasPlaying = _useState4[1];
|
|
1623
|
+
|
|
1624
|
+
useEffect(function () {
|
|
1625
|
+
var _ref2 = controlsTheme || {},
|
|
1626
|
+
color = _ref2.color,
|
|
1627
|
+
progressColor = _ref2.progressColor,
|
|
1628
|
+
seekBarOnly = _ref2.seekBarOnly;
|
|
1629
|
+
|
|
1630
|
+
setCustomControlsTheme({
|
|
1631
|
+
color: getColorAsString(color),
|
|
1632
|
+
progressColor: getColorAsString(progressColor),
|
|
1633
|
+
seekBarOnly: seekBarOnly
|
|
1634
|
+
});
|
|
1635
|
+
}, [controlsTheme, setCustomControlsTheme]);
|
|
1636
|
+
var onPlay = useCallback(function () {
|
|
1637
|
+
setPlaying(true);
|
|
1638
|
+
|
|
1639
|
+
if (!controlsVisible) {
|
|
1640
|
+
showControls();
|
|
1641
|
+
}
|
|
1642
|
+
}, [setPlaying, controlsVisible, showControls]);
|
|
1643
|
+
var onPause = useCallback(function () {
|
|
1644
|
+
setPlaying(false);
|
|
1645
|
+
|
|
1646
|
+
if (!controlsVisible) {
|
|
1647
|
+
showControls();
|
|
1648
|
+
}
|
|
1649
|
+
}, [setPlaying, controlsVisible, showControls]);
|
|
1650
|
+
var onMute = useCallback(function () {
|
|
1651
|
+
setMuted(true);
|
|
1652
|
+
|
|
1653
|
+
if (!controlsVisible && controls) {
|
|
1654
|
+
showControls();
|
|
1655
|
+
}
|
|
1656
|
+
}, [setMuted, controlsVisible, showControls]);
|
|
1657
|
+
var onUnmute = useCallback(function () {
|
|
1658
|
+
setMuted(false);
|
|
1659
|
+
|
|
1660
|
+
if (!controlsVisible && controls) {
|
|
1661
|
+
showControls();
|
|
1662
|
+
}
|
|
1663
|
+
}, [setMuted, controlsVisible, showControls]);
|
|
1664
|
+
var onSeekStart = useCallback(function () {
|
|
1665
|
+
setWasPlaying(playing);
|
|
1666
|
+
if (playing) setPlaying(false);
|
|
1667
|
+
}, [playing, setWasPlaying]);
|
|
1668
|
+
var onSeek = useCallback(function (time) {
|
|
1669
|
+
mediaElement.currentTime = time;
|
|
1670
|
+
showControls();
|
|
1671
|
+
}, [mediaElement, setWasPlaying, playing, setPlaying, showControls]);
|
|
1672
|
+
var onSeekEnd = useCallback(function () {
|
|
1673
|
+
if (wasPlaying) setPlaying(true);
|
|
1674
|
+
}, [playing, setPlaying, wasPlaying]);
|
|
1675
|
+
|
|
1676
|
+
var _ref3 = customControlsTheme || {},
|
|
1677
|
+
color = _ref3.color,
|
|
1678
|
+
progressColor = _ref3.progressColor,
|
|
1679
|
+
seekBarOnly = _ref3.seekBarOnly;
|
|
1680
|
+
|
|
1681
|
+
var isCollapsed = controls && !controlsVisible && playing || !controls && mediaElement !== null;
|
|
1682
|
+
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)])
|
|
1684
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
1685
|
+
type: "button",
|
|
1686
|
+
className: styles$1.playPauseButton,
|
|
1687
|
+
style: {
|
|
1688
|
+
color: color
|
|
1689
|
+
},
|
|
1690
|
+
onClick: playing ? onPause : onPlay,
|
|
1691
|
+
title: intl.formatMessage({
|
|
1692
|
+
id: "ahSpiH",
|
|
1693
|
+
defaultMessage: [{
|
|
1694
|
+
"type": 0,
|
|
1695
|
+
"value": "Play"
|
|
1696
|
+
}]
|
|
1697
|
+
}),
|
|
1698
|
+
"aria-label": intl.formatMessage({
|
|
1699
|
+
id: "ahSpiH",
|
|
1700
|
+
defaultMessage: [{
|
|
1701
|
+
"type": 0,
|
|
1702
|
+
"value": "Play"
|
|
1703
|
+
}]
|
|
1704
|
+
}),
|
|
1705
|
+
tabIndex: controlsVisible ? '0' : '-1'
|
|
1706
|
+
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1707
|
+
className: styles$1.icon,
|
|
1708
|
+
icon: playing ? faPause : faPlay
|
|
1709
|
+
})), /*#__PURE__*/React.createElement(SeekBar, {
|
|
1710
|
+
className: styles$1.seekBar,
|
|
1711
|
+
duration: duration,
|
|
1712
|
+
currentTime: currentTime,
|
|
1713
|
+
playing: playing,
|
|
1714
|
+
media: mediaElement,
|
|
1715
|
+
onSeek: onSeek,
|
|
1716
|
+
onSeekStart: onSeekStart,
|
|
1717
|
+
onSeekEnd: onSeekEnd,
|
|
1718
|
+
focusable: playing,
|
|
1719
|
+
withSeekHead: !isCollapsed && !seekBarOnly,
|
|
1720
|
+
backgroundColor: color,
|
|
1721
|
+
progressColor: progressColor
|
|
1722
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
1723
|
+
type: "button",
|
|
1724
|
+
className: classNames([styles$1.muteButton, _defineProperty({}, styles$1.isMuted, muted)]),
|
|
1725
|
+
style: {
|
|
1726
|
+
color: color
|
|
1727
|
+
},
|
|
1728
|
+
onClick: muted ? onUnmute : onMute,
|
|
1729
|
+
title: intl.formatMessage({
|
|
1730
|
+
id: "vzg8Es",
|
|
1731
|
+
defaultMessage: [{
|
|
1732
|
+
"type": 0,
|
|
1733
|
+
"value": "Mute"
|
|
1734
|
+
}]
|
|
1735
|
+
}),
|
|
1736
|
+
"aria-label": intl.formatMessage({
|
|
1737
|
+
id: "vzg8Es",
|
|
1738
|
+
defaultMessage: [{
|
|
1739
|
+
"type": 0,
|
|
1740
|
+
"value": "Mute"
|
|
1741
|
+
}]
|
|
1742
|
+
}),
|
|
1743
|
+
tabIndex: controlsVisible ? '0' : '-1'
|
|
1744
|
+
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1745
|
+
className: styles$1.icon,
|
|
1746
|
+
icon: faVolumeUp
|
|
1502
1747
|
})));
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
PlaybackControls.propTypes = propTypes$4;
|
|
1751
|
+
PlaybackControls.defaultProps = defaultProps$4;
|
|
1752
|
+
|
|
1753
|
+
var styles = {"container":"micromag-viewer-partials-web-view-container","opened":"micromag-viewer-partials-web-view-opened"};
|
|
1754
|
+
|
|
1755
|
+
var _excluded$2 = ["opened", "close", "open", "update", "url"];
|
|
1756
|
+
var propTypes$3 = {
|
|
1757
|
+
className: PropTypes.string,
|
|
1758
|
+
style: PropTypes.object
|
|
1759
|
+
};
|
|
1760
|
+
var defaultProps$3 = {
|
|
1761
|
+
className: null,
|
|
1762
|
+
style: null
|
|
1503
1763
|
};
|
|
1504
1764
|
|
|
1505
|
-
|
|
1506
|
-
|
|
1765
|
+
function WebViewContainer(_ref) {
|
|
1766
|
+
var _ref2;
|
|
1767
|
+
|
|
1768
|
+
var className = _ref.className,
|
|
1769
|
+
style = _ref.style;
|
|
1770
|
+
|
|
1771
|
+
var _useViewerWebView = useViewerWebView(),
|
|
1772
|
+
opened = _useViewerWebView.opened,
|
|
1773
|
+
close = _useViewerWebView.close;
|
|
1774
|
+
_useViewerWebView.open;
|
|
1775
|
+
_useViewerWebView.update;
|
|
1776
|
+
var _useViewerWebView$url = _useViewerWebView.url,
|
|
1777
|
+
url = _useViewerWebView$url === void 0 ? null : _useViewerWebView$url,
|
|
1778
|
+
webViewProps = _objectWithoutProperties(_useViewerWebView, _excluded$2);
|
|
1779
|
+
|
|
1780
|
+
var _useViewerInteraction = useViewerInteraction(),
|
|
1781
|
+
disableInteraction = _useViewerInteraction.disableInteraction,
|
|
1782
|
+
enableInteraction = _useViewerInteraction.enableInteraction;
|
|
1783
|
+
|
|
1784
|
+
var _useState = useState(url),
|
|
1785
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1786
|
+
currentUrl = _useState2[0],
|
|
1787
|
+
setCurrentUrl = _useState2[1];
|
|
1788
|
+
|
|
1789
|
+
useEffect(function () {
|
|
1790
|
+
if (url !== null) {
|
|
1791
|
+
setCurrentUrl(url);
|
|
1792
|
+
}
|
|
1793
|
+
}, [url, setCurrentUrl]);
|
|
1794
|
+
useEffect(function () {
|
|
1795
|
+
if (opened) {
|
|
1796
|
+
disableInteraction();
|
|
1797
|
+
} else {
|
|
1798
|
+
enableInteraction();
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
return function () {
|
|
1802
|
+
enableInteraction();
|
|
1803
|
+
};
|
|
1804
|
+
}, [opened]);
|
|
1805
|
+
var onTransitionEnd = useCallback(function () {
|
|
1806
|
+
if (url === null) {
|
|
1807
|
+
setCurrentUrl(null);
|
|
1808
|
+
}
|
|
1809
|
+
}, [url]);
|
|
1810
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1811
|
+
className: classNames([styles.container, (_ref2 = {}, _defineProperty(_ref2, styles.opened, opened), _defineProperty(_ref2, className, className !== null), _ref2)]),
|
|
1812
|
+
style: style,
|
|
1813
|
+
onTransitionEnd: onTransitionEnd
|
|
1814
|
+
}, /*#__PURE__*/React.createElement(WebView, Object.assign({
|
|
1815
|
+
url: url || currentUrl
|
|
1816
|
+
}, webViewProps, {
|
|
1817
|
+
closeable: true,
|
|
1818
|
+
className: styles.webView,
|
|
1819
|
+
onClose: close
|
|
1820
|
+
})));
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
WebViewContainer.propTypes = propTypes$3;
|
|
1824
|
+
WebViewContainer.defaultProps = defaultProps$3;
|
|
1507
1825
|
|
|
1508
1826
|
var propTypes$2 = {
|
|
1509
1827
|
story: PropTypes$1.story,
|
|
@@ -1582,7 +1900,7 @@ var defaultProps$2 = {
|
|
|
1582
1900
|
};
|
|
1583
1901
|
|
|
1584
1902
|
var Viewer = function Viewer(_ref) {
|
|
1585
|
-
var
|
|
1903
|
+
var _ref14;
|
|
1586
1904
|
|
|
1587
1905
|
var story = _ref.story,
|
|
1588
1906
|
basePath = _ref.basePath,
|
|
@@ -1594,7 +1912,6 @@ var Viewer = function Viewer(_ref) {
|
|
|
1594
1912
|
deviceScreens = _ref.deviceScreens,
|
|
1595
1913
|
renderContext = _ref.renderContext,
|
|
1596
1914
|
visitor = _ref.visitor,
|
|
1597
|
-
onScreenChange = _ref.onScreenChange,
|
|
1598
1915
|
tapNextScreenWidthPercent = _ref.tapNextScreenWidthPercent,
|
|
1599
1916
|
neighborScreensActive = _ref.neighborScreensActive,
|
|
1600
1917
|
neighborScreensMounted = _ref.neighborScreensMounted,
|
|
@@ -1612,6 +1929,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
1612
1929
|
onCloseViewer = _ref.onClose,
|
|
1613
1930
|
onInteraction = _ref.onInteraction,
|
|
1614
1931
|
onEnd = _ref.onEnd,
|
|
1932
|
+
onScreenChange = _ref.onScreenChange,
|
|
1615
1933
|
onViewModeChange = _ref.onViewModeChange,
|
|
1616
1934
|
currentScreenMedia = _ref.currentScreenMedia,
|
|
1617
1935
|
screensMedias = _ref.screensMedias,
|
|
@@ -1659,6 +1977,16 @@ var Viewer = function Viewer(_ref) {
|
|
|
1659
1977
|
var isStatic = renderContext === 'static';
|
|
1660
1978
|
var isCapture = renderContext === 'capture';
|
|
1661
1979
|
var withoutScreensTransforms = isStatic || isCapture;
|
|
1980
|
+
|
|
1981
|
+
var _usePlaybackContext = usePlaybackContext(),
|
|
1982
|
+
playing = _usePlaybackContext.playing,
|
|
1983
|
+
_usePlaybackContext$c = _usePlaybackContext.controls,
|
|
1984
|
+
playbackControls = _usePlaybackContext$c === void 0 ? false : _usePlaybackContext$c,
|
|
1985
|
+
_usePlaybackContext$c2 = _usePlaybackContext.controlsVisible,
|
|
1986
|
+
playbackcontrolsVisible = _usePlaybackContext$c2 === void 0 ? false : _usePlaybackContext$c2,
|
|
1987
|
+
_usePlaybackContext$m = _usePlaybackContext.media,
|
|
1988
|
+
playbackMedia = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m;
|
|
1989
|
+
|
|
1662
1990
|
var trackScreenView = useTrackScreenView();
|
|
1663
1991
|
var contentRef = useRef(null); // Get screen size
|
|
1664
1992
|
|
|
@@ -1689,10 +2017,11 @@ var Viewer = function Viewer(_ref) {
|
|
|
1689
2017
|
useEffect(function () {
|
|
1690
2018
|
if (ready && onViewModeChange !== null) {
|
|
1691
2019
|
onViewModeChange({
|
|
1692
|
-
landscape: landscape
|
|
2020
|
+
landscape: landscape,
|
|
2021
|
+
menuOverScreen: menuOverScreen
|
|
1693
2022
|
});
|
|
1694
2023
|
}
|
|
1695
|
-
}, [ready, landscape, onViewModeChange]);
|
|
2024
|
+
}, [ready, landscape, menuOverScreen, onViewModeChange]);
|
|
1696
2025
|
var screensMediasRef = useRef([]); // Screen index
|
|
1697
2026
|
|
|
1698
2027
|
var screenIndex = useMemo(function () {
|
|
@@ -1702,7 +2031,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
1702
2031
|
}, [screenId, screens]);
|
|
1703
2032
|
|
|
1704
2033
|
if (currentScreenMedia !== null) {
|
|
1705
|
-
currentScreenMedia.current = screensMediasRef.current[screenIndex];
|
|
2034
|
+
currentScreenMedia.current = screensMediasRef.current[screenIndex] || null;
|
|
1706
2035
|
}
|
|
1707
2036
|
|
|
1708
2037
|
if (screensMedias !== null) {
|
|
@@ -1733,12 +2062,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
1733
2062
|
|
|
1734
2063
|
var currentScreenRef = useRef(null);
|
|
1735
2064
|
var gotoPreviousScreen = useCallback(function () {
|
|
1736
|
-
changeIndex(Math.max(0, screenIndex - 1));
|
|
1737
|
-
currentScreenRef.current.focus();
|
|
2065
|
+
changeIndex(Math.max(0, screenIndex - 1)); // currentScreenRef.current.focus();
|
|
1738
2066
|
}, [changeIndex]);
|
|
1739
2067
|
var gotoNextScreen = useCallback(function () {
|
|
1740
|
-
changeIndex(Math.min(screens.length - 1, screenIndex + 1));
|
|
1741
|
-
currentScreenRef.current.focus();
|
|
2068
|
+
changeIndex(Math.min(screens.length - 1, screenIndex + 1)); // currentScreenRef.current.focus();
|
|
1742
2069
|
}, [changeIndex]);
|
|
1743
2070
|
var screensCount = screens.length;
|
|
1744
2071
|
|
|
@@ -1756,45 +2083,107 @@ var Viewer = function Viewer(_ref) {
|
|
|
1756
2083
|
setHasInteracted(true);
|
|
1757
2084
|
}
|
|
1758
2085
|
}, [onInteraction, hasInteracted, setHasInteracted]);
|
|
2086
|
+
var onScreenNavigate = useCallback(function (_ref6) {
|
|
2087
|
+
var index = _ref6.index,
|
|
2088
|
+
newIndex = _ref6.newIndex,
|
|
2089
|
+
end = _ref6.end,
|
|
2090
|
+
direction = _ref6.direction;
|
|
2091
|
+
|
|
2092
|
+
if (end && onEnd !== null) {
|
|
2093
|
+
onEnd();
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
changeIndex(newIndex);
|
|
2097
|
+
eventsManager.emit('navigate', {
|
|
2098
|
+
newIndex: newIndex,
|
|
2099
|
+
index: index,
|
|
2100
|
+
direction: direction,
|
|
2101
|
+
end: end
|
|
2102
|
+
});
|
|
2103
|
+
|
|
2104
|
+
if (end) {
|
|
2105
|
+
eventsManager.emit('navigate_end');
|
|
2106
|
+
} else {
|
|
2107
|
+
eventsManager.emit("navigate_".concat(direction), newIndex);
|
|
2108
|
+
}
|
|
2109
|
+
}, [onEnd, changeIndex]);
|
|
1759
2110
|
|
|
1760
2111
|
var _useScreenInteraction = useScreenInteraction({
|
|
1761
2112
|
screens: screens,
|
|
1762
2113
|
screenIndex: screenIndex,
|
|
1763
2114
|
screenWidth: screenContainerWidth,
|
|
1764
|
-
|
|
2115
|
+
disableCurrentScreenNavigation: !isView,
|
|
1765
2116
|
clickOnSiblings: landscape && withLandscapeSiblingsScreens,
|
|
1766
2117
|
nextScreenWidthPercent: tapNextScreenWidthPercent,
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
onEnd: onEnd,
|
|
1770
|
-
onChangeScreen: changeIndex
|
|
2118
|
+
onInteract: onInteractionPrivate,
|
|
2119
|
+
onNavigate: onScreenNavigate
|
|
1771
2120
|
}),
|
|
1772
|
-
|
|
2121
|
+
interactWithScreen = _useScreenInteraction.interact,
|
|
1773
2122
|
currentScreenInteractionEnabled = _useScreenInteraction.currentScreenInteractionEnabled,
|
|
1774
2123
|
enableInteraction = _useScreenInteraction.enableInteraction,
|
|
1775
|
-
disableInteraction = _useScreenInteraction.disableInteraction;
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
2124
|
+
disableInteraction = _useScreenInteraction.disableInteraction; // Handle tap on screens
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
var onDragScreen = useCallback(function (_ref7) {
|
|
2128
|
+
var _ref7$args = _slicedToArray(_ref7.args, 1),
|
|
2129
|
+
tapScreenIndex = _ref7$args[0],
|
|
2130
|
+
event = _ref7.event,
|
|
2131
|
+
target = _ref7.target,
|
|
2132
|
+
currentTarget = _ref7.currentTarget,
|
|
2133
|
+
tap = _ref7.tap,
|
|
2134
|
+
_ref7$xy = _slicedToArray(_ref7.xy, 2),
|
|
2135
|
+
x = _ref7$xy[0],
|
|
2136
|
+
y = _ref7$xy[1];
|
|
2137
|
+
|
|
2138
|
+
if (tap) {
|
|
2139
|
+
interactWithScreen({
|
|
2140
|
+
event: event,
|
|
2141
|
+
target: target,
|
|
2142
|
+
currentTarget: currentTarget,
|
|
2143
|
+
index: tapScreenIndex,
|
|
2144
|
+
x: x,
|
|
2145
|
+
y: y
|
|
2146
|
+
});
|
|
1780
2147
|
}
|
|
2148
|
+
}, [interactWithScreen]);
|
|
2149
|
+
var dragScreenBind = useDrag(onDragScreen, {
|
|
2150
|
+
filterTaps: true
|
|
2151
|
+
}); // Handles tap when landscape (space around current screen)
|
|
1781
2152
|
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
var tapX = e.clientX;
|
|
1789
|
-
var hasTappedLeft = tapX - contentX < contentWidth * 0.5;
|
|
1790
|
-
var nextIndex = hasTappedLeft ? Math.max(0, screenIndex - 1) : Math.min(screensCount - 1, screenIndex + 1);
|
|
2153
|
+
var onDragContent = useCallback(function (_ref8) {
|
|
2154
|
+
var tap = _ref8.tap,
|
|
2155
|
+
target = _ref8.target,
|
|
2156
|
+
currentTarget = _ref8.currentTarget,
|
|
2157
|
+
_ref8$xy = _slicedToArray(_ref8.xy, 1),
|
|
2158
|
+
x = _ref8$xy[0];
|
|
1791
2159
|
|
|
1792
|
-
if (
|
|
1793
|
-
|
|
2160
|
+
if (!landscape || withLandscapeSiblingsScreens || target !== contentRef.current) {
|
|
2161
|
+
return;
|
|
1794
2162
|
}
|
|
1795
2163
|
|
|
1796
|
-
|
|
1797
|
-
|
|
2164
|
+
if (tap) {
|
|
2165
|
+
var _currentTarget$getBou = currentTarget.getBoundingClientRect(),
|
|
2166
|
+
_currentTarget$getBou2 = _currentTarget$getBou.left,
|
|
2167
|
+
contentX = _currentTarget$getBou2 === void 0 ? 0 : _currentTarget$getBou2,
|
|
2168
|
+
_currentTarget$getBou3 = _currentTarget$getBou.width,
|
|
2169
|
+
contentWidth = _currentTarget$getBou3 === void 0 ? 0 : _currentTarget$getBou3;
|
|
2170
|
+
|
|
2171
|
+
var hasTappedLeft = x - contentX < contentWidth * 0.5;
|
|
2172
|
+
var nextIndex = hasTappedLeft ? Math.max(0, screenIndex - 1) : Math.min(screensCount - 1, screenIndex + 1);
|
|
2173
|
+
onScreenNavigate({
|
|
2174
|
+
index: screenIndex,
|
|
2175
|
+
newIndex: nextIndex
|
|
2176
|
+
});
|
|
2177
|
+
}
|
|
2178
|
+
}, [screenIndex, screensCount, landscape, withLandscapeSiblingsScreens]);
|
|
2179
|
+
var dragContentBind = useDrag(onDragContent, {
|
|
2180
|
+
filterTaps: true
|
|
2181
|
+
});
|
|
2182
|
+
var onScreenKeyUp = useCallback(function (e, i) {
|
|
2183
|
+
if (e.key === 'Enter' && withLandscapeSiblingsScreens && landscape && i !== screenIndex) {
|
|
2184
|
+
changeIndex(i);
|
|
2185
|
+
}
|
|
2186
|
+
}, [withLandscapeSiblingsScreens, changeIndex, landscape, screenIndex]); // swipe menu open
|
|
1798
2187
|
|
|
1799
2188
|
var menuVisible = screensCount === 0 || currentScreenInteractionEnabled;
|
|
1800
2189
|
|
|
@@ -1813,11 +2202,11 @@ var Viewer = function Viewer(_ref) {
|
|
|
1813
2202
|
onInteractionPrivate();
|
|
1814
2203
|
setMenuOpened(true);
|
|
1815
2204
|
}, [changeIndex, onInteractionPrivate, setMenuOpened]);
|
|
1816
|
-
var onClickMenuItem = useCallback(function (
|
|
1817
|
-
var itemScreenId =
|
|
2205
|
+
var onClickMenuItem = useCallback(function (_ref9) {
|
|
2206
|
+
var itemScreenId = _ref9.screenId;
|
|
1818
2207
|
onInteractionPrivate();
|
|
1819
|
-
var index = screens.findIndex(function (
|
|
1820
|
-
var id =
|
|
2208
|
+
var index = screens.findIndex(function (_ref10) {
|
|
2209
|
+
var id = _ref10.id;
|
|
1821
2210
|
return id === itemScreenId;
|
|
1822
2211
|
});
|
|
1823
2212
|
changeIndex(index);
|
|
@@ -1870,32 +2259,34 @@ var Viewer = function Viewer(_ref) {
|
|
|
1870
2259
|
disabled: renderContext !== 'view'
|
|
1871
2260
|
});
|
|
1872
2261
|
|
|
1873
|
-
var
|
|
1874
|
-
screenParameters =
|
|
2262
|
+
var _ref11 = currentScreen || {},
|
|
2263
|
+
screenParameters = _ref11.parameters;
|
|
1875
2264
|
|
|
1876
|
-
var
|
|
1877
|
-
screenMetadata =
|
|
2265
|
+
var _ref12 = screenParameters || {},
|
|
2266
|
+
screenMetadata = _ref12.metadata;
|
|
1878
2267
|
|
|
1879
|
-
var
|
|
1880
|
-
|
|
1881
|
-
screenTitle =
|
|
1882
|
-
|
|
1883
|
-
screenDescription =
|
|
2268
|
+
var _ref13 = screenMetadata || {},
|
|
2269
|
+
_ref13$title = _ref13.title,
|
|
2270
|
+
screenTitle = _ref13$title === void 0 ? null : _ref13$title,
|
|
2271
|
+
_ref13$description = _ref13.description,
|
|
2272
|
+
screenDescription = _ref13$description === void 0 ? null : _ref13$description;
|
|
1884
2273
|
|
|
1885
2274
|
var finalTitle = screenTitle !== null ? screenTitle : title;
|
|
1886
2275
|
var finalMetadata = useMemo(function () {
|
|
1887
2276
|
return screenDescription !== null ? _objectSpread(_objectSpread({}, metadata), {}, {
|
|
1888
2277
|
description: screenDescription
|
|
1889
2278
|
}) : metadata;
|
|
1890
|
-
}, [metadata]);
|
|
2279
|
+
}, [metadata]); // Get element height
|
|
1891
2280
|
|
|
1892
|
-
var
|
|
1893
|
-
menuDotsContainerRef =
|
|
1894
|
-
|
|
2281
|
+
var _useDimensionObserver = useDimensionObserver(),
|
|
2282
|
+
menuDotsContainerRef = _useDimensionObserver.ref,
|
|
2283
|
+
_useDimensionObserver2 = _useDimensionObserver.height,
|
|
2284
|
+
menuDotsContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
1895
2285
|
|
|
1896
|
-
var
|
|
1897
|
-
|
|
1898
|
-
|
|
2286
|
+
var _useDimensionObserver3 = useDimensionObserver(),
|
|
2287
|
+
playbackControlsContainerRef = _useDimensionObserver3.ref,
|
|
2288
|
+
_useDimensionObserver4 = _useDimensionObserver3.height,
|
|
2289
|
+
playbackControlsContainerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
1899
2290
|
|
|
1900
2291
|
var _useMemo = useMemo(function () {
|
|
1901
2292
|
return neighborScreensMounted !== null ? {
|
|
@@ -1912,14 +2303,17 @@ var Viewer = function Viewer(_ref) {
|
|
|
1912
2303
|
var mountedScreens = useMemo(function () {
|
|
1913
2304
|
return neighborScreensMounted != null ? screens.slice(mountedScreenStartIndex, mountedScreenEndIndex) : screens;
|
|
1914
2305
|
}, [screens, mountedScreenStartIndex, mountedScreenEndIndex, neighborScreensActive, neighborScreensMounted]);
|
|
1915
|
-
return /*#__PURE__*/React.createElement(
|
|
1916
|
-
size: screenSize
|
|
1917
|
-
}, /*#__PURE__*/React.createElement(VisitorProvider, {
|
|
2306
|
+
return /*#__PURE__*/React.createElement(VisitorProvider, {
|
|
1918
2307
|
visitor: visitor
|
|
2308
|
+
}, /*#__PURE__*/React.createElement(ScreenSizeProvider, {
|
|
2309
|
+
size: screenSize
|
|
1919
2310
|
}, /*#__PURE__*/React.createElement(ViewerProvider, {
|
|
1920
2311
|
events: eventsManager,
|
|
1921
2312
|
menuVisible: menuVisible,
|
|
1922
|
-
|
|
2313
|
+
menuOverScreen: menuOverScreen,
|
|
2314
|
+
topHeight: menuOverScreen && currentScreenInteractionEnabled ? menuDotsContainerHeight / screenScale : 0,
|
|
2315
|
+
bottomHeight: playbackControls && (playbackcontrolsVisible || !playing) && currentScreenInteractionEnabled ? playbackControlsContainerHeight / screenScale : 0,
|
|
2316
|
+
bottomSidesWidth: (playbackcontrolsVisible || !playing || playbackMedia !== null) && currentScreenInteractionEnabled ? 60 / screenScale : 0,
|
|
1923
2317
|
gotoPreviousScreen: gotoPreviousScreen,
|
|
1924
2318
|
gotoNextScreen: gotoNextScreen,
|
|
1925
2319
|
disableInteraction: disableInteraction,
|
|
@@ -1930,9 +2324,9 @@ var Viewer = function Viewer(_ref) {
|
|
|
1930
2324
|
}, overscrollStyle) : /*#__PURE__*/React.createElement(Helmet, null, overscrollStyle), /*#__PURE__*/React.createElement(FontFaces, {
|
|
1931
2325
|
fonts: finalFonts
|
|
1932
2326
|
}), /*#__PURE__*/React.createElement("div", {
|
|
1933
|
-
className: classNames([styles$
|
|
2327
|
+
className: classNames([styles$5.container, screenSize.screens.map(function (screenName) {
|
|
1934
2328
|
return "story-screen-".concat(screenName);
|
|
1935
|
-
}), (
|
|
2329
|
+
}), (_ref14 = {}, _defineProperty(_ref14, styles$5.landscape, landscape), _defineProperty(_ref14, styles$5.withSiblings, withLandscapeSiblingsScreens), _defineProperty(_ref14, styles$5.hideMenu, !menuVisible), _defineProperty(_ref14, styles$5.ready, ready || withoutScreensTransforms), _defineProperty(_ref14, styles$5.hasInteracted, hasInteracted), _defineProperty(_ref14, className, className), _ref14)]),
|
|
1936
2330
|
ref: containerRef,
|
|
1937
2331
|
onContextMenu: onContextMenu
|
|
1938
2332
|
}, !withoutMenu ? /*#__PURE__*/React.createElement(ViewerMenu, {
|
|
@@ -1956,14 +2350,11 @@ var Viewer = function Viewer(_ref) {
|
|
|
1956
2350
|
withDotItemClick: screenContainerWidth > 400,
|
|
1957
2351
|
withoutScreensMenu: withoutScreensMenu,
|
|
1958
2352
|
refDots: menuDotsContainerRef
|
|
1959
|
-
}) : null, ready || withoutScreensTransforms ? /*#__PURE__*/React.createElement("div", {
|
|
2353
|
+
}) : null, ready || withoutScreensTransforms ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
1960
2354
|
ref: contentRef,
|
|
1961
|
-
className: styles$
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
}, mountedScreens.map(function (scr, mountedIndex) {
|
|
1966
|
-
var _ref13;
|
|
2355
|
+
className: styles$5.content
|
|
2356
|
+
}, dragContentBind()), mountedScreens.map(function (scr, mountedIndex) {
|
|
2357
|
+
var _ref15;
|
|
1967
2358
|
|
|
1968
2359
|
var i = mountedScreenStartIndex + mountedIndex;
|
|
1969
2360
|
var current = i === parseInt(screenIndex, 10);
|
|
@@ -1975,12 +2366,8 @@ var Viewer = function Viewer(_ref) {
|
|
|
1975
2366
|
index: i,
|
|
1976
2367
|
current: current,
|
|
1977
2368
|
active: active,
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
enableInteraction: enableInteraction,
|
|
1981
|
-
disableInteraction: disableInteraction,
|
|
1982
|
-
getMediaRef: function getMediaRef(mediaRef) {
|
|
1983
|
-
screensMediasRef.current[i] = mediaRef;
|
|
2369
|
+
mediaRef: function mediaRef(ref) {
|
|
2370
|
+
screensMediasRef.current[i] = ref;
|
|
1984
2371
|
}
|
|
1985
2372
|
});
|
|
1986
2373
|
var key = "screen-viewer-".concat(scr.id || '', "-").concat(i + 1);
|
|
@@ -1994,7 +2381,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
1994
2381
|
|
|
1995
2382
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
1996
2383
|
key: key
|
|
1997
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
2384
|
+
}, /*#__PURE__*/React.createElement("div", Object.assign({
|
|
1998
2385
|
ref: current ? currentScreenRef : null,
|
|
1999
2386
|
style: {
|
|
2000
2387
|
// width: landscape ? screenWidth : null,
|
|
@@ -2003,7 +2390,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
2003
2390
|
height: screenContainerHeight,
|
|
2004
2391
|
transform: !withoutScreensTransforms ? screenTransform : null
|
|
2005
2392
|
},
|
|
2006
|
-
className: classNames([styles$
|
|
2393
|
+
className: classNames([styles$5.screen, (_ref15 = {}, _defineProperty(_ref15, styles$5.current, current), _defineProperty(_ref15, styles$5.visible, current || withLandscapeSiblingsScreens), _ref15)]),
|
|
2007
2394
|
tabIndex: active ? '0' : '-1'
|
|
2008
2395
|
/* eslint-disable-line */
|
|
2009
2396
|
,
|
|
@@ -2021,26 +2408,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
2021
2408
|
index: i + 1
|
|
2022
2409
|
}),
|
|
2023
2410
|
onKeyUp: function onKeyUp(e) {
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
onClick: function onClick(e) {
|
|
2029
|
-
return onScreenClick(e, i);
|
|
2030
|
-
} // @todo: this was to make the experience “snappier” when switching screens
|
|
2031
|
-
// onPointerDown={
|
|
2032
|
-
// detectPointerEvents.hasApi
|
|
2033
|
-
// ? (e) => onScreenClick(e, i)
|
|
2034
|
-
// : null
|
|
2035
|
-
// }
|
|
2036
|
-
// onMouseDown={
|
|
2037
|
-
// !detectPointerEvents.hasApi
|
|
2038
|
-
// ? (e) => onScreenClick(e, i)
|
|
2039
|
-
// : null
|
|
2040
|
-
// }
|
|
2041
|
-
|
|
2042
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
2043
|
-
className: styles$8.scaler,
|
|
2411
|
+
return onScreenKeyUp(e, i);
|
|
2412
|
+
}
|
|
2413
|
+
}, dragScreenBind(i)), /*#__PURE__*/React.createElement("div", {
|
|
2414
|
+
className: styles$5.scaler,
|
|
2044
2415
|
style: {
|
|
2045
2416
|
width: screenWidth,
|
|
2046
2417
|
height: screenHeight,
|
|
@@ -2049,10 +2420,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
2049
2420
|
}
|
|
2050
2421
|
}, current && screenIndex > 0 ? /*#__PURE__*/React.createElement("button", {
|
|
2051
2422
|
type: "button",
|
|
2052
|
-
className: classNames([styles$
|
|
2423
|
+
className: classNames([styles$5.navButton, styles$5.previous]),
|
|
2053
2424
|
onClick: gotoPreviousScreen
|
|
2054
2425
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
2055
|
-
className: styles$
|
|
2426
|
+
className: styles$5.arrow,
|
|
2056
2427
|
icon: faArrowLeft
|
|
2057
2428
|
}), /*#__PURE__*/React.createElement("span", {
|
|
2058
2429
|
className: "sr-only"
|
|
@@ -2064,10 +2435,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
2064
2435
|
}]
|
|
2065
2436
|
}))) : null, viewerScreen, current && screenIndex < screens.length - 1 ? /*#__PURE__*/React.createElement("button", {
|
|
2066
2437
|
type: "button",
|
|
2067
|
-
className: classNames([styles$
|
|
2438
|
+
className: classNames([styles$5.navButton, styles$5.next]),
|
|
2068
2439
|
onClick: gotoNextScreen
|
|
2069
2440
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
2070
|
-
className: styles$
|
|
2441
|
+
className: styles$5.arrow,
|
|
2071
2442
|
icon: faArrowRight
|
|
2072
2443
|
}), /*#__PURE__*/React.createElement("span", {
|
|
2073
2444
|
className: "sr-only"
|
|
@@ -2086,9 +2457,24 @@ var Viewer = function Viewer(_ref) {
|
|
|
2086
2457
|
"value": "Go to next screen"
|
|
2087
2458
|
}]
|
|
2088
2459
|
}))) : null), withNavigationHint && !withLandscapeSiblingsScreens && current && screenIndex === 0 ? /*#__PURE__*/React.createElement(HandTap, {
|
|
2089
|
-
className: styles$
|
|
2460
|
+
className: styles$5.handTap
|
|
2090
2461
|
}) : null));
|
|
2091
|
-
})
|
|
2462
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2463
|
+
className: classNames([styles$5.playbackControls, _defineProperty({}, styles$5.isCollapsed, !playbackcontrolsVisible)]),
|
|
2464
|
+
ref: playbackControlsContainerRef
|
|
2465
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2466
|
+
className: styles$5.playbackControlsContainer,
|
|
2467
|
+
style: {
|
|
2468
|
+
width: screenContainerWidth
|
|
2469
|
+
}
|
|
2470
|
+
}, /*#__PURE__*/React.createElement(PlaybackControls, {
|
|
2471
|
+
className: styles$5.controls
|
|
2472
|
+
})))) : null, /*#__PURE__*/React.createElement(WebViewContainer, {
|
|
2473
|
+
className: styles$5.webView,
|
|
2474
|
+
style: {
|
|
2475
|
+
maxWidth: Math.max(screenContainerWidth, 600)
|
|
2476
|
+
}
|
|
2477
|
+
})))));
|
|
2092
2478
|
};
|
|
2093
2479
|
|
|
2094
2480
|
Viewer.propTypes = propTypes$2;
|
|
@@ -2164,6 +2550,13 @@ var ViewerRoutes = function ViewerRoutes(_ref) {
|
|
|
2164
2550
|
ViewerRoutes.propTypes = propTypes$1;
|
|
2165
2551
|
ViewerRoutes.defaultProps = defaultProps$1;
|
|
2166
2552
|
|
|
2553
|
+
var home = "/";
|
|
2554
|
+
var screen = "/:screen";
|
|
2555
|
+
var defaultRoutes = {
|
|
2556
|
+
home: home,
|
|
2557
|
+
screen: screen
|
|
2558
|
+
};
|
|
2559
|
+
|
|
2167
2560
|
var _excluded = ["story", "screenComponents", "memoryRouter", "basePath", "routes", "withoutRouter", "googleApiKey", "trackingVariables", "locale", "locales", "translations", "pathWithIndex"];
|
|
2168
2561
|
var propTypes = {
|
|
2169
2562
|
story: PropTypes$1.story,
|
|
@@ -2255,7 +2648,7 @@ var ViewerContainer = function ViewerContainer(_ref) {
|
|
|
2255
2648
|
}, /*#__PURE__*/React.createElement(ScreensProvider, null, /*#__PURE__*/React.createElement(ComponentsProvider, {
|
|
2256
2649
|
namespace: SCREENS_NAMESPACE,
|
|
2257
2650
|
components: screenComponents || {}
|
|
2258
|
-
}, /*#__PURE__*/React.createElement(UserInteractionProvider, null, /*#__PURE__*/React.createElement(TrackingProvider, {
|
|
2651
|
+
}, /*#__PURE__*/React.createElement(UserInteractionProvider, null, /*#__PURE__*/React.createElement(PlaybackProvider, null, /*#__PURE__*/React.createElement(TrackingProvider, {
|
|
2259
2652
|
variables: finalTrackingVariables
|
|
2260
2653
|
}, withoutRouter ? /*#__PURE__*/React.createElement(Viewer, Object.assign({
|
|
2261
2654
|
story: story,
|
|
@@ -2264,7 +2657,7 @@ var ViewerContainer = function ViewerContainer(_ref) {
|
|
|
2264
2657
|
story: story,
|
|
2265
2658
|
basePath: basePath,
|
|
2266
2659
|
pathWithIndex: pathWithIndex
|
|
2267
|
-
}, otherProps))))))))));
|
|
2660
|
+
}, otherProps)))))))))));
|
|
2268
2661
|
return withoutRouter ? content : /*#__PURE__*/React.createElement(Router, {
|
|
2269
2662
|
basename: !memoryRouter ? basePath : null
|
|
2270
2663
|
}, /*#__PURE__*/React.createElement(RoutesProvider, {
|