@micromag/viewer 0.3.179 → 0.3.181
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 +12 -11
- package/es/index.js +1236 -1093
- package/lib/index.js +1254 -1111
- package/package.json +10 -10
package/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import React, { useEffect, useState, useCallback,
|
|
4
|
+
import React, { useEffect, useState, useCallback, useMemo, useRef } 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';
|
|
@@ -12,28 +12,20 @@ import { ScreensProvider } from '@micromag/screens';
|
|
|
12
12
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
13
13
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
14
14
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
15
|
-
import { useDrag, useGesture } from '@use-gesture/react';
|
|
16
15
|
import classNames from 'classnames';
|
|
17
16
|
import { Helmet } from 'react-helmet';
|
|
18
|
-
import { FormattedMessage, useIntl } from 'react-intl';
|
|
19
17
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { getStyleFromColor,
|
|
23
|
-
import {
|
|
24
|
-
import { animated } from '@react-spring/web';
|
|
25
|
-
import { faShare } from '@fortawesome/free-solid-svg-icons/faShare';
|
|
18
|
+
import { IconButton, ScreenPreview, SlidingButtons, CloseButton, Screen, Button, Meta, FontFaces } from '@micromag/core/components';
|
|
19
|
+
import { useDimensionObserver, useTrackEvent, useDragProgress, useMediaProgress, useParsedStory, useLoadedFonts, useTrackScreenView, useScreenSizeFromElement, useFullscreen } from '@micromag/core/hooks';
|
|
20
|
+
import { getStyleFromColor, getColorAsString, getDeviceScreens } from '@micromag/core/utils';
|
|
21
|
+
import { useIntl, FormattedMessage } from 'react-intl';
|
|
26
22
|
import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';
|
|
27
23
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
28
|
-
import
|
|
29
|
-
import {
|
|
30
|
-
import { faExpand } from '@fortawesome/free-solid-svg-icons/faExpand';
|
|
24
|
+
import { useSpring } from '@react-spring/core';
|
|
25
|
+
import { animated } from '@react-spring/web';
|
|
31
26
|
import Scroll from '@micromag/element-scroll';
|
|
32
|
-
import
|
|
33
|
-
import {
|
|
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';
|
|
27
|
+
import ShareOptions from '@micromag/element-share-options';
|
|
28
|
+
import { useGesture } from '@use-gesture/react';
|
|
37
29
|
import WebView from '@micromag/element-webview';
|
|
38
30
|
|
|
39
31
|
var routes = PropTypes.shape({
|
|
@@ -197,7 +189,7 @@ function useScreenInteraction() {
|
|
|
197
189
|
var relativeX = x - left;
|
|
198
190
|
var direction = relativeX < width * (1 - nextScreenWidthPercent) ? 'previous' : 'next';
|
|
199
191
|
var lastIndex = screensCount - 1;
|
|
200
|
-
var nextIndex = index;
|
|
192
|
+
var nextIndex = index; // @todo investigate what clickOnSiblings is doing
|
|
201
193
|
|
|
202
194
|
if (direction === 'previous' && !clickOnSiblings) {
|
|
203
195
|
nextIndex = Math.max(0, screenIndex - 1);
|
|
@@ -213,7 +205,7 @@ function useScreenInteraction() {
|
|
|
213
205
|
end: index === nextIndex && nextIndex === lastIndex
|
|
214
206
|
});
|
|
215
207
|
}
|
|
216
|
-
}, [screens, screenIndex,
|
|
208
|
+
}, [screens, screenIndex, screensInteractionEnabled, currentScreenInteractionEnabled, nextScreenWidthPercent, disableCurrentScreenNavigation, clickOnSiblings, onInteract, onNavigate]);
|
|
217
209
|
return {
|
|
218
210
|
interact: interact,
|
|
219
211
|
currentScreenInteractionEnabled: currentScreenInteractionEnabled,
|
|
@@ -222,171 +214,139 @@ function useScreenInteraction() {
|
|
|
222
214
|
};
|
|
223
215
|
}
|
|
224
216
|
|
|
225
|
-
var
|
|
226
|
-
|
|
227
|
-
var propTypes$h = {
|
|
228
|
-
url: PropTypes.string,
|
|
229
|
-
title: PropTypes.string,
|
|
230
|
-
opened: PropTypes.bool,
|
|
217
|
+
var _excluded$5 = ["className", "onClick", "theme"];
|
|
218
|
+
var propTypes$k = {
|
|
231
219
|
className: PropTypes.string,
|
|
232
|
-
|
|
233
|
-
|
|
220
|
+
onClick: PropTypes.func,
|
|
221
|
+
theme: PropTypes$1.viewerTheme
|
|
234
222
|
};
|
|
235
|
-
var defaultProps$
|
|
236
|
-
url: null,
|
|
237
|
-
title: null,
|
|
238
|
-
opened: false,
|
|
223
|
+
var defaultProps$k = {
|
|
239
224
|
className: null,
|
|
240
|
-
|
|
241
|
-
|
|
225
|
+
onClick: null,
|
|
226
|
+
theme: null
|
|
242
227
|
};
|
|
243
228
|
|
|
244
|
-
var
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
opened = _ref.opened,
|
|
250
|
-
className = _ref.className,
|
|
251
|
-
onShare = _ref.onShare,
|
|
252
|
-
onCancel = _ref.onCancel;
|
|
253
|
-
var modalRef = useRef();
|
|
254
|
-
var onDocumentClick = useCallback(function (e) {
|
|
255
|
-
var _ref2 = e || {},
|
|
256
|
-
target = _ref2.target;
|
|
257
|
-
|
|
258
|
-
if (!modalRef.current || modalRef.current.contains(target)) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
229
|
+
var MenuButton = function MenuButton(_ref) {
|
|
230
|
+
var className = _ref.className,
|
|
231
|
+
onClick = _ref.onClick,
|
|
232
|
+
theme = _ref.theme,
|
|
233
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
261
234
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
"
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
onClick:
|
|
284
|
-
|
|
285
|
-
}, /*#__PURE__*/React.createElement(Close, {
|
|
286
|
-
className: styles$c.closeIcon,
|
|
287
|
-
border: "none"
|
|
288
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
289
|
-
className: styles$c.content
|
|
290
|
-
}, /*#__PURE__*/React.createElement(ShareOptions, {
|
|
291
|
-
className: styles$c.shareOptions,
|
|
292
|
-
title: title,
|
|
293
|
-
url: url,
|
|
294
|
-
focusable: opened,
|
|
295
|
-
onShare: onShare,
|
|
296
|
-
onClose: onCancel
|
|
297
|
-
}))));
|
|
235
|
+
var intl = useIntl();
|
|
236
|
+
return /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
237
|
+
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
238
|
+
label: intl.formatMessage({
|
|
239
|
+
id: "F/gl4b",
|
|
240
|
+
defaultMessage: [{
|
|
241
|
+
"type": 0,
|
|
242
|
+
"value": "Menu"
|
|
243
|
+
}]
|
|
244
|
+
}),
|
|
245
|
+
iconPosition: "right",
|
|
246
|
+
icon: /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
247
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
248
|
+
width: "10",
|
|
249
|
+
height: "16",
|
|
250
|
+
viewBox: "0 0 10 16",
|
|
251
|
+
fill: "currentColor"
|
|
252
|
+
}, theme), /*#__PURE__*/React.createElement("rect", {
|
|
253
|
+
width: "10",
|
|
254
|
+
height: "16"
|
|
255
|
+
})),
|
|
256
|
+
onClick: onClick
|
|
257
|
+
}, props));
|
|
298
258
|
};
|
|
299
259
|
|
|
300
|
-
|
|
301
|
-
|
|
260
|
+
MenuButton.propTypes = propTypes$k;
|
|
261
|
+
MenuButton.defaultProps = defaultProps$k;
|
|
302
262
|
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
var propTypes$g = {
|
|
306
|
-
title: PropTypes.string,
|
|
307
|
-
url: PropTypes.string,
|
|
263
|
+
var _excluded$4 = ["className", "onClick", "theme"];
|
|
264
|
+
var propTypes$j = {
|
|
308
265
|
className: PropTypes.string,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
children: PropTypes.node,
|
|
312
|
-
focusable: PropTypes.bool
|
|
266
|
+
onClick: PropTypes.func,
|
|
267
|
+
theme: PropTypes$1.viewerTheme
|
|
313
268
|
};
|
|
314
|
-
var defaultProps$
|
|
315
|
-
title: null,
|
|
316
|
-
url: null,
|
|
269
|
+
var defaultProps$j = {
|
|
317
270
|
className: null,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
children: null,
|
|
321
|
-
focusable: false
|
|
271
|
+
onClick: null,
|
|
272
|
+
theme: null
|
|
322
273
|
};
|
|
323
274
|
|
|
324
275
|
var ShareButton = function ShareButton(_ref) {
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
onShare = _ref.onShare,
|
|
330
|
-
children = _ref.children,
|
|
331
|
-
focusable = _ref.focusable;
|
|
332
|
-
var intl = useIntl();
|
|
333
|
-
|
|
334
|
-
var _useState = useState(false),
|
|
335
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
336
|
-
storyShareModalOpened = _useState2[0],
|
|
337
|
-
setStoryShareModalOpened = _useState2[1];
|
|
338
|
-
|
|
339
|
-
var onShareIconClick = useCallback(function () {
|
|
340
|
-
setStoryShareModalOpened(function (opened) {
|
|
341
|
-
return !opened;
|
|
342
|
-
});
|
|
343
|
-
}, [setStoryShareModalOpened, storyShareModalOpened]);
|
|
344
|
-
var onStoryShared = useCallback(function (type) {
|
|
345
|
-
setStoryShareModalOpened(false);
|
|
276
|
+
var className = _ref.className,
|
|
277
|
+
onClick = _ref.onClick,
|
|
278
|
+
theme = _ref.theme,
|
|
279
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
346
280
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
var onStoryShareCanceled = useCallback(function () {
|
|
352
|
-
setStoryShareModalOpened(false);
|
|
353
|
-
}, [setStoryShareModalOpened]);
|
|
354
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
355
|
-
className: classNames([styles$b.container, _defineProperty({}, className, className !== null)])
|
|
356
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
357
|
-
className: classNames([_defineProperty({}, buttonClassName, buttonClassName !== null)]),
|
|
358
|
-
onClick: onShareIconClick,
|
|
359
|
-
title: intl.formatMessage({
|
|
360
|
-
id: "7tw6U2",
|
|
361
|
-
defaultMessage: [{
|
|
362
|
-
"type": 0,
|
|
363
|
-
"value": "Share"
|
|
364
|
-
}]
|
|
365
|
-
}),
|
|
366
|
-
"aria-label": intl.formatMessage({
|
|
281
|
+
var intl = useIntl();
|
|
282
|
+
return /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
283
|
+
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
284
|
+
label: intl.formatMessage({
|
|
367
285
|
id: "7tw6U2",
|
|
368
286
|
defaultMessage: [{
|
|
369
287
|
"type": 0,
|
|
370
288
|
"value": "Share"
|
|
371
289
|
}]
|
|
372
290
|
}),
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
291
|
+
iconPosition: "left",
|
|
292
|
+
icon: /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
293
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
294
|
+
width: "10",
|
|
295
|
+
height: "16",
|
|
296
|
+
viewBox: "0 0 10 16",
|
|
297
|
+
fill: "currentColor"
|
|
298
|
+
}, theme), /*#__PURE__*/React.createElement("polygon", {
|
|
299
|
+
points: "8.5 14.5 1.5 14.5 1.5 8 0 8 0 16 10 16 10 8 8.5 8 8.5 14.5"
|
|
300
|
+
}), /*#__PURE__*/React.createElement("polygon", {
|
|
301
|
+
points: "9.62 4.62 5 0 0.38 4.62 1.44 5.68 4.25 2.87 4.25 11.26 5.75 11.26 5.75 2.87 8.56 5.68 9.62 4.62"
|
|
302
|
+
})),
|
|
303
|
+
onClick: onClick
|
|
304
|
+
}, props));
|
|
382
305
|
};
|
|
383
306
|
|
|
384
|
-
ShareButton.propTypes = propTypes$
|
|
385
|
-
ShareButton.defaultProps = defaultProps$
|
|
307
|
+
ShareButton.propTypes = propTypes$j;
|
|
308
|
+
ShareButton.defaultProps = defaultProps$j;
|
|
386
309
|
|
|
387
|
-
var styles$
|
|
310
|
+
var styles$d = {"container":"micromag-viewer-menus-menu-container-container","heightContainer":"micromag-viewer-menus-menu-container-heightContainer","inner":"micromag-viewer-menus-menu-container-inner"};
|
|
388
311
|
|
|
389
|
-
var propTypes$
|
|
312
|
+
var propTypes$i = {
|
|
313
|
+
className: PropTypes.string,
|
|
314
|
+
transitionProgress: PropTypes.number,
|
|
315
|
+
children: PropTypes.node
|
|
316
|
+
};
|
|
317
|
+
var defaultProps$i = {
|
|
318
|
+
className: null,
|
|
319
|
+
transitionProgress: 0,
|
|
320
|
+
children: null
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
var ViewerMenuContainer = function ViewerMenuContainer(_ref) {
|
|
324
|
+
var className = _ref.className,
|
|
325
|
+
transitionProgress = _ref.transitionProgress,
|
|
326
|
+
children = _ref.children;
|
|
327
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
328
|
+
className: classNames([styles$d.container, _defineProperty({}, className, className !== null)]),
|
|
329
|
+
style: {
|
|
330
|
+
pointerEvents: 'none'
|
|
331
|
+
}
|
|
332
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
333
|
+
className: styles$d.heightContainer,
|
|
334
|
+
style: {
|
|
335
|
+
height: "".concat(transitionProgress * 100, "%"),
|
|
336
|
+
pointerEvents: transitionProgress < 0.25 ? 'none' : 'auto',
|
|
337
|
+
zIndex: Math.round(2 - transitionProgress)
|
|
338
|
+
}
|
|
339
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
340
|
+
className: styles$d.inner
|
|
341
|
+
}, children)));
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
ViewerMenuContainer.propTypes = propTypes$i;
|
|
345
|
+
ViewerMenuContainer.defaultProps = defaultProps$i;
|
|
346
|
+
|
|
347
|
+
var styles$c = {"button":"micromag-viewer-menus-menu-dot-button","progress":"micromag-viewer-menus-menu-dot-progress","dot":"micromag-viewer-menus-menu-dot-dot","container":"micromag-viewer-menus-menu-dot-container","vertical":"micromag-viewer-menus-menu-dot-vertical","subDot":"micromag-viewer-menus-menu-dot-subDot","dots":"micromag-viewer-menus-menu-dot-dots","outlineBounce":"micromag-viewer-menus-menu-dot-outlineBounce"};
|
|
348
|
+
|
|
349
|
+
var propTypes$h = {
|
|
390
350
|
current: PropTypes.bool,
|
|
391
351
|
active: PropTypes.bool,
|
|
392
352
|
colors: PropTypes.shape({
|
|
@@ -399,7 +359,7 @@ var propTypes$f = {
|
|
|
399
359
|
onClick: PropTypes.func,
|
|
400
360
|
className: PropTypes.string
|
|
401
361
|
};
|
|
402
|
-
var defaultProps$
|
|
362
|
+
var defaultProps$h = {
|
|
403
363
|
current: false,
|
|
404
364
|
active: false,
|
|
405
365
|
colors: null,
|
|
@@ -421,130 +381,67 @@ var ViewerMenuDot = function ViewerMenuDot(_ref) {
|
|
|
421
381
|
vertical = _ref.vertical,
|
|
422
382
|
onClick = _ref.onClick,
|
|
423
383
|
className = _ref.className;
|
|
424
|
-
var currentTime = 0;
|
|
425
|
-
var duration = 1;
|
|
426
|
-
var playing = true;
|
|
427
384
|
|
|
428
385
|
var _ref2 = colors || {},
|
|
429
386
|
_ref2$primary = _ref2.primary,
|
|
430
387
|
primary = _ref2$primary === void 0 ? 'rgba(255, 255, 255, 1)' : _ref2$primary,
|
|
431
388
|
_ref2$secondary = _ref2.secondary,
|
|
432
|
-
secondary = _ref2$secondary === void 0 ? 'rgba(
|
|
433
|
-
|
|
389
|
+
secondary = _ref2$secondary === void 0 ? 'rgba(255, 255, 255, 0.25)' : _ref2$secondary;
|
|
434
390
|
|
|
435
391
|
var _useSpring = useSpring(function () {
|
|
436
392
|
return {
|
|
437
|
-
|
|
393
|
+
scaleX: 0,
|
|
438
394
|
config: {
|
|
439
|
-
|
|
395
|
+
tension: 200,
|
|
396
|
+
friction: 30
|
|
440
397
|
}
|
|
441
398
|
};
|
|
442
399
|
}),
|
|
443
|
-
_useSpring2 = _slicedToArray(_useSpring, 2)
|
|
444
|
-
_useSpring2[0]
|
|
445
|
-
|
|
400
|
+
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
401
|
+
dotSpringStyles = _useSpring2[0],
|
|
402
|
+
setDotSpringProps = _useSpring2[1];
|
|
446
403
|
|
|
447
404
|
useEffect(function () {
|
|
448
|
-
|
|
449
|
-
var
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
x: progress
|
|
455
|
-
},
|
|
456
|
-
to: {
|
|
457
|
-
x: 1
|
|
458
|
-
},
|
|
459
|
-
config: {
|
|
460
|
-
duration: (duration - currentTime) * 1000
|
|
461
|
-
}
|
|
405
|
+
var activeRatio = active ? 1 : 0;
|
|
406
|
+
var ratio = count > 1 && current ? (subIndex + 1) / count : activeRatio;
|
|
407
|
+
var scaleX = ratio;
|
|
408
|
+
setDotSpringProps.start({
|
|
409
|
+
scaleX: scaleX,
|
|
410
|
+
immediate: !current
|
|
462
411
|
});
|
|
463
|
-
}, [
|
|
464
|
-
var inner = current && count > 1 ? /*#__PURE__*/React.createElement("span", {
|
|
465
|
-
className: styles$a.dots
|
|
466
|
-
}, _toConsumableArray(Array(count).keys()).map(function (i) {
|
|
467
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
468
|
-
className: classNames([styles$a.dot, styles$a.subDot]),
|
|
469
|
-
style: {
|
|
470
|
-
width: "".concat(parseFloat(1 / count * 100).toFixed(2), "%"),
|
|
471
|
-
backgroundColor: active && i <= subIndex ? primary : secondary
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
})) : /*#__PURE__*/React.createElement("span", {
|
|
475
|
-
className: styles$a.dot,
|
|
476
|
-
style: {
|
|
477
|
-
backgroundColor: active ? primary : secondary
|
|
478
|
-
}
|
|
479
|
-
});
|
|
412
|
+
}, [active, current, subIndex, count, setDotSpringProps]);
|
|
480
413
|
return /*#__PURE__*/React.createElement("li", {
|
|
481
|
-
className: classNames([styles$
|
|
414
|
+
className: classNames([styles$c.container, (_ref3 = {}, _defineProperty(_ref3, styles$c.active, current), _defineProperty(_ref3, styles$c.vertical, vertical), _defineProperty(_ref3, className, className !== null), _ref3)]),
|
|
482
415
|
"aria-hidden": "true"
|
|
483
416
|
}, /*#__PURE__*/React.createElement("button", {
|
|
484
417
|
type: "button",
|
|
485
|
-
className: styles$
|
|
418
|
+
className: styles$c.button,
|
|
486
419
|
onClick: onClick,
|
|
487
420
|
tabIndex: "-1"
|
|
488
|
-
},
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
color: PropTypes.string,
|
|
500
|
-
className: PropTypes.string
|
|
501
|
-
};
|
|
502
|
-
var defaultProps$e = {
|
|
503
|
-
size: 100,
|
|
504
|
-
spacing: 8,
|
|
505
|
-
color: 'white',
|
|
506
|
-
className: null
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
var MenuIcon = function MenuIcon(_ref) {
|
|
510
|
-
var size = _ref.size,
|
|
511
|
-
spacing = _ref.spacing,
|
|
512
|
-
color = _ref.color,
|
|
513
|
-
className = _ref.className;
|
|
514
|
-
var squareSize = (size - 2 * spacing) / 3;
|
|
515
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
516
|
-
className: classNames([styles$9.container, _defineProperty({}, className, className !== null)]),
|
|
517
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
518
|
-
viewBox: "0 0 ".concat(size, " ").concat(size),
|
|
519
|
-
"aria-hidden": "true"
|
|
520
|
-
}, _toConsumableArray(new Array(9)).map(function (square, squareI) {
|
|
521
|
-
var x = squareI % 3 * (squareSize + spacing);
|
|
522
|
-
var y = Math.floor(squareI / 3) * (squareSize + spacing);
|
|
523
|
-
return /*#__PURE__*/React.createElement("rect", {
|
|
524
|
-
key: "square-".concat(squareI),
|
|
525
|
-
fill: color,
|
|
526
|
-
x: x,
|
|
527
|
-
y: y,
|
|
528
|
-
width: squareSize,
|
|
529
|
-
height: squareSize
|
|
530
|
-
});
|
|
531
|
-
}));
|
|
421
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
422
|
+
className: styles$c.dot,
|
|
423
|
+
style: {
|
|
424
|
+
backgroundColor: secondary
|
|
425
|
+
}
|
|
426
|
+
}, /*#__PURE__*/React.createElement(animated.div, {
|
|
427
|
+
className: styles$c.progress,
|
|
428
|
+
style: _objectSpread(_objectSpread({}, dotSpringStyles), {}, {
|
|
429
|
+
backgroundColor: primary
|
|
430
|
+
})
|
|
431
|
+
}))));
|
|
532
432
|
};
|
|
533
433
|
|
|
534
|
-
|
|
535
|
-
|
|
434
|
+
ViewerMenuDot.propTypes = propTypes$h;
|
|
435
|
+
ViewerMenuDot.defaultProps = defaultProps$h;
|
|
536
436
|
|
|
537
|
-
var styles$
|
|
437
|
+
var styles$b = {"container":"micromag-viewer-menus-menu-dots-container","closeButton":"micromag-viewer-menus-menu-dots-closeButton","item":"micromag-viewer-menus-menu-dots-item","items":"micromag-viewer-menus-menu-dots-items","vertical":"micromag-viewer-menus-menu-dots-vertical"};
|
|
538
438
|
|
|
539
|
-
var
|
|
439
|
+
var _excluded$3 = ["direction", "items", "onClickDot", "onClickScreensMenu", "colors", "closeable", "withItemClick", "withoutScreensMenu", "onClose", "className"];
|
|
440
|
+
var propTypes$g = {
|
|
540
441
|
direction: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
541
|
-
withShadow: PropTypes.bool,
|
|
542
|
-
title: PropTypes.string,
|
|
543
442
|
items: PropTypes$1.menuItems,
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
onClickItem: PropTypes.func,
|
|
547
|
-
onClickMenu: PropTypes.func,
|
|
443
|
+
onClickDot: PropTypes.func,
|
|
444
|
+
onClickScreensMenu: PropTypes.func,
|
|
548
445
|
colors: PropTypes.shape({
|
|
549
446
|
primary: PropTypes.string,
|
|
550
447
|
secondary: PropTypes.string
|
|
@@ -552,46 +449,36 @@ var propTypes$d = {
|
|
|
552
449
|
closeable: PropTypes.bool,
|
|
553
450
|
withItemClick: PropTypes.bool,
|
|
554
451
|
withoutScreensMenu: PropTypes.bool,
|
|
555
|
-
withoutShareMenu: PropTypes.bool,
|
|
556
452
|
onClose: PropTypes.func,
|
|
557
453
|
className: PropTypes.string
|
|
558
454
|
};
|
|
559
|
-
var defaultProps$
|
|
455
|
+
var defaultProps$g = {
|
|
560
456
|
direction: 'horizontal',
|
|
561
|
-
withShadow: false,
|
|
562
|
-
title: null,
|
|
563
457
|
items: [],
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
onClickItem: null,
|
|
567
|
-
onClickMenu: null,
|
|
458
|
+
onClickDot: null,
|
|
459
|
+
onClickScreensMenu: null,
|
|
568
460
|
colors: null,
|
|
569
461
|
closeable: false,
|
|
570
462
|
withItemClick: false,
|
|
571
463
|
withoutScreensMenu: false,
|
|
572
|
-
withoutShareMenu: false,
|
|
573
464
|
onClose: null,
|
|
574
465
|
className: null
|
|
575
466
|
};
|
|
576
467
|
|
|
577
468
|
var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
578
|
-
var
|
|
469
|
+
var _ref5;
|
|
579
470
|
|
|
580
471
|
var direction = _ref.direction,
|
|
581
|
-
withShadow = _ref.withShadow,
|
|
582
|
-
title = _ref.title,
|
|
583
472
|
items = _ref.items,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
onClickItem = _ref.onClickItem,
|
|
587
|
-
onClickMenu = _ref.onClickMenu,
|
|
473
|
+
onClickDot = _ref.onClickDot,
|
|
474
|
+
onClickScreensMenu = _ref.onClickScreensMenu,
|
|
588
475
|
colors = _ref.colors,
|
|
589
476
|
closeable = _ref.closeable,
|
|
590
477
|
withItemClick = _ref.withItemClick,
|
|
591
478
|
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
592
|
-
withoutShareMenu = _ref.withoutShareMenu,
|
|
593
479
|
onClose = _ref.onClose,
|
|
594
|
-
className = _ref.className
|
|
480
|
+
className = _ref.className,
|
|
481
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
595
482
|
|
|
596
483
|
var _ref2 = colors || {},
|
|
597
484
|
_ref2$primary = _ref2.primary,
|
|
@@ -603,8 +490,12 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
603
490
|
current = _ref3$current === void 0 ? false : _ref3$current;
|
|
604
491
|
return current;
|
|
605
492
|
});
|
|
493
|
+
|
|
494
|
+
var _ref4 = props || {},
|
|
495
|
+
style = _ref4.style;
|
|
496
|
+
|
|
606
497
|
return /*#__PURE__*/React.createElement("nav", {
|
|
607
|
-
className: classNames([styles$
|
|
498
|
+
className: classNames([styles$b.container, (_ref5 = {}, _defineProperty(_ref5, className, className !== null), _defineProperty(_ref5, styles$b.vertical, direction === 'vertical'), _ref5)]),
|
|
608
499
|
"aria-label": intl.formatMessage({
|
|
609
500
|
id: "bLYuuN",
|
|
610
501
|
defaultMessage: [{
|
|
@@ -626,17 +517,18 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
626
517
|
}, {
|
|
627
518
|
current: currentIndex + 1,
|
|
628
519
|
total: items.length
|
|
629
|
-
})
|
|
520
|
+
}),
|
|
521
|
+
style: style
|
|
630
522
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
631
|
-
className: styles$
|
|
523
|
+
className: styles$b.items
|
|
632
524
|
}, items.map(function (item, index) {
|
|
633
|
-
var
|
|
634
|
-
|
|
635
|
-
current =
|
|
636
|
-
|
|
637
|
-
count =
|
|
638
|
-
|
|
639
|
-
subIndex =
|
|
525
|
+
var _ref6 = item || {},
|
|
526
|
+
_ref6$current = _ref6.current,
|
|
527
|
+
current = _ref6$current === void 0 ? false : _ref6$current,
|
|
528
|
+
_ref6$count = _ref6.count,
|
|
529
|
+
count = _ref6$count === void 0 ? 1 : _ref6$count,
|
|
530
|
+
_ref6$subIndex = _ref6.subIndex,
|
|
531
|
+
subIndex = _ref6$subIndex === void 0 ? 0 : _ref6$subIndex;
|
|
640
532
|
|
|
641
533
|
return /*#__PURE__*/React.createElement(ViewerMenuDot, {
|
|
642
534
|
key: "item-".concat(index + 1),
|
|
@@ -646,56 +538,22 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
646
538
|
count: count,
|
|
647
539
|
subIndex: subIndex,
|
|
648
540
|
onClick: function onClick() {
|
|
649
|
-
if ((withItemClick || withoutScreensMenu) &&
|
|
650
|
-
|
|
651
|
-
} else if (!withItemClick &&
|
|
652
|
-
|
|
541
|
+
if ((withItemClick || withoutScreensMenu) && onClickDot !== null) {
|
|
542
|
+
onClickDot(item);
|
|
543
|
+
} else if (!withItemClick && onClickScreensMenu !== null) {
|
|
544
|
+
onClickScreensMenu();
|
|
653
545
|
}
|
|
654
546
|
},
|
|
655
547
|
vertical: direction === 'vertical'
|
|
656
548
|
});
|
|
657
|
-
}),
|
|
658
|
-
className: styles$
|
|
659
|
-
}, /*#__PURE__*/React.createElement(ShareButton, {
|
|
660
|
-
className: styles$8.shareButton,
|
|
661
|
-
buttonClassName: styles$8.menuButton,
|
|
662
|
-
onShare: onShare,
|
|
663
|
-
url: shareUrl,
|
|
664
|
-
title: title
|
|
665
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
666
|
-
className: styles$8.icon,
|
|
667
|
-
icon: faShare
|
|
668
|
-
}))) : null, !withoutScreensMenu ? /*#__PURE__*/React.createElement("li", {
|
|
669
|
-
className: styles$8.menu
|
|
670
|
-
}, /*#__PURE__*/React.createElement(MenuIcon, {
|
|
671
|
-
className: styles$8.menuIcon,
|
|
672
|
-
color: primary
|
|
673
|
-
}), /*#__PURE__*/React.createElement("button", {
|
|
674
|
-
type: "button",
|
|
675
|
-
title: intl.formatMessage({
|
|
676
|
-
id: "F/gl4b",
|
|
677
|
-
defaultMessage: [{
|
|
678
|
-
"type": 0,
|
|
679
|
-
"value": "Menu"
|
|
680
|
-
}]
|
|
681
|
-
}),
|
|
682
|
-
"aria-label": intl.formatMessage({
|
|
683
|
-
id: "F/gl4b",
|
|
684
|
-
defaultMessage: [{
|
|
685
|
-
"type": 0,
|
|
686
|
-
"value": "Menu"
|
|
687
|
-
}]
|
|
688
|
-
}),
|
|
689
|
-
className: styles$8.menuButton,
|
|
690
|
-
onClick: onClickMenu
|
|
691
|
-
})) : null, closeable ? /*#__PURE__*/React.createElement("li", {
|
|
692
|
-
className: styles$8.closeButton,
|
|
549
|
+
}), closeable ? /*#__PURE__*/React.createElement("li", {
|
|
550
|
+
className: styles$b.closeButton,
|
|
693
551
|
style: {
|
|
694
552
|
color: primary
|
|
695
553
|
}
|
|
696
554
|
}, /*#__PURE__*/React.createElement("button", {
|
|
697
555
|
type: "button",
|
|
698
|
-
className: styles$
|
|
556
|
+
className: styles$b.closeButton,
|
|
699
557
|
onClick: onClose,
|
|
700
558
|
title: intl.formatMessage({
|
|
701
559
|
id: "dj/p/q",
|
|
@@ -716,64 +574,159 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
716
574
|
}))) : null));
|
|
717
575
|
};
|
|
718
576
|
|
|
719
|
-
ViewerMenuDots.propTypes = propTypes$
|
|
720
|
-
ViewerMenuDots.defaultProps = defaultProps$
|
|
577
|
+
ViewerMenuDots.propTypes = propTypes$g;
|
|
578
|
+
ViewerMenuDots.defaultProps = defaultProps$g;
|
|
721
579
|
|
|
722
|
-
var propTypes$
|
|
580
|
+
var propTypes$f = {
|
|
723
581
|
className: PropTypes.string
|
|
724
582
|
};
|
|
725
|
-
var defaultProps$
|
|
583
|
+
var defaultProps$f = {
|
|
726
584
|
className: null
|
|
727
585
|
};
|
|
728
586
|
|
|
729
587
|
var StackIcon = function StackIcon(_ref) {
|
|
730
588
|
var className = _ref.className;
|
|
731
589
|
return /*#__PURE__*/React.createElement("svg", {
|
|
732
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
590
|
+
xmlns: "http://www.w3.org/2000/svg" // width="32"
|
|
591
|
+
// height="32"
|
|
592
|
+
// viewBox="0 0 32 32"
|
|
593
|
+
,
|
|
594
|
+
width: "11.5",
|
|
595
|
+
height: "17.5",
|
|
596
|
+
viewBox: "0 0 11.5 17.5",
|
|
736
597
|
className: classNames([_defineProperty({}, className, className !== null)])
|
|
737
|
-
}, /*#__PURE__*/React.createElement("
|
|
738
|
-
|
|
598
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
599
|
+
width: "10",
|
|
600
|
+
height: "16"
|
|
601
|
+
}), /*#__PURE__*/React.createElement("polygon", {
|
|
602
|
+
points: "10.5 1.5 10.5 16.5 1.5 16.5 1.5 17.5 11.5 17.5 11.5 1.5 10.5 1.5"
|
|
739
603
|
}));
|
|
740
604
|
};
|
|
741
605
|
|
|
742
|
-
StackIcon.propTypes = propTypes$
|
|
743
|
-
StackIcon.defaultProps = defaultProps$
|
|
606
|
+
StackIcon.propTypes = propTypes$f;
|
|
607
|
+
StackIcon.defaultProps = defaultProps$f;
|
|
744
608
|
|
|
745
|
-
var styles$
|
|
609
|
+
var styles$a = {"button":"micromag-viewer-menus-menu-screen-button","container":"micromag-viewer-menus-menu-screen-container","isCurrent":"micromag-viewer-menus-menu-screen-isCurrent","pulse":"micromag-viewer-menus-menu-screen-pulse","inner":"micromag-viewer-menus-menu-screen-inner","subScreenBadge":"micromag-viewer-menus-menu-screen-subScreenBadge","subScreenCount":"micromag-viewer-menus-menu-screen-subScreenCount","subScreenIcon":"micromag-viewer-menus-menu-screen-subScreenIcon"};
|
|
746
610
|
|
|
747
|
-
var propTypes$
|
|
611
|
+
var propTypes$e = {
|
|
612
|
+
className: PropTypes.string,
|
|
613
|
+
item: PropTypes$1.menuItem,
|
|
614
|
+
index: PropTypes.number,
|
|
615
|
+
onClick: PropTypes.func,
|
|
616
|
+
screenSize: PropTypes$1.screenSize,
|
|
617
|
+
focusable: PropTypes.bool
|
|
618
|
+
};
|
|
619
|
+
var defaultProps$e = {
|
|
620
|
+
className: null,
|
|
621
|
+
item: PropTypes$1.menuItem,
|
|
622
|
+
index: 0,
|
|
623
|
+
onClick: null,
|
|
624
|
+
screenSize: null,
|
|
625
|
+
focusable: true
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
var ViewerMenuScreen = function ViewerMenuScreen(_ref) {
|
|
629
|
+
var _ref4;
|
|
630
|
+
|
|
631
|
+
var className = _ref.className,
|
|
632
|
+
item = _ref.item,
|
|
633
|
+
index = _ref.index,
|
|
634
|
+
_onClick = _ref.onClick,
|
|
635
|
+
screenSize = _ref.screenSize,
|
|
636
|
+
focusable = _ref.focusable;
|
|
637
|
+
var intl = useIntl();
|
|
638
|
+
|
|
639
|
+
var _ref2 = item || {},
|
|
640
|
+
_ref2$current = _ref2.current,
|
|
641
|
+
current = _ref2$current === void 0 ? false : _ref2$current,
|
|
642
|
+
screen = _ref2.screen,
|
|
643
|
+
_ref2$count = _ref2.count,
|
|
644
|
+
count = _ref2$count === void 0 ? 1 : _ref2$count;
|
|
645
|
+
|
|
646
|
+
var _ref3 = screenSize || {},
|
|
647
|
+
screenWidth = _ref3.width,
|
|
648
|
+
screenHeight = _ref3.height;
|
|
649
|
+
|
|
650
|
+
var screenAriaLabel = "".concat(intl.formatMessage({
|
|
651
|
+
id: "LkVfwW",
|
|
652
|
+
defaultMessage: [{
|
|
653
|
+
"type": 0,
|
|
654
|
+
"value": "Screen "
|
|
655
|
+
}, {
|
|
656
|
+
"type": 1,
|
|
657
|
+
"value": "index"
|
|
658
|
+
}]
|
|
659
|
+
}, {
|
|
660
|
+
index: index + 1
|
|
661
|
+
})).concat(current ? " ".concat(intl.formatMessage({
|
|
662
|
+
id: "vmrJ8U",
|
|
663
|
+
defaultMessage: [{
|
|
664
|
+
"type": 0,
|
|
665
|
+
"value": "(current screen)"
|
|
666
|
+
}]
|
|
667
|
+
})) : '');
|
|
668
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
669
|
+
className: classNames([styles$a.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$a.isCurrent, current), _ref4)])
|
|
670
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
671
|
+
type: "button",
|
|
672
|
+
className: styles$a.button,
|
|
673
|
+
onClick: function onClick() {
|
|
674
|
+
if (_onClick !== null) {
|
|
675
|
+
_onClick(item);
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
"aria-label": screenAriaLabel,
|
|
679
|
+
tabIndex: focusable ? '0' : '-1'
|
|
680
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
681
|
+
className: styles$a.inner
|
|
682
|
+
}, count > 1 ? /*#__PURE__*/React.createElement("div", {
|
|
683
|
+
className: styles$a.subScreenBadge
|
|
684
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
685
|
+
className: styles$a.subScreenCount
|
|
686
|
+
}, count), /*#__PURE__*/React.createElement(StackIcon, {
|
|
687
|
+
className: styles$a.subScreenIcon
|
|
688
|
+
})) : null, screenWidth > 0 && screenHeight > 0 ? /*#__PURE__*/React.createElement(ScreenPreview, {
|
|
689
|
+
className: styles$a.screen,
|
|
690
|
+
screenWidth: screenWidth,
|
|
691
|
+
screenHeight: screenHeight,
|
|
692
|
+
screen: screen,
|
|
693
|
+
focusable: focusable,
|
|
694
|
+
active: focusable,
|
|
695
|
+
withSize: true
|
|
696
|
+
}) : null));
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
ViewerMenuScreen.propTypes = propTypes$e;
|
|
700
|
+
ViewerMenuScreen.defaultProps = defaultProps$e;
|
|
701
|
+
|
|
702
|
+
var styles$9 = {"scroll":"micromag-viewer-menus-menu-preview-scroll","container":"micromag-viewer-menus-menu-preview-container","disabled":"micromag-viewer-menus-menu-preview-disabled","screenButton":"micromag-viewer-menus-menu-preview-screenButton","buttons":"micromag-viewer-menus-menu-preview-buttons","organisation":"micromag-viewer-menus-menu-preview-organisation","icon":"micromag-viewer-menus-menu-preview-icon","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"};
|
|
703
|
+
|
|
704
|
+
var propTypes$d = {
|
|
748
705
|
viewerTheme: PropTypes$1.viewerTheme,
|
|
749
706
|
screenSize: PropTypes$1.screenSize,
|
|
750
707
|
menuWidth: PropTypes.number,
|
|
751
|
-
title: PropTypes.string,
|
|
752
708
|
items: PropTypes$1.menuItems,
|
|
753
709
|
focusable: PropTypes.bool,
|
|
754
|
-
|
|
755
|
-
onClickItem: PropTypes.func,
|
|
756
|
-
onClose: PropTypes.func,
|
|
710
|
+
onClickScreen: PropTypes.func,
|
|
757
711
|
maxThumbsWidth: PropTypes.number,
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
712
|
+
// shouldLoad: PropTypes.bool, // @todo still needed? to re-implement?
|
|
713
|
+
// toggleFullscreen: PropTypes.func,
|
|
714
|
+
// fullscreenActive: PropTypes.bool,
|
|
715
|
+
// fullscreenEnabled: PropTypes.bool,
|
|
761
716
|
className: PropTypes.string
|
|
762
717
|
};
|
|
763
|
-
var defaultProps$
|
|
718
|
+
var defaultProps$d = {
|
|
764
719
|
viewerTheme: null,
|
|
765
720
|
screenSize: null,
|
|
766
721
|
menuWidth: null,
|
|
767
|
-
title: null,
|
|
768
722
|
items: [],
|
|
769
723
|
focusable: true,
|
|
770
|
-
shouldLoad: true,
|
|
771
|
-
|
|
772
|
-
onClose: null,
|
|
724
|
+
// shouldLoad: true,
|
|
725
|
+
onClickScreen: null,
|
|
773
726
|
maxThumbsWidth: 140,
|
|
774
|
-
toggleFullscreen: null,
|
|
775
|
-
fullscreenActive: false,
|
|
776
|
-
fullscreenEnabled: false,
|
|
727
|
+
// toggleFullscreen: null,
|
|
728
|
+
// fullscreenActive: false,
|
|
729
|
+
// fullscreenEnabled: false,
|
|
777
730
|
className: null
|
|
778
731
|
};
|
|
779
732
|
|
|
@@ -781,259 +734,313 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
781
734
|
var viewerTheme = _ref.viewerTheme,
|
|
782
735
|
screenSize = _ref.screenSize,
|
|
783
736
|
menuWidth = _ref.menuWidth,
|
|
784
|
-
title = _ref.title,
|
|
785
737
|
items = _ref.items,
|
|
786
738
|
focusable = _ref.focusable,
|
|
787
|
-
|
|
788
|
-
onClose = _ref.onClose,
|
|
739
|
+
onClickScreen = _ref.onClickScreen,
|
|
789
740
|
maxThumbsWidth = _ref.maxThumbsWidth,
|
|
790
|
-
toggleFullscreen = _ref.toggleFullscreen,
|
|
791
|
-
fullscreenActive = _ref.fullscreenActive,
|
|
792
|
-
fullscreenEnabled = _ref.fullscreenEnabled,
|
|
793
741
|
className = _ref.className;
|
|
794
|
-
var intl = useIntl();
|
|
795
|
-
|
|
796
|
-
var _ref2 = screenSize || {},
|
|
797
|
-
screenWidth = _ref2.width,
|
|
798
|
-
screenHeight = _ref2.height;
|
|
799
742
|
|
|
800
743
|
var _useDimensionObserver = useDimensionObserver(),
|
|
801
|
-
|
|
744
|
+
containerRef = _useDimensionObserver.ref,
|
|
802
745
|
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
var _useDimensionObserver3 = useDimensionObserver(),
|
|
806
|
-
containerRef = _useDimensionObserver3.ref,
|
|
807
|
-
_useDimensionObserver4 = _useDimensionObserver3.width,
|
|
808
|
-
contentWidth = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
746
|
+
contentWidth = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
809
747
|
|
|
810
748
|
var thumbsPerLine = Math.max(Math.floor(contentWidth / maxThumbsWidth), 3); // Viewer theme
|
|
749
|
+
// @todo room for improvement here probably
|
|
750
|
+
// @todo also re-implement!!
|
|
811
751
|
|
|
812
|
-
var
|
|
813
|
-
|
|
814
|
-
colors =
|
|
815
|
-
|
|
816
|
-
background =
|
|
817
|
-
|
|
818
|
-
textStyles = _ref3$textStyles === void 0 ? null : _ref3$textStyles,
|
|
819
|
-
_ref3$logo = _ref3.logo,
|
|
820
|
-
brandLogo = _ref3$logo === void 0 ? null : _ref3$logo;
|
|
821
|
-
|
|
822
|
-
var _ref4 = textStyles || {},
|
|
823
|
-
_ref4$title = _ref4.title,
|
|
824
|
-
brandTextStyle = _ref4$title === void 0 ? null : _ref4$title;
|
|
752
|
+
var _ref2 = viewerTheme || {},
|
|
753
|
+
_ref2$colors = _ref2.colors,
|
|
754
|
+
colors = _ref2$colors === void 0 ? null : _ref2$colors,
|
|
755
|
+
_ref2$background = _ref2.background,
|
|
756
|
+
background = _ref2$background === void 0 ? null : _ref2$background;
|
|
757
|
+
_ref2.logo;
|
|
825
758
|
|
|
826
|
-
var
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
_ref5$secondary = _ref5.secondary,
|
|
830
|
-
brandSecondaryColor = _ref5$secondary === void 0 ? null : _ref5$secondary;
|
|
759
|
+
var _ref3 = colors || {};
|
|
760
|
+
_ref3.primary;
|
|
761
|
+
_ref3.secondary;
|
|
831
762
|
|
|
832
|
-
var
|
|
833
|
-
|
|
834
|
-
brandBackgroundColor =
|
|
835
|
-
|
|
836
|
-
image =
|
|
763
|
+
var _ref4 = background || {},
|
|
764
|
+
_ref4$color = _ref4.color,
|
|
765
|
+
brandBackgroundColor = _ref4$color === void 0 ? null : _ref4$color,
|
|
766
|
+
_ref4$image = _ref4.image,
|
|
767
|
+
image = _ref4$image === void 0 ? null : _ref4$image;
|
|
837
768
|
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
brandImageUrl =
|
|
769
|
+
var _ref5 = image || {},
|
|
770
|
+
_ref5$url = _ref5.url,
|
|
771
|
+
brandImageUrl = _ref5$url === void 0 ? null : _ref5$url; // const borderPrimaryColorStyle = getStyleFromColor(brandPrimaryColor, 'borderColor');
|
|
772
|
+
// const colorSecondaryColorStyle = getStyleFromColor(brandSecondaryColor, 'color');
|
|
841
773
|
|
|
842
|
-
var borderPrimaryColorStyle = getStyleFromColor(brandPrimaryColor, 'borderColor');
|
|
843
|
-
var colorSecondaryColorStyle = getStyleFromColor(brandSecondaryColor, 'color');
|
|
844
|
-
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor');
|
|
845
774
|
|
|
846
|
-
var
|
|
847
|
-
_ref8$url = _ref8.url,
|
|
848
|
-
brandLogoUrl = _ref8$url === void 0 ? null : _ref8$url;
|
|
775
|
+
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor'); // const { url: brandLogoUrl = null } = brandLogo || {};
|
|
849
776
|
|
|
850
777
|
var brandImageStyle = brandImageUrl !== null ? {
|
|
851
778
|
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
852
|
-
} : null;
|
|
853
|
-
var titleStyle = brandTextStyle !== null ? getStyleFromText(brandTextStyle) : null;
|
|
779
|
+
} : null; // @todo could probably use some work to avoid the visual jump from 3 screens to all of them
|
|
854
780
|
|
|
855
|
-
var _useState = useState(false),
|
|
856
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
857
|
-
scrolledBottom = _useState2[0],
|
|
858
|
-
setScrolledBottom = _useState2[1];
|
|
859
|
-
|
|
860
|
-
var dragBind = useDrag(function (_ref9) {
|
|
861
|
-
var _ref9$direction = _slicedToArray(_ref9.direction, 2),
|
|
862
|
-
dy = _ref9$direction[1],
|
|
863
|
-
last = _ref9.last,
|
|
864
|
-
tap = _ref9.tap;
|
|
865
|
-
|
|
866
|
-
if (!tap && last && scrolledBottom && dy < 0 && onClose !== null) {
|
|
867
|
-
onClose();
|
|
868
|
-
}
|
|
869
|
-
}, {
|
|
870
|
-
filterTaps: true,
|
|
871
|
-
eventOptions: {
|
|
872
|
-
capture: true
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
var onScrolledBottom = useCallback(function () {
|
|
876
|
-
setScrolledBottom(true);
|
|
877
|
-
}, [setScrolledBottom]);
|
|
878
|
-
var onScrolledNotBottom = useCallback(function () {
|
|
879
|
-
setScrolledBottom(false);
|
|
880
|
-
}, [setScrolledBottom]);
|
|
881
781
|
var finalItems = useMemo(function () {
|
|
882
|
-
return !focusable ? items.
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
782
|
+
return !focusable ? items.map(function (s, i) {
|
|
783
|
+
return i > 3 ? {
|
|
784
|
+
screenId: s.screenId
|
|
785
|
+
} : s;
|
|
786
|
+
}) : items;
|
|
787
|
+
}, [items, focusable]); // @todo bookmarks
|
|
788
|
+
// const bookmarks = finalItems.reduce((acc, it) => {
|
|
789
|
+
// const { screen = null } = it || {};
|
|
790
|
+
// const { bookmark = null } = screen || {};
|
|
791
|
+
// return bookmark !== null ? [...acc, bookmark] : acc; // merge with array or return original array
|
|
792
|
+
// }, []);
|
|
793
|
+
|
|
794
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
795
|
+
className: classNames([styles$9.container, _defineProperty({}, className, className !== null)]),
|
|
886
796
|
style: _objectSpread(_objectSpread(_objectSpread({}, backgroundColorStyle), brandImageStyle), {}, {
|
|
887
797
|
width: menuWidth
|
|
888
798
|
}),
|
|
889
799
|
"aria-hidden": focusable ? null : 'true'
|
|
890
|
-
},
|
|
891
|
-
className: styles$
|
|
892
|
-
}, brandLogoUrl !== null ? /*#__PURE__*/React.createElement("div", {
|
|
893
|
-
className: styles$7.organisation,
|
|
894
|
-
style: {
|
|
895
|
-
backgroundImage: "url(".concat(brandLogoUrl, ")")
|
|
896
|
-
}
|
|
897
|
-
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
898
|
-
className: styles$7.title,
|
|
899
|
-
style: titleStyle
|
|
900
|
-
}, title), /*#__PURE__*/React.createElement("div", {
|
|
901
|
-
className: styles$7.buttons,
|
|
902
|
-
style: colorSecondaryColorStyle
|
|
903
|
-
}, fullscreenEnabled ? /*#__PURE__*/React.createElement(Button, {
|
|
904
|
-
className: styles$7.button,
|
|
905
|
-
onClick: toggleFullscreen,
|
|
906
|
-
title: intl.formatMessage({
|
|
907
|
-
id: "AuxqcG",
|
|
908
|
-
defaultMessage: [{
|
|
909
|
-
"type": 0,
|
|
910
|
-
"value": "Fullscreen"
|
|
911
|
-
}]
|
|
912
|
-
}),
|
|
913
|
-
"aria-label": intl.formatMessage({
|
|
914
|
-
id: "AuxqcG",
|
|
915
|
-
defaultMessage: [{
|
|
916
|
-
"type": 0,
|
|
917
|
-
"value": "Fullscreen"
|
|
918
|
-
}]
|
|
919
|
-
}),
|
|
920
|
-
focusable: focusable
|
|
921
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
922
|
-
className: styles$7.icon,
|
|
923
|
-
icon: fullscreenActive ? faCompress : faExpand
|
|
924
|
-
})) : null, /*#__PURE__*/React.createElement(Button, {
|
|
925
|
-
className: styles$7.button,
|
|
926
|
-
onClick: onClose,
|
|
927
|
-
title: intl.formatMessage({
|
|
928
|
-
id: "dj/p/q",
|
|
929
|
-
defaultMessage: [{
|
|
930
|
-
"type": 0,
|
|
931
|
-
"value": "Close"
|
|
932
|
-
}]
|
|
933
|
-
}),
|
|
934
|
-
"aria-label": intl.formatMessage({
|
|
935
|
-
id: "dj/p/q",
|
|
936
|
-
defaultMessage: [{
|
|
937
|
-
"type": 0,
|
|
938
|
-
"value": "Close"
|
|
939
|
-
}]
|
|
940
|
-
}),
|
|
941
|
-
focusable: focusable
|
|
942
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
943
|
-
className: styles$7.icon,
|
|
944
|
-
icon: faTimes
|
|
945
|
-
})))), /*#__PURE__*/React.createElement("div", {
|
|
946
|
-
className: styles$7.content,
|
|
800
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
801
|
+
className: styles$9.content,
|
|
947
802
|
ref: containerRef
|
|
948
803
|
}, /*#__PURE__*/React.createElement(Scroll, {
|
|
949
|
-
className: styles$
|
|
950
|
-
onScrolledBottom: onScrolledBottom,
|
|
951
|
-
onScrolledNotBottom: onScrolledNotBottom
|
|
804
|
+
className: styles$9.scroll
|
|
952
805
|
}, /*#__PURE__*/React.createElement("nav", {
|
|
953
|
-
className: styles$
|
|
806
|
+
className: styles$9.nav
|
|
954
807
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
955
|
-
className: styles$
|
|
808
|
+
className: styles$9.items
|
|
956
809
|
}, finalItems.map(function (item, index) {
|
|
957
|
-
var
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
var screenAriaLabel = "".concat(intl.formatMessage({
|
|
964
|
-
id: "LkVfwW",
|
|
965
|
-
defaultMessage: [{
|
|
966
|
-
"type": 0,
|
|
967
|
-
"value": "Screen "
|
|
968
|
-
}, {
|
|
969
|
-
"type": 1,
|
|
970
|
-
"value": "index"
|
|
971
|
-
}]
|
|
972
|
-
}, {
|
|
973
|
-
index: index + 1
|
|
974
|
-
})).concat(current ? " ".concat(intl.formatMessage({
|
|
975
|
-
id: "vmrJ8U",
|
|
976
|
-
defaultMessage: [{
|
|
977
|
-
"type": 0,
|
|
978
|
-
"value": "(current screen)"
|
|
979
|
-
}]
|
|
980
|
-
})) : '');
|
|
810
|
+
var _ref7 = item || {},
|
|
811
|
+
screenId = _ref7.screenId;
|
|
812
|
+
|
|
813
|
+
var itemStyles = {
|
|
814
|
+
width: "".concat(100 / thumbsPerLine, "%")
|
|
815
|
+
};
|
|
981
816
|
return /*#__PURE__*/React.createElement("li", {
|
|
982
|
-
className: classNames([styles$7.item, _defineProperty({}, styles$7.active, current)]),
|
|
983
817
|
key: "item-".concat(screenId),
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
className: styles$7.subScreenBadge
|
|
994
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
995
|
-
className: styles$7.subScreenCount
|
|
996
|
-
}, count), /*#__PURE__*/React.createElement(StackIcon, {
|
|
997
|
-
className: styles$7.subScreenIcon
|
|
998
|
-
})) : null, screenWidth > 0 && screenHeight > 0 ? /*#__PURE__*/React.createElement(ScreenPreview, {
|
|
999
|
-
screenWidth: screenWidth,
|
|
1000
|
-
screenHeight: screenHeight,
|
|
1001
|
-
width: thumbWidth,
|
|
1002
|
-
screen: screen,
|
|
1003
|
-
focusable: focusable,
|
|
1004
|
-
active: focusable,
|
|
1005
|
-
withSize: true
|
|
1006
|
-
}) : null, current ? /*#__PURE__*/React.createElement("div", {
|
|
1007
|
-
className: styles$7.activeScreenBorder,
|
|
1008
|
-
style: borderPrimaryColorStyle
|
|
1009
|
-
}) : null)), /*#__PURE__*/React.createElement("button", {
|
|
1010
|
-
type: "button",
|
|
1011
|
-
className: styles$7.screenButton,
|
|
1012
|
-
onClick: function onClick() {
|
|
1013
|
-
if (onClickItem !== null) {
|
|
1014
|
-
onClickItem(item);
|
|
1015
|
-
}
|
|
1016
|
-
},
|
|
1017
|
-
"aria-label": screenAriaLabel,
|
|
1018
|
-
onKeyUp: function onKeyUp(e) {
|
|
1019
|
-
if (e.key === 'Enter' && onClickItem !== null) {
|
|
1020
|
-
onClickItem(item);
|
|
1021
|
-
}
|
|
1022
|
-
},
|
|
1023
|
-
tabIndex: focusable ? '0' : '-1'
|
|
818
|
+
className: styles$9.item,
|
|
819
|
+
style: itemStyles
|
|
820
|
+
}, item === null ? 'loading' : /*#__PURE__*/React.createElement(ViewerMenuScreen, {
|
|
821
|
+
className: styles$9.screenPreview,
|
|
822
|
+
item: item,
|
|
823
|
+
index: index,
|
|
824
|
+
screenSize: screenSize,
|
|
825
|
+
onClick: onClickScreen,
|
|
826
|
+
focusable: focusable
|
|
1024
827
|
}));
|
|
1025
828
|
}))))));
|
|
1026
829
|
};
|
|
1027
830
|
|
|
1028
|
-
ViewerMenuPreview.propTypes = propTypes$
|
|
1029
|
-
ViewerMenuPreview.defaultProps = defaultProps$
|
|
831
|
+
ViewerMenuPreview.propTypes = propTypes$d;
|
|
832
|
+
ViewerMenuPreview.defaultProps = defaultProps$d;
|
|
833
|
+
|
|
834
|
+
var styles$8 = {"container":"micromag-viewer-partials-micromag-preview-container","cover":"micromag-viewer-partials-micromag-preview-cover","info":"micromag-viewer-partials-micromag-preview-info","url":"micromag-viewer-partials-micromag-preview-url","title":"micromag-viewer-partials-micromag-preview-title"};
|
|
835
|
+
|
|
836
|
+
var propTypes$c = {
|
|
837
|
+
screen: PropTypes$1.item,
|
|
838
|
+
title: PropTypes.string,
|
|
839
|
+
url: PropTypes.string,
|
|
840
|
+
description: PropTypes.string,
|
|
841
|
+
className: PropTypes.string
|
|
842
|
+
};
|
|
843
|
+
var defaultProps$c = {
|
|
844
|
+
screen: null,
|
|
845
|
+
title: null,
|
|
846
|
+
url: null,
|
|
847
|
+
description: null,
|
|
848
|
+
className: null
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
var MicromagPreview = function MicromagPreview(_ref) {
|
|
852
|
+
var screen = _ref.screen,
|
|
853
|
+
title = _ref.title,
|
|
854
|
+
url = _ref.url,
|
|
855
|
+
description = _ref.description,
|
|
856
|
+
className = _ref.className;
|
|
857
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
858
|
+
className: classNames([styles$8.container, _defineProperty({}, className, className)])
|
|
859
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
860
|
+
className: styles$8.cover
|
|
861
|
+
}, /*#__PURE__*/React.createElement(ScreenPreview, {
|
|
862
|
+
screen: screen,
|
|
863
|
+
width: 100,
|
|
864
|
+
height: 150,
|
|
865
|
+
withSize: true
|
|
866
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
867
|
+
className: styles$8.info
|
|
868
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
869
|
+
className: styles$8.title
|
|
870
|
+
}, title), url ? /*#__PURE__*/React.createElement("div", {
|
|
871
|
+
className: styles$8.url
|
|
872
|
+
}, url) : null, /*#__PURE__*/React.createElement("p", null, description)));
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
MicromagPreview.propTypes = propTypes$c;
|
|
876
|
+
MicromagPreview.defaultProps = defaultProps$c;
|
|
877
|
+
|
|
878
|
+
var styles$7 = {"scroll":"micromag-viewer-menus-menu-share-scroll","container":"micromag-viewer-menus-menu-share-container","disabled":"micromag-viewer-menus-menu-share-disabled","screenButton":"micromag-viewer-menus-menu-share-screenButton","organisation":"micromag-viewer-menus-menu-share-organisation","icon":"micromag-viewer-menus-menu-share-icon","header":"micromag-viewer-menus-menu-share-header","mode":"micromag-viewer-menus-menu-share-mode","bump":"micromag-viewer-menus-menu-share-bump","options":"micromag-viewer-menus-menu-share-options","optionButton":"micromag-viewer-menus-menu-share-optionButton","content":"micromag-viewer-menus-menu-share-content"};
|
|
879
|
+
|
|
880
|
+
var propTypes$b = {
|
|
881
|
+
viewerTheme: PropTypes$1.viewerTheme,
|
|
882
|
+
menuWidth: PropTypes.number,
|
|
883
|
+
title: PropTypes.string,
|
|
884
|
+
description: PropTypes.string,
|
|
885
|
+
items: PropTypes$1.menuItems,
|
|
886
|
+
focusable: PropTypes.bool,
|
|
887
|
+
// shouldLoad: PropTypes.bool, // @todo still needed? to re-implement?
|
|
888
|
+
currentScreenIndex: PropTypes.number,
|
|
889
|
+
shareUrl: PropTypes.string,
|
|
890
|
+
onShare: PropTypes.func,
|
|
891
|
+
className: PropTypes.string
|
|
892
|
+
};
|
|
893
|
+
var defaultProps$b = {
|
|
894
|
+
viewerTheme: null,
|
|
895
|
+
menuWidth: null,
|
|
896
|
+
title: null,
|
|
897
|
+
description: null,
|
|
898
|
+
items: [],
|
|
899
|
+
focusable: true,
|
|
900
|
+
currentScreenIndex: 0,
|
|
901
|
+
shareUrl: null,
|
|
902
|
+
onShare: null,
|
|
903
|
+
className: null
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
var ViewerMenuShare = function ViewerMenuShare(_ref) {
|
|
907
|
+
var viewerTheme = _ref.viewerTheme,
|
|
908
|
+
menuWidth = _ref.menuWidth,
|
|
909
|
+
title = _ref.title,
|
|
910
|
+
description = _ref.description,
|
|
911
|
+
items = _ref.items,
|
|
912
|
+
focusable = _ref.focusable,
|
|
913
|
+
currentScreenIndex = _ref.currentScreenIndex,
|
|
914
|
+
shareUrl = _ref.shareUrl,
|
|
915
|
+
onShare = _ref.onShare,
|
|
916
|
+
className = _ref.className;
|
|
917
|
+
|
|
918
|
+
// Viewer theme
|
|
919
|
+
// @todo room for improvement here probably
|
|
920
|
+
var _ref2 = viewerTheme || {},
|
|
921
|
+
_ref2$colors = _ref2.colors,
|
|
922
|
+
colors = _ref2$colors === void 0 ? null : _ref2$colors,
|
|
923
|
+
_ref2$background = _ref2.background,
|
|
924
|
+
background = _ref2$background === void 0 ? null : _ref2$background;
|
|
925
|
+
_ref2.logo;
|
|
926
|
+
// @todo could get from theme provider? need to re-implement
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
var _ref3 = colors || {};
|
|
930
|
+
_ref3.primary;
|
|
931
|
+
_ref3.secondary;
|
|
932
|
+
|
|
933
|
+
var _ref4 = background || {},
|
|
934
|
+
_ref4$color = _ref4.color,
|
|
935
|
+
brandBackgroundColor = _ref4$color === void 0 ? null : _ref4$color,
|
|
936
|
+
_ref4$image = _ref4.image,
|
|
937
|
+
image = _ref4$image === void 0 ? null : _ref4$image;
|
|
938
|
+
|
|
939
|
+
var _ref5 = image || {},
|
|
940
|
+
_ref5$url = _ref5.url,
|
|
941
|
+
brandImageUrl = _ref5$url === void 0 ? null : _ref5$url; // const borderPrimaryColorStyle = getStyleFromColor(brandPrimaryColor, 'borderColor');
|
|
942
|
+
// const colorSecondaryColorStyle = getStyleFromColor(brandSecondaryColor, 'color');
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
var backgroundColorStyle = getStyleFromColor(brandBackgroundColor, 'backgroundColor'); // const { url: brandLogoUrl = null } = brandLogo || {};
|
|
946
|
+
|
|
947
|
+
var brandImageStyle = brandImageUrl !== null ? {
|
|
948
|
+
backgroundImage: "url(".concat(brandImageUrl, ")")
|
|
949
|
+
} : null;
|
|
950
|
+
var coverScreen = useMemo(function () {
|
|
951
|
+
var _ref6 = items[0] || {},
|
|
952
|
+
_ref6$screen = _ref6.screen,
|
|
953
|
+
screen = _ref6$screen === void 0 ? null : _ref6$screen;
|
|
954
|
+
|
|
955
|
+
return screen;
|
|
956
|
+
}, [items]);
|
|
957
|
+
var currentScreen = useMemo(function () {
|
|
958
|
+
var found = items.find(function (item) {
|
|
959
|
+
var _ref7 = item || {},
|
|
960
|
+
_ref7$current = _ref7.current,
|
|
961
|
+
current = _ref7$current === void 0 ? false : _ref7$current;
|
|
962
|
+
|
|
963
|
+
return current;
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
var _ref8 = found || {},
|
|
967
|
+
_ref8$screen = _ref8.screen,
|
|
968
|
+
screen = _ref8$screen === void 0 ? null : _ref8$screen;
|
|
969
|
+
|
|
970
|
+
return screen;
|
|
971
|
+
}, [items, currentScreenIndex, focusable]);
|
|
972
|
+
|
|
973
|
+
var _useState = useState(false),
|
|
974
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
975
|
+
shareCurrentScreen = _useState2[0],
|
|
976
|
+
setShareCurrentScreen = _useState2[1];
|
|
977
|
+
|
|
978
|
+
var onShareModeChange = useCallback(function () {
|
|
979
|
+
setShareCurrentScreen(function (value) {
|
|
980
|
+
return !value;
|
|
981
|
+
});
|
|
982
|
+
}, [setShareCurrentScreen]);
|
|
983
|
+
|
|
984
|
+
var _useState3 = useState(shareUrl),
|
|
985
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
986
|
+
finalShareUrl = _useState4[0],
|
|
987
|
+
setFinalShareUrl = _useState4[1];
|
|
988
|
+
|
|
989
|
+
useEffect(function () {
|
|
990
|
+
setFinalShareUrl(shareCurrentScreen && currentScreenIndex !== 0 ? "".concat(shareUrl, "/").concat(currentScreenIndex) : shareUrl);
|
|
991
|
+
}, [shareCurrentScreen, currentScreenIndex, setFinalShareUrl]);
|
|
992
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
993
|
+
className: classNames([styles$7.container, _defineProperty({}, className, className !== null)]),
|
|
994
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, backgroundColorStyle), brandImageStyle), {}, {
|
|
995
|
+
width: menuWidth
|
|
996
|
+
}),
|
|
997
|
+
"aria-hidden": focusable ? null : 'true'
|
|
998
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
999
|
+
className: styles$7.content
|
|
1000
|
+
}, /*#__PURE__*/React.createElement(Scroll, {
|
|
1001
|
+
className: styles$7.scroll
|
|
1002
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1003
|
+
className: styles$7.header
|
|
1004
|
+
}, /*#__PURE__*/React.createElement(MicromagPreview, {
|
|
1005
|
+
className: styles$7.preview,
|
|
1006
|
+
screen: shareCurrentScreen ? currentScreen : coverScreen,
|
|
1007
|
+
title: title,
|
|
1008
|
+
url: finalShareUrl,
|
|
1009
|
+
description: description
|
|
1010
|
+
}), currentScreenIndex !== 0 ? /*#__PURE__*/React.createElement("div", {
|
|
1011
|
+
className: styles$7.mode
|
|
1012
|
+
}, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
|
|
1013
|
+
type: "checkbox",
|
|
1014
|
+
name: "currentScreen",
|
|
1015
|
+
value: "currentScreen",
|
|
1016
|
+
onChange: onShareModeChange,
|
|
1017
|
+
checked: shareCurrentScreen
|
|
1018
|
+
}), /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
1019
|
+
id: "xuPbeq",
|
|
1020
|
+
defaultMessage: [{
|
|
1021
|
+
"type": 0,
|
|
1022
|
+
"value": "Start from the current screen"
|
|
1023
|
+
}]
|
|
1024
|
+
}))) : null), /*#__PURE__*/React.createElement(ShareOptions, {
|
|
1025
|
+
className: styles$7.options,
|
|
1026
|
+
itemClassName: styles$7.optionItem,
|
|
1027
|
+
buttonClassName: styles$7.optionButton,
|
|
1028
|
+
title: title,
|
|
1029
|
+
url: finalShareUrl,
|
|
1030
|
+
focusable: focusable,
|
|
1031
|
+
onShare: onShare,
|
|
1032
|
+
shareCurrentScreen: shareCurrentScreen
|
|
1033
|
+
}))));
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
ViewerMenuShare.propTypes = propTypes$b;
|
|
1037
|
+
ViewerMenuShare.defaultProps = defaultProps$b;
|
|
1030
1038
|
|
|
1031
|
-
var styles$6 = {"container":"micromag-viewer-container","
|
|
1039
|
+
var styles$6 = {"container":"micromag-viewer-container","screenContainer":"micromag-viewer-screenContainer","screensFrame":"micromag-viewer-screensFrame","landscape":"micromag-viewer-landscape","hideMenu":"micromag-viewer-hideMenu","menuNavContainer":"micromag-viewer-menuNavContainer","dots":"micromag-viewer-dots","menuTopContainer":"micromag-viewer-menuTopContainer","content":"micromag-viewer-content","fadeMenu":"micromag-viewer-fadeMenu","withShadow":"micromag-viewer-withShadow","isOpened":"micromag-viewer-isOpened","menuItem":"micromag-viewer-menuItem","menuScreens":"micromag-viewer-menuScreens","slidingButton":"micromag-viewer-slidingButton","menuButton":"micromag-viewer-menuButton","isHidden":"micromag-viewer-isHidden","navButton":"micromag-viewer-navButton","previous":"micromag-viewer-previous","next":"micromag-viewer-next","isDragging":"micromag-viewer-isDragging","withoutGestures":"micromag-viewer-withoutGestures","screen":"micromag-viewer-screen","current":"micromag-viewer-current","playbackControls":"micromag-viewer-playbackControls","webView":"micromag-viewer-webView"};
|
|
1032
1040
|
|
|
1033
1041
|
var propTypes$a = {
|
|
1034
1042
|
story: PropTypes$1.story.isRequired,
|
|
1035
1043
|
currentScreenIndex: PropTypes.number,
|
|
1036
|
-
opened: PropTypes.bool,
|
|
1037
1044
|
toggleFullscreen: PropTypes.func,
|
|
1038
1045
|
fullscreenActive: PropTypes.bool,
|
|
1039
1046
|
fullscreenEnabled: PropTypes.bool,
|
|
@@ -1047,9 +1054,7 @@ var propTypes$a = {
|
|
|
1047
1054
|
withDotItemClick: PropTypes.bool,
|
|
1048
1055
|
withoutScreensMenu: PropTypes.bool,
|
|
1049
1056
|
withoutShareMenu: PropTypes.bool,
|
|
1050
|
-
|
|
1051
|
-
onRequestClose: PropTypes.func,
|
|
1052
|
-
onClickItem: PropTypes.func,
|
|
1057
|
+
onClickScreen: PropTypes.func,
|
|
1053
1058
|
onClickMenu: PropTypes.func,
|
|
1054
1059
|
onClickCloseViewer: PropTypes.func,
|
|
1055
1060
|
refDots: PropTypes.shape({
|
|
@@ -1059,7 +1064,6 @@ var propTypes$a = {
|
|
|
1059
1064
|
};
|
|
1060
1065
|
var defaultProps$a = {
|
|
1061
1066
|
currentScreenIndex: 0,
|
|
1062
|
-
opened: false,
|
|
1063
1067
|
toggleFullscreen: null,
|
|
1064
1068
|
fullscreenActive: false,
|
|
1065
1069
|
fullscreenEnabled: false,
|
|
@@ -1073,18 +1077,17 @@ var defaultProps$a = {
|
|
|
1073
1077
|
withDotItemClick: false,
|
|
1074
1078
|
withoutScreensMenu: false,
|
|
1075
1079
|
withoutShareMenu: false,
|
|
1076
|
-
|
|
1077
|
-
onRequestClose: null,
|
|
1078
|
-
onClickItem: null,
|
|
1080
|
+
onClickScreen: null,
|
|
1079
1081
|
onClickMenu: null,
|
|
1080
1082
|
onClickCloseViewer: null,
|
|
1081
1083
|
refDots: null
|
|
1082
1084
|
};
|
|
1083
1085
|
|
|
1084
1086
|
var ViewerMenu = function ViewerMenu(_ref) {
|
|
1087
|
+
var _ref9;
|
|
1088
|
+
|
|
1085
1089
|
var story = _ref.story,
|
|
1086
1090
|
currentScreenIndex = _ref.currentScreenIndex,
|
|
1087
|
-
opened = _ref.opened,
|
|
1088
1091
|
toggleFullscreen = _ref.toggleFullscreen,
|
|
1089
1092
|
fullscreenActive = _ref.fullscreenActive,
|
|
1090
1093
|
fullscreenEnabled = _ref.fullscreenEnabled,
|
|
@@ -1098,23 +1101,42 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1098
1101
|
withDotItemClick = _ref.withDotItemClick,
|
|
1099
1102
|
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
1100
1103
|
withoutShareMenu = _ref.withoutShareMenu,
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
customOnClickMenu = _ref.onClickMenu,
|
|
1105
|
-
onClickCloseViewer = _ref.onClickCloseViewer,
|
|
1104
|
+
customOnClickScreen = _ref.onClickScreen;
|
|
1105
|
+
_ref.onClickMenu;
|
|
1106
|
+
var onClickCloseViewer = _ref.onClickCloseViewer,
|
|
1106
1107
|
refDots = _ref.refDots;
|
|
1107
1108
|
var _story$components = story.components,
|
|
1108
1109
|
screens = _story$components === void 0 ? [] : _story$components,
|
|
1109
1110
|
_story$title = story.title,
|
|
1110
|
-
title = _story$title === void 0 ? null : _story$title
|
|
1111
|
+
title = _story$title === void 0 ? null : _story$title,
|
|
1112
|
+
_story$metadata = story.metadata,
|
|
1113
|
+
metadata = _story$metadata === void 0 ? null : _story$metadata;
|
|
1114
|
+
|
|
1115
|
+
var _ref2 = metadata || {},
|
|
1116
|
+
_ref2$description = _ref2.description,
|
|
1117
|
+
description = _ref2$description === void 0 ? null : _ref2$description;
|
|
1118
|
+
|
|
1111
1119
|
var currentScreen = screens !== null ? screens[currentScreenIndex] || null : null;
|
|
1112
1120
|
|
|
1113
|
-
var
|
|
1114
|
-
|
|
1115
|
-
screenId =
|
|
1116
|
-
|
|
1117
|
-
screenType =
|
|
1121
|
+
var _ref3 = currentScreen || {},
|
|
1122
|
+
_ref3$id = _ref3.id,
|
|
1123
|
+
screenId = _ref3$id === void 0 ? null : _ref3$id,
|
|
1124
|
+
_ref3$type = _ref3.type,
|
|
1125
|
+
screenType = _ref3$type === void 0 ? null : _ref3$type;
|
|
1126
|
+
|
|
1127
|
+
var _ref4 = viewerTheme || {},
|
|
1128
|
+
_ref4$menuTheme = _ref4.menuTheme,
|
|
1129
|
+
menuTheme = _ref4$menuTheme === void 0 ? null : _ref4$menuTheme;
|
|
1130
|
+
|
|
1131
|
+
var _useState = useState(false),
|
|
1132
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1133
|
+
menuOpened = _useState2[0],
|
|
1134
|
+
setMenuOpened = _useState2[1];
|
|
1135
|
+
|
|
1136
|
+
var _useState3 = useState(false),
|
|
1137
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1138
|
+
shareOpened = _useState4[0],
|
|
1139
|
+
setShareOpened = _useState4[1];
|
|
1118
1140
|
|
|
1119
1141
|
var items = useMemo(function () {
|
|
1120
1142
|
return screens.map(function (it) {
|
|
@@ -1135,9 +1157,9 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1135
1157
|
count: children.length + 1 || 1,
|
|
1136
1158
|
subIndex: subIndex || 0
|
|
1137
1159
|
};
|
|
1138
|
-
}).filter(function (
|
|
1139
|
-
var
|
|
1140
|
-
visible =
|
|
1160
|
+
}).filter(function (_ref5) {
|
|
1161
|
+
var _ref5$visible = _ref5.visible,
|
|
1162
|
+
visible = _ref5$visible === void 0 ? true : _ref5$visible;
|
|
1141
1163
|
return visible;
|
|
1142
1164
|
});
|
|
1143
1165
|
}, [screens, screenId]);
|
|
@@ -1152,161 +1174,223 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
1152
1174
|
}
|
|
1153
1175
|
}, [trackEvent, screenId, currentScreenIndex, screenType]);
|
|
1154
1176
|
var shareUrl = useMemo(function () {
|
|
1155
|
-
|
|
1156
|
-
|
|
1177
|
+
// @todo validate this
|
|
1178
|
+
// const base =
|
|
1179
|
+
// typeof window !== 'undefined' ? window.location.origin.replace(/\/+$/, '') : '';
|
|
1180
|
+
// const path = shareBasePath !== null ? `${base}${shareBasePath}` : base;
|
|
1181
|
+
var base = typeof window !== 'undefined' ? window.location.host : '';
|
|
1182
|
+
var path = shareBasePath !== null ? "".concat(base).concat(shareBasePath) : base;
|
|
1157
1183
|
return path;
|
|
1158
|
-
}, [shareBasePath]);
|
|
1159
|
-
|
|
1160
|
-
var _useSpring = useSpring(function () {
|
|
1161
|
-
return {
|
|
1162
|
-
y: 0,
|
|
1163
|
-
config: _objectSpread(_objectSpread({}, config.stiff), {}, {
|
|
1164
|
-
clamp: true
|
|
1165
|
-
})
|
|
1166
|
-
};
|
|
1167
|
-
}),
|
|
1168
|
-
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
1169
|
-
menuY = _useSpring2[0].y,
|
|
1170
|
-
setMenuSpring = _useSpring2[1];
|
|
1171
|
-
|
|
1172
|
-
var refOpened = useRef(opened);
|
|
1173
|
-
|
|
1174
|
-
if (refOpened.current !== opened) {
|
|
1175
|
-
refOpened.current = opened;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
useEffect(function () {
|
|
1179
|
-
setMenuSpring.start({
|
|
1180
|
-
y: opened ? 1 : 0
|
|
1181
|
-
});
|
|
1182
|
-
}, [opened]);
|
|
1184
|
+
}, [shareBasePath]); // @todo sorta not super good here
|
|
1183
1185
|
|
|
1184
|
-
var
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
var
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
};
|
|
1194
|
-
var
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1186
|
+
var onOpenMenu = useCallback(function () {
|
|
1187
|
+
setMenuOpened(true);
|
|
1188
|
+
setShareOpened(false);
|
|
1189
|
+
trackScreenEvent('viewer_menu', 'open_screens_menu');
|
|
1190
|
+
}, [setMenuOpened, setShareOpened, trackScreenEvent]);
|
|
1191
|
+
var onCloseMenu = useCallback(function () {
|
|
1192
|
+
setMenuOpened(false);
|
|
1193
|
+
setShareOpened(false);
|
|
1194
|
+
trackScreenEvent('viewer_menu', 'close_screens_menu');
|
|
1195
|
+
}, [setMenuOpened, setShareOpened, trackScreenEvent]);
|
|
1196
|
+
var onOpenShare = useCallback(function () {
|
|
1197
|
+
setShareOpened(true);
|
|
1198
|
+
setMenuOpened(false);
|
|
1199
|
+
trackScreenEvent('viewer_menu', 'open_share_menu');
|
|
1200
|
+
}, [setShareOpened, setMenuOpened, trackScreenEvent]);
|
|
1201
|
+
var onCloseShare = useCallback(function () {
|
|
1202
|
+
setShareOpened(false);
|
|
1203
|
+
setMenuOpened(false);
|
|
1204
|
+
trackScreenEvent('viewer_menu', 'close_share_menu');
|
|
1205
|
+
}, [setShareOpened, setMenuOpened, trackScreenEvent]);
|
|
1206
|
+
var onClickScreen = useCallback(function (screen) {
|
|
1207
|
+
setMenuOpened(false);
|
|
1208
|
+
|
|
1209
|
+
if (customOnClickScreen !== null) {
|
|
1210
|
+
customOnClickScreen(screen);
|
|
1207
1211
|
}
|
|
1208
1212
|
|
|
1209
|
-
var
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1213
|
+
var index = items.findIndex(function (_ref6) {
|
|
1214
|
+
var id = _ref6.id;
|
|
1215
|
+
return id === screenId;
|
|
1216
|
+
});
|
|
1217
|
+
trackScreenEvent('viewer_menu', 'click_screen_change', "Screen ".concat(index + 1));
|
|
1218
|
+
}, [customOnClickScreen, setMenuOpened, items, screenId, trackScreenEvent]);
|
|
1219
|
+
var onShare = useCallback(function (type) {
|
|
1220
|
+
// @todo display something to say thanks for sharing?
|
|
1221
|
+
trackScreenEvent('viewer_menu', 'shared_story', type);
|
|
1222
|
+
}, [trackScreenEvent]);
|
|
1223
|
+
var computeShareProgress = useCallback(function (_ref7) {
|
|
1224
|
+
var active = _ref7.active,
|
|
1225
|
+
_ref7$direction = _slicedToArray(_ref7.direction, 2),
|
|
1226
|
+
dy = _ref7$direction[1],
|
|
1227
|
+
_ref7$movement = _slicedToArray(_ref7.movement, 2),
|
|
1228
|
+
my = _ref7$movement[1],
|
|
1229
|
+
_ref7$velocity = _slicedToArray(_ref7.velocity, 2),
|
|
1230
|
+
vy = _ref7$velocity[1];
|
|
1231
|
+
|
|
1232
|
+
var progress = Math.max(0, my) / (window.innerHeight * 0.8);
|
|
1233
|
+
var reachedThreshold = (vy > 0.3 || Math.abs(progress) > 0.3) && dy !== -1;
|
|
1234
|
+
|
|
1235
|
+
if (!active) {
|
|
1236
|
+
if (reachedThreshold) onOpenShare();
|
|
1237
|
+
return reachedThreshold ? 1 : 0;
|
|
1216
1238
|
}
|
|
1217
1239
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
if (last) {
|
|
1221
|
-
var menuNowOpened = dy > 0 && yProgress > 0.1;
|
|
1222
|
-
refOpened.current = menuNowOpened;
|
|
1223
|
-
setMenuSpring.start({
|
|
1224
|
-
y: menuNowOpened ? 1 : 0
|
|
1225
|
-
});
|
|
1240
|
+
return progress;
|
|
1241
|
+
}, [menuOpened, onOpenShare]);
|
|
1226
1242
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1243
|
+
var _useDragProgress = useDragProgress({
|
|
1244
|
+
progress: shareOpened ? 1 : 0,
|
|
1245
|
+
computeProgress: computeShareProgress,
|
|
1246
|
+
springParams: {
|
|
1247
|
+
config: {
|
|
1248
|
+
tension: 300,
|
|
1249
|
+
friction: 30
|
|
1231
1250
|
}
|
|
1232
|
-
} else {
|
|
1233
|
-
setMenuSpring.start({
|
|
1234
|
-
y: yProgress
|
|
1235
|
-
});
|
|
1236
1251
|
}
|
|
1237
|
-
},
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
var
|
|
1243
|
-
|
|
1244
|
-
|
|
1252
|
+
}),
|
|
1253
|
+
bindShareDrag = _useDragProgress.bind,
|
|
1254
|
+
isDraggingShare = _useDragProgress.dragging,
|
|
1255
|
+
shareOpenedProgress = _useDragProgress.progress;
|
|
1256
|
+
|
|
1257
|
+
var computeMenuProgress = useCallback(function (_ref8) {
|
|
1258
|
+
var active = _ref8.active,
|
|
1259
|
+
_ref8$direction = _slicedToArray(_ref8.direction, 2),
|
|
1260
|
+
dy = _ref8$direction[1],
|
|
1261
|
+
_ref8$movement = _slicedToArray(_ref8.movement, 2),
|
|
1262
|
+
my = _ref8$movement[1],
|
|
1263
|
+
_ref8$velocity = _slicedToArray(_ref8.velocity, 2),
|
|
1264
|
+
vy = _ref8$velocity[1];
|
|
1265
|
+
|
|
1266
|
+
var progress = Math.max(0, my) / (window.innerHeight * 0.8);
|
|
1267
|
+
var reachedThreshold = (vy > 0.3 || Math.abs(progress) > 0.3) && dy !== -1;
|
|
1268
|
+
|
|
1269
|
+
if (!active) {
|
|
1270
|
+
if (reachedThreshold) onOpenMenu();
|
|
1271
|
+
return reachedThreshold ? 1 : 0;
|
|
1245
1272
|
}
|
|
1246
1273
|
|
|
1247
|
-
|
|
1248
|
-
}, [
|
|
1249
|
-
var onClickItem = useCallback(function (item) {
|
|
1250
|
-
if (customOnClickItem !== null) {
|
|
1251
|
-
customOnClickItem(item);
|
|
1252
|
-
}
|
|
1274
|
+
return progress;
|
|
1275
|
+
}, [menuOpened, onOpenMenu]);
|
|
1253
1276
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
onRequestClose();
|
|
1277
|
+
var _useDragProgress2 = useDragProgress({
|
|
1278
|
+
progress: menuOpened ? 1 : 0,
|
|
1279
|
+
computeProgress: computeMenuProgress,
|
|
1280
|
+
springParams: {
|
|
1281
|
+
config: {
|
|
1282
|
+
tension: 300,
|
|
1283
|
+
friction: 30
|
|
1284
|
+
}
|
|
1263
1285
|
}
|
|
1286
|
+
}),
|
|
1287
|
+
bindMenuDrag = _useDragProgress2.bind,
|
|
1288
|
+
isDraggingMenu = _useDragProgress2.dragging,
|
|
1289
|
+
menuOpenedProgress = _useDragProgress2.progress;
|
|
1264
1290
|
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1291
|
+
var keyboardShortcuts = useMemo(function () {
|
|
1292
|
+
return {
|
|
1293
|
+
m: function m() {
|
|
1294
|
+
return !menuOpened ? onOpenMenu() : onCloseMenu();
|
|
1295
|
+
},
|
|
1296
|
+
escape: function escape() {
|
|
1297
|
+
return onCloseMenu();
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
}, [menuOpened, onOpenMenu, onCloseMenu]);
|
|
1301
|
+
useKeyboardShortcuts(keyboardShortcuts); // should be zero if either screens menu or share menu is opened
|
|
1275
1302
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1303
|
+
var dotsOpacity = Math.min(1, Math.max(0, 1 - (menuOpenedProgress + shareOpenedProgress)));
|
|
1304
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
1305
|
+
className: classNames([styles$6.menuNavContainer, (_ref9 = {}, _defineProperty(_ref9, styles$6.withShadow, withShadow), _defineProperty(_ref9, styles$6.isOpened, menuOpened || shareOpened), _ref9)]),
|
|
1278
1306
|
ref: refDots,
|
|
1279
1307
|
style: {
|
|
1280
1308
|
width: menuWidth
|
|
1281
1309
|
}
|
|
1282
|
-
},
|
|
1310
|
+
}, /*#__PURE__*/React.createElement("nav", {
|
|
1311
|
+
className: styles$6.menuTopContainer
|
|
1312
|
+
}, !withoutShareMenu ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
1313
|
+
className: classNames([styles$6.menuItem, styles$6.menuShare])
|
|
1314
|
+
}, bindShareDrag()), /*#__PURE__*/React.createElement(SlidingButtons, {
|
|
1315
|
+
className: styles$6.slidingButton,
|
|
1316
|
+
current: shareOpenedProgress,
|
|
1317
|
+
immediate: isDraggingShare,
|
|
1318
|
+
buttons: [ShareButton, CloseButton],
|
|
1319
|
+
buttonsProps: [{
|
|
1320
|
+
key: 'share',
|
|
1321
|
+
className: styles$6.menuButton,
|
|
1322
|
+
onClick: onOpenShare,
|
|
1323
|
+
theme: menuTheme
|
|
1324
|
+
}, {
|
|
1325
|
+
key: 'close-share',
|
|
1326
|
+
className: styles$6.menuButton,
|
|
1327
|
+
onClick: onCloseShare,
|
|
1328
|
+
theme: menuTheme,
|
|
1329
|
+
iconPosition: 'left'
|
|
1330
|
+
}]
|
|
1331
|
+
})) : null, !withoutScreensMenu ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
1332
|
+
className: classNames([styles$6.menuItem, styles$6.menuScreens])
|
|
1333
|
+
}, bindMenuDrag()), /*#__PURE__*/React.createElement(SlidingButtons, {
|
|
1334
|
+
className: styles$6.slidingButton,
|
|
1335
|
+
current: menuOpenedProgress,
|
|
1336
|
+
immediate: isDraggingMenu,
|
|
1337
|
+
buttons: [MenuButton, CloseButton],
|
|
1338
|
+
buttonsProps: [{
|
|
1339
|
+
key: 'menu',
|
|
1340
|
+
className: styles$6.menuButton,
|
|
1341
|
+
onClick: onOpenMenu,
|
|
1342
|
+
theme: menuTheme
|
|
1343
|
+
}, {
|
|
1344
|
+
key: 'close-menu',
|
|
1345
|
+
className: styles$6.menuButton,
|
|
1346
|
+
onClick: onCloseMenu,
|
|
1347
|
+
theme: menuTheme,
|
|
1348
|
+
iconPosition: 'right'
|
|
1349
|
+
}]
|
|
1350
|
+
})) : null), /*#__PURE__*/React.createElement(ViewerMenuDots, Object.assign({}, menuTheme, {
|
|
1283
1351
|
direction: "horizontal",
|
|
1284
|
-
withShadow: withShadow,
|
|
1285
1352
|
items: items,
|
|
1286
|
-
|
|
1353
|
+
onClickDot: onClickScreen,
|
|
1354
|
+
onClickMenu: onOpenMenu,
|
|
1355
|
+
closeable: closeable,
|
|
1356
|
+
withItemClick: withDotItemClick,
|
|
1357
|
+
withoutScreensMenu: withoutScreensMenu,
|
|
1358
|
+
withoutShareMenu: withoutShareMenu,
|
|
1359
|
+
onClose: onClickCloseViewer,
|
|
1360
|
+
className: styles$6.dots,
|
|
1361
|
+
style: {
|
|
1362
|
+
opacity: dotsOpacity
|
|
1363
|
+
}
|
|
1364
|
+
}))), /*#__PURE__*/React.createElement(ViewerMenuContainer, {
|
|
1365
|
+
className: styles$6.menuContainerShare,
|
|
1366
|
+
transitionProgress: shareOpenedProgress
|
|
1367
|
+
}, /*#__PURE__*/React.createElement(ViewerMenuShare, {
|
|
1368
|
+
viewerTheme: viewerTheme,
|
|
1369
|
+
className: styles$6.menuShare,
|
|
1370
|
+
title: title,
|
|
1371
|
+
description: description,
|
|
1372
|
+
menuWidth: menuWidth,
|
|
1373
|
+
focusable: shareOpened,
|
|
1374
|
+
items: items,
|
|
1375
|
+
currentScreenIndex: currentScreenIndex,
|
|
1287
1376
|
shareUrl: shareUrl,
|
|
1288
|
-
onShare:
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
withoutScreensMenu: withoutScreensMenu,
|
|
1294
|
-
withoutShareMenu: withoutShareMenu,
|
|
1295
|
-
onClose: onClickCloseViewer,
|
|
1296
|
-
className: styles$6.menuDots
|
|
1297
|
-
}))), /*#__PURE__*/React.createElement(animated.div, {
|
|
1298
|
-
className: styles$6.menuPreviewContainer,
|
|
1299
|
-
style: menuPreviewStyle,
|
|
1300
|
-
ref: menuPreviewContainerRef
|
|
1377
|
+
onShare: onShare,
|
|
1378
|
+
onClose: onCloseShare
|
|
1379
|
+
})), /*#__PURE__*/React.createElement(ViewerMenuContainer, {
|
|
1380
|
+
className: styles$6.menuContainerScreens,
|
|
1381
|
+
transitionProgress: menuOpenedProgress
|
|
1301
1382
|
}, /*#__PURE__*/React.createElement(ViewerMenuPreview, {
|
|
1302
1383
|
viewerTheme: viewerTheme,
|
|
1303
1384
|
className: styles$6.menuPreview,
|
|
1304
1385
|
screenSize: screenSize,
|
|
1305
1386
|
menuWidth: menuWidth,
|
|
1306
|
-
focusable:
|
|
1387
|
+
focusable: menuOpened,
|
|
1307
1388
|
items: items,
|
|
1308
|
-
|
|
1309
|
-
|
|
1389
|
+
currentScreenIndex: currentScreenIndex,
|
|
1390
|
+
shareUrl: shareUrl,
|
|
1391
|
+
onShare: onShare,
|
|
1392
|
+
onClickScreen: onClickScreen,
|
|
1393
|
+
onClose: onCloseMenu,
|
|
1310
1394
|
toggleFullscreen: toggleFullscreen,
|
|
1311
1395
|
fullscreenActive: fullscreenActive,
|
|
1312
1396
|
fullscreenEnabled: fullscreenEnabled
|
|
@@ -1380,7 +1464,7 @@ var propTypes$7 = {
|
|
|
1380
1464
|
width: PropTypes.number,
|
|
1381
1465
|
height: PropTypes.number,
|
|
1382
1466
|
scale: PropTypes.number,
|
|
1383
|
-
withNavigationHint: PropTypes.
|
|
1467
|
+
withNavigationHint: PropTypes.bool,
|
|
1384
1468
|
className: PropTypes.string
|
|
1385
1469
|
};
|
|
1386
1470
|
var defaultProps$7 = {
|
|
@@ -1433,11 +1517,11 @@ function ViewerScreen(_ref) {
|
|
|
1433
1517
|
ViewerScreen.propTypes = propTypes$7;
|
|
1434
1518
|
ViewerScreen.defaultProps = defaultProps$7;
|
|
1435
1519
|
|
|
1436
|
-
var styles$3 = {"
|
|
1520
|
+
var styles$3 = {"arrow":"micromag-viewer-buttons-navigation-button-arrow","next":"micromag-viewer-buttons-navigation-button-next","previous":"micromag-viewer-buttons-navigation-button-previous"};
|
|
1437
1521
|
|
|
1438
1522
|
var propTypes$6 = {
|
|
1439
1523
|
direction: PropTypes.oneOf(['previous', 'next']),
|
|
1440
|
-
onClick:
|
|
1524
|
+
onClick: PropTypes.func,
|
|
1441
1525
|
className: PropTypes.string
|
|
1442
1526
|
};
|
|
1443
1527
|
var defaultProps$6 = {
|
|
@@ -1450,37 +1534,57 @@ var NavigationButton = function NavigationButton(_ref) {
|
|
|
1450
1534
|
var direction = _ref.direction,
|
|
1451
1535
|
onClick = _ref.onClick,
|
|
1452
1536
|
className = _ref.className;
|
|
1453
|
-
return /*#__PURE__*/React.createElement(
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1537
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
1538
|
+
className: classNames([styles$3.container, styles$3[direction], _defineProperty({}, className, className !== null)]),
|
|
1539
|
+
onClick: onClick,
|
|
1540
|
+
iconPosition: direction === 'next' ? 'right' : 'left',
|
|
1541
|
+
icon: /*#__PURE__*/React.createElement("svg", {
|
|
1542
|
+
className: styles$3.arrow,
|
|
1543
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1544
|
+
width: "10",
|
|
1545
|
+
height: "16",
|
|
1546
|
+
viewBox: "0 0 10 16",
|
|
1547
|
+
fill: "currentColor"
|
|
1548
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
1549
|
+
points: "9.62 4.62 5 0 0.38 4.62 1.44 5.68 4.25 2.87 4.25 14.39 5.75 14.39 5.75 2.87 8.56 5.68 9.62 4.62"
|
|
1550
|
+
})),
|
|
1551
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
1552
|
+
className: "sr-only"
|
|
1553
|
+
}, direction === 'previous' ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
1554
|
+
id: "zYH/31",
|
|
1555
|
+
defaultMessage: [{
|
|
1556
|
+
"type": 0,
|
|
1557
|
+
"value": "Go to previous screen"
|
|
1558
|
+
}]
|
|
1559
|
+
}) : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
1560
|
+
id: "v9bqYj",
|
|
1561
|
+
defaultMessage: [{
|
|
1562
|
+
"type": 0,
|
|
1563
|
+
"value": "Go to next screen"
|
|
1564
|
+
}]
|
|
1565
|
+
}))
|
|
1566
|
+
});
|
|
1475
1567
|
};
|
|
1476
1568
|
|
|
1477
1569
|
NavigationButton.propTypes = propTypes$6;
|
|
1478
1570
|
NavigationButton.defaultProps = defaultProps$6;
|
|
1479
1571
|
|
|
1480
|
-
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","
|
|
1572
|
+
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","scrubbedTime":"micromag-viewer-partials-seek-bar-scrubbedTime","showTimestamp":"micromag-viewer-partials-seek-bar-showTimestamp"};
|
|
1573
|
+
|
|
1574
|
+
function getFormattedTimestamp(s) {
|
|
1575
|
+
var withMilliseconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1576
|
+
var sparts = withMilliseconds ? "".concat(s).split('.') : [];
|
|
1577
|
+
var ms = sparts.length > 1 ? ":".concat(sparts[1].substring(0, 3)) : '';
|
|
1578
|
+
return (s - (s %= 60)) / 60 + (9 < s ? ':' : ':0') + ~~s + ms; // eslint-disable-line
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
var SHOW_MILLISECONDS_THRESHOLD = 5; // show milliseconds when scrubbing if length of video is shorter than 5 seconds
|
|
1481
1582
|
|
|
1482
1583
|
var propTypes$5 = {
|
|
1483
|
-
media: PropTypes.
|
|
1584
|
+
media: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
1585
|
+
current: PropTypes.any
|
|
1586
|
+
}) // eslint-disable-line
|
|
1587
|
+
]),
|
|
1484
1588
|
playing: PropTypes.bool,
|
|
1485
1589
|
backgroundColor: PropTypes.string,
|
|
1486
1590
|
progressColor: PropTypes.string,
|
|
@@ -1505,7 +1609,7 @@ var defaultProps$5 = {
|
|
|
1505
1609
|
};
|
|
1506
1610
|
|
|
1507
1611
|
var SeekBar = function SeekBar(_ref) {
|
|
1508
|
-
var
|
|
1612
|
+
var _ref4;
|
|
1509
1613
|
|
|
1510
1614
|
var media = _ref.media,
|
|
1511
1615
|
playing = _ref.playing,
|
|
@@ -1521,13 +1625,28 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1521
1625
|
var progress = useMediaProgress(media, {
|
|
1522
1626
|
disabled: !playing
|
|
1523
1627
|
});
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1628
|
+
|
|
1629
|
+
var _ref2 = media || {},
|
|
1630
|
+
_ref2$currentTime = _ref2.currentTime,
|
|
1631
|
+
currentTime = _ref2$currentTime === void 0 ? null : _ref2$currentTime,
|
|
1632
|
+
_ref2$duration = _ref2.duration,
|
|
1633
|
+
duration = _ref2$duration === void 0 ? null : _ref2$duration;
|
|
1634
|
+
|
|
1635
|
+
var _useState = useState(false),
|
|
1636
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1637
|
+
showTimestamp = _useState2[0],
|
|
1638
|
+
setShowTimestamp = _useState2[1];
|
|
1639
|
+
|
|
1640
|
+
var onDrag = useCallback(function (_ref3) {
|
|
1641
|
+
var event = _ref3.event,
|
|
1642
|
+
_ref3$xy = _slicedToArray(_ref3.xy, 1),
|
|
1643
|
+
x = _ref3$xy[0],
|
|
1644
|
+
elapsedTime = _ref3.elapsedTime,
|
|
1645
|
+
active = _ref3.active,
|
|
1646
|
+
tap = _ref3.tap,
|
|
1647
|
+
currentTarget = _ref3.currentTarget;
|
|
1648
|
+
|
|
1649
|
+
event.stopPropagation();
|
|
1531
1650
|
|
|
1532
1651
|
if (!active && elapsedTime > 300) {
|
|
1533
1652
|
return;
|
|
@@ -1543,16 +1662,21 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1543
1662
|
onSeek(newProgress, tap);
|
|
1544
1663
|
}
|
|
1545
1664
|
}, [onSeek]);
|
|
1546
|
-
var onDragStart = useCallback(function () {
|
|
1665
|
+
var onDragStart = useCallback(function (event) {
|
|
1666
|
+
setShowTimestamp(true);
|
|
1667
|
+
|
|
1547
1668
|
if (onSeekStart !== null) {
|
|
1548
1669
|
onSeekStart();
|
|
1549
1670
|
}
|
|
1550
|
-
|
|
1671
|
+
|
|
1672
|
+
event.stopPropagation();
|
|
1673
|
+
}, [onSeekStart, setShowTimestamp]);
|
|
1551
1674
|
var onDragEnd = useCallback(function () {
|
|
1552
1675
|
if (onSeekEnd !== null) {
|
|
1676
|
+
setShowTimestamp(false);
|
|
1553
1677
|
onSeekEnd();
|
|
1554
1678
|
}
|
|
1555
|
-
}, [onSeekEnd]);
|
|
1679
|
+
}, [onSeekEnd, setShowTimestamp]);
|
|
1556
1680
|
var bind = useGesture({
|
|
1557
1681
|
onDrag: onDrag,
|
|
1558
1682
|
onDragStart: onDragStart,
|
|
@@ -1564,7 +1688,7 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1564
1688
|
}
|
|
1565
1689
|
});
|
|
1566
1690
|
return /*#__PURE__*/React.createElement("div", {
|
|
1567
|
-
className: classNames([styles$2.container, (
|
|
1691
|
+
className: classNames([styles$2.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$2.withSeekHead, withSeekHead), _defineProperty(_ref4, styles$2.showTimestamp, showTimestamp), _ref4)])
|
|
1568
1692
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1569
1693
|
className: styles$2.inner
|
|
1570
1694
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -1578,7 +1702,12 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1578
1702
|
left: "".concat(progress * 100, "%"),
|
|
1579
1703
|
backgroundColor: progressColor
|
|
1580
1704
|
}
|
|
1581
|
-
}
|
|
1705
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1706
|
+
className: styles$2.scrubbedTime,
|
|
1707
|
+
style: {
|
|
1708
|
+
borderColor: progressColor
|
|
1709
|
+
}
|
|
1710
|
+
}, getFormattedTimestamp(currentTime, duration < SHOW_MILLISECONDS_THRESHOLD))), /*#__PURE__*/React.createElement("div", {
|
|
1582
1711
|
className: styles$2.progress,
|
|
1583
1712
|
style: {
|
|
1584
1713
|
transform: "scaleX(".concat(progress, ")"),
|
|
@@ -1608,7 +1737,7 @@ var SeekBar = function SeekBar(_ref) {
|
|
|
1608
1737
|
SeekBar.propTypes = propTypes$5;
|
|
1609
1738
|
SeekBar.defaultProps = defaultProps$5;
|
|
1610
1739
|
|
|
1611
|
-
var styles$1 = {"muteButton":"micromag-viewer-partials-playback-controls-muteButton","playPauseButton":"micromag-viewer-partials-playback-controls-playPauseButton","container":"micromag-viewer-partials-playback-controls-container","icon":"micromag-viewer-partials-playback-controls-icon","withPlayPause":"micromag-viewer-partials-playback-controls-withPlayPause","isCollapsed":"micromag-viewer-partials-playback-controls-isCollapsed","isMuted":"micromag-viewer-partials-playback-controls-isMuted","withMute":"micromag-viewer-partials-playback-controls-withMute","
|
|
1740
|
+
var styles$1 = {"muteButton":"micromag-viewer-partials-playback-controls-muteButton","playPauseButton":"micromag-viewer-partials-playback-controls-playPauseButton","container":"micromag-viewer-partials-playback-controls-container","icon":"micromag-viewer-partials-playback-controls-icon","withPlayPause":"micromag-viewer-partials-playback-controls-withPlayPause","isCollapsed":"micromag-viewer-partials-playback-controls-isCollapsed","isMuted":"micromag-viewer-partials-playback-controls-isMuted","withMute":"micromag-viewer-partials-playback-controls-withMute","withSeekBar":"micromag-viewer-partials-playback-controls-withSeekBar","seekBar":"micromag-viewer-partials-playback-controls-seekBar","withSeekBarOnly":"micromag-viewer-partials-playback-controls-withSeekBarOnly"};
|
|
1612
1741
|
|
|
1613
1742
|
var propTypes$4 = {
|
|
1614
1743
|
className: PropTypes.string,
|
|
@@ -1713,7 +1842,8 @@ function PlaybackControls(_ref) {
|
|
|
1713
1842
|
setPlaying(true);
|
|
1714
1843
|
}
|
|
1715
1844
|
}, [setPlaying, wasPlaying]);
|
|
1716
|
-
var
|
|
1845
|
+
var hasMedia = mediaElement !== null;
|
|
1846
|
+
var mediaHasAudio = hasMedia && (hasAudio === null || hasAudio === true);
|
|
1717
1847
|
|
|
1718
1848
|
var _ref3 = customControlsTheme || {},
|
|
1719
1849
|
color = _ref3.color,
|
|
@@ -1722,33 +1852,55 @@ function PlaybackControls(_ref) {
|
|
|
1722
1852
|
|
|
1723
1853
|
var isCollapsed = controls && !controlsVisible && playing || !controls && mediaHasAudio;
|
|
1724
1854
|
return /*#__PURE__*/React.createElement("div", {
|
|
1725
|
-
className: classNames([styles$1.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$1.withPlayPause, controls && !seekBarOnly), _defineProperty(_ref4, styles$1.withMute,
|
|
1726
|
-
}, /*#__PURE__*/React.createElement(
|
|
1727
|
-
type: "button",
|
|
1855
|
+
className: classNames([styles$1.container, (_ref4 = {}, _defineProperty(_ref4, className, className !== null), _defineProperty(_ref4, styles$1.withPlayPause, controls && !seekBarOnly), _defineProperty(_ref4, styles$1.withMute, hasMedia || controls), _defineProperty(_ref4, styles$1.withSeekBar, controls), _defineProperty(_ref4, styles$1.withSeekBarOnly, seekBarOnly), _defineProperty(_ref4, styles$1.isCollapsed, isCollapsed), _defineProperty(_ref4, styles$1.isMuted, muted), _defineProperty(_ref4, collapsedClassName, collapsedClassName !== null && isCollapsed), _ref4)])
|
|
1856
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1728
1857
|
className: styles$1.playPauseButton,
|
|
1729
1858
|
style: {
|
|
1730
1859
|
color: color
|
|
1731
1860
|
},
|
|
1732
1861
|
onClick: playing ? onPause : onPlay,
|
|
1733
|
-
|
|
1734
|
-
|
|
1862
|
+
focusable: controlsVisible,
|
|
1863
|
+
icon: playing ? /*#__PURE__*/React.createElement("svg", {
|
|
1864
|
+
className: styles$1.icon,
|
|
1865
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1866
|
+
width: "10",
|
|
1867
|
+
height: "16",
|
|
1868
|
+
viewBox: "0 0 10 16",
|
|
1869
|
+
fill: "currentColor"
|
|
1870
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
1871
|
+
x: "1",
|
|
1872
|
+
y: "3.27",
|
|
1873
|
+
width: "3",
|
|
1874
|
+
height: "9.69"
|
|
1875
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
1876
|
+
x: "6",
|
|
1877
|
+
y: "3.27",
|
|
1878
|
+
width: "3",
|
|
1879
|
+
height: "9.69"
|
|
1880
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
1881
|
+
className: styles$1.icon,
|
|
1882
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1883
|
+
width: "10",
|
|
1884
|
+
height: "16",
|
|
1885
|
+
viewBox: "0 0 10 16",
|
|
1886
|
+
fill: "currentColor"
|
|
1887
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1888
|
+
d: "M1,3.16V12.84l8-4.84L1,3.16"
|
|
1889
|
+
})),
|
|
1890
|
+
"aria-label": playing ? intl.formatMessage({
|
|
1891
|
+
id: "mTqcmA",
|
|
1735
1892
|
defaultMessage: [{
|
|
1736
1893
|
"type": 0,
|
|
1737
|
-
"value": "
|
|
1894
|
+
"value": "Pause"
|
|
1738
1895
|
}]
|
|
1739
|
-
})
|
|
1740
|
-
"aria-label": intl.formatMessage({
|
|
1896
|
+
}) : intl.formatMessage({
|
|
1741
1897
|
id: "ahSpiH",
|
|
1742
1898
|
defaultMessage: [{
|
|
1743
1899
|
"type": 0,
|
|
1744
1900
|
"value": "Play"
|
|
1745
1901
|
}]
|
|
1746
|
-
})
|
|
1747
|
-
|
|
1748
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1749
|
-
className: styles$1.icon,
|
|
1750
|
-
icon: playing ? faPause : faPlay
|
|
1751
|
-
})), /*#__PURE__*/React.createElement(SeekBar, {
|
|
1902
|
+
})
|
|
1903
|
+
}), /*#__PURE__*/React.createElement(SeekBar, {
|
|
1752
1904
|
className: styles$1.seekBar,
|
|
1753
1905
|
media: mediaElement,
|
|
1754
1906
|
playing: playing,
|
|
@@ -1759,32 +1911,54 @@ function PlaybackControls(_ref) {
|
|
|
1759
1911
|
withSeekHead: !isCollapsed && !seekBarOnly,
|
|
1760
1912
|
backgroundColor: color,
|
|
1761
1913
|
progressColor: progressColor
|
|
1762
|
-
}), /*#__PURE__*/React.createElement(
|
|
1763
|
-
|
|
1764
|
-
className: classNames([styles$1.muteButton, _defineProperty({}, styles$1.isMuted, muted)]),
|
|
1914
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
1915
|
+
className: styles$1.muteButton,
|
|
1765
1916
|
style: {
|
|
1766
1917
|
color: color
|
|
1767
1918
|
},
|
|
1768
1919
|
onClick: muted ? onUnmute : onMute,
|
|
1769
|
-
|
|
1770
|
-
|
|
1920
|
+
focusable: controlsVisible || mediaHasAudio,
|
|
1921
|
+
icon: muted ? /*#__PURE__*/React.createElement("svg", {
|
|
1922
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1923
|
+
width: "10",
|
|
1924
|
+
height: "16",
|
|
1925
|
+
viewBox: "0 0 10 16",
|
|
1926
|
+
className: styles$1.icon,
|
|
1927
|
+
fill: "currentColor"
|
|
1928
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
1929
|
+
points: "2.75 4.63 1.24 6 0 6 0 10 1.24 10 4.54 13 4.54 3 2.75 4.63"
|
|
1930
|
+
}), /*#__PURE__*/React.createElement("polygon", {
|
|
1931
|
+
points: "10 6.63 8.94 5.57 7.58 6.93 6.21 5.57 5.15 6.63 6.52 7.99 5.15 9.35 6.21 10.43 7.58 9.06 8.94 10.43 10 9.35 8.64 7.99 10 6.63"
|
|
1932
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
1933
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1934
|
+
width: "10",
|
|
1935
|
+
height: "16",
|
|
1936
|
+
viewBox: "0 0 10 16",
|
|
1937
|
+
className: styles$1.icon,
|
|
1938
|
+
fill: "currentColor"
|
|
1939
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
1940
|
+
points: "2.75 4.63 1.24 6 0 6 0 10 1.24 10 4.54 13 4.54 3 2.75 4.63"
|
|
1941
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
1942
|
+
cx: "6.14",
|
|
1943
|
+
cy: "8",
|
|
1944
|
+
r: ".99"
|
|
1945
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
1946
|
+
d: "M6.14,11.88v-1.5c1.31,0,2.38-1.07,2.38-2.38s-1.07-2.38-2.38-2.38v-1.5c2.14,0,3.88,1.74,3.88,3.88s-1.74,3.88-3.88,3.88Z"
|
|
1947
|
+
})),
|
|
1948
|
+
"aria-label": muted ? intl.formatMessage({
|
|
1949
|
+
id: "RK/QEY",
|
|
1771
1950
|
defaultMessage: [{
|
|
1772
1951
|
"type": 0,
|
|
1773
|
-
"value": "
|
|
1952
|
+
"value": "Unmute"
|
|
1774
1953
|
}]
|
|
1775
|
-
})
|
|
1776
|
-
"aria-label": intl.formatMessage({
|
|
1954
|
+
}) : intl.formatMessage({
|
|
1777
1955
|
id: "vzg8Es",
|
|
1778
1956
|
defaultMessage: [{
|
|
1779
1957
|
"type": 0,
|
|
1780
1958
|
"value": "Mute"
|
|
1781
1959
|
}]
|
|
1782
|
-
})
|
|
1783
|
-
|
|
1784
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1785
|
-
className: styles$1.icon,
|
|
1786
|
-
icon: faVolumeUp
|
|
1787
|
-
})));
|
|
1960
|
+
})
|
|
1961
|
+
}));
|
|
1788
1962
|
}
|
|
1789
1963
|
|
|
1790
1964
|
PlaybackControls.propTypes = propTypes$4;
|
|
@@ -1877,6 +2051,15 @@ function WebViewContainer(_ref) {
|
|
|
1877
2051
|
WebViewContainer.propTypes = propTypes$3;
|
|
1878
2052
|
WebViewContainer.defaultProps = defaultProps$3;
|
|
1879
2053
|
|
|
2054
|
+
var SPRING_CONFIG_TIGHT = {
|
|
2055
|
+
tension: 300,
|
|
2056
|
+
friction: 35
|
|
2057
|
+
}; // tight
|
|
2058
|
+
|
|
2059
|
+
var DRAG_PROGRESS_ACTIVATION_THRESHOLD = 0.3;
|
|
2060
|
+
var DRAG_VELOCITY_ACTIVATION_THRESHOLD = 0.3;
|
|
2061
|
+
var DEFAULT_TRANSITION_TYPE_LANDSCAPE = 'carousel';
|
|
2062
|
+
var DEFAULT_TRANSITION_TYPE_PORTRAIT = 'stack';
|
|
1880
2063
|
var propTypes$2 = {
|
|
1881
2064
|
story: PropTypes$1.story,
|
|
1882
2065
|
// .isRequired,
|
|
@@ -1892,17 +2075,19 @@ var propTypes$2 = {
|
|
|
1892
2075
|
onScreenChange: PropTypes.func,
|
|
1893
2076
|
tapNextScreenWidthPercent: PropTypes.number,
|
|
1894
2077
|
neighborScreensActive: PropTypes.number,
|
|
1895
|
-
neighborScreensMounted: PropTypes.number,
|
|
1896
2078
|
storyIsParsed: PropTypes.bool,
|
|
1897
|
-
landscapeScreenMargin: PropTypes.number,
|
|
1898
|
-
landscapeSmallScreenScale: PropTypes.number,
|
|
2079
|
+
// landscapeScreenMargin: PropTypes.number,
|
|
2080
|
+
// landscapeSmallScreenScale: PropTypes.number,
|
|
1899
2081
|
withMetadata: PropTypes.bool,
|
|
2082
|
+
withoutGestures: PropTypes.bool,
|
|
1900
2083
|
withoutMenu: PropTypes.bool,
|
|
1901
2084
|
withoutScreensMenu: PropTypes.bool,
|
|
1902
2085
|
withoutShareMenu: PropTypes.bool,
|
|
1903
2086
|
withoutMenuShadow: PropTypes.bool,
|
|
1904
2087
|
withoutFullscreen: PropTypes.bool,
|
|
1905
|
-
|
|
2088
|
+
withoutNavigationArrow: PropTypes.bool,
|
|
2089
|
+
withoutTransitions: PropTypes.bool,
|
|
2090
|
+
withNeighborScreens: PropTypes.bool,
|
|
1906
2091
|
withNavigationHint: PropTypes.bool,
|
|
1907
2092
|
withoutPlaybackControls: PropTypes.bool,
|
|
1908
2093
|
closeable: PropTypes.bool,
|
|
@@ -1934,18 +2119,20 @@ var defaultProps$2 = {
|
|
|
1934
2119
|
onScreenChange: null,
|
|
1935
2120
|
tapNextScreenWidthPercent: 0.8,
|
|
1936
2121
|
neighborScreensActive: 1,
|
|
1937
|
-
neighborScreensMounted: 1,
|
|
1938
2122
|
storyIsParsed: false,
|
|
1939
|
-
landscapeScreenMargin: 20,
|
|
1940
|
-
landscapeSmallScreenScale: 0.9,
|
|
2123
|
+
// landscapeScreenMargin: 20,
|
|
2124
|
+
// landscapeSmallScreenScale: 0.9,
|
|
1941
2125
|
withMetadata: false,
|
|
2126
|
+
withNeighborScreens: false,
|
|
2127
|
+
withNavigationHint: false,
|
|
2128
|
+
withoutGestures: false,
|
|
1942
2129
|
withoutMenu: false,
|
|
1943
2130
|
withoutScreensMenu: false,
|
|
1944
2131
|
withoutShareMenu: false,
|
|
1945
2132
|
withoutMenuShadow: false,
|
|
1946
2133
|
withoutFullscreen: false,
|
|
1947
|
-
|
|
1948
|
-
|
|
2134
|
+
withoutTransitions: false,
|
|
2135
|
+
withoutNavigationArrow: false,
|
|
1949
2136
|
withoutPlaybackControls: false,
|
|
1950
2137
|
menuIsScreenWidth: false,
|
|
1951
2138
|
closeable: false,
|
|
@@ -1974,17 +2161,17 @@ var Viewer = function Viewer(_ref) {
|
|
|
1974
2161
|
visitor = _ref.visitor,
|
|
1975
2162
|
tapNextScreenWidthPercent = _ref.tapNextScreenWidthPercent,
|
|
1976
2163
|
neighborScreensActive = _ref.neighborScreensActive,
|
|
1977
|
-
neighborScreensMounted = _ref.neighborScreensMounted,
|
|
1978
2164
|
storyIsParsed = _ref.storyIsParsed,
|
|
1979
|
-
landscapeScreenMargin = _ref.landscapeScreenMargin,
|
|
1980
|
-
landscapeSmallScreenScale = _ref.landscapeSmallScreenScale,
|
|
1981
2165
|
withMetadata = _ref.withMetadata,
|
|
2166
|
+
withoutGestures = _ref.withoutGestures,
|
|
1982
2167
|
withoutMenu = _ref.withoutMenu,
|
|
1983
2168
|
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
1984
2169
|
withoutShareMenu = _ref.withoutShareMenu,
|
|
1985
2170
|
withoutMenuShadow = _ref.withoutMenuShadow;
|
|
1986
2171
|
_ref.withoutFullscreen;
|
|
1987
|
-
var
|
|
2172
|
+
var withoutNavigationArrow = _ref.withoutNavigationArrow;
|
|
2173
|
+
_ref.withoutTransitions;
|
|
2174
|
+
var withNeighborScreens = _ref.withNeighborScreens,
|
|
1988
2175
|
withNavigationHint = _ref.withNavigationHint,
|
|
1989
2176
|
withoutPlaybackControls = _ref.withoutPlaybackControls,
|
|
1990
2177
|
menuIsScreenWidth = _ref.menuIsScreenWidth,
|
|
@@ -1998,7 +2185,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
1998
2185
|
screensMedias = _ref.screensMedias,
|
|
1999
2186
|
screenSizeOptions = _ref.screenSizeOptions,
|
|
2000
2187
|
className = _ref.className;
|
|
2001
|
-
|
|
2188
|
+
|
|
2189
|
+
/**
|
|
2190
|
+
* Screen Data + Processing
|
|
2191
|
+
*/
|
|
2002
2192
|
var parsedStory = useParsedStory(story, {
|
|
2003
2193
|
disabled: storyIsParsed
|
|
2004
2194
|
}) || {};
|
|
@@ -2010,20 +2200,59 @@ var Viewer = function Viewer(_ref) {
|
|
|
2010
2200
|
metadata = _parsedStory$metadata === void 0 ? null : _parsedStory$metadata,
|
|
2011
2201
|
_parsedStory$fonts = parsedStory.fonts,
|
|
2012
2202
|
fonts = _parsedStory$fonts === void 0 ? null : _parsedStory$fonts;
|
|
2203
|
+
var screensCount = screens.length;
|
|
2013
2204
|
var eventsManager = useMemo(function () {
|
|
2014
2205
|
return new EventEmitter();
|
|
2015
|
-
}, [parsedStory]);
|
|
2206
|
+
}, [parsedStory]);
|
|
2207
|
+
var screenIndex = useMemo(function () {
|
|
2208
|
+
return Math.max(0, screens.findIndex(function (it) {
|
|
2209
|
+
return "".concat(it.id) === "".concat(screenId);
|
|
2210
|
+
}));
|
|
2211
|
+
}, [screenId, screens]);
|
|
2212
|
+
var currentScreen = screens[screenIndex] || null;
|
|
2016
2213
|
|
|
2017
|
-
var _ref2 =
|
|
2018
|
-
|
|
2214
|
+
var _ref2 = currentScreen || {},
|
|
2215
|
+
screenParameters = _ref2.parameters;
|
|
2216
|
+
|
|
2217
|
+
var _ref3 = screenParameters || {},
|
|
2218
|
+
screenMetadata = _ref3.metadata;
|
|
2219
|
+
|
|
2220
|
+
var _ref4 = screenMetadata || {},
|
|
2221
|
+
_ref4$title = _ref4.title,
|
|
2222
|
+
screenTitle = _ref4$title === void 0 ? null : _ref4$title,
|
|
2223
|
+
_ref4$description = _ref4.description,
|
|
2224
|
+
screenDescription = _ref4$description === void 0 ? null : _ref4$description;
|
|
2225
|
+
|
|
2226
|
+
var finalTitle = screenTitle !== null ? screenTitle : title;
|
|
2227
|
+
var finalMetadata = useMemo(function () {
|
|
2228
|
+
return screenDescription !== null ? _objectSpread(_objectSpread({}, metadata), {}, {
|
|
2229
|
+
description: screenDescription
|
|
2230
|
+
}) : metadata;
|
|
2231
|
+
}, [metadata, screenDescription]);
|
|
2232
|
+
var screensMediasRef = useRef([]);
|
|
2233
|
+
|
|
2234
|
+
if (currentScreenMedia !== null) {
|
|
2235
|
+
currentScreenMedia.current = screensMediasRef.current[screenIndex] || null;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
if (screensMedias !== null) {
|
|
2239
|
+
screensMedias.current = screensMediasRef.current;
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Screen Layout
|
|
2243
|
+
*/
|
|
2019
2244
|
|
|
2020
|
-
var _ref3 = textStyles || {},
|
|
2021
|
-
_ref3$title = _ref3.title,
|
|
2022
|
-
themeTextStyle = _ref3$title === void 0 ? null : _ref3$title;
|
|
2023
2245
|
|
|
2024
|
-
var
|
|
2025
|
-
|
|
2026
|
-
|
|
2246
|
+
var _ref5 = viewerTheme || {},
|
|
2247
|
+
textStyles = _ref5.textStyles;
|
|
2248
|
+
|
|
2249
|
+
var _ref6 = textStyles || {},
|
|
2250
|
+
_ref6$title = _ref6.title,
|
|
2251
|
+
themeTextStyle = _ref6$title === void 0 ? null : _ref6$title;
|
|
2252
|
+
|
|
2253
|
+
var _ref7 = themeTextStyle || {},
|
|
2254
|
+
_ref7$fontFamily = _ref7.fontFamily,
|
|
2255
|
+
themeFont = _ref7$fontFamily === void 0 ? null : _ref7$fontFamily; // Fonts
|
|
2027
2256
|
|
|
2028
2257
|
|
|
2029
2258
|
var finalFonts = useMemo(function () {
|
|
@@ -2050,8 +2279,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
2050
2279
|
_usePlaybackContext$m = _usePlaybackContext.media,
|
|
2051
2280
|
playbackMedia = _usePlaybackContext$m === void 0 ? null : _usePlaybackContext$m;
|
|
2052
2281
|
|
|
2053
|
-
var
|
|
2054
|
-
|
|
2282
|
+
var _useDimensionObserver = useDimensionObserver(),
|
|
2283
|
+
playbackControlsContainerRef = _useDimensionObserver.ref,
|
|
2284
|
+
_useDimensionObserver2 = _useDimensionObserver.height,
|
|
2285
|
+
playbackControlsContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
2286
|
+
|
|
2287
|
+
var trackScreenView = useTrackScreenView(); // Get screen size
|
|
2055
2288
|
|
|
2056
2289
|
var _useScreenSizeFromEle = useScreenSizeFromElement(_objectSpread({
|
|
2057
2290
|
width: width,
|
|
@@ -2062,21 +2295,26 @@ var Viewer = function Viewer(_ref) {
|
|
|
2062
2295
|
screenSize = _useScreenSizeFromEle.screenSize,
|
|
2063
2296
|
screenScale = _useScreenSizeFromEle.scale;
|
|
2064
2297
|
|
|
2065
|
-
var
|
|
2066
|
-
|
|
2067
|
-
screenWidth =
|
|
2068
|
-
|
|
2069
|
-
screenHeight =
|
|
2070
|
-
|
|
2071
|
-
landscape =
|
|
2072
|
-
|
|
2073
|
-
menuOverScreen =
|
|
2298
|
+
var _ref8 = screenSize || {},
|
|
2299
|
+
_ref8$width = _ref8.width,
|
|
2300
|
+
screenWidth = _ref8$width === void 0 ? null : _ref8$width,
|
|
2301
|
+
_ref8$height = _ref8.height,
|
|
2302
|
+
screenHeight = _ref8$height === void 0 ? null : _ref8$height,
|
|
2303
|
+
_ref8$landscape = _ref8.landscape,
|
|
2304
|
+
landscape = _ref8$landscape === void 0 ? false : _ref8$landscape,
|
|
2305
|
+
_ref8$menuOverScreen = _ref8.menuOverScreen,
|
|
2306
|
+
menuOverScreen = _ref8$menuOverScreen === void 0 ? false : _ref8$menuOverScreen;
|
|
2074
2307
|
|
|
2075
2308
|
var screenContainerWidth = screenScale !== null ? screenWidth * screenScale : screenWidth;
|
|
2076
2309
|
var screenContainerHeight = screenScale !== null ? screenHeight * screenScale : screenHeight;
|
|
2077
2310
|
var hasSize = screenWidth > 0 && screenHeight > 0;
|
|
2078
|
-
var ready = hasSize;
|
|
2079
|
-
|
|
2311
|
+
var ready = hasSize;
|
|
2312
|
+
var trackingEnabled = isView;
|
|
2313
|
+
useEffect(function () {
|
|
2314
|
+
if (trackingEnabled && currentScreen !== null) {
|
|
2315
|
+
trackScreenView(currentScreen, screenIndex);
|
|
2316
|
+
}
|
|
2317
|
+
}, [currentScreen, trackScreenView, trackingEnabled]);
|
|
2080
2318
|
useEffect(function () {
|
|
2081
2319
|
if (ready && onViewModeChange !== null) {
|
|
2082
2320
|
onViewModeChange({
|
|
@@ -2085,21 +2323,14 @@ var Viewer = function Viewer(_ref) {
|
|
|
2085
2323
|
});
|
|
2086
2324
|
}
|
|
2087
2325
|
}, [ready, landscape, menuOverScreen, onViewModeChange]);
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
return Math.max(0, screens.findIndex(function (it) {
|
|
2092
|
-
return "".concat(it.id) === "".concat(screenId);
|
|
2093
|
-
}));
|
|
2094
|
-
}, [screenId, screens]);
|
|
2095
|
-
|
|
2096
|
-
if (currentScreenMedia !== null) {
|
|
2097
|
-
currentScreenMedia.current = screensMediasRef.current[screenIndex] || null;
|
|
2098
|
-
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Screen Transitions
|
|
2328
|
+
*/
|
|
2099
2329
|
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2330
|
+
var transitionType = landscape && withNeighborScreens ? DEFAULT_TRANSITION_TYPE_LANDSCAPE : DEFAULT_TRANSITION_TYPE_PORTRAIT;
|
|
2331
|
+
/**
|
|
2332
|
+
* Screen Navigation
|
|
2333
|
+
*/
|
|
2103
2334
|
|
|
2104
2335
|
var changeIndex = useCallback(function (index) {
|
|
2105
2336
|
if (index === screenIndex) {
|
|
@@ -2113,23 +2344,37 @@ var Viewer = function Viewer(_ref) {
|
|
|
2113
2344
|
if (onScreenChange !== null) {
|
|
2114
2345
|
onScreenChange(screens[index], index);
|
|
2115
2346
|
}
|
|
2116
|
-
}, [screenIndex, screens, onScreenChange]);
|
|
2347
|
+
}, [screenIndex, screens, onScreenChange]);
|
|
2348
|
+
var onScreenNavigate = useCallback(function (_ref9) {
|
|
2349
|
+
var index = _ref9.index,
|
|
2350
|
+
newIndex = _ref9.newIndex,
|
|
2351
|
+
end = _ref9.end,
|
|
2352
|
+
direction = _ref9.direction;
|
|
2117
2353
|
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
useEffect(function () {
|
|
2121
|
-
if (trackingEnabled && currentScreen !== null) {
|
|
2122
|
-
trackScreenView(currentScreen, screenIndex);
|
|
2354
|
+
if (end && onEnd !== null) {
|
|
2355
|
+
onEnd();
|
|
2123
2356
|
}
|
|
2124
|
-
}, [currentScreen, trackScreenView, trackingEnabled]); // Handle interaction enable
|
|
2125
2357
|
|
|
2358
|
+
changeIndex(newIndex);
|
|
2359
|
+
eventsManager.emit('navigate', {
|
|
2360
|
+
index: index,
|
|
2361
|
+
newIndex: newIndex,
|
|
2362
|
+
direction: direction,
|
|
2363
|
+
end: end
|
|
2364
|
+
});
|
|
2365
|
+
|
|
2366
|
+
if (end) {
|
|
2367
|
+
eventsManager.emit('navigate_end');
|
|
2368
|
+
} else {
|
|
2369
|
+
eventsManager.emit("navigate_".concat(direction), newIndex);
|
|
2370
|
+
}
|
|
2371
|
+
}, [onEnd, changeIndex]);
|
|
2126
2372
|
var gotoPreviousScreen = useCallback(function () {
|
|
2127
2373
|
changeIndex(Math.max(0, screenIndex - 1));
|
|
2128
|
-
}, [changeIndex]);
|
|
2374
|
+
}, [changeIndex, screenIndex]);
|
|
2129
2375
|
var gotoNextScreen = useCallback(function () {
|
|
2130
2376
|
changeIndex(Math.min(screens.length - 1, screenIndex + 1));
|
|
2131
|
-
}, [changeIndex]);
|
|
2132
|
-
var screensCount = screens.length;
|
|
2377
|
+
}, [changeIndex, screenIndex]);
|
|
2133
2378
|
|
|
2134
2379
|
var _useState = useState(false),
|
|
2135
2380
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2145,37 +2390,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
2145
2390
|
setHasInteracted(true);
|
|
2146
2391
|
}
|
|
2147
2392
|
}, [onInteraction, hasInteracted, setHasInteracted]);
|
|
2148
|
-
var onScreenNavigate = useCallback(function (_ref6) {
|
|
2149
|
-
var index = _ref6.index,
|
|
2150
|
-
newIndex = _ref6.newIndex,
|
|
2151
|
-
end = _ref6.end,
|
|
2152
|
-
direction = _ref6.direction;
|
|
2153
|
-
|
|
2154
|
-
if (end && onEnd !== null) {
|
|
2155
|
-
onEnd();
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
|
-
changeIndex(newIndex);
|
|
2159
|
-
eventsManager.emit('navigate', {
|
|
2160
|
-
newIndex: newIndex,
|
|
2161
|
-
index: index,
|
|
2162
|
-
direction: direction,
|
|
2163
|
-
end: end
|
|
2164
|
-
});
|
|
2165
|
-
|
|
2166
|
-
if (end) {
|
|
2167
|
-
eventsManager.emit('navigate_end');
|
|
2168
|
-
} else {
|
|
2169
|
-
eventsManager.emit("navigate_".concat(direction), newIndex);
|
|
2170
|
-
}
|
|
2171
|
-
}, [onEnd, changeIndex]);
|
|
2172
2393
|
|
|
2173
2394
|
var _useScreenInteraction = useScreenInteraction({
|
|
2174
2395
|
screens: screens,
|
|
2175
2396
|
screenIndex: screenIndex,
|
|
2176
2397
|
screenWidth: screenContainerWidth,
|
|
2177
2398
|
disableCurrentScreenNavigation: !isView,
|
|
2178
|
-
clickOnSiblings: landscape && withLandscapeSiblingsScreens,
|
|
2179
2399
|
nextScreenWidthPercent: tapNextScreenWidthPercent,
|
|
2180
2400
|
onInteract: onInteractionPrivate,
|
|
2181
2401
|
onNavigate: onScreenNavigate
|
|
@@ -2183,102 +2403,127 @@ var Viewer = function Viewer(_ref) {
|
|
|
2183
2403
|
interactWithScreen = _useScreenInteraction.interact,
|
|
2184
2404
|
currentScreenInteractionEnabled = _useScreenInteraction.currentScreenInteractionEnabled,
|
|
2185
2405
|
enableInteraction = _useScreenInteraction.enableInteraction,
|
|
2186
|
-
disableInteraction = _useScreenInteraction.disableInteraction;
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
var
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2406
|
+
disableInteraction = _useScreenInteraction.disableInteraction;
|
|
2407
|
+
|
|
2408
|
+
var onTap = useCallback(function (_ref10) {
|
|
2409
|
+
var currentTarget = _ref10.currentTarget,
|
|
2410
|
+
event = _ref10.event,
|
|
2411
|
+
target = _ref10.target,
|
|
2412
|
+
_ref10$xy = _slicedToArray(_ref10.xy, 2),
|
|
2413
|
+
x = _ref10$xy[0],
|
|
2414
|
+
y = _ref10$xy[1];
|
|
2415
|
+
|
|
2416
|
+
interactWithScreen({
|
|
2417
|
+
event: event,
|
|
2418
|
+
target: target,
|
|
2419
|
+
currentTarget: currentTarget,
|
|
2420
|
+
index: screenIndex,
|
|
2421
|
+
x: x,
|
|
2422
|
+
y: y
|
|
2423
|
+
});
|
|
2424
|
+
}, [interactWithScreen, screenIndex]);
|
|
2425
|
+
var computeScreenProgress = useCallback(function (_ref11) {
|
|
2426
|
+
var active = _ref11.active,
|
|
2427
|
+
_ref11$movement = _slicedToArray(_ref11.movement, 1),
|
|
2428
|
+
mx = _ref11$movement[0],
|
|
2429
|
+
_ref11$velocity = _slicedToArray(_ref11.velocity, 1),
|
|
2430
|
+
vx = _ref11$velocity[0];
|
|
2431
|
+
|
|
2432
|
+
var p = mx / screenContainerWidth; // drag "ratio": how much of the screen width has been swiped?
|
|
2433
|
+
|
|
2434
|
+
var forwards = mx < 0; // true if swiping to left (to navigate forwards)
|
|
2435
|
+
|
|
2436
|
+
var newIndex = !forwards ? screenIndex - 1 : screenIndex + 1; // which item index are we moving towards?
|
|
2437
|
+
|
|
2438
|
+
var reachedThreshold = vx > DRAG_VELOCITY_ACTIVATION_THRESHOLD || Math.abs(p) > DRAG_PROGRESS_ACTIVATION_THRESHOLD;
|
|
2439
|
+
var reachedBounds = newIndex < 0 || newIndex >= screensCount; // have we reached the end of the stack?
|
|
2440
|
+
|
|
2441
|
+
var damper = reachedBounds ? 0.1 : 1;
|
|
2442
|
+
var progress = Math.max(-1, Math.min(1, p * damper));
|
|
2443
|
+
|
|
2444
|
+
if (!active) {
|
|
2445
|
+
return reachedThreshold && !reachedBounds ? newIndex : screenIndex;
|
|
2224
2446
|
}
|
|
2225
2447
|
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2448
|
+
return screenIndex - progress;
|
|
2449
|
+
}, [screenContainerWidth, screenIndex]);
|
|
2450
|
+
var onScreenProgress = useCallback(function (progress, _ref12) {
|
|
2451
|
+
var active = _ref12.active;
|
|
2452
|
+
var delta = Math.abs(progress - screenIndex);
|
|
2453
|
+
var reachedBounds = progress < 0 || progress >= screensCount; // have we reached the end of the stack?
|
|
2232
2454
|
|
|
2233
|
-
|
|
2234
|
-
var nextIndex = hasTappedLeft ? Math.max(0, screenIndex - 1) : Math.min(screensCount - 1, screenIndex + 1);
|
|
2455
|
+
if (!active && delta === 1 && !reachedBounds) {
|
|
2235
2456
|
onScreenNavigate({
|
|
2236
2457
|
index: screenIndex,
|
|
2237
|
-
newIndex:
|
|
2458
|
+
newIndex: progress
|
|
2238
2459
|
});
|
|
2239
2460
|
}
|
|
2240
|
-
}, [
|
|
2241
|
-
var
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2461
|
+
}, [onScreenNavigate, screenIndex]);
|
|
2462
|
+
var springParams = useMemo(function () {
|
|
2463
|
+
return {
|
|
2464
|
+
config: SPRING_CONFIG_TIGHT
|
|
2465
|
+
};
|
|
2466
|
+
}, []);
|
|
2467
|
+
|
|
2468
|
+
var _useDragProgress = useDragProgress({
|
|
2469
|
+
progress: screenIndex,
|
|
2470
|
+
disabled: !isView,
|
|
2471
|
+
dragDisabled: withoutGestures,
|
|
2472
|
+
computeProgress: computeScreenProgress,
|
|
2473
|
+
onProgress: onScreenProgress,
|
|
2474
|
+
onTap: onTap,
|
|
2475
|
+
springParams: springParams
|
|
2476
|
+
}),
|
|
2477
|
+
isDragging = _useDragProgress.dragging,
|
|
2478
|
+
screenIndexProgress = _useDragProgress.progress,
|
|
2479
|
+
dragContentBind = _useDragProgress.bind;
|
|
2480
|
+
|
|
2481
|
+
var getScreenStylesByIndex = function getScreenStylesByIndex(index, progress) {
|
|
2482
|
+
if (transitionType === 'stack') {
|
|
2483
|
+
var _t = index - progress;
|
|
2246
2484
|
|
|
2247
|
-
|
|
2248
|
-
|
|
2485
|
+
var _clamped = Math.min(1, Math.max(0, _t));
|
|
2486
|
+
|
|
2487
|
+
var invert = Math.min(1, Math.max(0, -_t));
|
|
2488
|
+
var opacity = Math.max(0, 1 - 0.75 * invert + (_t + 1));
|
|
2489
|
+
return {
|
|
2490
|
+
opacity: opacity,
|
|
2491
|
+
transform: "translateX(".concat(_clamped * 100, "%) scale(").concat(1 - 0.2 * invert, ")"),
|
|
2492
|
+
boxShadow: "0 0 ".concat(4 * (1 - _clamped), "rem ").concat(-0.5 * (1 - _clamped), "rem black"),
|
|
2493
|
+
zIndex: index
|
|
2494
|
+
};
|
|
2249
2495
|
}
|
|
2250
|
-
}, [withLandscapeSiblingsScreens, changeIndex, landscape, screenIndex]); // swipe menu open
|
|
2251
2496
|
|
|
2252
|
-
|
|
2497
|
+
var t = index - progress;
|
|
2498
|
+
var clamped = Math.min(1, Math.max(0, Math.abs(t)));
|
|
2499
|
+
return {
|
|
2500
|
+
opacity: 1 - 0.75 * clamped,
|
|
2501
|
+
transform: "translateX(".concat(t * 105, "%) scale(").concat(1 - 0.2 * clamped, ")"),
|
|
2502
|
+
zIndex: screensCount - index
|
|
2503
|
+
};
|
|
2504
|
+
};
|
|
2505
|
+
|
|
2506
|
+
var _useFullscreen = useFullscreen(containerRef.current || null),
|
|
2507
|
+
toggleFullscreen = _useFullscreen.toggle,
|
|
2508
|
+
fullscreenActive = _useFullscreen.active,
|
|
2509
|
+
fullscreenEnabled = _useFullscreen.enabled;
|
|
2253
2510
|
|
|
2254
|
-
var
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
return setMenuOpened(false);
|
|
2264
|
-
}, [setMenuOpened]);
|
|
2265
|
-
var onClickMenu = useCallback(function () {
|
|
2266
|
-
onInteractionPrivate();
|
|
2267
|
-
setMenuOpened(true);
|
|
2268
|
-
}, [changeIndex, onInteractionPrivate, setMenuOpened]);
|
|
2269
|
-
var onClickMenuItem = useCallback(function (_ref10) {
|
|
2270
|
-
var itemScreenId = _ref10.screenId;
|
|
2511
|
+
var menuVisible = screensCount === 0 || currentScreenInteractionEnabled; // Get element height
|
|
2512
|
+
|
|
2513
|
+
var _useDimensionObserver3 = useDimensionObserver(),
|
|
2514
|
+
menuDotsContainerRef = _useDimensionObserver3.ref,
|
|
2515
|
+
_useDimensionObserver4 = _useDimensionObserver3.height,
|
|
2516
|
+
menuDotsContainerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
2517
|
+
|
|
2518
|
+
var onClickScreen = useCallback(function (_ref13) {
|
|
2519
|
+
var itemScreenId = _ref13.screenId;
|
|
2271
2520
|
onInteractionPrivate();
|
|
2272
|
-
var index = screens.findIndex(function (
|
|
2273
|
-
var id =
|
|
2521
|
+
var index = screens.findIndex(function (_ref14) {
|
|
2522
|
+
var id = _ref14.id;
|
|
2274
2523
|
return id === itemScreenId;
|
|
2275
2524
|
});
|
|
2276
2525
|
changeIndex(index);
|
|
2277
|
-
|
|
2278
|
-
if (menuOpened) {
|
|
2279
|
-
setMenuOpened(false);
|
|
2280
|
-
}
|
|
2281
|
-
}, [onInteractionPrivate, changeIndex, menuOpened, setMenuOpened]);
|
|
2526
|
+
}, [onInteractionPrivate, changeIndex]);
|
|
2282
2527
|
var onContextMenu = useCallback(function (e) {
|
|
2283
2528
|
if (!landscape) {
|
|
2284
2529
|
e.preventDefault();
|
|
@@ -2286,28 +2531,16 @@ var Viewer = function Viewer(_ref) {
|
|
|
2286
2531
|
}
|
|
2287
2532
|
|
|
2288
2533
|
return true;
|
|
2289
|
-
}, [landscape]);
|
|
2534
|
+
}, [landscape]); // hmm?
|
|
2535
|
+
|
|
2290
2536
|
var overscrollStyle = /*#__PURE__*/React.createElement("style", {
|
|
2291
2537
|
type: "text/css"
|
|
2292
|
-
}, "body { overscroll-behavior: contain; }");
|
|
2293
|
-
|
|
2294
|
-
var _useFullscreen = useFullscreen(containerRef.current || null),
|
|
2295
|
-
toggleFullscreen = _useFullscreen.toggle,
|
|
2296
|
-
fullscreenActive = _useFullscreen.active,
|
|
2297
|
-
fullscreenEnabled = _useFullscreen.enabled; // Keyboard Events
|
|
2298
|
-
|
|
2299
|
-
|
|
2538
|
+
}, "body { overscroll-behavior: contain; }");
|
|
2300
2539
|
var keyboardShortcuts = useMemo(function () {
|
|
2301
2540
|
return {
|
|
2302
2541
|
f: function f() {
|
|
2303
2542
|
return toggleFullscreen();
|
|
2304
2543
|
},
|
|
2305
|
-
m: function m() {
|
|
2306
|
-
return setMenuOpened(!menuOpened);
|
|
2307
|
-
},
|
|
2308
|
-
escape: function escape() {
|
|
2309
|
-
return setMenuOpened(false);
|
|
2310
|
-
},
|
|
2311
2544
|
arrowleft: function arrowleft() {
|
|
2312
2545
|
return gotoPreviousScreen();
|
|
2313
2546
|
},
|
|
@@ -2318,55 +2551,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
2318
2551
|
return gotoNextScreen();
|
|
2319
2552
|
}
|
|
2320
2553
|
};
|
|
2321
|
-
}, [
|
|
2554
|
+
}, [gotoPreviousScreen, gotoNextScreen]);
|
|
2322
2555
|
useKeyboardShortcuts(keyboardShortcuts, {
|
|
2323
2556
|
disabled: renderContext !== 'view'
|
|
2324
2557
|
});
|
|
2325
|
-
|
|
2326
|
-
var _ref12 = currentScreen || {},
|
|
2327
|
-
screenParameters = _ref12.parameters;
|
|
2328
|
-
|
|
2329
|
-
var _ref13 = screenParameters || {},
|
|
2330
|
-
screenMetadata = _ref13.metadata;
|
|
2331
|
-
|
|
2332
|
-
var _ref14 = screenMetadata || {},
|
|
2333
|
-
_ref14$title = _ref14.title,
|
|
2334
|
-
screenTitle = _ref14$title === void 0 ? null : _ref14$title,
|
|
2335
|
-
_ref14$description = _ref14.description,
|
|
2336
|
-
screenDescription = _ref14$description === void 0 ? null : _ref14$description;
|
|
2337
|
-
|
|
2338
|
-
var finalTitle = screenTitle !== null ? screenTitle : title;
|
|
2339
|
-
var finalMetadata = useMemo(function () {
|
|
2340
|
-
return screenDescription !== null ? _objectSpread(_objectSpread({}, metadata), {}, {
|
|
2341
|
-
description: screenDescription
|
|
2342
|
-
}) : metadata;
|
|
2343
|
-
}, [metadata, screenDescription]); // Get element height
|
|
2344
|
-
|
|
2345
|
-
var _useDimensionObserver = useDimensionObserver(),
|
|
2346
|
-
menuDotsContainerRef = _useDimensionObserver.ref,
|
|
2347
|
-
_useDimensionObserver2 = _useDimensionObserver.height,
|
|
2348
|
-
menuDotsContainerHeight = _useDimensionObserver2 === void 0 ? 0 : _useDimensionObserver2;
|
|
2349
|
-
|
|
2350
|
-
var _useDimensionObserver3 = useDimensionObserver(),
|
|
2351
|
-
playbackControlsContainerRef = _useDimensionObserver3.ref,
|
|
2352
|
-
_useDimensionObserver4 = _useDimensionObserver3.height,
|
|
2353
|
-
playbackControlsContainerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
2354
|
-
|
|
2355
|
-
var _useMemo = useMemo(function () {
|
|
2356
|
-
return neighborScreensMounted !== null ? {
|
|
2357
|
-
startIndex: Math.max(screenIndex - (neighborScreensActive + neighborScreensMounted), 0),
|
|
2358
|
-
endIndex: Math.min(screenIndex + (neighborScreensActive + neighborScreensMounted), screensCount)
|
|
2359
|
-
} : {
|
|
2360
|
-
startIndex: 0,
|
|
2361
|
-
endIndex: screensCount - 1
|
|
2362
|
-
};
|
|
2363
|
-
}, [screenIndex, neighborScreensActive, neighborScreensMounted, screensCount]),
|
|
2364
|
-
mountedScreenStartIndex = _useMemo.startIndex,
|
|
2365
|
-
mountedScreenEndIndex = _useMemo.endIndex;
|
|
2366
|
-
|
|
2367
|
-
var mountedScreens = useMemo(function () {
|
|
2368
|
-
return neighborScreensMounted != null ? screens.slice(mountedScreenStartIndex, mountedScreenEndIndex) : screens;
|
|
2369
|
-
}, [screens, mountedScreenStartIndex, mountedScreenEndIndex, neighborScreensActive, neighborScreensMounted]);
|
|
2370
2558
|
return /*#__PURE__*/React.createElement(VisitorProvider, {
|
|
2371
2559
|
visitor: visitor
|
|
2372
2560
|
}, /*#__PURE__*/React.createElement(ScreenSizeProvider, {
|
|
@@ -2391,13 +2579,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
2391
2579
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2392
2580
|
className: classNames([styles$6.container, screenSize.screens.map(function (screenName) {
|
|
2393
2581
|
return "story-screen-".concat(screenName);
|
|
2394
|
-
}), (_ref15 = {}, _defineProperty(_ref15, styles$6.landscape, landscape), _defineProperty(_ref15, styles$6.
|
|
2582
|
+
}), (_ref15 = {}, _defineProperty(_ref15, styles$6.landscape, landscape), _defineProperty(_ref15, styles$6.withoutGestures, withoutGestures), _defineProperty(_ref15, styles$6.hideMenu, !menuVisible), _defineProperty(_ref15, styles$6.fadeMenu, playing && playbackControls && !playbackcontrolsVisible), _defineProperty(_ref15, styles$6.ready, ready || withoutScreensTransforms), _defineProperty(_ref15, styles$6.hasInteracted, hasInteracted), _defineProperty(_ref15, styles$6.isDragging, isDragging), _defineProperty(_ref15, className, className), _ref15)]),
|
|
2395
2583
|
ref: containerRef,
|
|
2396
2584
|
onContextMenu: onContextMenu
|
|
2397
2585
|
}, !withoutMenu ? /*#__PURE__*/React.createElement(ViewerMenu, {
|
|
2398
2586
|
story: parsedStory,
|
|
2399
2587
|
currentScreenIndex: screenIndex,
|
|
2400
|
-
opened: menuOpened,
|
|
2401
2588
|
withShadow: menuOverScreen && !withoutMenuShadow,
|
|
2402
2589
|
toggleFullscreen: toggleFullscreen,
|
|
2403
2590
|
fullscreenActive: fullscreenActive,
|
|
@@ -2407,108 +2594,64 @@ var Viewer = function Viewer(_ref) {
|
|
|
2407
2594
|
screenSize: screenSize,
|
|
2408
2595
|
menuWidth: menuIsScreenWidth ? screenContainerWidth : null,
|
|
2409
2596
|
trackingEnabled: trackingEnabled,
|
|
2410
|
-
|
|
2411
|
-
onClickMenu: onClickMenu,
|
|
2597
|
+
onClickScreen: onClickScreen,
|
|
2412
2598
|
onClickCloseViewer: onCloseViewer,
|
|
2413
|
-
onRequestOpen: onMenuRequestOpen,
|
|
2414
|
-
onRequestClose: onMenuRequestClose,
|
|
2415
2599
|
withDotItemClick: screenContainerWidth > 400,
|
|
2416
2600
|
withoutScreensMenu: withoutScreensMenu,
|
|
2417
2601
|
withoutShareMenu: withoutShareMenu,
|
|
2418
2602
|
refDots: menuDotsContainerRef
|
|
2419
2603
|
}) : null, ready || withoutScreensTransforms ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
2420
|
-
ref: contentRef,
|
|
2421
2604
|
className: styles$6.content
|
|
2422
|
-
}, dragContentBind()),
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
var distance = (screenContainerWidth + landscapeScreenMargin) * max; // Compensates for scaling
|
|
2433
|
-
|
|
2434
|
-
if (max !== 0) {
|
|
2435
|
-
var halfMargin = screenContainerWidth * (1 - landscapeSmallScreenScale) / 2;
|
|
2436
|
-
distance -= halfMargin * max;
|
|
2437
|
-
|
|
2438
|
-
if (max < -1) {
|
|
2439
|
-
distance -= halfMargin * (max + 1);
|
|
2440
|
-
} else if (max > 1) {
|
|
2441
|
-
distance -= halfMargin * (max - 1);
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
screenTransform = withLandscapeSiblingsScreens ? "translateX(calc(".concat(distance, "px - 50%)) scale(").concat(current ? 1 : landscapeSmallScreenScale, ")") : null;
|
|
2446
|
-
} else {
|
|
2447
|
-
screenTransform = "translateX(".concat(current ? 0 : '100%', ")");
|
|
2605
|
+
}, dragContentBind()), !withoutNavigationArrow && !withNeighborScreens && screenIndex > 0 && screens.length > 1 ? /*#__PURE__*/React.createElement(NavigationButton, {
|
|
2606
|
+
direction: "previous",
|
|
2607
|
+
className: classNames([styles$6.navButton, styles$6.previous]),
|
|
2608
|
+
onClick: gotoPreviousScreen
|
|
2609
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
2610
|
+
className: styles$6.screensFrame,
|
|
2611
|
+
style: {
|
|
2612
|
+
width: screenContainerWidth,
|
|
2613
|
+
height: screenContainerHeight,
|
|
2614
|
+
overflow: !withNeighborScreens ? 'hidden' : null
|
|
2448
2615
|
}
|
|
2616
|
+
}, screens.map(function (screen, i) {
|
|
2617
|
+
// const current = i === parseInt(screenIndex, 10);
|
|
2618
|
+
var current = i === Math.round(screenIndexProgress); // base current on transition
|
|
2449
2619
|
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
className: classNames([styles$6.screenContainer, (
|
|
2459
|
-
|
|
2460
|
-
tabIndex: !active ? -1 : null,
|
|
2461
|
-
"aria-hidden": !current,
|
|
2462
|
-
"aria-label": intl.formatMessage({
|
|
2463
|
-
id: "LkVfwW",
|
|
2464
|
-
defaultMessage: [{
|
|
2465
|
-
"type": 0,
|
|
2466
|
-
"value": "Screen "
|
|
2467
|
-
}, {
|
|
2468
|
-
"type": 1,
|
|
2469
|
-
"value": "index"
|
|
2470
|
-
}]
|
|
2471
|
-
}, {
|
|
2472
|
-
index: i + 1
|
|
2473
|
-
}),
|
|
2474
|
-
onKeyUp: function onKeyUp(e) {
|
|
2475
|
-
return onScreenKeyUp(e, i);
|
|
2476
|
-
}
|
|
2477
|
-
}, dragScreenBind(i)), current && screenIndex > 0 ? /*#__PURE__*/React.createElement(NavigationButton, {
|
|
2478
|
-
direction: "previous",
|
|
2479
|
-
className: classNames([styles$6.navButton, styles$6.previous]),
|
|
2480
|
-
onClick: gotoPreviousScreen
|
|
2481
|
-
}) : null, mountedScreen !== null ? /*#__PURE__*/React.createElement(ViewerScreen, {
|
|
2620
|
+
var active = i >= screenIndex - neighborScreensActive && i <= screenIndex + neighborScreensActive;
|
|
2621
|
+
var defaultStyles = {
|
|
2622
|
+
opacity: current ? 1 : 0
|
|
2623
|
+
};
|
|
2624
|
+
var screenStyles = active ? getScreenStylesByIndex(i, screenIndexProgress) : defaultStyles;
|
|
2625
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2626
|
+
key: "screen-viewer-".concat(screen.id || '', "-").concat(i + 1),
|
|
2627
|
+
style: screenStyles,
|
|
2628
|
+
className: classNames([styles$6.screenContainer, _defineProperty({}, styles$6.current, current)])
|
|
2629
|
+
}, screen !== null && active ? /*#__PURE__*/React.createElement(ViewerScreen, {
|
|
2482
2630
|
className: styles$6.screen,
|
|
2483
|
-
screen:
|
|
2631
|
+
screen: screen,
|
|
2484
2632
|
screenState: current ? screenState : null,
|
|
2485
|
-
renderContext: renderContext,
|
|
2486
2633
|
index: i,
|
|
2487
2634
|
current: current,
|
|
2488
2635
|
active: active,
|
|
2489
2636
|
mediaRef: function mediaRef(ref) {
|
|
2490
2637
|
screensMediasRef.current[i] = ref;
|
|
2491
2638
|
},
|
|
2639
|
+
renderContext: renderContext,
|
|
2492
2640
|
width: screenWidth,
|
|
2493
2641
|
height: screenHeight,
|
|
2494
2642
|
scale: screenScale,
|
|
2495
|
-
withNavigationHint: withNavigationHint && !
|
|
2496
|
-
}) : null
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
}), !withoutPlaybackControls ? /*#__PURE__*/React.createElement("div", {
|
|
2643
|
+
withNavigationHint: withNavigationHint && !withNeighborScreens && current && screenIndex === 0 && !hasInteracted
|
|
2644
|
+
}) : null);
|
|
2645
|
+
})), !withoutNavigationArrow && !withNeighborScreens && screenIndex < screens.length - 1 ? /*#__PURE__*/React.createElement(NavigationButton, {
|
|
2646
|
+
direction: "next",
|
|
2647
|
+
className: classNames([styles$6.navButton, styles$6.next]),
|
|
2648
|
+
onClick: gotoNextScreen
|
|
2649
|
+
}) : null, !withoutPlaybackControls ? /*#__PURE__*/React.createElement("div", {
|
|
2502
2650
|
className: styles$6.playbackControls,
|
|
2503
2651
|
ref: playbackControlsContainerRef
|
|
2504
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
2505
|
-
className: styles$6.playbackControlsContainer,
|
|
2506
|
-
style: {
|
|
2507
|
-
width: screenContainerWidth
|
|
2508
|
-
}
|
|
2509
2652
|
}, /*#__PURE__*/React.createElement(PlaybackControls, {
|
|
2510
2653
|
className: styles$6.controls
|
|
2511
|
-
}))
|
|
2654
|
+
})) : null) : null, /*#__PURE__*/React.createElement(WebViewContainer, {
|
|
2512
2655
|
className: styles$6.webView,
|
|
2513
2656
|
style: {
|
|
2514
2657
|
maxWidth: Math.max(screenContainerWidth, 600)
|